using System; using CoreSavingLibrary; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; namespace Saving.Applications.shrlon.ws_sl_reprint2_ctrl { public partial class DsList : DataSourceRepeater { public DataSet1.SLSLIPPAYINDETDataTable DATA { get; set; } public void InitDsList(PageWeb pw) { css1.Visible = false; DataSet1 ds = new DataSet1(); this.DATA = ds.SLSLIPPAYINDET; this.EventItemChanged = "OnDsListItemChanged"; this.EventClicked = "OnDsListClicked"; this.InitDataSource(pw, Repeater1, this.DATA, "dsList"); this.Register(); } // public void Retrieve(string member_no, string entry_id, string sliptype_code, string payinslip_no_s, string payinslip_no_e, string slip_date_s, string slip_date_e) // { // string sqlext = ""; // if (member_no != "") // { // sqlext += " and slslippayinlaw.member_no = '" + String.Format("{0:00000000}", Convert.ToDecimal(member_no)) + "'"; // } // if (entry_id != "") // { // sqlext += " and slslippayinlaw.entry_id = '" + entry_id + "'"; // } // if (sliptype_code != "") // { // sqlext += " and slslippayinlaw.sliptype_code = '" + sliptype_code + "'"; // } // if (payinslip_no_s != "" && payinslip_no_e != "") // { // sqlext += " and (slslippayinlaw.payinslip_no between '" + payinslip_no_s + "' and '" + payinslip_no_e + "')"; // } // if (slip_date_s != "" && slip_date_e != "") // { // sqlext += " and (slslippayinlaw.slip_date between to_date('" + slip_date_s + "','dd/mm/yyyy') and to_date('" + slip_date_e + "','dd/mm/yyyy'))"; // } // string sql = @" select MBUCFPRENAME.PRENAME_DESC,LNLAWMBMASTER.MEMB_NAME,LNLAWMBMASTER.MEMB_SURNAME, // LNLAWMBMASTER.MEMBGROUP_CODE, slslippayinlaw.* // from slslippayinlaw,LNLAWMBMASTER,MBUCFPRENAME // WHERE LNLAWMBMASTER.PRENAME_CODE = MBUCFPRENAME.PRENAME_CODE and // slslippayinlaw.MEMBER_NO = LNLAWMBMASTER.MEMBER_NO and // LNLAWMBMASTER.COOP_ID = slslippayinlaw.MEMCOOP_ID and // slslippayinlaw.COOP_ID = {0} " + sqlext; // sql = WebUtil.SQLFormat(sql, state.SsCoopId); // DataTable dt = WebUtil.Query(sql); // ImportData(dt); // } public void Retrieve(string member_no, string entry_id, string sliptype_code, string document_no_s, string document_no_e, DateTime slip_date_s, DateTime slip_date_e) { string sqlext = ""; if (member_no != "") { sqlext += " and slslippayinlaw.member_no = '" + WebUtil.MemberNoFormat(member_no) + "'"; } if (entry_id != "") { sqlext += " and slslippayinlaw.entry_id = '" + entry_id + "'"; } if (sliptype_code != "") { sqlext += " and slslippayinlaw.sliptype_code = '" + sliptype_code + "'"; } if (document_no_s != "" && document_no_e != "") { sqlext += " and (slslippayinlaw.document_no between '" + document_no_s + "' and '" + document_no_e + "')"; } if (slip_date_s.Year > 1900 && slip_date_e.Year > 1900) { sqlext += " and slslippayinlaw.slip_date between {1} and {2} "; } string sql = @"select MBUCFPRENAME.PRENAME_DESC||LNLAWMBMASTER.MEMB_NAME||' '||LNLAWMBMASTER.MEMB_SURNAME as cancel_id, slslippayinlaw.payinslip_no,slslippayinlaw.document_no,slslippayinlaw.slip_date, slslippayinlaw.entry_id,slslippayinlaw.sliptype_code, slslippayinlaw.member_no,sd.item_payamt,sd.slipitem_desc||' '||NVL(sd.loancontract_no,'') as slipitem_desc ,sd.slipitemtype_code, slslippayinlaw.SLIP_STATUS from slslippayinlaw left join slslippayindetlaw sd on slslippayinlaw.payinslip_no = sd.payinslip_no left join LNLAWMBMASTER on slslippayinlaw.MEMBER_NO = LNLAWMBMASTER.MEMBER_NO left join MBUCFPRENAME on LNLAWMBMASTER.PRENAME_CODE = MBUCFPRENAME.PRENAME_CODE WHERE LNLAWMBMASTER.COOP_ID = slslippayinlaw.COOP_ID and rownum <= 300 and slslippayinlaw.COOP_ID = {0} " + sqlext + " order by slslippayinlaw.slip_date,slslippayinlaw.payinslip_no desc "; sql = WebUtil.SQLFormat(sql, state.SsCoopId, slip_date_s, slip_date_e); DataTable dt = WebUtil.Query(sql); ImportData(dt); } public void RetrieveOUT(string member_no, string entry_id, string sliptype_code, string document_no_s, string document_no_e, DateTime slip_date_s, DateTime slip_date_e) { string sqlext2 = ""; if (member_no != "") { sqlext2 += " and slslippayout.member_no = '" + WebUtil.MemberNoFormat(member_no) + "'"; } if (entry_id != "") { sqlext2 += " and slslippayout.entry_id = '" + entry_id + "'"; } if (sliptype_code != "") { sqlext2 += " and slslippayout.sliptype_code = '" + sliptype_code + "'"; } if (document_no_s != "" && document_no_e != "") { sqlext2 += " and (slslippayout.document_no between '" + document_no_s + "' and '" + document_no_e + "')"; } if (slip_date_s.Year > 1900 && slip_date_e.Year > 1900) { sqlext2 += " and slslippayout.slip_date between {1} and {2} "; } // string sql = @"select MBUCFPRENAME.PRENAME_DESC,LNLAWMBMASTER.MEMB_NAME,LNLAWMBMASTER.MEMB_SURNAME, // LNLAWMBMASTER.MEMBGROUP_CODE, slslippayinlaw.* // from slslippayinlaw,LNLAWMBMASTER,MBUCFPRENAME // WHERE LNLAWMBMASTER.PRENAME_CODE = MBUCFPRENAME.PRENAME_CODE and // slslippayinlaw.MEMBER_NO = LNLAWMBMASTER.MEMBER_NO and // LNLAWMBMASTER.COOP_ID = slslippayinlaw.MEMCOOP_ID and // rownum <= 100 and // slslippayinlaw.COOP_ID = {0} " + sqlext + "order by " + "slslippayinlaw.slip_date desc "; string sql = @"select MBUCFPRENAME.PRENAME_DESC||LNLAWMBMASTER.MEMB_NAME||' '||LNLAWMBMASTER.MEMB_SURNAME as cancel_id, slslippayout.payoutslip_no as payinslip_no,slslippayout.document_no,slslippayout.slip_date, slslippayout.entry_id,slslippayout.sliptype_code, slslippayout.member_no,slslippayout.payout_amt as item_payamt, (case slslippayout.sliptype_code when 'SWD' then 'ถอนหุ้น '||slslippayout.MEMBER_NO else 'จ่ายเงินกู้ '||NVL(slslippayout.loancontract_no,'') end) as slipitem_desc ,(case slslippayout.sliptype_code when 'SWD' then 'SWD' else 'OUT' end) as slipitemtype_code, slslippayout.SLIP_STATUS from slslippayout left join LNLAWMBMASTER on slslippayout.MEMBER_NO = LNLAWMBMASTER.MEMBER_NO left join MBUCFPRENAME on LNLAWMBMASTER.PRENAME_CODE = MBUCFPRENAME.PRENAME_CODE WHERE LNLAWMBMASTER.COOP_ID = slslippayout.MEMCOOP_ID and rownum <= 100 and slslippayout.COOP_ID = {0} " + sqlext2 + " order by slslippayout.slip_date desc "; sql = WebUtil.SQLFormat(sql, state.SsCoopId, slip_date_s, slip_date_e); DataTable dt = WebUtil.Query(sql); ImportData(dt); } } }