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_PRINT_Click(object sender, EventArgs e) { if (strRefundStatusCode.Equals("04")) { MetroMessageBox.Show(this, Constants.getMessage("ALREADYCANCELREFUND"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Constants.PRINTER_TYPE == null || string.Empty.Equals(Constants.PRINTER_TYPE.Trim())) { MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_NOTHING"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Warning); setWaitCursor(false); return; } 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; } Transaction tran = new Transaction();//거래내용 조회 GTF_ReceiptPrinter printer = new GTF_ReceiptPrinter(null); printer.setPrinter(Constants.PRINTER_TYPE); string strSlip_no = m_SlipNo; string retailer = ""; string docid = ""; string goods = ""; string tourist = ""; string singinfo = ""; string adsinfo = ""; JArray arrComm = new JArray(); JArray arrExComm = new JArray(); JToken signToken; string strRes = tran.getSlipPrintInfo(strSlip_no); JObject result = JObject.Parse(strRes); JToken retailerToken = result["retailerInfo"].DeepClone(); JToken touristToken = result["touristInfo"].DeepClone(); JToken refundToken = result["refundInfo"].DeepClone(); JToken saleToken = result["saleInfo"].DeepClone(); if (result["signInfo"] != null) { signToken = result["signInfo"].DeepClone(); } else { signToken = null; } JArray goodsList = JArray.Parse(result["goodsList"].ToString()); tourist = touristToken["PASSPORT_TYPE"].ToString() + "|"; tourist += touristToken["PASSPORT_SERIAL_NO"].ToString() + "|"; tourist += touristToken["BUYER_NAME"].ToString() + "|"; tourist += touristToken["NATIONALITY"].ToString() + "|"; tourist += touristToken["BUYER_BIRTH"].ToString() + "|"; tourist += touristToken["RESIDENCE"].ToString() + "|"; tourist += touristToken["ENTRYDT"].ToString() + "|"; retailer = retailerToken["TAXOFFICE_NAME"].ToString() + "|"; retailer += retailerToken["TAX_ADDR1"].ToString() + "|"; retailer += retailerToken["TAX_ADDR2"].ToString() + "|"; retailer += retailerToken["MERCHANT_JPNM"].ToString() + "|"; retailer += retailerToken["JP_ADDR1"].ToString() + "|"; retailer += retailerToken["JP_ADDR2"].ToString() + "|"; retailer += retailerToken["OPT_CORP_JPNM"].ToString() + "|"; docid += strSlipLang + "|"; //출력언어 if (Constants.PRINT_TYPE != "ALL") { docid += "1" + "|"; //출력전표 갯수 docid += "01" + "|"; //출력 } else { docid += "2" + "|"; //출력전표 갯수 docid += "01/02" + "|"; //출력 } docid += "[REPUBLISH]" + "|"; //출력유형 docid += strSlip_no + "|"; docid += "N" + "|"; //합산전표 출력여부 docid += refundToken["REFUND_WAY_CODE"].ToString() + "|"; // docid += refundToken["REFUND_WAY_CODE_DESC"].ToString() + "|"; docid += refundToken["MASK_REMIT_NO"].ToString() + "|"; docid += retailerToken["UNIKEY"].ToString(); goods = retailerToken["SALEDT"].ToString() + "|"; long com_cnt = Int64.Parse(saleToken["COM_COUNT"].ToString()); long excom_cnt = Int64.Parse(saleToken["EXCOM_COUNT"].ToString()); if (com_cnt > 0 && excom_cnt > 0) { goods += "2" + "|"; } else if (com_cnt > 0 || excom_cnt > 0) { goods += "1" + "|"; } else { MetroMessageBox.Show(this, Constants.getMessage("ERROR_ISSUE"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Warning); //setWaitCursor(false); return; } for (int i = 0; i < goodsList.Count; i++) { JObject tempObj = (JObject)goodsList[i]; string item_code = tempObj["GOODS_ITEMS_CODE"].ToString(); if (item_code.Equals("A0002")) { arrComm.Add(tempObj); } else { arrExComm.Add(tempObj); } } if (arrComm != null && arrComm.Count > 0) { goods += "01" + "|"; //물품종류(소비) goods += arrComm.Count + "|"; //물품갯수 for (int i = 0; i < arrComm.Count; i++) { JObject tempObj = (JObject)arrComm[i]; goods += tempObj["GOODS_NAME"].ToString() + "|"; goods += tempObj["GOODS_UNIT_PRICE"].ToString() + "|"; goods += tempObj["GOODS_QTY"].ToString() + "|"; goods += tempObj["GOODS_AMT"].ToString() + "|"; } goods += saleToken["TOTAL_COMM_SALE_AMT"].ToString() + "|"; goods += saleToken["TOTAL_COMM_TAX_AMT"].ToString() + "|"; goods += saleToken["TOTAL_COMM_REFUND_AMT"].ToString() + "|"; goods += "|";; } if (arrExComm != null && arrExComm.Count > 0) { goods += "02" + "|"; //물품종류(일반) goods += arrExComm.Count + "|"; //물품갯수 for (int i = 0; i < arrExComm.Count; i++) { JObject tempObj = (JObject)arrExComm[i]; goods += tempObj["GOODS_NAME"].ToString() + "|"; goods += tempObj["GOODS_UNIT_PRICE"].ToString() + "|"; goods += tempObj["GOODS_QTY"].ToString() + "|"; goods += tempObj["GOODS_AMT"].ToString() + "|"; } goods += saleToken["TOTAL_EXCOMM_SALE_AMT"].ToString() + "|"; goods += saleToken["TOTAL_EXCOMM_TAX_AMT"].ToString() + "|"; goods += saleToken["TOTAL_EXCOMM_REFUND_AMT"].ToString() + "|"; goods += "|"; } goods += Int64.Parse(saleToken["TOTAL_EXCOMM_TAX_AMT"].ToString()) + Int64.Parse(saleToken["TOTAL_COMM_TAX_AMT"].ToString()) + "|"; goods += Int64.Parse(saleToken["TOTAL_EXCOMM_SALE_AMT"].ToString()) + Int64.Parse(saleToken["TOTAL_COMM_SALE_AMT"].ToString()) + "|"; goods += ((Int64.Parse(saleToken["TOTAL_EXCOMM_TAX_AMT"].ToString()) + Int64.Parse(saleToken["TOTAL_COMM_TAX_AMT"].ToString())) - (Int64.Parse(saleToken["TOTAL_EXCOMM_REFUND_AMT"].ToString()) + Int64.Parse(saleToken["TOTAL_COMM_REFUND_AMT"].ToString()))) + "|"; goods += Int64.Parse(saleToken["TOTAL_EXCOMM_REFUND_AMT"].ToString()) + Int64.Parse(saleToken["TOTAL_COMM_REFUND_AMT"].ToString()) + "|"; if (signToken != null) { singinfo = signToken["SIGN_DATA"].ToString(); } #if DEBUG printer.PrintSlip_ja(docid.Replace("[REPUBLISH]", "0"), retailer, goods, tourist, adsinfo, true, singinfo); #else printer.PrintSlip_ja(docid.Replace("[REPUBLISH]", "0"), retailer, goods, tourist, adsinfo, false, singinfo); #endif }