File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
using ClientLib;
using ClientLib.CommonService;
using DevExpress.XtraCharts;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using PublicLib;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HANMI_J_SALE
{
public partial class TradeMoneyList : PublicLib.CommonMDI
{
private int m_CURR_MY, m_VAT_MY, m_ORDER_MY;
private NewTradeControl m_NEW_LIST;
public TradeMoneyList()
{
InitializeComponent();
gridControl_Main.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
gridControl_Main.LookAndFeel.UseDefaultLookAndFeel = false;
gridView_Main.Appearance.HeaderPanel.BackColor = Color.FromArgb(170, 204, 255);
m_CURR_MY = 0;
m_VAT_MY = 0;
m_ORDER_MY = 0;
dateEdit_SDATE.DateTime = DateTime.MinValue;
dateEdit_FDATE.DateTime = DateTime.Now;
buttonEdit_NORM.ButtonClick += (sender, e) =>
{
selectNormProc();
};
buttonEdit_CUST_NM.ButtonClick += (sender, e) =>
{
selectCustProc();
};
buttonEdit_CUST_NM.KeyPress += (sender, e) =>
{
if (e.KeyChar == '\r')
{
selectCustProc();
}
};
buttonEdit_CUST_NM.EditValueChanged += (sender, e) =>
{
if (UtilClass.isNull(buttonEdit_CUST_NM.Text))
{
labelControl_CUST_CD.Text = "";
}
};
buttonEdit_RoutingNM.ButtonClick += (sender, e) =>
{
selectRoutingProc();
};
//checkEdit_SpecToItemName.KeyPress += (sender, e) =>
//{
// if (e.KeyChar == '\r')
// {
// searchProc();
// }
//};
GridGroupSummaryItem item;
item = new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Sum, "CURR_MY", gridView_Main.Columns["CURR_MY"], "{0:#,##0}");
gridView_Main.GroupSummary.Add(item);
item = new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Sum, "VAT_MY", gridView_Main.Columns["VAT_MY"], "{0:#,##0}");
gridView_Main.GroupSummary.Add(item);
item = new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Sum, "ORDER_MY", gridView_Main.Columns["ORDER_MY"], "{0:#,##0}");
gridView_Main.GroupSummary.Add(item);
gridView_Main.DoubleClick += (sender, e) =>
{
Point aPT = gridControl_Main.PointToClient(Control.MousePosition);
GridHitInfo aInfo = gridView_Main.CalcHitInfo(aPT);
if (aInfo.InRowCell)
{
DataRow row = gridView_Main.GetFocusedDataRow();
if (m_NEW_LIST != null)
m_NEW_LIST.Dispose();
m_NEW_LIST = new NewTradeControl();
m_NEW_LIST.selectNEWProc(row["COUNT"].ToString(), dateEdit_SDATE.DateTime.ToString("yyyy.MM.dd"), dateEdit_FDATE.DateTime.ToString("yyyy.MM.dd"),labelControl_CUST_CD.Text, labelControl_RoutingCD.Text, buttonEdit_NORM.Text, row["COUNT"].ToString());
m_NEW_LIST.SetBounds(chartControl_AVG.Location.X, chartControl_AVG.Location.Y, m_NEW_LIST.Width, m_NEW_LIST.Height);
m_NEW_LIST.Visible = true;
panelMain.Controls.Add(m_NEW_LIST);
m_NEW_LIST.BringToFront();
}
};
gridView_Main.CustomDrawFooterCell += (sender, e) =>
{
if (e.Column == gridView_Main.Columns["CURR_MY"])
{
e.Info.DisplayText = m_CURR_MY.ToString("#,##0");
}
else if (e.Column == gridView_Main.Columns["VAT_MY"])
{
e.Info.DisplayText = m_VAT_MY.ToString("#,##0");
}
else if (e.Column == gridView_Main.Columns["ORDER_MY"])
{
e.Info.DisplayText = m_ORDER_MY.ToString("#,##0");
}
};
this.Shown += (sender, e) =>
{
try
{
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD)
};
ResultData resultData = ClientClass.GetData("U3GetSalesListForLookup", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
DataRow row;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
this.Close();
}
};
btnSelect.Click += (sender, e) =>
{
selectAVGProc();
};
}
private void selectCustProc()
{
SelectCustomerForm form = new SelectCustomerForm(buttonEdit_CUST_NM.Text, DateTime.Now);
if (form.ShowDialog() != DialogResult.Yes)
{
return;
}
buttonEdit_CUST_NM.Text = form.m_CUST_NM;
labelControl_CUST_CD.Text = form.m_CUST_CD;
}
private void selectNormProc()
{
SelectNormForm form = new SelectNormForm("");
if (form.ShowDialog() != DialogResult.Yes)
{
return;
}
buttonEdit_NORM.Text = form.m_NORM;
}
private void selectRoutingProc()
{
SelectRoutingForm form = new SelectRoutingForm(labelControl_RoutingCD.Text);
if (form.ShowDialog() != DialogResult.Yes)
{
return;
}
buttonEdit_RoutingNM.Text = form.m_ITEM_NM;
labelControl_RoutingCD.Text = form.m_ITEM_CD;
}
private void selectItemProc()
{
}
public void selectAVGProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
gridControl_Main.DataSource = null;
gridView_Main.Columns.Clear();
GridColumn gc = new GridColumn();
gc.Caption = "수량";
gc.FieldName = "COUNT";
gc.Name = "gridColumn_COUNT";
gc.Width = 70;
gc.Visible = true;
gridView_Main.Columns.Add(gc);
gc = new GridColumn();
gc.Caption = "평균단가";
gc.FieldName = "TARGET_AVG";
gc.Name = "gridColumn_TARGET_AVG";
gc.Width = 100;
gc.Visible = true;
gridView_Main.Columns.Add(gc);
gc = new GridColumn();
gc.Caption = "전체평균";
gc.FieldName = "TOTAL_AVG";
gc.Name = "gridColumn_TOTAL_AVG";
gc.Width = 100;
gc.Visible = true;
gridView_Main.Columns.Add(gc);
System.Data.DataTable dt;
dt = new DataTable();
dt.Columns.Add("COUNT", Type.GetType("System.String"));
dt.Columns.Add("TARGET_AVG", Type.GetType("System.Int32"));
dt.Columns.Add("TOTAL_AVG", Type.GetType("System.Int32"));
GetAVGDataRow(ref dt);
gridControl_Main.DataSource = dt;
chartControl_AVG.Series.Clear();
Series chartSeries = new Series(buttonEdit_CUST_NM.Text, ViewType.Line);
chartControl_AVG.Series.AddRange(new Series[] { chartSeries });
chartSeries.DataSource = dt;
chartSeries.ArgumentDataMember = "COUNT";
chartSeries.ValueDataMembers.AddRange(new string[] { "TARGET_AVG" });
chartSeries = new Series("전체평균", ViewType.Line);
chartControl_AVG.Series.AddRange(new Series[] { chartSeries });
chartSeries.DataSource = dt;
chartSeries.ArgumentDataMember = "COUNT";
chartSeries.ValueDataMembers.AddRange(new string[] { "TOTAL_AVG" });
chartControl_AVG.Series.EndUpdate();
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
private void GetAVGDataRow(ref DataTable dt)
{
SerializedSqlParam[] aParam;
ResultData resultData;
DataTable aData;
DataRow dr;
try
{
aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("SDATE", SqlDbType.NVarChar, dateEdit_SDATE.DateTime.ToString("yyyy.MM.dd")),
ClientClass.CreateSqlParameter("FDATE", SqlDbType.NVarChar, dateEdit_FDATE.DateTime.ToString("yyyy.MM.dd")),
ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text),
ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, labelControl_RoutingCD.Text),
ClientClass.CreateSqlParameter("ORDER_NORM", SqlDbType.NVarChar, buttonEdit_NORM.Text)
};
resultData = ClientClass.GetData("U3GetTradeMoneyListAVG", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
aData = resultData.TableData;
if (resultData.TableData.Rows.Count > 0)
{
for (int i = 0; i < resultData.TableData.Rows.Count; i++)
{
dr = dt.NewRow();
if(UtilClass.toInt(aData.Rows[i]["QTY"])==0)
{
dr[0] = ((UtilClass.toInt(aData.Rows[i]["QTY"])) * 100 + 1) + "~" + ((UtilClass.toInt(aData.Rows[i]["QTY"])) * 100 + 99);
}else
{
dr[0] = ((UtilClass.toInt(aData.Rows[i]["QTY"])) * 100) + "~" + ((UtilClass.toInt(aData.Rows[i]["QTY"])) * 100 + 99);
}
dr[1] = UtilClass.toInt(aData.Rows[i]["TARGET_AVG"]);
dr[2] = UtilClass.toInt(aData.Rows[i]["TOTAL_AVG"]);
dt.Rows.Add(dr);
}
}
else
{
gridControl_Main.DataSource = resultData.TableData;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public override void searchProc()
{
selectAVGProc();
}
public override void newProc()
{
try
{
SaleRegistrationPopup form = new SaleRegistrationPopup();
form.ShowDialog();
if (form.m_Changed)
{
searchProc();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public override void excelProc()
{
this.ExportExcelGrid(gridControl_Main);
}
}
}