private void bill_Print_Card(string _strTaskDate, string _strBizCode, string _strFacilityCode, string _strBillNo, string _strPaySeq, string _strMngNo, string _strMngSeq) { try { string strBizCode = Parm.CurrentUserInformation.BizInfo.BizCode; DataSet ds = null; DataTable dtParm = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParm.Rows.Add(new object[] { "V_SALE_DATE", _strTaskDate }); dtParm.Rows.Add(new object[] { "V_BIZ_CODE", _strBizCode }); dtParm.Rows.Add(new object[] { "V_FACILITY_CODE", _strFacilityCode }); dtParm.Rows.Add(new object[] { "V_POS_NO", "01" }); dtParm.Rows.Add(new object[] { "V_BILL_NO", _strBillNo }); dtParm.Rows.Add(new object[] { "V_AGREE_YN", "N" }); dtParm.Rows.Add(new object[] { "V_PAY_SEQ", "" }); ds = DataLayer.ExecuteSpDataset("PKG_DAZAZ02.PR_CARD_SELECT", dtParm, DataLayer.MessageEncoding.Default); DataTable dtCard = new DataTable(); dtCard.Load(ds.Tables[0].CreateDataReader()); DataTable dtTitle = new DataTable("dtTitle"); dtTitle.Columns.Add("ROOM_NO"); dtTitle.Columns.Add("GUEST_NAME"); dtTitle.Columns.Add("AMT", typeof(decimal)); dtTitle.Columns.Add("CHECKOUT_DATE"); dtTitle.Columns.Add("ROOM_TYPE"); dtTitle.Columns.Add("MEMBER_NO"); dtTitle.Columns.Add("MOBILE_TEL"); dtTitle.Columns.Add("CHECKIN_DATE"); DataSet dst = null; DataTable dtParmT = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParmT.Rows.Add(new object[] { "V_MNG_NO", _strMngNo }); dtParmT.Rows.Add(new object[] { "V_MNG_SEQ", _strMngSeq }); dtParmT.Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParmT.Rows.Add(new object[] { "V_FACILITY_CODE", Parm.CurrentUserInformation.roomTask.gsDFacility }); if (strBizCode == "20") { dst = DataLayer.ExecuteSpDataset("PKG_DAHAH23.PR_04", dtParmT, DataLayer.MessageEncoding.Default); } else { dst = DataLayer.ExecuteSpDataset("PKG_DAHDH23.PR_04", dtParmT, DataLayer.MessageEncoding.Default); } dtTitle.Clear(); dtTitle.Load(dst.Tables[0].CreateDataReader()); #region 레포트이용 if (Parm.CurrentUserInformation.roomTask.gsPrintMode == PrintMode.DRIVER) { // 신용카드영수증 출력 DevExpress.XtraReports.UI.XtraReport rpt = null; if (Parm.CurrentUserInformation.BizInfo.BizCode == "22141") { } else { rpt = new Erp.Room.DAHA.Report.DAHAP23_03(); } DataTable dttmp = new DataTable(); dttmp.Columns.Add("PRINT_YN"); dttmp.Columns.Add("BIZ_CODE"); dttmp.Columns.Add("MNG_NO"); dttmp.Columns.Add("MNG_SEQ", typeof(decimal)); dttmp.Columns.Add("TASK_DATE"); dttmp.Columns.Add("KEY_SEQ", typeof(decimal)); dttmp.Columns.Add("CARD_NO"); dttmp.Columns.Add("RAISE_CODE_NAME"); dttmp.Columns.Add("AGREE_NO"); dttmp.Columns.Add("CARD_CO_NAME"); dttmp.Columns.Add("INSTALLMENT_CNT", typeof(decimal)); dttmp.Columns.Add("SALE_AMT", typeof(decimal)); dttmp.Columns.Add("CARD_JOIN_NO"); dttmp.Columns.Add("VALID_THRU"); dttmp.Rows.Add(new Object[] { "Y" , dtCard.Rows[0]["BIZ_CODE"] , _strMngNo , Int32.Parse(_strMngSeq) , dtCard.Rows[0]["TASK_DATE"] , dtCard.Rows[0]["KEY_SEQ"] , dtCard.Rows[0]["CARD_NO"] , "" , dtCard.Rows[0]["AGREE_NO"] , dtCard.Rows[0]["CARD_CO_NAME"] , dtCard.Rows[0]["INSTALLMENT_CNT"] , dtCard.Rows[0]["SALE_AMT"] , dtCard.Rows[0]["CARD_JOIN_NO"] , dtCard.Rows[0]["VALID_THRU"] }); DataTable dtSign = new DataTable("dtSign"); DataTable dtParmsign = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParmsign.Rows.Add(new object[] { "V_SALE_DATE", dtCard.Rows[0]["TASK_DATE"].ToString().Replace("-", "").Trim() }); dtParmsign.Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParmsign.Rows.Add(new object[] { "V_FACILITY_CODE", Parm.CurrentUserInformation.roomTask.gsDFacility }); dtParmsign.Rows.Add(new object[] { "V_PAY_SEQ", dtCard.Rows[0]["KEY_SEQ"] }); DataSet dssign = DataLayer.ExecuteSpDataset("PKG_DAHAH23.PR_05", dtParmsign, DataLayer.MessageEncoding.Default); dtSign.Load(dssign.Tables[0].CreateDataReader()); //int prtcnt = dtSign.Rows.Count > 0 ? 1 : 2; DataSet dsTemp = new DataSet(); dsTemp.Tables.AddRange(new DataTable[] { dttmp.Copy(), dtTitle.Copy(), dtSign.Copy() }); frmReport = new XtraReportsBase.DxReport.XtraPreviewForm(); //frmReport.ShowReport(dsTemp, rpt); // FREEVIEW //frmReport.Show(); rpt.PrinterName = Parm.CurrentUserInformation.roomTask.TSP800; frmReport.ShowReportPrint(dsTemp, rpt, 1); // 출력 if (dtSign.Rows.Count <= 0) { frmReport.ShowReportPrint(dsTemp, rpt, 1); // 출력 } } #endregion ////////////////////////////////////////////////////////////////////////////////////////////////// #region 시리얼프린트사용 //영수증 프린터 if (Parm.CurrentUserInformation.roomTask.gsPrintMode == PrintMode.SERIALPORT) { using (Bill_Print bill = new Bill_Print(Parm.CurrentUserInformation.roomTask.SerialPrintStyle)) { bill.PortNum = int.Parse(Parm.CurrentUserInformation.roomTask.SerialPrintInfo.ComPort.Trim().ToUpper().Replace("COM", "")); bill.Parity = Parm.CurrentUserInformation.roomTask.SerialPrintInfo.Parity; bill.StopBit = Parm.CurrentUserInformation.roomTask.SerialPrintInfo.StopBit; bill.DataBit = int.Parse(Parm.CurrentUserInformation.roomTask.SerialPrintInfo.DataBit); bill.BaudRate = int.Parse(Parm.CurrentUserInformation.roomTask.SerialPrintInfo.BaundRate); bill.SetCenter(); bill.SetHW2(); bill.Add("신용카드 영수증"); bill.ClearFontSize(); bill.NewLine(); bill.Add("(보관용)"); bill.NewLine(); bill.SetLeft(); bill.NewLine(); bill.Add("사업자 번호 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.BizNo); bill.NewLine(); bill.Add("상 호 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.BizName); bill.NewLine(); bill.Add("대 표 자 명 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.CeoName); bill.NewLine(); bill.Add("전 화 번 호 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.TelNo1); bill.NewLine(); string StrAddr = Parm.CurrentUserInformation.BizInfo.Address; string[] addrs = bill.Split42byte(StrAddr); for (int j = 0; j < addrs.Length; j++) { bill.Add(addrs[j]); bill.NewLine(); } bill.NewLine(); bill.AddDoubleLine(); bill.NewLine(); bill.NewLine(); bill.Add("카드종류 : " + dtCard.Rows[0]["CARD_CO_NAME"].ToString().Trim()); bill.NewLine(); bill.Add("카드번호 : " + dtCard.Rows[0]["CARD_NO"].ToString().Trim()); bill.NewLine(); bill.Add("유효기간 : " + dtCard.Rows[0]["VALID_THRU"].ToString().Trim()); bill.NewLine(); bill.Add("승인일자 : " + dtCard.Rows[0]["TASK_DATE"].ToString().Trim()); bill.NewLine(); bill.Add("할부기간 : " + dtCard.Rows[0]["INSTALLMENT_CNT"].ToString().Trim()); bill.NewLine(); bill.Add("승인번호 : " + dtCard.Rows[0]["AGREE_NO"].ToString().Trim()); bill.NewLine(); bill.Add("승인금액 : " + int.Parse(dtCard.Rows[0]["SALE_AMT"].ToString().Trim()).ToString("n0")); bill.NewLine(); bill.Add("가맹번호 : " + dtCard.Rows[0]["CARD_JOIN_NO"].ToString().Trim()); bill.NewLine(); bill.NewLine(); DataTable dtParmsign = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParmsign.Rows.Add(new object[] { "V_SALE_DATE", dtCard.Rows[0]["TASK_DATE"].ToString().Replace("-", "").Trim() }); dtParmsign.Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParmsign.Rows.Add(new object[] { "V_FACILITY_CODE", Parm.CurrentUserInformation.roomTask.gsDFacility }); dtParmsign.Rows.Add(new object[] { "V_PAY_SEQ", dtCard.Rows[0]["KEY_SEQ"] }); DataSet dssign = DataLayer.ExecuteSpDataset("PKG_DAHAH23.PR_05", dtParmsign, DataLayer.MessageEncoding.Default); //dtSign.Load(dssign.Tables[0].CreateDataReader()); if (dssign.Tables[0].Rows.Count == 0) //if (DBNull.Value.Equals(dtSign.Rows[0]["SIGN_IMG"])) { bill.AddDoubleLine(); bill.NewLine(); bill.Add("서명 : "); bill.NewLine(); bill.NewLine(); bill.NewLine(); bill.NewLine(); bill.NewLine(); } else { //byte[] bSign = (byte[])dssign.Tables[0].Rows[i]["SIGN_IMG"]; byte[] bSign = (byte[])dssign.Tables[0].Rows[0]["SIGN_IMG"]; if (bSign != null && bSign.Length >= 1086) { bill.AddDoubleLine(); bill.NewLine(); bill.AddSignData(bSign); bill.NewLine(); bill.NewLine(); bill.NewLine(); bill.NewLine(); bill.NewLine(); } } bill.Add(bill.GetCut()); bill.Send(bill.GetInitPrinter()); bill.Send(bill.SendData); //if (dssign.Tables[0].Rows.Count == 0) //{ //고객용 영수증 출력 //대천 무조건 2장씩 출력..요즘 편의점도 1장만 출력 하는구만..ㅠㅠ #region Sign 정보가 없을시 고객용 출력 //Sign 정보가 없을시 고객용 출력 bill.Clear(); // 고객용. bill.SetCenter(); bill.SetHW2(); bill.Add("신용카드 영수증"); bill.ClearFontSize(); bill.NewLine(); bill.Add("(고객용)"); bill.NewLine(); bill.SetLeft(); bill.NewLine(); bill.Add("사업자 번호 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.BizNo); bill.NewLine(); bill.Add("상 호 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.BizName); bill.NewLine(); bill.Add("대 표 자 명 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.CeoName); bill.NewLine(); bill.Add("전 화 번 호 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.TelNo1); bill.NewLine(); for (int j = 0; j < addrs.Length; j++) { bill.Add(addrs[j]); bill.NewLine(); } bill.NewLine(); bill.AddDoubleLine(); bill.NewLine(); bill.NewLine(); bill.Add("카드종류 : " + dtCard.Rows[0]["CARD_CO_NAME"].ToString().Trim()); bill.NewLine(); bill.Add("카드번호 : " + dtCard.Rows[0]["CARD_NO"].ToString().Trim()); bill.NewLine(); bill.Add("유효기간 : " + dtCard.Rows[0]["VALID_THRU"].ToString().Trim()); bill.NewLine(); bill.Add("승인일자 : " + dtCard.Rows[0]["TASK_DATE"].ToString().Trim()); bill.NewLine(); bill.Add("할부기간 : " + dtCard.Rows[0]["INSTALLMENT_CNT"].ToString().Trim()); bill.NewLine(); bill.Add("승인번호 : " + dtCard.Rows[0]["AGREE_NO"].ToString().Trim()); bill.NewLine(); bill.Add("승인금액 : " + int.Parse(dtCard.Rows[0]["SALE_AMT"].ToString().Trim()).ToString("n0")); bill.NewLine(); bill.Add("가맹번호 : " + dtCard.Rows[0]["CARD_JOIN_NO"].ToString().Trim()); bill.NewLine(); bill.NewLine(); bill.AddDoubleLine(); bill.NewLine(); bill.Add("서명 : "); bill.NewLine(); bill.NewLine(); bill.NewLine(); bill.NewLine(); bill.NewLine(); bill.Add(bill.GetCut()); bill.Send(bill.GetInitPrinter()); bill.Send(bill.SendData); #endregion //} bill.Clear(); //메모리소멸 프린트 / 시리얼개체소멸 bill.Dispose(); } } #endregion } catch (Exception ex) { Basic.ShowMessage(3, ex.Message); } }
//현금영수증 출력 private void fnBill_Cash(string cashbillyn, string rsvno, string saleamt , string idno, string agreedate, string agreeno ) { #region 시리얼프린트사용 //영수증 프린터 using (Bill_Print bill = new Bill_Print(Parm.CurrentUserInformation.roomTask.SerialPrintStyle)) { bill.PortNum = int.Parse(Parm.CurrentUserInformation.roomTask.SerialPrintInfo.ComPort.Trim().ToUpper().Replace("COM", "")); bill.Parity = Parm.CurrentUserInformation.roomTask.SerialPrintInfo.Parity; bill.StopBit = Parm.CurrentUserInformation.roomTask.SerialPrintInfo.StopBit; bill.DataBit = int.Parse(Parm.CurrentUserInformation.roomTask.SerialPrintInfo.DataBit); bill.BaudRate = int.Parse(Parm.CurrentUserInformation.roomTask.SerialPrintInfo.BaundRate); bill.SetCenter(); bill.SetHW2(); bill.Add("현금영수증"); bill.ClearFontSize(); bill.NewLine(); bill.Add("(고객용)"); bill.NewLine(); bill.SetLeft(); bill.NewLine(); bill.Add("사업자 번호 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.BizNo); bill.NewLine(); bill.Add("상 호 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.BizName); bill.NewLine(); bill.Add("대 표 자 명 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.CeoName); bill.NewLine(); bill.Add("전 화 번 호 : "); bill.Add(Parm.CurrentUserInformation.BizInfo.TelNo1); bill.NewLine(); string StrAddr = Parm.CurrentUserInformation.BizInfo.Address; string[] addrs = bill.Split42byte(StrAddr); for (int j = 0; j < addrs.Length; j++) { bill.Add(addrs[j]); bill.NewLine(); } bill.NewLine(); bill.AddDoubleLine(); bill.NewLine(); bill.NewLine(); if (cashbillyn == "Y") { //bill.Add("거래종류 : " + dtCash.Rows[i]["RAISE_CODE_NAME"].ToString().Trim()); bill.NewLine(); bill.Add("식별번호 : " + idno); bill.NewLine(); bill.Add("승인일자 : " + agreedate); bill.NewLine(); bill.Add("승인번호 : " + agreeno); bill.NewLine(); bill.Add("승인금액 : " + saleamt); bill.NewLine(); //bill.Add("승인금액 : " + int.Parse(dtCash.Rows[0]["SALE_AMT"].ToString().Trim()).ToString("n0")); bill.NewLine(); } else { bill.Add("고객명 : " + rsvno); bill.NewLine(); bill.Add("금액 : " + saleamt); bill.NewLine(); } bill.NewLine(); bill.AddDoubleLine(); bill.NewLine(); bill.NewLine(); if (cashbillyn == "Y") { bill.Add("현금영수증 국세청 문의처 : 1544-2020"); bill.NewLine(); bill.Add("http://www.taxsave.go.kr"); bill.NewLine(); } bill.NewLine(); bill.NewLine(); bill.NewLine(); bill.NewLine(); bill.Add(bill.GetCut()); bill.Send(bill.GetInitPrinter()); bill.Send(bill.SendData); //bill.Send(bill.Cut()); bill.Dispose(); } #endregion 시리얼포트사용 }