using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CoreSavingLibrary; using CoreSavingLibrary.WcfNDeposit; using DataLibrary; namespace Saving.Applications.shrlon.dlg { public partial class w_dlg_sl_printcard : PageWebDialog, WebDialog { private n_depositClient ndept; //new deposit private String pbl = "sl_print_book.pbl"; [JsPostBack] public string postPrintBook { get; set; } [JsPostBack] public string Exit_ireport { get; set; } [JsPostBack] public string Post_Slippayout { get; set; } [JsPostBack] public string Post_slip_interperiod { get; set; } [JsPostBack] public string Post_slip_share { get; set; } [JsPostBack] public string jsPrintLnconNo { get; set; } [JsPostBack] public string FirstBook { get; set; } [JsPostBack] public string PrintBookShare2 { get; set; } [JsPostBack] public string Post_PrintNewBookin { get; set; } [JsPostBack] public string Post_PrinHeaderbook { get; set; } [JsPostBack] public string PrintNewBookout { get; set; } [JsPostBack] public string Post_PrintBookin { get; set; } string loancontract_no = ""; Sdt d; Sta ta; string coop_id_tron = "000101"; public void InitJsPostBack() { //postPrintBook = WebUtil.JsPostBack(this, "postPrintBook"); //Exit_ireport = WebUtil.JsPostBack(this, "Exit_ireport"); //Post_Slippayout = WebUtil.JsPostBack(this, "Post_Slippayout"); //Post_slip_interperiod = WebUtil.JsPostBack(this, "Post_slip_interperiod"); //Post_slip_share = WebUtil.JsPostBack(this, "Post_slip_share"); //jsPrintLnconNo = WebUtil.JsPostBack(this, "jsPrintLnconNo"); //FirstBook = WebUtil.JsPostBack(this, "FirstBook"); //PrintBookShare2 = WebUtil.JsPostBack(this, "PrintBookShare2"); Post_PrintNewBookin = WebUtil.JsPostBack(this, "Post_PrintNewBookin"); //Post_PrinHeaderbook = WebUtil.JsPostBack(this, "Post_PrinHeaderbook"); } public void WebDialogLoadBegin() { ndept = wcf.NDeposit; this.ConnectSQLCA(); DwPrintPrompt.SetTransaction(sqlca); ta = new Sta(sqlca.ConnectionString); sqlca = new DwTrans(); sqlca.Connect(); if (!IsPostBack) { loancontract_no = Request["loancon"]; if (loancontract_no == "") { Sdt d = WebUtil.QuerySdt("select loancontract_no from slslippayout where payoutslip_no = '" + Request["payoutslip_no"] + "' "); if (d.Next()) { loancontract_no = d.GetString("loancontract_no"); } } string[] arg = new string[2] { state.SsCoopControl, loancontract_no }; DwUtil.RetrieveDataWindow(DwPrintPrompt, pbl, null, arg); //if (state.SsCoopId != "000401" ) //{ // Bookin.Style["display"] = "none"; // bookin2.Style["display"] = "none"; // Headerbook.Style["display"] = "none"; //} } else { this.RestoreContextDw(DwPrintPrompt); } // DwPrintPrompt.InsertRow(0); } public void CheckJsPostBack(string eventArg) { if (eventArg == "postPrintBook") { try { Int16 seq = Convert.ToInt16(DwPrintPrompt.GetItemDecimal(1, "lastrec_no")); Int16 page = Convert.ToInt16(DwPrintPrompt.GetItemDecimal(1, "lastpage_no")); Int16 line = Convert.ToInt16(DwPrintPrompt.GetItemDecimal(1, "lastline_no")); Int32 stm_no = Convert.ToInt16(DwPrintPrompt.GetItemDecimal(1, "last_stm_no")); String as_loan_no = Request["loancon"]; int ai_status = 1;// xml.DepositPrintMode; String as_xml_return = ""; String as_return = ""; string printset = state.SsPrinterSet; ndept.of_print_bookloan(state.SsWsPass, as_loan_no, seq, page, line, true, ref as_xml_return, ref as_return); String[] re = as_return.Split('@'); int rePage = int.Parse(re[0]); int reReq = int.Parse(re[1]); HdIsZeroPage.Value = rePage == 0 ? "true" : "false"; HdIsNewBook.Value = rePage == 1 ? "true" : "false"; //เพิ่มเพื่อรับค่าจาก pb srv ว่าขึ้นเล่มใหม่ Printing.PrintApplet(this, "loan_printbook", as_xml_return); //} if (stm_no > 22) { stm_no = stm_no / 22; } DwPrintPrompt.SetItemDecimal(1, "lastpage_no", 1); DwPrintPrompt.SetItemDecimal(1, "lastrec_no", stm_no); DwPrintPrompt.SetItemDecimal(1, "lastline_no", stm_no); string updateline = @"update lncontmaster set lastline_no={0},lastrec_no=last_stm_no where loancontract_no ={1} and coop_id={2}"; updateline = WebUtil.SQLFormat(updateline, stm_no, as_loan_no, state.SsCoopId); WebUtil.QuerySdt(updateline); } catch (Exception ex) { LtServerMessage.Text = WebUtil.ErrorMessage(ex); } } else if (eventArg == "jsPrintLnconNo") { } else if (eventArg == "PrintNewBookout") { string as_loan_no = Request["loancon"]; DateTime adtm_date = state.SsWorkDate; String as_xml_return = ""; String as_entryid = ""; //short ai_reprint = 0 ; String as_newpassbook_no = ""; String as_reson = ""; int result = ndept.of_print_bookloan_firstpage(state.SsWsPass, as_loan_no, state.SsWorkDate, as_entryid, ref as_xml_return, 0, as_newpassbook_no, as_reson); //Printing.Loanprintbookfristpage(this, as_xml_return); Printing.PrintApplet(this, "loan_printbookout", as_xml_return); } else if (eventArg == "FirstBook") { try { string as_loan_no = Request["loancon"]; DateTime adtm_date = state.SsWorkDate; String as_xml_return = ""; String as_entryid = ""; //short ai_reprint = 0 ; String as_newpassbook_no = ""; String as_reson = ""; int result = ndept.of_print_bookloan_firstpage(state.SsWsPass, as_loan_no, state.SsWorkDate, as_entryid, ref as_xml_return, 0, as_newpassbook_no, as_reson); //Printing.Loanprintbookfristpage(this, as_xml_return); Printing.PrintApplet(this, "loan_printbookfirst", as_xml_return); } catch (Exception ex) { LtServerMessage.Text = WebUtil.ErrorMessage(ex); } } else if (eventArg == "Exit_ireport") { Exit_ireport2(loancontract_no, state.SsCoopId); } } public void Exit_ireport2(string loancontract_no, string coop_id) { // if(coop_id_tron==state.SsCoopId){ this.SetOnLoadedScript("parent.RemoveIFrame();"); //} //else{ //this.SetOnLoadedScript(" parent.ExitIFrame(\"" + loancontract_no + "\",\"" + Request["payinslip_no"] + "\"); parent.RemoveIFrame();"); //} } public void WebDialogLoadEnd() { DwPrintPrompt.SaveDataCache(); } } }