private void BTN_CLOSING_Click(object sender, EventArgs e) { try { Transaction tran = new Transaction();//거래내용 조회 //JArray arrRet = tran.SearchSlips(Constants.OPEN_DATE, Constants.OPEN_DATE, "N" , "02"); JArray arrRet = tran.SearchUserSlips("", "", "N", "02"); MessageForm msgForm = new MessageForm(""); if (arrRet != null && arrRet.Count > 0) { msgForm = new MessageForm(Constants.getMessage("CLOSING_FAIL"), null, MessageBoxButtons.OK); msgForm.ShowDialog(this); msgForm = null; } else { if (arrRet != null) { arrRet.RemoveAll(); arrRet.Clear(); arrRet = null; } arrRet = tran.SearchUserSlips(Constants.OPEN_DATE, Constants.OPEN_DATE, "Y", "02"); Int64 saleCnt = 0, saleAmt = 0, taxAmt = 0, feeAmt = 0; if (arrRet != null) { saleCnt = arrRet.Count; for (int i = 0; i < arrRet.Count; i++) { JObject tempObj = (JObject)arrRet[i]; saleAmt += Int64.Parse(tempObj["GOODS_BUY_AMT"].ToString()); taxAmt += Int64.Parse(tempObj["GOODS_TAX_AMT"].ToString()); feeAmt += Int64.Parse(tempObj["GOODS_TAX_AMT"].ToString()) - Int64.Parse(tempObj["GOODS_REFUND_AMT"].ToString()); saleAmt += Int64.Parse(tempObj["CONSUMS_BUY_AMT"].ToString()); taxAmt += Int64.Parse(tempObj["CONSUMS_TAX_AMT"].ToString()); feeAmt += Int64.Parse(tempObj["CONSUMS_TAX_AMT"].ToString()) - Int64.Parse(tempObj["CONSUMS_REFUND_AMT"].ToString()); tempObj.RemoveAll(); tempObj = null; } arrRet.RemoveAll(); arrRet.Clear(); arrRet = null; } msgForm = new MessageForm(Constants.getMessage("CLOSING"), null, MessageBoxButtons.YesNo); msgForm.ShowDialog(this); if (msgForm.DialogResult == DialogResult.Yes) { //업무마감 거래 실행 if (tran.Closing(Constants.USER_ID, Constants.OPEN_DATE, saleCnt.ToString(), saleAmt.ToString(), taxAmt.ToString(), feeAmt.ToString())) { msgForm = null; msgForm = new MessageForm(Constants.getMessage("CLOSING_YES"), null, MessageBoxButtons.OK); msgForm.ShowDialog(this); Application.ExitThread(); Environment.Exit(0); } else { msgForm = null; msgForm = new MessageForm(Constants.getMessage("CLOSING_NO"), null, MessageBoxButtons.OK); msgForm.ShowDialog(this); } } msgForm = null; } }catch (Exception ex) { m_Logger.Error(ex.StackTrace); } }
private void metroGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 12 && e.RowIndex >= 0) { if (!Constants.OPEN_DATE.Equals(m_strLastSearchDate)) { MetroMessageBox.Show(this, Constants.getMessage("ERROR_PRINT_DATE"), "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string strSlipNo = GRD_SLIP[2, e.RowIndex].Value.ToString(); string printCnt = (GRD_SLIP[12, e.RowIndex].Value == null || string.Empty.Equals(GRD_SLIP[12, e.RowIndex].Value.ToString().Trim())) ? "0":GRD_SLIP[12, e.RowIndex].Value.ToString(); Transaction tran = new Transaction(); PrintSlipLangForm langForm = new PrintSlipLangForm(m_Logger); langForm.ShowDialog(this); string strSlipLang = string.Empty; if (langForm.m_SelectLang != null && !string.Empty.Equals(langForm.m_SelectLang.Trim())) { strSlipLang = langForm.m_SelectLang; } else { MetroMessageBox.Show(this, "Select Lang.", "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (langForm.DialogResult != DialogResult.OK) { return; } JObject jsonDocs = tran.GetPrintDocs(strSlipNo); if (jsonDocs != null)//출력 { string docid, retailer, goods, tourist, adsinfo, signInfo, preview = string.Empty; docid = jsonDocs["DOCID"].ToString(); retailer = jsonDocs["RETAILER"].ToString(); goods = jsonDocs["GOODS"].ToString(); tourist = jsonDocs["TOURIST"].ToString(); adsinfo = jsonDocs["ADSINFO"].ToString(); preview = jsonDocs["PREVIEW"].ToString(); signInfo = jsonDocs["SIGN"].ToString(); docid = strSlipLang + docid.Substring(2); try { GTF_ReceiptPrinter printer = new GTF_ReceiptPrinter(m_Logger); printer.setPrinter(Constants.PRINTER_TYPE); #if DEBUG printer.PrintSlip_ja(docid.Replace("[REPUBLISH]", "1"), retailer, goods, tourist, adsinfo, true, signInfo); #else printer.PrintSlip_ja(docid.Replace("[REPUBLISH]", "1"), retailer, goods, tourist, adsinfo, "Y".Equals(preview), signInfo); #endif } catch (Exception ex) { m_Logger.Error(ex.StackTrace); } JObject tempObj = new JObject(); JObject tempObj2 = new JObject(); tempObj.Add("SLIP_NO", strSlipNo); tempObj2.Add(Constants.PRINT_CNT, (Int32.Parse(printCnt) + 1).ToString()); if (GRD_SLIP[13, e.RowIndex].Value == null || !"02".Equals(GRD_SLIP[13, e.RowIndex].Value.ToString())) { MessageForm msgForm = new MessageForm(Constants.getMessage("SLIP_CONFIRM"), null, MessageBoxButtons.YesNo); msgForm.ShowDialog(this); if (msgForm.DialogResult == DialogResult.Yes) { string refunddt = System.DateTime.Now.ToString("yy'/'MM'/'dd HH:mm:ss"); tempObj2.Add("SLIP_STATUS_CODE", "02"); tempObj2.Add("REFUNDDT", refunddt); refunddt = ""; } } tran.UpdateSlip(tempObj, tempObj2); tempObj.RemoveAll(); tempObj2.RemoveAll(); tempObj = null; tempObj2 = null; BTN_SEARCH_Click(null, null); } else { MetroMessageBox.Show(this, "Print Error", "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } }
private void BTN_CANCEL_Click(object sender, EventArgs e) { Transaction tran = new Transaction(); string strSlipNo = ""; string strTotalSlipNo = ""; string strRefundWayCode = ""; string strProgressStatus_code = ""; string alert_msg = ""; string strRefundStatusCode = ""; if (GRD_SLIP.SelectedRows.Count != 0) { DataGridViewRow row = this.GRD_SLIP.SelectedRows[0]; strSlipNo = row.Cells[1].Value.ToString(); strTotalSlipNo = row.Cells[11].Value.ToString(); strRefundStatusCode = row.Cells[14].Value.ToString(); strRefundWayCode = row.Cells[15].Value.ToString(); strProgressStatus_code = row.Cells[16].Value.ToString(); /* * string alert_test; * alert_test = "strSlipNo[" + strSlipNo + "]" + Environment.NewLine; * alert_test += "strTotalSlipNo[" + strTotalSlipNo + "]" + Environment.NewLine; * alert_test += "strRefundWayCode[" + strRefundWayCode + "]" + Environment.NewLine; * alert_test += "strProgressStatus_code[" + strProgressStatus_code + "]" + Environment.NewLine; * MetroMessageBox.Show(this, alert_test, "info", MessageBoxButtons.OK); * * */ } else { MetroMessageBox.Show(this, Constants.getMessage("SELECTCANCELSLIP"), "Cancel", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (strRefundStatusCode.Equals("04")) { MetroMessageBox.Show(this, Constants.getMessage("ALREADYCANCELREFUND"), "Cancel", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (strRefundWayCode != "01") { if (strProgressStatus_code != "99") { alert_msg = Constants.getMessage("REMMITYETSEND") + Environment.NewLine; } else { alert_msg = Constants.getMessage("REMMITSENDCOM") + Environment.NewLine; } } if (strTotalSlipNo != "") { alert_msg += Constants.getMessage("TOTAL_SLIP_ISSUED") + Environment.NewLine + Constants.getMessage("CANCELREQUEST"); MessageForm msgForm = new MessageForm(alert_msg, null, MessageBoxButtons.YesNo); msgForm.ShowDialog(this); if (msgForm.DialogResult == DialogResult.Yes) { MessageForm msgForm2 = new MessageForm(Constants.getMessage("TOTALSLIPALLCANCEL"), null, MessageBoxButtons.YesNo); msgForm2.ShowDialog(this); if (msgForm2.DialogResult == DialogResult.Yes) { if (tran.CancelAll(Constants.USER_ID, strSlipNo, strTotalSlipNo)) { msgForm = null; msgForm = new MessageForm(Constants.getMessage("REFUNDCANCELCOM"), null, MessageBoxButtons.OK); msgForm.ShowDialog(this); searchList(((cmbbox_Page.SelectedIndex) + 1).ToString()); } else { msgForm = null; msgForm = new MessageForm(Constants.getMessage("REFUNDCANCELFAIL"), null, MessageBoxButtons.OK); msgForm.ShowDialog(this); } } else { if (tran.Cancel(Constants.USER_ID, strSlipNo, strTotalSlipNo)) { msgForm = null; msgForm = new MessageForm(Constants.getMessage("REFUNDCANCELCOM"), null, MessageBoxButtons.OK); msgForm.ShowDialog(this); searchList(((cmbbox_Page.SelectedIndex) + 1).ToString()); } else { msgForm = null; msgForm = new MessageForm(Constants.getMessage("REFUNDCANCELFAIL"), null, MessageBoxButtons.OK); msgForm.ShowDialog(this); } } } else { MetroMessageBox.Show(this, Constants.getMessage("CONFIRMCANCEL"), "Cancel", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { alert_msg += "[" + strSlipNo + "] " + Constants.getMessage("CANCELREQUEST"); MessageForm msgForm = new MessageForm(alert_msg, null, MessageBoxButtons.YesNo); msgForm.ShowDialog(this); if (msgForm.DialogResult == DialogResult.Yes) { if (tran.Cancel(Constants.USER_ID, strSlipNo, strTotalSlipNo)) { msgForm = null; msgForm = new MessageForm(Constants.getMessage("REFUNDCANCELCOM"), null, MessageBoxButtons.OK); msgForm.ShowDialog(this); searchList(((cmbbox_Page.SelectedIndex) + 1).ToString()); } else { msgForm = null; msgForm = new MessageForm(Constants.getMessage("REFUNDCANCELFAIL"), null, MessageBoxButtons.OK); msgForm.ShowDialog(this); } } else { MetroMessageBox.Show(this, Constants.getMessage("CONFIRMCANCEL"), "Cancel", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }