/// <summary> /// EDI 파일을 만듭니다. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnMakeFile_Click(object sender, EventArgs e) { Ctl.Control.frmLoading f = new Ctl.Control.frmLoading("청구확정 작업 중 입니다."); try { if (dt.Rows.Count <= 0) { Basic.ShowMessage(1, "청구할 데이터가 없습니다."); return; } /*************************/ // 중복승인건 조회 /*************************/ DataTable dtParm33 = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParm33.Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParm33.Rows.Add(new object[] { "V_FROM", Basic.MaskReplace(this.dtpFrom.Text.Trim()) }); dtParm33.Rows.Add(new object[] { "V_TO", Basic.MaskReplace(this.dtpTo.Text.Trim()) }); DataSet dsTmp = DataLayer.ExecuteSpDataset("PKG_JIAAI09.PR_01", dtParm33, DataLayer.MessageEncoding.Default); /*************************/ if (dsTmp.Tables[0].Rows.Count > 0) { JIAAI09 ff = new JIAAI09(dsTmp.Tables[0]); ff.Owner = this; ff.ShowDialog(); return; //if(ff.ShowDialog() == DialogResult.No) //{ // return; //} //else //{ // if(Basic.ShowMessageQuestion("승인-취소건을 상계처리 하시겠습니까?") == DialogResult.No) return; //} } /*가맹점번호 확인*/ int cntContract = int.Parse(dt.Compute("COUNT(CHK)", "ISNULL(VAN_ID,'') = ''").ToString().Trim()); if (cntContract > 0) { Basic.ShowMessage(2, "가맹점 번호가 없는 데어터가 있습니다."); return; } int cntCompanyId = int.Parse(dt.Compute("COUNT(CHK)", "ISNULL(COMPANY_ID,'') = ''").ToString().Trim()); if (cntContract > 0) { Basic.ShowMessage(2, "매입사 사업자 번호가 등록되지 않은 데이터가 있습니다."); return; } Basic.SetCursor(this, false); int idate = int.Parse(dt.Compute("COUNT(SALE_AMT)", "LEN(ISNULL(AGREE_DATE,'')) <> 10").ToString()); if (idate > 0) { Basic.ShowMessage(2, "승일일자가 없거나 형식이 틀린 데이터가 있습니다."); return; } RegistryKey regKey1 = Registry.CurrentUser.CreateSubKey(@"Software\EDIPath"); string paths = ""; if (regKey1 != null) { paths = (string)regKey1.GetValue("Path"); regKey1.Close(); } folderBrowserDialog1.SelectedPath = paths; EDI.Log.Log.FilePath = ""; EDI.Log.Log.FileName = ""; DialogResult dr = this.folderBrowserDialog1.ShowDialog(); if (dr == DialogResult.OK) { EDI.Log.Log.FilePath = this.folderBrowserDialog1.SelectedPath; RegistryKey regKey = Registry.CurrentUser.CreateSubKey(@"Software\EDIPath"); regKey.SetValue("DefaultFolder", System.Environment.CurrentDirectory.ToString()); regKey.SetValue("Path", EDI.Log.Log.FilePath); regKey.Close(); } if (EDI.Log.Log.FilePath.Trim() == "") { return; } //FileName을 가져온다. DataTable dtParm = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParm.Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParm.Rows.Add(new object[] { "V_REG_KIND", "I" }); string vRet = DataLayer.ExecuteSpScala("PKG_JIAAI02.PR_02", dtParm, DataLayer.MessageEncoding.Default); string strDate = vRet.Split('|')[0].Trim(); string strSeq = vRet.Split('|')[1].Trim();; if (int.Parse(strSeq) > 1) { Basic.ShowMessage(1, "금일 청구건이 존재합니다. \n\r당일 1회 청구만 가능합니다."); return; } f.TopMost = true; f.Show(); Application.DoEvents(); EDI.Log.Log.FileName = GetFileName(strDate, strSeq); fnMakeFile(); SendComplate(strDate, strSeq, EDI.Log.Log.FileName); this.dt.Clear(); this.dtSumery.Clear(); _strFrom = ""; _strTo = ""; Basic.SetCursor(this, true); if (f.IsHandleCreated) { f.Dispose(); f.Close(); } Application.DoEvents(); Basic.ShowMessage(1, "파일을 생성하였습니다."); Process.Start(EDI.Log.Log.FilePath); } catch (Exception ex) { Basic.SetCursor(this, true); if (f.IsHandleCreated) { f.Dispose(); f.Close(); } if (System.IO.File.Exists(Log.FilePath + "\\" + Log.FileName)) { System.IO.File.Delete(Log.FilePath + "\\" + Log.FileName); } Basic.ShowMessage(3, ex.Message); } finally { Basic.SetCursor(this, true); if (f.IsHandleCreated) { f.Dispose(); f.Close(); } Basic.SetCursor(this, true); } }
/// <summary> /// 취소-승인건 자동선택 /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnCheck_Click(object sender, EventArgs e) { Ctl.Control.frmLoading f = new Ctl.Control.frmLoading("승인-취소건을 체크합니다."); try { if (dt.Rows.Count <= 0) { Basic.ShowMessage(1, "청구할 데이터가 없습니다."); return; } if (dt.Rows.Count <= 0) { return; } for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["CHK"] = "N"; } dt.AcceptChanges(); DataRow[] r = dt.Select("ISNULL(ORG_AGREE_NO,'') <> '' AND AGREE_YN = 'N' "); if (r == null || r.Length <= 0) { return; } /*************************/ // 중복승인건 조회 /*************************/ DataTable dtParm33 = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParm33.Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParm33.Rows.Add(new object[] { "V_FROM", Basic.MaskReplace(this.dtpFrom.Text.Trim()) }); dtParm33.Rows.Add(new object[] { "V_TO", Basic.MaskReplace(this.dtpTo.Text.Trim()) }); DataSet dsTmp = DataLayer.ExecuteSpDataset("PKG_JIAAI09.PR_01", dtParm33, DataLayer.MessageEncoding.Default); /*************************/ if (dsTmp.Tables[0].Rows.Count > 0) { JIAAI09 ff = new JIAAI09(dsTmp.Tables[0]); ff.Owner = this; ff.ShowDialog(); return; //if(ff.ShowDialog() == DialogResult.No) //{ // return; //} //else //{ // if(Basic.ShowMessageQuestion("승인-취소건을 상계처리 하시겠습니까?") == DialogResult.No) return; //} } Basic.SetCursor(this, false); f.TopMost = true; f.Show(); Application.DoEvents(); this.progressBarControl1.Visible = true; this.progressBarControl1.Properties.Maximum = r.Length; this.progressBarControl1.Properties.Minimum = 0; this.progressBarControl1.EditValue = 0; for (int j = 0; j < r.Length; j++) { Application.DoEvents(); this.progressBarControl1.EditValue = j + 1; string saleamt = r[j]["SALE_AMT_ABS"].ToString().Trim(); string agreeno = r[j]["AGREE_NO"].ToString().Trim(); string cardno = r[j]["CARD_NO"].ToString().Trim(); string filter = "AGREE_NO = '{0}' AND CARD_NO = '{1}' AND ISNULL(ORG_AGREE_NO,'') = '' AND SALE_AMT_ABS = {2}"; filter = string.Format(filter, agreeno, cardno, saleamt); DataRow[] ir = dt.Select(filter); if (ir == null || ir.Length <= 0) { continue; } if (ir.Length > 1) { Basic.SetCursor(this, true); if (f.IsHandleCreated) { f.Dispose(); f.Close(); } Basic.ShowMessage(1, "중복건이 존재합니다. - " + filter); dt.RejectChanges(); return; } ir[0]["CHK"] = "Y"; r[j]["CHK"] = "Y"; string sale_date0 = Basic.MaskReplace(r[j]["SALE_DATE"].ToString().Trim()); string facility0 = r[j]["FACILITY_CODE"].ToString().Trim(); string posno0 = r[j]["POS_NO"].ToString().Trim(); string billno0 = r[j]["BILL_NO"].ToString().Trim(); string saleyn0 = r[j]["SALE_YN"].ToString().Trim(); string payseq0 = r[j]["PAY_SEQ"].ToString().Trim(); DataTable[] dtParm = new DataTable[2]; dtParm[0] = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParm[0].TableName = "PKG_JIAAI02.PR_04"; dtParm[0].Rows.Add(new object[] { "V_TID", "승인취소-상계" }); dtParm[0].Rows.Add(new object[] { "V_SALE_DATE", sale_date0 }); dtParm[0].Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParm[0].Rows.Add(new object[] { "V_FACILITY_CODE", facility0 }); dtParm[0].Rows.Add(new object[] { "V_POS_NO", posno0 }); dtParm[0].Rows.Add(new object[] { "V_BILL_NO", billno0 }); dtParm[0].Rows.Add(new object[] { "V_SALE_YN", saleyn0 }); dtParm[0].Rows.Add(new object[] { "V_PAY_SEQ", payseq0 }); dtParm[0].Rows.Add(new object[] { "V_EMP_NO", Parm.CurrentUserInformation.id }); dtParm[0].Rows.Add(new object[] { "V_IP", Parm.CurrentUserInformation.ip }); /////////////////////////////////////////////////////////////////////////////////////////////////////////// string sale_date1 = Basic.MaskReplace(ir[0]["SALE_DATE"].ToString().Trim()); string facility1 = ir[0]["FACILITY_CODE"].ToString().Trim(); string posno1 = ir[0]["POS_NO"].ToString().Trim(); string billno1 = ir[0]["BILL_NO"].ToString().Trim(); string saleyn1 = ir[0]["SALE_YN"].ToString().Trim(); string payseq1 = ir[0]["PAY_SEQ"].ToString().Trim(); dtParm[1] = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParm[1].TableName = "PKG_JIAAI02.PR_04"; dtParm[1].Rows.Add(new object[] { "V_TID", "승인취소-상계" }); dtParm[1].Rows.Add(new object[] { "V_SALE_DATE", sale_date1 }); dtParm[1].Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParm[1].Rows.Add(new object[] { "V_FACILITY_CODE", facility1 }); dtParm[1].Rows.Add(new object[] { "V_POS_NO", posno1 }); dtParm[1].Rows.Add(new object[] { "V_BILL_NO", billno1 }); dtParm[1].Rows.Add(new object[] { "V_SALE_YN", saleyn1 }); dtParm[1].Rows.Add(new object[] { "V_PAY_SEQ", payseq1 }); dtParm[1].Rows.Add(new object[] { "V_EMP_NO", Parm.CurrentUserInformation.id }); dtParm[1].Rows.Add(new object[] { "V_IP", Parm.CurrentUserInformation.ip }); DataSet ds = DataLayer.AddProdedcure(dtParm); string vRet = DataLayer.ExecuteSpScalaTransaction(ds, "OK", DataLayer.MessageEncoding.Default); if (vRet != "OK") { Basic.ShowMessage(1, vRet + "\n\r" + filter); if (Basic.ShowMessageQuestion("다음건 을 진행하시겠습나까?") == DialogResult.No) { return; } } } this.progressBarControl1.Visible = false; Basic.SetCursor(this, true); if (f.IsHandleCreated) { f.Dispose(); f.Close(); } Basic.ShowMessage(1, "데이터를 갱신합니다."); Application.DoEvents(); InvokeOnClick(btnSelect, new EventArgs()); } catch (Exception ex) { dt.RejectChanges(); Basic.ShowMessage(3, ex.Message); } finally { this.progressBarControl1.Visible = false; Basic.SetCursor(this, true); if (f.IsHandleCreated) { f.Dispose(); f.Close(); } } }