/* * V2: 단가와 공급가를 입력하는 화면에서 표준단가를 표시. */ using ClientLib; using ClientLib.CommonService; using DevExpress.XtraEditors; 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.Net; using System.Text; using System.Windows.Forms; using System.Xml; namespace HANMI_J_SALE { partial class SaleRegistrationPopupV2 : XtraForm { private string m_ORDER_NO; public bool m_Changed; public SaleRegistrationPopupV2() { InitializeComponent(); this.Icon = ConstClass._MAIN.Icon; m_Changed = false; m_ORDER_NO = ""; dateEdit_DATE.DateTime = DateTime.Now; buttonEdit_ORDER_SEQ.Text = ""; buttonEdit_DC.ButtonClick += (sender, e) => { if (UtilClass.isNull(labelControl_CUST_CD.Text)) { MessageBox.Show("거래선을 먼저 조회하여 선택하십시오."); return; } SelectCustDCPopup form = new SelectCustDCPopup(labelControl_CUST_CD.Text, buttonEdit_CUST_NM.Text); form.ShowDialog(); }; buttonEdit_CUST_NM.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { selectCustProc(); } }; buttonEdit_CUST_NM.ButtonClick += (sender, e) => { selectCustProc(); }; buttonEdit_ITEM_NM.ButtonClick += (sender, e) => { SelectSalesItemForm form = new SelectSalesItemForm(buttonEdit_ITEM_NM.Text); if (form.ShowDialog() == DialogResult.Yes) { buttonEdit_ITEM_NM.Text = form.m_ITEM_NM; buttonEdit_ITEM_NM.Tag = form.m_UNIT_MY; labelControl_ITEM_CD.Text = form.m_ITEM_CD; labelControl_ITEM_CD.Tag = form.m_ROUT_CD; textEdit_UNIT_WT.EditValue = form.m_UNIT_WT; textEdit_AREA_WT.Focus(); } else { buttonEdit_ITEM_NM.Text = ""; buttonEdit_ITEM_NM.Tag = 0; labelControl_ITEM_CD.Text = ""; labelControl_ITEM_CD.Tag = ""; textEdit_UNIT_WT.Text = ""; } }; buttonEdit_ITEM_NM.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { SelectSalesItemForm form = new SelectSalesItemForm(buttonEdit_ITEM_NM.Text); if (form.ShowDialog() == DialogResult.Yes) { buttonEdit_ITEM_NM.Text = form.m_ITEM_NM; labelControl_ITEM_CD.Text = form.m_ITEM_CD; textEdit_UNIT_WT.EditValue = form.m_UNIT_WT; textEdit_AREA_WT.Focus(); } else { buttonEdit_ITEM_NM.Text = ""; labelControl_ITEM_CD.Text = ""; textEdit_UNIT_WT.Text = ""; } } }; buttonEdit_SPEC.ButtonClick += (sender, e) => { if (UtilClass.isNull(labelControl_ITEM_CD.Text)) { buttonEdit_ITEM_NM.Focus(); MessageBox.Show("품목을 선택하십시오."); return; } SelectNormForm form = new SelectNormForm(labelControl_ITEM_CD.Text); if (form.ShowDialog() == DialogResult.Yes) { buttonEdit_SPEC.Text = form.m_NORM; textEdit_ORDER_QTY.Focus(); } }; buttonEdit_SPEC.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { SelectNormForm form = new SelectNormForm(labelControl_ITEM_CD.Text); if (form.ShowDialog() == DialogResult.Yes) { buttonEdit_SPEC.Text = form.m_NORM; textEdit_ORDER_QTY.Focus(); } } }; buttonEdit_CUT_CNT.ButtonClick += (sender, e) => { SelectCodePopup form = new SelectCodePopup("C", "C15", "절수"); if (form.ShowDialog() == DialogResult.Yes) { buttonEdit_CUT_CNT.Text = form.m_NO_CD_NM; textEdit_REMARK.Focus(); } }; buttonEdit_CURR_UNIT_MY.ButtonClick += (sender, e) => { selectCurrentMoney(); }; gridView_Code.DoubleClick += (sender, e) => { DataRow row = gridView_Code.GetFocusedDataRow(); try { if (row != null && row[gridView_Code.FocusedColumn.FieldName].ToString() != "") { buttonEdit_CURR_UNIT_MY.Text = row[gridView_Code.FocusedColumn.FieldName].ToString(); } } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } }; textEdit_ORDER_QTY.EditValueChanged += (sender, e) => { refreshCost(); }; buttonEdit_CURR_UNIT_MY.ButtonClick += (sender, e) => { try { this.Cursor = Cursors.WaitCursor; if (UtilClass.isNull(labelControl_ITEM_CD.Text)) { throw new Exception("품목코드 없이 단가조회를 할 수 없습니다. 품목을 조회하여 선택하십시오."); } buttonEdit_CURR_UNIT_MY.Text = ""; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, labelControl_ITEM_CD.Text) }; ResultData resultData = ClientClass.GetData("GetItemUnitMy", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } if (resultData.TableData.Rows.Count > 0) { buttonEdit_CURR_UNIT_MY.EditValue = resultData.TableData.Rows[0]["UNIT_MY"]; } this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } }; buttonEdit_CURR_UNIT_MY.ButtonClick += (sender, e) => { buttonEdit_CURR_UNIT_MY.EditValue = UtilClass.toDouble(buttonEdit_ITEM_NM.Tag); }; buttonEdit_CURR_UNIT_MY.EditValueChanged += (sender, e) => { refreshCost(); }; buttonEdit_ORDER_SEQ.KeyPress += (sender, e) => { if (!UtilClass.isNull(buttonEdit_ORDER_SEQ.Text)) { searchProc(3); } }; buttonEdit_ORDER_SEQ.ButtonClick += (sender, e) => { if (e.Button.Index == 0) // 기존정보 검색 { OrderSeqPopup form = new OrderSeqPopup(dateEdit_DATE.DateTime); if (form.ShowDialog() == DialogResult.Yes) { buttonEdit_ORDER_SEQ.Text = form.m_ORDER_SEQ; dateEdit_DATE.DateTime = UtilClass.toDateTime(form.m_ORDER_DT); searchProc(3); } } else if (e.Button.Index == 1) // 높은 번호 검색 { searchProc(1); } else // 낮은 번호 검색 { searchProc(2); } }; buttonEdit_OUT_POS.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { if (UtilClass.isNull(buttonEdit_OUT_POS.Text)) { if (!UtilClass.isNull(labelControl_CUST_CD.Text)) { buttonEdit_OUT_POS.Text = buttonEdit_CUST_NM.Text; } } } }; buttonEdit_OUT_POS.ButtonClick += (sender, e) => { SelectOutPosForm form = new SelectOutPosForm(labelControl_CUST_CD.Text, buttonEdit_CUST_NM.Text); if (form.ShowDialog() == DialogResult.Yes) { buttonEdit_OUT_POS.Text = form.m_LOCATION_NM; } else { buttonEdit_OUT_POS.Text = ""; labelControl_OUT_POS.Text = ""; } }; simpleButton_AreaEdit.Click += (sender, e) => { SelectCodePopup form = new SelectCodePopup("C", "C17", "지역"); if (form.ShowDialog() == DialogResult.Yes) { UtilClass.SetLookup(lookUpEdit_OUT_AREA_CD, form.m_Data, "NO_CD", "NO_CD_NM", true); lookUpEdit_OUT_AREA_CD.EditValue = form.m_NO_CD; } }; simpleButton_Clear.Click += (sender, e) => { clearProc(); }; simpleButton_ItemAdd.Click += (sender, e) => { itemAddProc(); }; simpleButton_ItemUpdate.Click += (sender, e) => { itemUpdateProc(); }; simpleButton_ItemDelete.Click += (sender, e) => { itemDeleteProc(); }; simpleButton_ItemClose.Click += (sender, e) => { itemCloseProc(); }; simpleButton_CANCEL.Click += (sender, e) => { searchProc(0); }; simpleButton_INPUT.Click += (sender, e) => { saveProc("I", ""); }; simpleButton_UPDATE.Click += (sender, e) => { saveProc("M", buttonEdit_ORDER_SEQ.Text); }; simpleButton_DELETE.Click += (sender, e) => { deleteProc(); }; simpleButton_CLOSE.Click += (sender, e) => { this.DialogResult = m_Changed ? DialogResult.Yes : DialogResult.Cancel; this.Close(); }; gridView_Main.Click += (sender, e) => { Point aPT = gridControl_Main.PointToClient(Control.MousePosition); GridHitInfo aInfo = gridView_Main.CalcHitInfo(aPT); if (aInfo.InRowCell) { dataBinding(); } }; gridView_Main.FocusedRowChanged += (sender, e) => { dataBinding(); }; this.Shown += (sender, e) => { try { DataView c13 = new DataView(ConstClass._DATA); c13.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C13'"; UtilClass.SetLookup(lookUpEdit_PROC_CD, c13, "NO_CD", "NO_CD_NM", true); DataView c11 = new DataView(ConstClass._DATA); c11.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C11'"; UtilClass.SetLookup(lookUpEdit_STOCK, c11, "NO_CD", "NO_CD_NM", true); DataView c14 = new DataView(ConstClass._DATA); c14.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C14'"; UtilClass.SetLookup(lookUpEdit_UNIT_CD, c14, "NO_CD", "NO_CD_NM", true); DataView c16 = new DataView(ConstClass._DATA); c16.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C16'"; UtilClass.SetLookup(lookUpEdit_SIGN_GUBUN_CD, c16, "NO_CD", "NO_CD_NM", true); DataView c17 = new DataView(ConstClass._DATA); c17.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C17'"; UtilClass.SetLookup(lookUpEdit_OUT_AREA_CD, c17, "NO_CD", "NO_CD_NM", true); if (UtilClass.isNull(buttonEdit_ORDER_SEQ.Text)) { searchProc(0); } else { searchProc(3); } } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } }; } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == (Keys.A | Keys.Alt)) { searchProc(0); return true; } else if (keyData == (Keys.I | Keys.Alt)) { saveProc("I", ""); return true; } else if (keyData == (Keys.M | Keys.Alt)) { saveProc("M", buttonEdit_ORDER_SEQ.Text); return true; } else if (keyData == (Keys.D | Keys.Alt)) { deleteProc(); return true; } else if (keyData == (Keys.X | Keys.Alt)) { this.DialogResult = m_Changed ? DialogResult.Yes : DialogResult.Cancel; this.Close(); return true; } else if (keyData == (Keys.F5)) { itemAddProc(); return true; } else if (keyData == (Keys.F6)) { itemUpdateProc(); return true; } else if (keyData == (Keys.F7)) { itemDeleteProc(); return true; } else if (keyData == (Keys.F8)) { itemCloseProc(); return true; } return base.ProcessCmdKey(ref msg, keyData); } public void setData(DateTime dt, string seq) { dateEdit_DATE.DateTime = dt; buttonEdit_ORDER_SEQ.Text = seq; } private void itemAddProc() { try { if (UtilClass.isNull(labelControl_CUST_CD.Text)) { buttonEdit_CUST_NM.Focus(); throw new Exception("거래선을 조회하여 선택하십시오."); } if (UtilClass.isNull(labelControl_ITEM_CD.Text)) { buttonEdit_ITEM_NM.Focus(); throw new Exception("품목을 조회하여 선택하십시오."); } int r_no = 0, ln_seq = 0; ; DataTable data = gridControl_Main.DataSource as DataTable; for (int i = 0; i < data.Rows.Count; i++) { if (data.Rows[i].RowState == DataRowState.Deleted) { continue; } if (r_no < UtilClass.toInt(data.Rows[i]["R_NO"])) { r_no = UtilClass.toInt(data.Rows[i]["R_NO"]); } if (ln_seq < UtilClass.toInt(data.Rows[i]["LN_SEQ"])) { ln_seq = UtilClass.toInt(data.Rows[i]["LN_SEQ"]); } } r_no++; ln_seq++; DataRow row = data.NewRow(); row["R_NO"] = r_no; row["LN_SEQ"] = ln_seq; row["ORDER_NO"] = ""; row["ITEM_CD"] = labelControl_ITEM_CD.Text; row["ITEM_NM"] = buttonEdit_ITEM_NM.Text; row["ROUT_CD"] = labelControl_ITEM_CD.Tag; row["AREA_WT"] = textEdit_AREA_WT.Text; row["ORDER_NORM"] = buttonEdit_SPEC.Text.Trim(); row["ORDER_QTY"] = UtilClass.toInt(textEdit_ORDER_QTY.EditValue); row["UNIT_NM"] = lookUpEdit_UNIT_CD.Text; row["DC_RATE"] = UtilClass.toDouble(textEdit_DC_RATE.EditValue); row["CURR_UNIT_MY"] = UtilClass.toInt(buttonEdit_CURR_UNIT_MY.EditValue); row["CURR_MY"] = UtilClass.toInt(textEdit_CURR_MY.EditValue); row["VAT_MY"] = UtilClass.toInt(textEdit_VAT_MY.EditValue); row["ORDER_MY"] = UtilClass.toInt(textEdit_ORDER_MY.EditValue); row["REPLACE_YN"] = ""; row["LN_RMK"] = textEdit_REMARK.Text.Trim(); row["STOCK_NM"] = lookUpEdit_STOCK.Text; row["ORDER_WT"] = UtilClass.toInt(textEdit_ORDER_QTY.EditValue) * UtilClass.toInt(textEdit_UNIT_WT.EditValue); row["CUT_CNT"] = buttonEdit_CUT_CNT.Text; row["SALES_GUBUN_NM"] = ""; row["PAPER_CUST_NM"] = ""; row["STOCK_CNT"] = 0; row["ORDER_UNIT_CD"] = lookUpEdit_UNIT_CD.EditValue; row["STOCK_CD"] = lookUpEdit_STOCK.EditValue; row["SALES_GUBUN_CD"] = ""; row["PAPER_CUST_CD"] = ""; row["BILL_NO"] = ""; data.Rows.Add(row); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void itemUpdateProc() { DataRow row = gridView_Main.GetFocusedDataRow(); if (row == null) { return; } row["ITEM_CD"] = labelControl_ITEM_CD.Text; row["ITEM_NM"] = buttonEdit_ITEM_NM.Text; row["ROUT_CD"] = labelControl_ITEM_CD.Tag; row["AREA_WT"] = textEdit_AREA_WT.Text; row["ORDER_NORM"] = buttonEdit_SPEC.Text.Trim(); row["ORDER_QTY"] = UtilClass.toInt(textEdit_ORDER_QTY.EditValue); row["UNIT_NM"] = lookUpEdit_UNIT_CD.Text; row["DC_RATE"] = UtilClass.toDouble(textEdit_DC_RATE.EditValue); row["CURR_UNIT_MY"] = UtilClass.toInt(buttonEdit_CURR_UNIT_MY.EditValue); row["CURR_MY"] = UtilClass.toInt(textEdit_CURR_MY.EditValue); row["VAT_MY"] = UtilClass.toInt(textEdit_VAT_MY.EditValue); row["ORDER_MY"] = UtilClass.toInt(textEdit_ORDER_MY.EditValue); row["REPLACE_YN"] = ""; row["LN_RMK"] = textEdit_REMARK.Text.Trim(); row["STOCK_NM"] = lookUpEdit_STOCK.Text; row["ORDER_WT"] = UtilClass.toInt(textEdit_ORDER_QTY.EditValue) * UtilClass.toInt(textEdit_UNIT_WT.EditValue); row["CUT_CNT"] = buttonEdit_CUT_CNT.Text; row["SALES_GUBUN_NM"] = ""; row["PAPER_CUST_NM"] = ""; row["STOCK_CNT"] = 0; row["ORDER_UNIT_CD"] = lookUpEdit_UNIT_CD.EditValue; row["STOCK_CD"] = lookUpEdit_STOCK.EditValue; row["SALES_GUBUN_CD"] = ""; row["PAPER_CUST_CD"] = ""; } private void itemDeleteProc() { if (MessageBox.Show("선택하신 건 자료를 삭제하시겠습니까?", "삭제", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { gridView_Main.DeleteSelectedRows(); } } private void itemCloseProc() { buttonEdit_OUT_POS.Focus(); } private void clearProc() { buttonEdit_ITEM_NM.Text = ""; buttonEdit_ITEM_NM.Tag = 0; labelControl_ITEM_CD.Text = ""; labelControl_ITEM_CD.Tag = ""; textEdit_AREA_WT.Text = ""; buttonEdit_SPEC.Text = ""; textEdit_YearWT.Text = ""; textEdit_ORDER_QTY.Text = "0"; textEdit_UNIT_WT.Text = "0.0"; lookUpEdit_UNIT_CD.ItemIndex = 0; buttonEdit_CUT_CNT.Text = ""; textEdit_REMARK.Text = ""; buttonEdit_STD_COST.Text = ""; textEdit_DC_RATE.Text = "0.0"; buttonEdit_CURR_UNIT_MY.Text = "0"; textEdit_CURR_MY.Text = "0"; textEdit_VAT_MY.Text = "0"; textEdit_ORDER_MY.Text = "0"; textEdit_BILL_NO.Text = ""; } private void dataBinding() { DataRow row = gridView_Main.GetFocusedDataRow(); if (row == null) { clearProc(); return; } buttonEdit_ITEM_NM.Text = UtilClass.toStr(row["ITEM_NM"]); buttonEdit_ITEM_NM.Tag = row["UNIT_MY"]; labelControl_ITEM_CD.Text = UtilClass.toStr(row["ITEM_CD"]); labelControl_ITEM_CD.Tag = UtilClass.toStr(row["ROUT_CD"]); textEdit_AREA_WT.Text = UtilClass.toStr(row["AREA_WT"]); buttonEdit_SPEC.Text = UtilClass.toStr(row["ORDER_NORM"]); textEdit_YearWT.Text = ""; textEdit_ORDER_QTY.EditValue = row["ORDER_QTY"]; textEdit_UNIT_WT.EditValue = row["UNIT_WT"]; lookUpEdit_UNIT_CD.EditValue = row["ORDER_UNIT_CD"]; buttonEdit_CUT_CNT.Text = UtilClass.toStr(row["CUT_CNT"]); textEdit_REMARK.Text = UtilClass.toStr(row["LN_RMK"]); buttonEdit_STD_COST.Text = ""; textEdit_DC_RATE.EditValue = row["DC_RATE"]; buttonEdit_CURR_UNIT_MY.EditValue = row["CURR_UNIT_MY"]; textEdit_CURR_MY.EditValue = row["CURR_MY"]; textEdit_VAT_MY.EditValue = row["VAT_MY"]; textEdit_ORDER_MY.EditValue = row["ORDER_MY"]; textEdit_BILL_NO.EditValue = UtilClass.toStr(row["BILL_NO"]); } private void refreshCost() { int qty = UtilClass.toInt(textEdit_ORDER_QTY.EditValue); int unit_my = UtilClass.toInt(buttonEdit_CURR_UNIT_MY.EditValue); buttonEdit_CURR_UNIT_MY.EditValue = unit_my; textEdit_CURR_MY.EditValue = qty * unit_my; textEdit_VAT_MY.EditValue = (qty * unit_my) * 0.1; textEdit_ORDER_MY.EditValue = (qty * unit_my) + (qty * unit_my) * 0.1; } private void selectCustProc() { SelectCustomerForm form = new SelectCustomerForm(buttonEdit_CUST_NM.Text, DateTime.Now); if (form.ShowDialog() != System.Windows.Forms.DialogResult.Yes) { return; } buttonEdit_CUST_NM.Text = form.m_CUST_NM; labelControl_CUST_CD.Text = form.m_CUST_CD; } private void searchProc(int mode) { try { this.Cursor = Cursors.WaitCursor; gridControl_Main.DataSource = null; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("ORDER_DT", SqlDbType.NVarChar, dateEdit_DATE.DateTime.ToString("yyyy.MM.dd")), ClientClass.CreateSqlParameter("ORDER_SEQ", SqlDbType.NVarChar, buttonEdit_ORDER_SEQ.Text), ClientClass.CreateSqlParameter("MODE", SqlDbType.Int, mode) }; ResultData resultData = ClientClass.GetData("GetSaleRegistrationPopup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } m_ORDER_NO = ""; if (resultData.DataList.Tables[0].Rows.Count > 0) { m_ORDER_NO = UtilClass.toStr(resultData.DataList.Tables[0].Rows[0]["ORDER_NO"]); } gridControl_Main.DataSource = resultData.DataList.Tables[0]; if (resultData.DataList.Tables[1].Rows.Count > 0) { buttonEdit_OUT_POS.Text = UtilClass.toStr(resultData.DataList.Tables[1].Rows[0]["OUT_POS"]); lookUpEdit_SIGN_GUBUN_CD.EditValue = resultData.DataList.Tables[1].Rows[0]["SIGN_GUBUN_CD"]; lookUpEdit_OUT_AREA_CD.EditValue = resultData.DataList.Tables[1].Rows[0]["OUT_AREA_CD"]; buttonEdit_CUST_NM.Text = UtilClass.toStr(resultData.DataList.Tables[1].Rows[0]["CUST_NM"]); labelControl_CUST_CD.Text = UtilClass.toStr(resultData.DataList.Tables[1].Rows[0]["CUST_CD"]); } else { lookUpEdit_SIGN_GUBUN_CD.ItemIndex = 1; lookUpEdit_OUT_AREA_CD.ItemIndex = 0; buttonEdit_OUT_POS.Text = ""; buttonEdit_CUST_NM.Text = ""; labelControl_CUST_CD.Text = ""; } if (resultData.DataList.Tables[2].Rows.Count > 0) { buttonEdit_ORDER_SEQ.Text = UtilClass.toStr(resultData.DataList.Tables[2].Rows[0]["ORDER_SEQ"]); } else { buttonEdit_ORDER_SEQ.Text = ""; } this.Cursor = Cursors.Arrow; if (mode > 0 && resultData.DataList.Tables[0].Rows.Count < 1) { MessageBox.Show("해당 관리번호가 없습니다. 확인하시길 바랍니다."); } clearProc(); } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } private void saveProc(string mode, string order_seq) { try { this.Cursor = Cursors.WaitCursor; if (UtilClass.isNull(labelControl_CUST_CD.Text)) { buttonEdit_CUST_NM.Focus(); throw new Exception("거래선을 조회하여 선택하십시오."); } if (mode.Equals("M") && UtilClass.isNull(order_seq)) { buttonEdit_ORDER_SEQ.Focus(); throw new Exception("수정할 관리번호가 없습니다."); } DataTable data = gridControl_Main.DataSource as DataTable; DataTable aData = new DataTable(); aData.Columns.Add("LN_SEQ", typeof(int)); aData.Columns.Add("ITEM_CD", typeof(string)); aData.Columns.Add("ROUT_CD", typeof(string)); aData.Columns.Add("AREA_WT", typeof(string)); aData.Columns.Add("ORDER_NORM", typeof(string)); aData.Columns.Add("ORDER_QTY", typeof(int)); aData.Columns.Add("ORDER_UNIT_CD", typeof(string)); aData.Columns.Add("DC_RATE", typeof(double)); aData.Columns.Add("CURR_UNIT_MY", typeof(int)); aData.Columns.Add("CURR_MY", typeof(int)); aData.Columns.Add("VAT_MY", typeof(int)); aData.Columns.Add("ORDER_MY", typeof(int)); aData.Columns.Add("REPLACE_YN", typeof(string)); aData.Columns.Add("LN_RMK", typeof(string)); aData.Columns.Add("STOCK_CD", typeof(string)); aData.Columns.Add("ORDER_WT", typeof(double)); aData.Columns.Add("CUT_CNT", typeof(string)); aData.Columns.Add("SALES_GUBUN_CD", typeof(string)); aData.Columns.Add("PAPER_CUST_CD", typeof(string)); aData.Columns.Add("STOCK_CNT", typeof(string)); DataRow row; for (int i = 0; i < data.Rows.Count; i++) { if (data.Rows[i].RowState == DataRowState.Deleted) { continue; } row = aData.NewRow(); row["LN_SEQ"] = data.Rows[i]["LN_SEQ"]; row["ITEM_CD"] = data.Rows[i]["ITEM_CD"]; row["ROUT_CD"] = data.Rows[i]["ROUT_CD"]; row["AREA_WT"] = data.Rows[i]["AREA_WT"]; row["ORDER_NORM"] = data.Rows[i]["ORDER_NORM"]; row["ORDER_QTY"] = data.Rows[i]["ORDER_QTY"]; row["ORDER_UNIT_CD"] = data.Rows[i]["ORDER_UNIT_CD"]; row["DC_RATE"] = data.Rows[i]["DC_RATE"]; row["CURR_UNIT_MY"] = data.Rows[i]["CURR_UNIT_MY"]; row["CURR_MY"] = data.Rows[i]["CURR_MY"]; row["VAT_MY"] = data.Rows[i]["VAT_MY"]; row["ORDER_MY"] = data.Rows[i]["ORDER_MY"]; row["REPLACE_YN"] = data.Rows[i]["REPLACE_YN"]; row["LN_RMK"] = data.Rows[i]["LN_RMK"]; row["STOCK_CD"] = data.Rows[i]["STOCK_CD"]; row["ORDER_WT"] = data.Rows[i]["ORDER_WT"]; row["CUT_CNT"] = data.Rows[i]["CUT_CNT"]; row["SALES_GUBUN_CD"] = data.Rows[i]["SALES_GUBUN_CD"]; row["PAPER_CUST_CD"] = data.Rows[i]["PAPER_CUST_CD"]; row["STOCK_CNT"] = data.Rows[i]["STOCK_CNT"]; aData.Rows.Add(row); }; aData.TableName = "ADATA"; if (aData.Rows.Count < 1) { throw new Exception((mode.Equals("I") ? "등록" : "수정") + "할 정보가 없습니다."); } ResultData data1 = new ResultData(); data1.TableData = aData; ResultData[] dataList = new ResultData[] { data1 }; string out_pos = UtilClass.toStr(buttonEdit_OUT_POS.Text); if (out_pos.Equals("")) { out_pos = buttonEdit_CUST_NM.Text.Trim(); } SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("MODE", SqlDbType.NVarChar, mode), ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("ORDER_NO", SqlDbType.NVarChar, m_ORDER_NO), ClientClass.CreateSqlParameter("ORDER_DT", SqlDbType.NVarChar, dateEdit_DATE.DateTime.ToString("yyyy.MM.dd")), ClientClass.CreateSqlParameter("ORDER_SEQ", SqlDbType.NVarChar, order_seq), ClientClass.CreateSqlParameter("PROC_CD", SqlDbType.NVarChar, lookUpEdit_PROC_CD.EditValue), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text), ClientClass.CreateSqlParameter("OUT_POS", SqlDbType.NVarChar, out_pos), ClientClass.CreateSqlParameter("SIGN_GUBUN_CD", SqlDbType.NVarChar, lookUpEdit_SIGN_GUBUN_CD.EditValue), ClientClass.CreateSqlParameter("OUT_AREA_CD", SqlDbType.NVarChar, lookUpEdit_OUT_AREA_CD.EditValue), ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID), ClientClass.CreateSqlParameter("RESULT_STR", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000) }; ResultData resultData = ClientClass.SetTableData("SaveSaleRegistrationPopup", dataList, aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } m_Changed = true; data.AcceptChanges(); this.Cursor = Cursors.Arrow; if (!UtilClass.isNull(resultData.ResultValue)) { MessageBox.Show(resultData.ResultValue); } else { MessageBox.Show((UtilClass.isEqual(mode, "I") ? "등록" : "수정") + " 완료."); } } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } private void selectCurrentMoney() { if (labelControl_CUST_CD.Text != "" && labelControl_ITEM_CD.Text != "") { try { this.Cursor = Cursors.WaitCursor; gridControl_Code.DataSource = null; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, labelControl_ITEM_CD.Text) }; ResultData resultData = ClientClass.GetData("U3GetSaleCurrentMoneyPopup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } gridControl_Code.DataSource = resultData.TableData; gridControl_Code.Focus(); this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } } private void deleteProc() { try { if (UtilClass.isNull(m_ORDER_NO)) { throw new Exception("조회된 자료가 없습니다."); } if (MessageBox.Show("해당 매출 자료를 삭제하시겠습니까?", "삭제", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } this.Cursor = Cursors.WaitCursor; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("ORDER_NO", SqlDbType.NVarChar, m_ORDER_NO) }; ResultData resultData = ClientClass.SetData("DeleteSaleRegistrationPopup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } m_Changed = true; this.Cursor = Cursors.Arrow; m_ORDER_NO = ""; MessageBox.Show("삭제 완료"); searchProc(0); } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } } }