private void BTN_PRINT_Click(object sender, EventArgs e) { DialogResult dRet = MetroMessageBox.Show(this, Constants.getMessage("REPRINT_CONFIRM"), "상세조회", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dRet != DialogResult.Yes) { return; } Transaction tran = new Transaction(); JObject sebdObj = new JObject(); sebdObj.Add("buy_serial_no", TXT_BUY_SERIAL_NO.Text.Replace("-", "")); sebdObj.Add("tml_id", Constants.TML_ID); try { JObject objRet = tran.sendServer_object(sebdObj.ToString(), tran.url_Slip_Info, 60, true, true); PrintUtil pu = new PrintUtil(); pu.PrintRefundSlip(objRet); } catch (Exception ex2) { MetroMessageBox.Show(this, Constants.getMessage("ERROR_PRINT"), "상세조회", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BTN_SUBMIT_Click(object sender, EventArgs e) { try { Boolean bRet = false; //처리중에 이중 입력 방지 if (this.UseWaitCursor) { return; } setWaitCursor(true); Utils util = new Utils(); Transaction tran = new Transaction(); 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); BTN_SUBMIT.Focus(); return; } //정합성 체크. 여권정보 없어도 출력 할 수 있게끔.. if (!validationCheck(false, true)) { setWaitCursor(false); BTN_SUBMIT.Focus(); return; } long nCalTax = Int64.Parse(TXT_SALES_AMT.Text.ToString().Replace(",", "")) / 11; long nViewTax = Int64.Parse(TXT_TAX_AMT.Text.ToString().Replace(",", "")); //예상새액이 계산 세액보다 5% 이상 차이가 있으면 오류 확인 팝업 호출 Boolean bDiff = (Math.Abs(nCalTax - nViewTax) * 100 / nCalTax) >= 5.0 ? true : false; DialogResult dRet; if (bDiff) { dRet = MetroMessageBox.Show(this, Constants.getMessage("TAX_CONFIRM") + "\n● 예상 세금액:" + string.Format(CultureInfo.CreateSpecificCulture("en-US"), "{0:n0}", nCalTax).Replace("$", "") + "\n● 입력 세금액:" + string.Format(CultureInfo.CreateSpecificCulture("en-US"), "{0:n0}", nViewTax).Replace("$", "") , "Issue", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dRet != DialogResult.Yes) { setWaitCursor(false); BTN_SUBMIT.Focus(); return; } } //전표발행여부 확인 //전표를 발행하시겠습니까? //아래에 관련 데이터 출력해야 함 //여권정보 //숙박일수 dRet = MetroMessageBox.Show(this, Constants.getMessage("ISSUE_CONFIRM") + "\n● 공급가격:" + TXT_SALES_AMT.Text + "\n● 세금:" + TXT_TAX_AMT.Text + "\n● 환급금:" + TXT_REFUND_AMT.Text, "Issue", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dRet != DialogResult.Yes) { setWaitCursor(false); BTN_SUBMIT.Focus(); return; } try { setWaitCursor(true); JObject jsonSlip = new JObject(); JObject jsonStdInfo = new JObject(); JObject jsonSutInfo = new JObject(); JArray arrjsonSlip = new JArray(); int nSerialNo = 0; //calAccAmt();//금액 재계산 calAccAmt(true, true);//금액 재계산 long nStdNight = Int64.Parse(COM_STD_NIGHT.Text.Replace(",", "")); long nSutNight = Int64.Parse(COM_SUT_NIGHT.Text.Replace(",", "")); long nStdSalesAmt = Int64.Parse(TXT_STD_SALES_AMT.Text.Replace(",", "")); long nSutSalesAmt = Int64.Parse(TXT_SUT_SALES_AMT.Text.Replace(",", "")); jsonSlip.Add("passport_no", TXT_PASSPORT_NO.Text); jsonSlip.Add("passport_name", TXT_PASSPORT_NAME.Text); jsonSlip.Add("passport_nat", TXT_PASSPORT_NAT.Text); jsonSlip.Add("passport_sex", COM_PASSPORT_SEX.Text); jsonSlip.Add("passport_birth", TXT_PASSPORT_BIRTH.Text.Replace("-", "").Replace("/", "")); jsonSlip.Add("passport_expire", TXT_PASSPORT_EXP.Text.Replace("-", "").Replace("/", "")); jsonSlip.Add("sales_amount", TXT_SALES_AMT.Text.Replace(",", "")); jsonSlip.Add("tax_amount", TXT_TAX_AMT.Text.Replace(",", "")); jsonSlip.Add("charge_amount", (Int64.Parse(TXT_TAX_AMT.Text.Replace(",", "")) - Int64.Parse(TXT_REFUND_AMT.Text.Replace(",", ""))).ToString()); jsonSlip.Add("refund_amount", TXT_REFUND_AMT.Text.Replace(",", "")); jsonSlip.Add("tml_id", Constants.TML_ID); jsonSlip.Add("sale_date", TXT_REFUND_DATE.Text.Replace("-", "").Replace("/", "")); jsonSlip.Add("sale_time", DateTime.Now.ToString("HHmmss")); jsonSlip.Add("payment_type", COM_PAYMENT.SelectedIndex != 0 ? "02" : "01");//2018.02.20 지불조건 추가 //jsonSlip.Add("export_expiry_date", TXT_PASSPORT_EXP.Text); //jsonSlip.Add("shop_name", TXT_PASSPORT_EXP.Text); //jsonSlip.Add("biz_permit_no", "104-00-00000"); //jsonSlip.Add("company_reg_no", "");//관광사업자등록번호 //jsonSlip.Add("shop_name", "글로벌호텔");//관광사업자등록번호 //jsonSlip.Add("ceo_name", "홍길동");//관광사업자등록번호 //jsonSlip.Add("shop_addr", "서울특별시 중구 퇴계로 131 2층");//관광사업자등록번호 jsonSlip.Add("remark", TXT_REMARK.Text); jsonSlip.Add("sign_img", TXT_SIGN_DATA.Text); if (TXT_SIGN_DATA.Text != null && !"".Equals(TXT_SIGN_DATA.Text.Trim())) { jsonSlip.Add("sign_img_type_code", "01"); } else { jsonSlip.Add("sign_img_type_code", ""); } //숙박일 수 있는 경우 if (COM_STD_NIGHT.SelectedIndex > 0) { nSerialNo++; jsonStdInfo.Add("serial_no", nSerialNo.ToString()); jsonStdInfo.Add("unit_price", (Int64.Parse(TXT_STD_SALES_AMT.Text.Replace(",", "")) / Int64.Parse(COM_STD_NIGHT.Text)).ToString()); jsonStdInfo.Add("qty", COM_STD_NIGHT.Text); jsonStdInfo.Add("goods_name", "일반객실(standard room)"); jsonStdInfo.Add("sales_amount", TXT_STD_SALES_AMT.Text.Replace(",", "")); jsonStdInfo.Add("tax_amount", TXT_STD_TAX_AMT.Text.Replace(",", "")); jsonStdInfo.Add("vat_amount", TXT_STD_TAX_AMT.Text.Replace(",", "")); jsonStdInfo.Add("sct_amount", "0"); jsonStdInfo.Add("et_amount", "0"); jsonStdInfo.Add("item_code", "40"); jsonStdInfo.Add("item_name", "Standard"); jsonStdInfo.Add("item_tax_code", "1"); arrjsonSlip.Add(jsonStdInfo); } if (COM_SUT_NIGHT.SelectedIndex > 0) { nSerialNo++; jsonSutInfo.Add("serial_no", nSerialNo.ToString()); jsonSutInfo.Add("unit_price", (Int64.Parse(TXT_SUT_SALES_AMT.Text.Replace(",", "")) / Int64.Parse(COM_SUT_NIGHT.Text)).ToString()); jsonSutInfo.Add("qty", COM_SUT_NIGHT.Text); jsonSutInfo.Add("goods_name", "스위트룸(suite room)"); jsonSutInfo.Add("sales_amount", TXT_SUT_SALES_AMT.Text.Replace(",", "")); jsonSutInfo.Add("tax_amount", TXT_SUT_TAX_AMT.Text.Replace(",", "")); jsonSutInfo.Add("vat_amount", TXT_SUT_TAX_AMT.Text.Replace(",", "")); jsonSutInfo.Add("sct_amount", "0"); jsonSutInfo.Add("et_amount", "0"); jsonSutInfo.Add("item_code", "41"); jsonSutInfo.Add("item_name", "Suite"); jsonSutInfo.Add("item_tax_code", "1"); arrjsonSlip.Add(jsonSutInfo); } jsonSlip.Add("buyList", arrjsonSlip); //송신 JObject objRet = tran.sendServer_object(jsonSlip.ToString(), tran.url_Slip_Submit, 60, true, true); if (objRet != null && "S".Equals(objRet["result"].ToString())) { jsonSlip.Add("biz_permit_no", objRet["biz_permit_no"]); jsonSlip.Add("buy_serial_no", objRet["buy_serial_no"]); jsonSlip.Add("company_reg_no", objRet["company_reg_no"]); jsonSlip.Add("shop_name", objRet["shop_name"]); jsonSlip.Add("ceo_name", objRet["ceo_name"]); jsonSlip.Add("shop_addr", objRet["shop_addr"]); jsonSlip.Add("shop_phone", objRet["shop_phone"]); try { PrintUtil pu = new PrintUtil(); pu.PrintRefundSlip(jsonSlip); bRet = true; MetroMessageBox.Show(this, Constants.getMessage("ISSUE_SUCCESS"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex2) { MetroMessageBox.Show(this, Constants.getMessage("ERROR_PRINT"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Information); } //bRet = true; } else { if (objRet != null && objRet["resp_msg"] != null) { MetroMessageBox.Show(this, objRet["resp_msg"].ToString(), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MetroMessageBox.Show(this, Constants.getMessage("ISSUE_ERROR"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { setWaitCursor(false); BTN_SUBMIT.Focus(); } //거래 성공 시 화면 초기화 if (bRet) { SCREEN_CLEAR(); } } catch (Exception e2) { Constants.LOGGER_MAIN.Info(e2.Message); } setWaitCursor(false); }