Commit 7f371187 authored by cpatil's avatar cpatil

modified in sun by manoj


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99817 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 04a22aba
......@@ -255,7 +255,7 @@ public class AutoPmtGenPrc extends ProcessEJB
this.dateTo = Timestamp.valueOf(toDate + " 00:00:00 ");
getSql = "SELECT misc_payables.ref_no,misc_payables.tran_date,misc_payables.ref_date,misc_payables.bill_no,misc_payables.bill_date,misc_payables.curr_code,misc_payables.exch_rate,misc_payables.sundry_code,misc_payables.acct_code,misc_payables.cctr_code,misc_payables.due_date,misc_payables.site_code,misc_payables.fin_entity,misc_payables.tot_amt,misc_payables.sundry_type,misc_payables.bank_code,misc_payables.pay_mode,misc_payables.adv_amt,misc_payables.tran_id,misc_payables.tran_ser,misc_payables.adj_amt,misc_payables.hold_amt,fn_confirmed_by(misc_payables.tran_ser, misc_payables.ref_no) as username,misc_payables.tot_amt - (case when misc_payables.adj_amt is null then 0 else misc_payables.adj_amt end) - (case when misc_payables.hold_amt is null then 0 else misc_payables.hold_amt end) as pay_amt,fn_sundry_name(misc_payables.sundry_type,misc_payables.sundry_code,'') as sundry_name, misc_payables.tot_amt - (case when misc_payables.adj_amt is null then 0 else misc_payables.adj_amt end) - (case when misc_payables.hold_amt is null then 0 else misc_payables.hold_amt end) as net_payable FROM misc_payables ";
/* getSql = "SELECT misc_payables.ref_no,misc_payables.tran_date,misc_payables.ref_date,misc_payables.bill_no,misc_payables.bill_date,misc_payables.curr_code,misc_payables.exch_rate,misc_payables.sundry_code,misc_payables.acct_code,misc_payables.cctr_code,misc_payables.due_date,misc_payables.site_code,misc_payables.fin_entity,misc_payables.tot_amt,misc_payables.sundry_type,misc_payables.bank_code,misc_payables.pay_mode,misc_payables.adv_amt,misc_payables.tran_id,misc_payables.tran_ser,misc_payables.adj_amt,misc_payables.hold_amt,fn_confirmed_by(misc_payables.tran_ser, misc_payables.ref_no) as username,misc_payables.tot_amt - (case when misc_payables.adj_amt is null then 0 else misc_payables.adj_amt end) - (case when misc_payables.hold_amt is null then 0 else misc_payables.hold_amt end) as pay_amt,fn_sundry_name(misc_payables.sundry_type,misc_payables.sundry_code,'') as sundry_name, misc_payables.tot_amt - (case when misc_payables.adj_amt is null then 0 else misc_payables.adj_amt end) - (case when misc_payables.hold_amt is null then 0 else misc_payables.hold_amt end) as net_payable FROM misc_payables ";
if (isSSCUserConsider)
{
......@@ -282,7 +282,7 @@ public class AutoPmtGenPrc extends ProcessEJB
"misc_payables.pay_mode like '" + payMode + "' AND " +
"case when misc_payables.entry_batch_no is null then ' ' else" +
" misc_payables.entry_batch_no end like '" + entryBatchNo + "' AND " +
" misc_payables.curr_code ='" + currCode + "'AND" +
" misc_payables.curr_code ='" + currCode + "' AND" +
" tran_ser NOT in('P-ADV','M-ADV')";
if (isSSCUserConsider)
......@@ -293,10 +293,76 @@ public class AutoPmtGenPrc extends ProcessEJB
getSql = getSql + "and misc_payables.tot_amt - (case when misc_payables.adj_amt is null then 0 else misc_payables.adj_amt end) - (case when misc_payables.hold_amt is null then 0 else misc_payables.hold_amt end)>0 ORDER BY misc_payables. sundry_type ASC, misc_payables.sundry_code ASC, misc_payables.ref_no ASC";
System.out.println(">>>>Final getSql:" + getSql);
*/
getSql="SELECT ref_no,tran_date,ref_date,bill_no,bill_date,curr_code,exch_rate,sundry_code,acct_code,cctr_code,due_date,site_code," +
" fin_entity,tot_amt,sundry_type,bank_code, pay_mode,adv_amt,tran_id,tran_ser, " +
" adj_amt,hold_amt,username, pay_amt, sundry_name, net_payable , APRV_CODE, " +
" (SELECT 'SSC_USER' FROM DUAL WHERE APRV_CODE IN (SELECT EMP_CODE FROM " +
" ( " +
" SELECT GENCODES.FLD_VALUE , " +
" (SELECT USERS.EMP_CODE FROM USERS WHERE USERS.CODE = GENCODES.FLD_VALUE) AS EMP_CODE " +
" FROM GENCODES WHERE FLD_NAME ='SSC_USER' AND MOD_NAME='SSC_SITE_CODE'))) AS SSC_USER " +
" FROM " +
" ( " +
" SELECT misc_payables.ref_no,misc_payables.tran_date,misc_payables.ref_date,misc_payables.bill_no, " +
" misc_payables.bill_date,misc_payables.curr_code,misc_payables.exch_rate,misc_payables.sundry_code, " +
" misc_payables.acct_code,misc_payables.cctr_code,misc_payables.due_date,misc_payables.site_code, " +
" misc_payables.fin_entity,misc_payables.tot_amt,misc_payables.sundry_type,misc_payables.bank_code, " +
" misc_payables.pay_mode,misc_payables.adv_amt,misc_payables.tran_id,misc_payables.tran_ser, " +
" misc_payables.adj_amt,misc_payables.hold_amt,fn_confirmed_by(misc_payables.tran_ser, " +
" misc_payables.ref_no) as username, misc_payables.tot_amt - (case when misc_payables.adj_amt is null then 0 else misc_payables.adj_amt end) - (case when misc_payables.hold_amt is null then 0 else misc_payables.hold_amt end) as pay_amt, " +
" fn_sundry_name(misc_payables.sundry_type,misc_payables.sundry_code,'') as sundry_name, " +
" misc_payables.tot_amt - (case when misc_payables.adj_amt is null then 0 else misc_payables.adj_amt end) - (case when misc_payables.hold_amt is null then 0 else misc_payables.hold_amt end) as net_payable , " +
" PAYABLE.APRV_CODE AS APRV_CODE " +
" FROM misc_payables , ( " +
" SELECT TRAN_ID,CONF_DATE,DDF_SUNDRY_NAME('E',EMP_CODE__APRV,'D') AS APRV_NAME,EMP_CODE__APRV AS APRV_CODE,REMARKS " +
" FROM VOUCHER WHERE TRAN_DATE >=? " +
" UNION ALL " +
" SELECT TRAN_ID,CONF_DATE,DDF_SUNDRY_NAME('E',EMP_CODE__APRV,'D') AS APRV_NAME,EMP_CODE__APRV AS APRV_CODE,REMARKS " +
" FROM MISC_VOUCHER WHERE TRAN_DATE >= ? " +
" ) PAYABLE " +
" WHERE MISC_PAYABLES.REF_NO = PAYABLE.TRAN_ID (+) " +
" AND ( misc_payables.site_code = '" + siteCode + "' ) " ;
if ((sundryType != null) && (!"null".equalsIgnoreCase(sundryType)) && (sundryType.trim().length() > 0))
{
getSql = getSql + " AND ( misc_payables.sundry_type = '" + sundryType + "' ) ";
}
//" AND( misc_payables.sundry_type = 'S' ) " +
if ((sundryCode != null) && (!"null".equalsIgnoreCase(sundryCode)) && (sundryCode.trim().length() > 0))
{
getSql = getSql + " AND ( misc_payables.sundry_code LIKE '" + sundryCode + "' ) ";
}
//" AND ( misc_payables.sundry_code LIKE '%' ) " +
getSql=getSql+ " AND ( misc_payables.due_date >= ? ) " +
" AND ( misc_payables.due_date <= ? ) " +
" AND ( misc_payables.ref_no >= '"+vouchNoFrom+"' ) AND ( misc_payables.ref_no <= '" + vouchNoTo + "' ) AND ( nvl(misc_payables.auto_pay,'Y') = 'Y' ) " +
" AND (misc_payables.tot_amt - misc_payables.adj_amt > 0 ) " +
" AND (misc_payables.hold_amt is null or misc_payables.tot_amt - misc_payables.adj_amt - misc_payables.hold_amt <> 0 ) " +
" AND misc_payables.pay_mode like '" + payMode + "' " +
" AND case when misc_payables.entry_batch_no is null then ' ' else misc_payables.entry_batch_no end like '" + entryBatchNo + "' " +
" AND misc_payables.curr_code ='" + currCode + "' " +
" AND tran_ser NOT in('P-ADV','M-ADV') " +
" and misc_payables.tot_amt - (case when misc_payables.adj_amt is null then 0 else misc_payables.adj_amt end) - (case when misc_payables.hold_amt is null then 0 else misc_payables.hold_amt end)>0 " +
" ORDER BY misc_payables. sundry_type ASC, " +
" misc_payables.sundry_code ASC, misc_payables.ref_no ASC) " ;
if (isSSCUserConsider)
{
getSql=getSql+ " where aprv_code in (SELECT EMP_CODE " +
" FROM ( " +
" SELECT GENCODES.FLD_VALUE , " +
" (SELECT USERS.EMP_CODE FROM USERS WHERE USERS.CODE = GENCODES.FLD_VALUE) AS EMP_CODE " +
" FROM GENCODES " +
" WHERE FLD_NAME ='SSC_USER' " +
" AND MOD_NAME='SSC_SITE_CODE'))";
}
pstmt = conn.prepareStatement(getSql);
pstmt.setTimestamp(1, this.dateFr);
pstmt.setTimestamp(2, this.dateTo);
pstmt.setTimestamp(3, this.dateFr);
pstmt.setTimestamp(4, this.dateTo);
rs = pstmt.executeQuery();
while (rs.next())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment