using ClientLib; using ClientLib.CommonService; using DevExpress.XtraEditors; using DevExpress.XtraGrid; 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_SALE { public partial class CreditDaySalesList : PublicLib.CommonMDI { public CreditDaySalesList() { InitializeComponent(); // textEdit_CUST_NM.ImeMode = System.Windows.Forms.ImeMode.Hangul; dateEdit_WORK_DATE.DateTime = DateTime.Now.Date; gridControl_Main.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat; gridControl_Main.LookAndFeel.UseDefaultLookAndFeel = false; gridView_Main.Appearance.HeaderPanel.BackColor = Color.FromArgb(170, 204, 255); panelControl_Det.Visible = splitterControl_Det.Visible = false; checkEdit_YearList.CheckedChanged += (sender, e) => { panelControl_Det.Visible = splitterControl_Det.Visible = checkEdit_YearList.Checked; if (checkEdit_YearList.Checked) { splitterControl_Det.BringToFront(); gridSplitContainer_Main.BringToFront(); ShowDetail(); } }; gridView_Main.FocusedRowChanged += (sender, e) => { ShowDetail(); }; this.Shown += (sender, e) => { try { SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD) }; ResultData resultData = ClientClass.GetData("GetCreditSalesListForLookup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } DataRow row; row = resultData.DataList.Tables[0].NewRow(); row["USR_ID"] = ""; row["EMP_NO"] = ""; row["USR_NM"] = "전체담당자"; resultData.DataList.Tables[0].Rows.InsertAt(row, 0); UtilClass.SetLookup(lookUpEdit_SALES_USER, resultData.DataList.Tables[0], "EMP_NO", "USR_NM", true); row = resultData.DataList.Tables[1].NewRow(); row["MST_DEPT_CD"] = ""; row["DEPT_CD"] = ""; row["DEPT_NM"] = "전체부서"; resultData.DataList.Tables[1].Rows.InsertAt(row, 0); UtilClass.SetLookup(lookUpEdit_DEPT, resultData.DataList.Tables[1], "MST_DEPT_CD", "DEPT_NM", true); DataView c17 = new DataView(ConstClass._DATA); c17.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C17'"; DataTable c17Data = c17.ToTable(); row = c17Data.NewRow(); row["NO_CD"] = ""; row["NO_CD_NM"] = "전체지역"; c17Data.Rows.InsertAt(row, 0); UtilClass.SetLookup(lookUpEdit_AREA_CD, c17Data, "NO_CD", "NO_CD_NM", true); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); this.Close(); } }; } public override void searchProc() { try { this.Cursor = Cursors.WaitCursor; gridControl_Main.DataSource = null; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("YYMM", SqlDbType.NVarChar, dateEdit_WORK_DATE.Text), ClientClass.CreateSqlParameter("SEARCH_CONDITION", SqlDbType.Int, comboBoxEdit_SEARCH_CONDITION.SelectedIndex), ClientClass.CreateSqlParameter("REMARK_CONDITION", SqlDbType.Int, comboBoxEdit_REMARK_CONDITION.SelectedIndex), ClientClass.CreateSqlParameter("MST_DEPT_CD", SqlDbType.NVarChar, lookUpEdit_DEPT.EditValue), ClientClass.CreateSqlParameter("SALES_USR_ID", SqlDbType.NVarChar, lookUpEdit_SALES_USER.EditValue), ClientClass.CreateSqlParameter("AREA_CD", SqlDbType.NVarChar, lookUpEdit_AREA_CD.EditValue) }; ResultData resultData = ClientClass.GetData("GetCreditSaleList", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } gridControl_Main.DataSource = resultData.TableData; this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } } private void ShowDetail() { try { DataRow row = gridView_Main.GetFocusedDataRow(); gridControl_Det.DataSource = null; textEdit_REMAIN_MY.Text = ""; if (row == null || !gridControl_Det.Visible) { return; } this.Cursor = Cursors.WaitCursor; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("YY", SqlDbType.NVarChar, dateEdit_WORK_DATE.DateTime.ToString("yyyy")), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, row["CUST_CD"]) }; ResultData resultData = ClientClass.GetData("GetCreditSaleListDetail", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } int remain_my = UtilClass.toInt(resultData.DataList.Tables[1].Rows[0]["REMAIN_MY"]); textEdit_REMAIN_MY.EditValue = remain_my; int order_my, col_my; for (int i = 0; i < resultData.DataList.Tables[0].Rows.Count; i++) { order_my = UtilClass.toInt(resultData.DataList.Tables[0].Rows[i]["ORDER_MY"]); col_my = UtilClass.toInt(resultData.DataList.Tables[0].Rows[i]["COL_MY"]); remain_my = remain_my + order_my - col_my; resultData.DataList.Tables[0].Rows[i]["REMAIN_MY"] = remain_my; } resultData.DataList.Tables[0].AcceptChanges(); gridControl_Det.DataSource = resultData.DataList.Tables[0]; this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } } public override void excelProc() { this.ExportExcelGrid(gridControl_Main); } } }