Commit a3ca4a3a authored by asikarwar's avatar asikarwar

changes done for correction in receipt code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93545 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4d74acbe
...@@ -3,7 +3,6 @@ package ibase.webitm.ejb.fin; ...@@ -3,7 +3,6 @@ package ibase.webitm.ejb.fin;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.DistCommon; import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -146,9 +145,9 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -146,9 +145,9 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try try
{ {
this.finCommon = new FinCommon(); finCommon = new FinCommon();
this.disCommon = new DistCommon(); disCommon = new DistCommon();
this.validator = new ValidatorEJB(); validator = new ValidatorEJB();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if ((objContext != null) && (objContext.trim().length() > 0)) if ((objContext != null) && (objContext.trim().length() > 0))
...@@ -327,7 +326,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -327,7 +326,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
System.out.println("prioddddddddd"); System.out.println("prioddddddddd");
tranDate = dateFormat2.parse(this.genericUtility.getColumnValue("tran_date", dom)); tranDate = dateFormat2.parse(this.genericUtility.getColumnValue("tran_date", dom));
errCode = checkPeriod("FIN", siteCode, tranDate, conn); errCode = this.nfCheckPeriod("FIN", tranDate, siteCode);
if(errCode != null && errCode.trim().length() >0) if(errCode != null && errCode.trim().length() >0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -388,11 +387,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -388,11 +387,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
else if (childNodeName.equalsIgnoreCase("acct_code__bal")) else if (childNodeName.equalsIgnoreCase("acct_code__bal"))
{ {
acctCodeBal = this.genericUtility.getColumnValue("acct_code__bal", dom); acctCodeBal = this.genericUtility.getColumnValue("acct_code__bal", dom);
if(acctCodeBal != null && acctCodeBal.trim().length() > 0) if(acctCodeBal != null && acctCodeBal.trim().length() > 0)
{ {
siteCode = this.genericUtility.getColumnValue("site_code", dom); siteCode = this.genericUtility.getColumnValue("site_code", dom);
errCode = validateAccount(siteCode, acctCodeBal, conn); errCode = finCommon.isAcctCode(siteCode, acctCodeBal, "FIN", conn);
//errCode = validateAccount(siteCode, acctCodeBal, conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -402,11 +403,17 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -402,11 +403,17 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
else if (childNodeName.equalsIgnoreCase("cctr_code__bal")) else if (childNodeName.equalsIgnoreCase("cctr_code__bal"))
{ {
cctrCodeBal = this.genericUtility.getColumnValue("cctr_code__bal", dom); cctrCodeBal = this.genericUtility.getColumnValue("cctr_code__bal", dom);
analCode = this.genericUtility.getColumnValue("anal_code", dom);
refSer = this.genericUtility.getColumnValue("ref_ser", dom);
if(cctrCodeBal != null && cctrCodeBal.trim().length() > 0) if(cctrCodeBal != null && cctrCodeBal.trim().length() > 0)
{ {
acctCodeBal = this.genericUtility.getColumnValue("acct_code__bal", dom); acctCodeBal = this.genericUtility.getColumnValue("acct_code__bal", dom);
errCode = validateCctrCode(cctrCodeBal, acctCodeBal, conn); errCode = finCommon.isCctrCode(acctCodeBal, cctrCodeBal, "FIN", conn);
//errCode = validateCctrCode(cctrCodeBal, acctCodeBal, conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -417,12 +424,16 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -417,12 +424,16 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
else if (childNodeName.equalsIgnoreCase("acct_code__adv")) else if (childNodeName.equalsIgnoreCase("acct_code__adv"))
{ {
acctCodeAdv = this.genericUtility.getColumnValue("acct_code__adv", dom); acctCodeAdv = this.genericUtility.getColumnValue("acct_code__adv", dom);
advAmt = doublevalue(this.genericUtility.getColumnValue("adv_amt", dom)); advAmt = doublevalue(this.genericUtility.getColumnValue("adv_amt", dom));
if ((advAmt != 0.0) && ((acctCodeAdv.trim().length() != 0) && (acctCodeAdv != null))) if ((advAmt != 0.0) && ((acctCodeAdv.trim().length() != 0) && (acctCodeAdv != null)))
{ {
siteCode = this.genericUtility.getColumnValue("site_code", dom); siteCode = this.genericUtility.getColumnValue("site_code", dom);
errCode = validateAccount(siteCode, acctCodeAdv, conn); errCode = finCommon.isAcctCode(siteCode, acctCodeAdv, "FIN", conn);
//errCode = validateAccount(siteCode, acctCodeAdv, conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -433,12 +444,15 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -433,12 +444,15 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
else if (childNodeName.equalsIgnoreCase("cctr_code__adv")) else if (childNodeName.equalsIgnoreCase("cctr_code__adv"))
{ {
cctrCodeAdv = this.genericUtility.getColumnValue("cctr_code__adv", dom); cctrCodeAdv = this.genericUtility.getColumnValue("cctr_code__adv", dom);
acctCodeAdv = this.genericUtility.getColumnValue("acct_code__adv", dom); acctCodeAdv = this.genericUtility.getColumnValue("acct_code__adv", dom);
advAmt = Double.parseDouble(this.genericUtility.getColumnValue("adv_amt", dom)); advAmt = Double.parseDouble(this.genericUtility.getColumnValue("adv_amt", dom));
if ((advAmt != 0.0) && ((acctCodeAdv.trim().length() != 0) && (acctCodeAdv != null))) if ((advAmt != 0.0) && ((acctCodeAdv.trim().length() != 0) && (acctCodeAdv != null)))
{ {
errCode = validateCctrCode(cctrCodeAdv ,acctCodeAdv, conn); errCode = finCommon.isCctrCode(acctCodeAdv, cctrCodeAdv, "FIN", conn);
//errCode = validateCctrCode(cctrCodeAdv ,acctCodeAdv, conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -457,7 +471,8 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -457,7 +471,8 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
diffAmtExch = doublevalue(this.genericUtility.getColumnValue("diff_amt__exch", dom)); diffAmtExch = doublevalue(this.genericUtility.getColumnValue("diff_amt__exch", dom));
if (diffAmtExch != 0.0D) if (diffAmtExch != 0.0D)
{ {
errCode = validateAccount(siteCode ,acctCodeCf, conn); errCode = finCommon.isAcctCode(siteCode, acctCodeCf, "FIN", conn);
//errCode = validateAccount(siteCode ,acctCodeCf, conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -475,7 +490,8 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -475,7 +490,8 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
advAmt = doublevalue(this.genericUtility.getColumnValue("adv_amt", dom)); advAmt = doublevalue(this.genericUtility.getColumnValue("adv_amt", dom));
if ((acctCodeCf != null) && (acctCodeCf.trim().length() > 0)) if ((acctCodeCf != null) && (acctCodeCf.trim().length() > 0))
{ {
errCode = validateCctrCode(cctrCodeCf, acctCodeCf, conn); errCode = finCommon.isCctrCode(acctCodeCf, cctrCodeCf, "FIN", conn);
//errCode = validateCctrCode(cctrCodeCf, acctCodeCf, conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -503,7 +519,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -503,7 +519,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
if ((!rcpMode.equals("Q")) && (!rcpMode.equals("D")) && (!rcpMode.equals("P"))) if ((!rcpMode.equals("Q")) && (!rcpMode.equals("D")) && (!rcpMode.equals("P")))
continue; continue;
Sdays = getfinparm("999999", "RCP_REF_DATE",conn); Sdays = finCommon.getFinparams("999999", "RCP_REF_DATE",conn);
if (Sdays == null || Sdays.equals("") ) if (Sdays == null || Sdays.equals("") )
{ {
Sdays = "0"; Sdays = "0";
...@@ -522,7 +538,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -522,7 +538,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
continue; continue;
if ((!rcpMode.equals("Q")) && (!rcpMode.equals("D"))) if ((!rcpMode.equals("Q")) && (!rcpMode.equals("D")))
continue; continue;
Sdays = getfinparm("999999", "RCP_REF_DATE",conn); Sdays = finCommon.getFinparams("999999", "RCP_REF_DATE",conn);
if (Sdays == null || Sdays.equals("")) if (Sdays == null || Sdays.equals(""))
{ {
Sdays = "0"; Sdays = "0";
...@@ -559,14 +575,19 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -559,14 +575,19 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
// added by akhilesh on 01/aug/13 as discuss with manoj // added by akhilesh on 01/aug/13 as discuss with manoj sharma
siteSpecificBank = finCommon.getFinparams("999999", "SITE_SPECIFIC_BANK", conn); siteSpecificBank = finCommon.getFinparams("999999", "SITE_SPECIFIC_BANK", conn);
if(siteSpecificBank != null && "Y".equalsIgnoreCase(siteSpecificBank)) if(siteSpecificBank != null && "Y".equalsIgnoreCase(siteSpecificBank))
{ {
siteCode = this.genericUtility.getColumnValue("site_code", dom); siteCode = this.genericUtility.getColumnValue("site_code", dom);
errCode = validateBankCode(bankCode, siteCode, conn); errCode = this.isBankCode(siteCode, bankCode, "FIN");
//errCode = validateBankCode(bankCode, siteCode, conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -585,11 +606,14 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -585,11 +606,14 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
else if (childNodeName.equalsIgnoreCase("anal_code")) else if (childNodeName.equalsIgnoreCase("anal_code"))
{ {
analCode = this.genericUtility.getColumnValue("anal_code", dom); analCode = this.genericUtility.getColumnValue("anal_code", dom);
if(analCode != null && analCode.trim().length() >0) if(analCode != null && analCode.trim().length() >0)
{ {
refSer = checkNull(this.genericUtility.getColumnValue("ref_ser", dom));
acctCodeBal = this.genericUtility.getColumnValue("acct_code__bal", dom); acctCodeBal = this.genericUtility.getColumnValue("acct_code__bal", dom);
errCode = validateAnalysisCode(acctCodeBal, analCode, conn); errCode =finCommon.isAnalysis(acctCodeBal, analCode, refSer, conn);
//errCode = validateAnalysisCode(acctCodeBal, analCode, conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -836,6 +860,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -836,6 +860,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
refSer = this.genericUtility.getColumnValue("ref_ser", dom); refSer = this.genericUtility.getColumnValue("ref_ser", dom);
lineNoRef = this.genericUtility.getColumnValue("line_no__ref", dom); lineNoRef = this.genericUtility.getColumnValue("line_no__ref", dom);
sql = " select count(*) from receivables where tran_ser = ? and ref_no = ? and line_no__ref = ?"; sql = " select count(*) from receivables where tran_ser = ? and ref_no = ? and line_no__ref = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refSer); pstmt.setString(1, refSer);
...@@ -846,6 +871,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -846,6 +871,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
cnt = rs.getInt(1); cnt = rs.getInt(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) if (cnt == 0)
{ {
errCode = "VMREF1"; errCode = "VMREF1";
...@@ -865,6 +895,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -865,6 +895,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
siteCode = rs.getString(1); siteCode = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (!siteCode.trim().equals(hsiteCode.trim())) if (!siteCode.trim().equals(hsiteCode.trim()))
{ {
errCode = "VTSITE1"; errCode = "VTSITE1";
...@@ -872,10 +907,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -872,10 +907,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(errCode == null || errCode.trim().length() == 0) if(errCode == null || errCode.trim().length() == 0)
{ {
errCode = checkBadDebtAmt(1, conn, dom); errCode = checkBadDebtAmt(1, conn, dom);
...@@ -937,7 +968,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -937,7 +968,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
if (acctCodeAr != null && acctCodeAr.trim().length() > 0) if (acctCodeAr != null && acctCodeAr.trim().length() > 0)
{ {
hsiteCode = this.genericUtility.getColumnValue("site_code", dom1); hsiteCode = this.genericUtility.getColumnValue("site_code", dom1);
errCode = validateAccount(hsiteCode, acctCodeAr, conn); errCode = finCommon.isAcctCode(hsiteCode, acctCodeAr, "FIN", conn);
if(errCode != null && errCode.trim().length() >0) if(errCode != null && errCode.trim().length() >0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -947,11 +978,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -947,11 +978,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
else if (childNodeName.equalsIgnoreCase("cctr_code__ar")) else if (childNodeName.equalsIgnoreCase("cctr_code__ar"))
{ {
cctrCodeAr = this.genericUtility.getColumnValue("cctr_code__ar", dom); cctrCodeAr = this.genericUtility.getColumnValue("cctr_code__ar", dom);
if (cctrCodeAr != null && cctrCodeAr.trim().length() > 0) if (cctrCodeAr != null && cctrCodeAr.trim().length() > 0)
{ {
acctCodeAr = this.genericUtility.getColumnValue("acct_code__ar", dom); acctCodeAr = this.genericUtility.getColumnValue("acct_code__ar", dom);
errCode = validateCctrCode(cctrCodeAr ,acctCodeAr, conn); errCode = finCommon.isCctrCode(acctCodeAr, cctrCodeAr, "FIN", conn);
//errCode = validateCctrCode(cctrCodeAr ,acctCodeAr, conn);
if(errCode != null && errCode.trim().length() >0) if(errCode != null && errCode.trim().length() >0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -966,6 +999,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -966,6 +999,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
if(custCode != null && custCode.trim().length() > 0) if(custCode != null && custCode.trim().length() > 0)
{ {
hcustCode = this.genericUtility.getColumnValue("cust_code", dom1); hcustCode = this.genericUtility.getColumnValue("cust_code", dom1);
sql = "select count(*) from customer where cust_code = ?"; sql = "select count(*) from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode); pstmt.setString(1, custCode);
...@@ -974,12 +1008,18 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -974,12 +1008,18 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
cnt = rs.getInt(1); cnt = rs.getInt(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) if (cnt == 0)
{ {
errCode = "VMCUS1"; errCode = "VMCUS1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if(hcustCode.trim().length() > 0) else if(hcustCode.trim().length() > 0)
{ {
sql = "select group_code from customer where cust_code = ?"; sql = "select group_code from customer where cust_code = ?";
...@@ -990,6 +1030,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -990,6 +1030,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
hgroupCode = rs.getString(1); hgroupCode = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select group_code from customer where cust_code = ?"; sql = "select group_code from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode); pstmt.setString(1, custCode);
...@@ -998,16 +1043,18 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -998,16 +1043,18 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
groupCode = rs.getString(1); groupCode = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (hgroupCode.equals(groupCode)) if (hgroupCode.equals(groupCode))
continue; continue;
errCode = "VTCGRP1"; errCode = "VTCGRP1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
} }
else if(childNodeName.equalsIgnoreCase("bill_disc_amt")) //added by ritesh as per discusion with pravin on 14/05/13 start else if(childNodeName.equalsIgnoreCase("bill_disc_amt")) //added by ritesh as per discusion with pravin on 14/05/13 start
...@@ -1053,6 +1100,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1053,6 +1100,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
balAmt = rs.getDouble(1); balAmt = rs.getDouble(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (((balAmt < 0.0D) && (rcpAmt < 0.0D) && (Math.abs(balAmt) < Math.abs(rcpAmt))) || if (((balAmt < 0.0D) && (rcpAmt < 0.0D) && (Math.abs(balAmt) < Math.abs(rcpAmt))) ||
((balAmt > 0.0D) && (rcpAmt > 0.0D) && (Math.abs(balAmt) < Math.abs(rcpAmt))) || ((balAmt > 0.0D) && (rcpAmt < 0.0D)) || ( ((balAmt > 0.0D) && (rcpAmt > 0.0D) && (Math.abs(balAmt) < Math.abs(rcpAmt))) || ((balAmt > 0.0D) && (rcpAmt < 0.0D)) || (
(balAmt < 0.0D) && (rcpAmt > 0.0D))) (balAmt < 0.0D) && (rcpAmt > 0.0D)))
...@@ -1074,9 +1126,15 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1074,9 +1126,15 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
balAmt = rs.getDouble(1); balAmt = rs.getDouble(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
tranId = this.genericUtility.getColumnValue("tran_id", dom); tranId = this.genericUtility.getColumnValue("tran_id", dom);
sql = "select sum(case when det.rcp_amt is null then 0 else det.rcp_amt end) from receipt hdr, rcpdet det where hdr.tran_id = det.tran_id and hdr.tran_id != ? and hdr.tran_id__advbking = ? and (case when hdr.confirmed is null then 'N' else hdr.confirmed end) != 'Y' ";
sql = "select sum(case when det.rcp_amt is null then 0 else det.rcp_amt end) from receipt hdr, rcpdet det where hdr.tran_id = det.tran_id and hdr.tran_id != ? and hdr.tran_id__advbking = ? and (case when hdr.confirmed is null then 'N' else hdr.confirmed end) != 'Y' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
pstmt.setString(2, htranIdAdvbking); pstmt.setString(2, htranIdAdvbking);
...@@ -1085,6 +1143,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1085,6 +1143,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
pendingAmt = rs.getDouble(1); pendingAmt = rs.getDouble(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (pendingAmt != 0.0D) if (pendingAmt != 0.0D)
continue; continue;
for (crt = 1; crt <= parentNodeList.getLength(); crt++) for (crt = 1; crt <= parentNodeList.getLength(); crt++)
...@@ -1105,10 +1168,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1105,10 +1168,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
...@@ -1198,7 +1258,15 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1198,7 +1258,15 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
} }
//ended by akhilesh on 31/july/13 for tax provision //ended by akhilesh on 31/july/13 for tax provision
else if (childNodeName.trim().equalsIgnoreCase("bad_debt_amt"))
{
errCode = checkBadDebtAmt(1, conn, dom);
if(errCode == null && errCode.trim().length() == 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
} }
valueXmlString.append("</Detail2>"); valueXmlString.append("</Detail2>");
break; break;
...@@ -1328,6 +1396,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1328,6 +1396,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
amount = doublevalue(this.genericUtility.getColumnValue("amount", dom)); amount = doublevalue(this.genericUtility.getColumnValue("amount", dom));
htranDate = dateFormat2.parse(this.genericUtility.getColumnValue("tran_date", dom1)); htranDate = dateFormat2.parse(this.genericUtility.getColumnValue("tran_date", dom1));
hbankCode = this.genericUtility.getColumnValue("bank_code", dom1); hbankCode = this.genericUtility.getColumnValue("bank_code", dom1);
sql = "select count(*) from misc_payables where tran_ser = ? and ref_no = ?"; sql = "select count(*) from misc_payables where tran_ser = ? and ref_no = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "E-FUND"); pstmt.setString(1, "E-FUND");
...@@ -1342,7 +1411,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1342,7 +1411,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
errCode = "VMREF1"; errCode = "VMREF1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select tot_amt, adj_amt, bank_code from misc_payables where tran_ser = ? and ref_no = ?"; sql = "select tot_amt, adj_amt, bank_code from misc_payables where tran_ser = ? and ref_no = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "E-FUND"); pstmt.setString(1, "E-FUND");
...@@ -1354,6 +1428,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1354,6 +1428,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
adjAmt = rs.getDouble(2); adjAmt = rs.getDouble(2);
bankCode = rs.getString(3); bankCode = rs.getString(3);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (Math.abs(totAmt - adjAmt) < Math.abs(amount)) if (Math.abs(totAmt - adjAmt) < Math.abs(amount))
{ {
errCode = "VTINVPCAMT"; errCode = "VTINVPCAMT";
...@@ -1367,10 +1446,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1367,10 +1446,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
...@@ -1436,6 +1512,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1436,6 +1512,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
balAmt = rs.getDouble(1); balAmt = rs.getDouble(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select sum(case when e.amount is null then 0.0 else e.amount end) from receipt r, rcpepc_adj e where r.tran_id = e.tran_id and r.tran_id != ? and e.ref_no = ? and (case when r.confirmed is null then 'N' else r.confirmed end) != 'Y'"; sql = "select sum(case when e.amount is null then 0.0 else e.amount end) from receipt r, rcpepc_adj e where r.tran_id = e.tran_id and r.tran_id != ? and e.ref_no = ? and (case when r.confirmed is null then 'N' else r.confirmed end) != 'Y'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, htranId); pstmt.setString(1, htranId);
...@@ -1449,6 +1530,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1449,6 +1530,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
Amt = 0.0; Amt = 0.0;
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (Math.abs(amount) + Math.abs(Amt) > balAmt) if (Math.abs(amount) + Math.abs(Amt) > balAmt)
{ {
errCode = "VTINVPCAMT"; errCode = "VTINVPCAMT";
...@@ -1487,10 +1574,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1487,10 +1574,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
...@@ -1515,7 +1598,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1515,7 +1598,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
if(acctCode != null && acctCode.trim().length() > 0) if(acctCode != null && acctCode.trim().length() > 0)
{ {
hsiteCode = this.genericUtility.getColumnValue("site_code", dom1); hsiteCode = this.genericUtility.getColumnValue("site_code", dom1);
errCode = validateAccount(hsiteCode, acctCode, conn); errCode = finCommon.isAcctCode(hsiteCode, acctCode,"FIN", conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -1548,7 +1631,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1548,7 +1631,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
acctCode = this.genericUtility.getColumnValue("acct_code", dom); acctCode = this.genericUtility.getColumnValue("acct_code", dom);
//if(acctCode == null || acctCode.trim().length() == 0){acctCode="";} //if(acctCode == null || acctCode.trim().length() == 0){acctCode="";}
System.out.println("CTTC CODE 111["+cctrCode+""+acctCode); System.out.println("CTTC CODE 111["+cctrCode+""+acctCode);
errCode = validateCctrCode(cctrCode, acctCode, conn); errCode = finCommon.isCctrCode(acctCode, cctrCode, "FIN", conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -1586,11 +1669,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1586,11 +1669,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
else if(childNodeName.equalsIgnoreCase("emp_code")) else if(childNodeName.equalsIgnoreCase("emp_code"))
{ {
refSer = checkNull(this.genericUtility.getColumnValue("ref_ser", dom));
empCode = this.genericUtility.getColumnValue("emp_code", dom); empCode = this.genericUtility.getColumnValue("emp_code", dom);
if(empCode != null && empCode.trim().length() > 0) if(empCode != null && empCode.trim().length() > 0)
{ {
hsiteCode = this.genericUtility.getColumnValue("site_code", dom1); hsiteCode = this.genericUtility.getColumnValue("site_code", dom1);
errCode = validateEmpCode(hsiteCode, empCode, conn); errCode = finCommon.isEmployee(hsiteCode, empCode, refSer, conn);
//errCode = this.validateEmpCode(hsiteCode, empCode, conn);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -1676,7 +1761,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1676,7 +1761,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
return errString; return errString;
} }
public String getfinparm(String pCode, String varName,Connection conn ) /*public String getfinparm(String pCode, String varName,Connection conn )
{ {
String sql = ""; String sql = "";
String varValue = ""; String varValue = "";
...@@ -1711,8 +1796,8 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1711,8 +1796,8 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
return addValue.trim(); return addValue.trim();
} }
*/
public String validateAccount(String sitecode, String acctcode, Connection conn) /* public String validateAccount(String sitecode, String acctcode, Connection conn)
{ {
String sql = ""; String sql = "";
...@@ -1786,9 +1871,9 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1786,9 +1871,9 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
return errCode; return errCode;
} }*/
public String validateCctrCode(String cctrCode, String acctCode, Connection conn) { /*public String validateCctrCode(String cctrCode, String acctCode, Connection conn) {
String sql = ""; String sql = "";
String errCode = ""; String errCode = "";
...@@ -1860,9 +1945,9 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1860,9 +1945,9 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
return errCode; return errCode;
} }*/
public String validateBankCode(String bankCode, String siteCode, Connection conn) { /* public String validateBankCode(String bankCode, String siteCode, Connection conn) {
String sql = ""; String sql = "";
String errCode = ""; String errCode = "";
String siteCodel = ""; String siteCodel = "";
...@@ -1920,9 +2005,9 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1920,9 +2005,9 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
return errCode; return errCode;
} }*/
public String validateAnalysisCode(String acctCodeBal, String analCode, Connection conn) /*public String validateAnalysisCode(String acctCodeBal, String analCode, Connection conn)
{ {
String sql = ""; String sql = "";
String errCode = ""; String errCode = "";
...@@ -1992,8 +2077,8 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -1992,8 +2077,8 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
return errCode; return errCode;
} }*/
public String validateEmpCode(String siteCode, String empCode, Connection conn) /* public String validateEmpCode(String siteCode, String empCode, Connection conn)
{ {
String sql = ""; String sql = "";
String errCode = ""; String errCode = "";
...@@ -2066,7 +2151,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2066,7 +2151,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
return errCode; return errCode;
} }*/
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams)
throws RemoteException, ITMException throws RemoteException, ITMException
...@@ -2270,6 +2355,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2270,6 +2355,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
instrPerSlip = rs.getInt(1); instrPerSlip = rs.getInt(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (instrPerSlip == 0) if (instrPerSlip == 0)
{ {
valueXmlString.append("<entry_batch_no protect = \"0\">").append("<![CDATA["+""+"]]>").append("</entry_batch_no>"); valueXmlString.append("<entry_batch_no protect = \"0\">").append("<![CDATA["+""+"]]>").append("</entry_batch_no>");
...@@ -2304,11 +2394,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2304,11 +2394,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
valueXmlString.append("<curr_code protect = \"1\">").append("<![CDATA["+genericUtility.getColumnValue("curr_code", dom)+"]]>").append("</curr_code>"); valueXmlString.append("<curr_code protect = \"1\">").append("<![CDATA["+genericUtility.getColumnValue("curr_code", dom)+"]]>").append("</curr_code>");
valueXmlString.append("<sale_order protect = \"1\">").append("<![CDATA["+checkNull(genericUtility.getColumnValue("sale_order", dom))+"]]>").append("</sale_order>"); valueXmlString.append("<sale_order protect = \"1\">").append("<![CDATA["+checkNull(genericUtility.getColumnValue("sale_order", dom))+"]]>").append("</sale_order>");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
else if (currentColumn.trim().equalsIgnoreCase("itm_default")) else if (currentColumn.trim().equalsIgnoreCase("itm_default"))
{ {
...@@ -2523,6 +2613,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2523,6 +2613,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
acctCodeCfAr = rs.getString(7); acctCodeCfAr = rs.getString(7);
cctrCodeCfAr = rs.getString(8); cctrCodeCfAr = rs.getString(8);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ((acctCodeCfAr != null) && (acctCodeCfAr.trim().length() > 0)) if ((acctCodeCfAr != null) && (acctCodeCfAr.trim().length() > 0))
{ {
acctCodeCf = acctCodeCfAr; acctCodeCf = acctCodeCfAr;
...@@ -2544,11 +2640,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2544,11 +2640,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
valueXmlString.append("<entry_batch_no protect = \"1\">").append("<![CDATA[]]>").append("</entry_batch_no>"); valueXmlString.append("<entry_batch_no protect = \"1\">").append("<![CDATA[]]>").append("</entry_batch_no>");
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
...@@ -2711,14 +2802,16 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2711,14 +2802,16 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
stdExRt = rs.getInt(1); stdExRt = rs.getInt(1);
} }
valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA[" + stdExRt +"]]>").append("</exch_rate>");
valueXmlString.append("<exch_rate_spot protect = \"0\">").append("<![CDATA[" + stdExRt + "]]>").append("</exch_rate_spot>");
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA[" + stdExRt +"]]>").append("</exch_rate>");
valueXmlString.append("<exch_rate_spot protect = \"0\">").append("<![CDATA[" + stdExRt + "]]>").append("</exch_rate_spot>");
} }
else if (currentColumn.trim().equalsIgnoreCase("chq_amt")) else if (currentColumn.trim().equalsIgnoreCase("chq_amt"))
{ {
...@@ -2746,6 +2839,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2746,6 +2839,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
CurrCodeFrom = rs.getString(1); CurrCodeFrom = rs.getString(1);
exchRate = rs.getDouble(2); exchRate = rs.getDouble(2);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<curr_code>").append("<![CDATA[" + CurrCodeFrom + "]]>").append("</curr_code>"); valueXmlString.append("<curr_code>").append("<![CDATA[" + CurrCodeFrom + "]]>").append("</curr_code>");
valueXmlString.append("<exch_rate >").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate >").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>");
setNodeValue(dom, "curr_code", getAbsString(currCode)); setNodeValue(dom, "curr_code", getAbsString(currCode));
...@@ -2760,10 +2859,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2760,10 +2859,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
valueXmlString.append("<curr_code protect = \"1\">").append("<![CDATA[" + CurrCodeFrom + "]]>").append("</curr_code>"); valueXmlString.append("<curr_code protect = \"1\">").append("<![CDATA[" + CurrCodeFrom + "]]>").append("</curr_code>");
valueXmlString.append("<exch_rate protect = \"1\" >").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate protect = \"1\" >").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>");
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
...@@ -2801,6 +2896,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2801,6 +2896,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
rcvSer = rs.getString(1); rcvSer = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<tran_id>").append("<![CDATA[" + tranId + "]]>").append("</tran_id>"); valueXmlString.append("<tran_id>").append("<![CDATA[" + tranId + "]]>").append("</tran_id>");
valueXmlString.append("<ref_ser>").append("<![CDATA[" + rcvSer + "]]>").append("</ref_ser>"); valueXmlString.append("<ref_ser>").append("<![CDATA[" + rcvSer + "]]>").append("</ref_ser>");
valueXmlString.append("<bill_disc>").append("<![CDATA[" + "N" + "]]>").append("</bill_disc>"); valueXmlString.append("<bill_disc>").append("<![CDATA[" + "N" + "]]>").append("</bill_disc>");
...@@ -2811,12 +2911,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2811,12 +2911,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
valueXmlString.append("<tax_env>").append("<![CDATA[" + checkNull(genericUtility.getColumnValue("tax_env", dom1))+ "]]>").append("</tax_env>"); valueXmlString.append("<tax_env>").append("<![CDATA[" + checkNull(genericUtility.getColumnValue("tax_env", dom1))+ "]]>").append("</tax_env>");
//ended by akhilesh on 19/AUG/13 for tax provision //ended by akhilesh on 19/AUG/13 for tax provision
pstmt.close();
pstmt = null;
rs.close();
rs = null;
} }
else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit")) else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{ {
...@@ -2852,6 +2946,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2852,6 +2946,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ((lineNoRef != null) || (lineNoRef.trim().length() > 0)) if ((lineNoRef != null) || (lineNoRef.trim().length() > 0))
{ {
if (!refSer.equals("E-FUND")) if (!refSer.equals("E-FUND"))
...@@ -2881,6 +2980,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2881,6 +2980,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
adjAmt = rs.getDouble(14); adjAmt = rs.getDouble(14);
badDebtAmt = rs.getDouble(15); badDebtAmt = rs.getDouble(15);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
hexchRate = doublevalue(genericUtility.getColumnValue("exch_rate", dom1)); hexchRate = doublevalue(genericUtility.getColumnValue("exch_rate", dom1));
sql = "select descr from currency where currency.curr_code = ?"; sql = "select descr from currency where currency.curr_code = ?";
...@@ -2891,6 +2994,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2891,6 +2994,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
currDescr = rs.getString(1); currDescr = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select descr from accounts where accounts.acct_code = ?"; sql = "select descr from accounts where accounts.acct_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCode); pstmt.setString(1, acctCode);
...@@ -2899,6 +3009,14 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2899,6 +3009,14 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
accDescr = rs.getString(1); accDescr = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select receivables.bill_disc from receivables where tran_ser = ? and ref_no = ? "; sql = "select receivables.bill_disc from receivables where tran_ser = ? and ref_no = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refSer); pstmt.setString(1, refSer);
...@@ -2908,6 +3026,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2908,6 +3026,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
billDisc = rs.getString(1); billDisc = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ((billDisc == null) || (billDisc.trim().length() == 0)) if ((billDisc == null) || (billDisc.trim().length() == 0))
billDisc = "N"; billDisc = "N";
...@@ -2924,6 +3049,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2924,6 +3049,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
discExchRate = rs.getDouble(1); // change by ritesh on 25/05/13 discExchRate = rs.getDouble(1); // change by ritesh on 25/05/13
lcBillDescAmt = rs.getString(2); lcBillDescAmt = rs.getString(2);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<bill_disc_amt>").append("<![CDATA[" + lcBillDescAmt + "]]>").append("</bill_disc_amt>"); //added by ritesh as per discussion with pravin valueXmlString.append("<bill_disc_amt>").append("<![CDATA[" + lcBillDescAmt + "]]>").append("</bill_disc_amt>"); //added by ritesh as per discussion with pravin
} }
valueXmlString.append("<bill_disc>").append("<![CDATA[" + billDisc + "]]>").append("</bill_disc>"); valueXmlString.append("<bill_disc>").append("<![CDATA[" + billDisc + "]]>").append("</bill_disc>");
...@@ -2953,10 +3083,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2953,10 +3083,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
valueXmlString.append("<accounts_descr>").append("<![CDATA[" + accDescr + "]]>").append("</accounts_descr>"); valueXmlString.append("<accounts_descr>").append("<![CDATA[" + accDescr + "]]>").append("</accounts_descr>");
valueXmlString.append("<cctr_code__ar>").append("<![CDATA[" + cctrCode + "]]>").append("</cctr_code__ar>"); valueXmlString.append("<cctr_code__ar>").append("<![CDATA[" + cctrCode + "]]>").append("</cctr_code__ar>");
valueXmlString.append("<cust_code>").append("<![CDATA[" + custCode + "]]>").append("</cust_code>"); valueXmlString.append("<cust_code>").append("<![CDATA[" + custCode + "]]>").append("</cust_code>");
bdFluctuationCf = getfinparm("999999", "BD_FLUCTUATION_CF",conn); bdFluctuationCf = finCommon.getFinparams("999999", "BD_FLUCTUATION_CF",conn);
if (bdFluctuationCf.equals("") || bdFluctuationCf == null) if (bdFluctuationCf.equals("") || bdFluctuationCf == null)
{ {
bdFluctuationCf = "Y"; bdFluctuationCf = "N";
} }
if ((billDisc.equals("Y")) && (bdFluctuationCf.equals("Y"))) if ((billDisc.equals("Y")) && (bdFluctuationCf.equals("Y")))
{ {
...@@ -2980,7 +3110,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2980,7 +3110,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
rcpAutoFinchg = getfinparm("999999", "RCP_AUTO_FINCHG",conn).trim(); rcpAutoFinchg = finCommon.getFinparams("999999", "RCP_AUTO_FINCHG",conn).trim();
if (rcpAutoFinchg.equals("") || rcpAutoFinchg == null ) if (rcpAutoFinchg.equals("") || rcpAutoFinchg == null )
{ {
bdFluctuationCf = "N"; bdFluctuationCf = "N";
...@@ -2997,6 +3127,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -2997,6 +3127,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
ctr = rs.getInt(1); ctr = rs.getInt(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ((tranSer == "S-INV") || (ctr == 1)) if ((tranSer == "S-INV") || (ctr == 1))
{ {
sql = "select due_date,cr_term from invoice where invoice_id = ?"; sql = "select due_date,cr_term from invoice where invoice_id = ?";
...@@ -3008,6 +3143,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3008,6 +3143,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
dueDate = rs.getDate(1); dueDate = rs.getDate(1);
crTrem = rs.getString(2); crTrem = rs.getString(2);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
tranDate = dateFormat1.parse(genericUtility.getColumnValue("tran_date", dom)); tranDate = dateFormat1.parse(genericUtility.getColumnValue("tran_date", dom));
if (tranDate.before(dueDate)) if (tranDate.before(dueDate))
{ {
...@@ -3039,147 +3179,166 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3039,147 +3179,166 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
discountLc = Math.round(discountLc) * -1L; discountLc = Math.round(discountLc) * -1L;
valueXmlString.append("<fin_chg>").append("<![CDATA[" + discountLc + "]]>").append("</fin_chg>"); valueXmlString.append("<fin_chg>").append("<![CDATA[" + discountLc + "]]>").append("</fin_chg>");
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
} }
} }
} }
} }
else if ((currentColumn.trim().equalsIgnoreCase("exch_rate")) || (currentColumn.trim().equalsIgnoreCase("rcp_amt"))) }
else if ((currentColumn.trim().equalsIgnoreCase("exch_rate")) || (currentColumn.trim().equalsIgnoreCase("rcp_amt")))
{
billDisc = "N";
refNo = genericUtility.getColumnValue("ref_no", dom);
refSer = genericUtility.getColumnValue("ref_ser", dom);
sql = "select bill_disc FROM receivables where tran_ser = ? and ref_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refSer);
pstmt.setString(2, refNo);
rs = pstmt.executeQuery();
if (rs.next())
{
billDisc = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (billDisc == null) billDisc = "N";
if (billDisc == "Y")
{ {
billDisc = "N"; sql = "select export_fund.exch_rate from export_fund, export_fundet where ( export_fund.tran_id = export_fundet.tran_id ) and ( export_fund.confirmed = 'Y') and( ( export_fundet.ref_ser = ? ) and ( export_fundet.ref_no = ?) )";
refNo = genericUtility.getColumnValue("ref_no", dom);
refSer = genericUtility.getColumnValue("ref_ser", dom);
sql = "select bill_disc FROM receivables where tran_ser = ? and ref_no = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refSer); pstmt.setString(1, refSer);
pstmt.setString(2, refNo); pstmt.setString(2, refNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
billDisc = rs.getString(1); exchRate = rs.getDouble(1);
} }
if (billDisc == null) billDisc = "N"; rs.close();
if (billDisc == "Y") rs = null;
{ pstmt.close();
sql = "select export_fund.exch_rate from export_fund, export_fundet where ( export_fund.tran_id = export_fundet.tran_id ) and ( export_fund.confirmed = 'Y') and( ( export_fundet.ref_ser = ? ) and ( export_fundet.ref_no = ?) )"; pstmt = null;
pstmt = conn.prepareStatement(sql); rcpAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt", dom));
pstmt.setString(1, refSer); hexchRate = Double.parseDouble(genericUtility.getColumnValue("exch_rate", dom));
pstmt.setString(2, refNo); exchRate = Double.parseDouble(genericUtility.getColumnValue("exch_rate__rcv", dom));
rs = pstmt.executeQuery(); }
if (rs.next()) bdFluctuationCf = finCommon.getFinparams("999999", "BD_FLUCTUATION_CF" ,conn);
{ if (bdFluctuationCf.equals("") || bdFluctuationCf == null)
exchRate = rs.getDouble(1); {
} bdFluctuationCf = "Y";
rcpAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt", dom)); }
hexchRate = Double.parseDouble(genericUtility.getColumnValue("exch_rate", dom)); if ((billDisc.equals("Y")) && (bdFluctuationCf.equals("Y")))
exchRate = Double.parseDouble(genericUtility.getColumnValue("exch_rate__rcv", dom)); {
} diffAmtExch = rcpAmt * exchRate - rcpAmt * exchRate;
bdFluctuationCf = getfinparm("999999", "BD_FLUCTUATION_CF" ,conn); valueXmlString.append("<diff_amt__exch>").append("<![CDATA[" + diffAmtExch + "]]>").append("</diff_amt__exch>");
if (bdFluctuationCf.equals("") || bdFluctuationCf == null) }
{ else
bdFluctuationCf = "Y"; {
} diffAmtExch = rcpAmt * exchRate - rcpAmt * hexchRate;
if ((billDisc.equals("Y")) && (bdFluctuationCf.equals("Y"))) valueXmlString.append("<diff_amt__exch>").append("<![CDATA[" + diffAmtExch + "]]>").append("</diff_amt__exch>");
{ }
diffAmtExch = rcpAmt * exchRate - rcpAmt * exchRate;
valueXmlString.append("<diff_amt__exch>").append("<![CDATA[" + diffAmtExch + "]]>").append("</diff_amt__exch>");
}
else
{
diffAmtExch = rcpAmt * exchRate - rcpAmt * hexchRate;
valueXmlString.append("<diff_amt__exch>").append("<![CDATA[" + diffAmtExch + "]]>").append("</diff_amt__exch>");
}
valueXmlString.append("<site_code protect = \"1\">").append("<![CDATA[" + siteCode + "]]>").append("</site_code>"); valueXmlString.append("<site_code protect = \"1\">").append("<![CDATA[" + siteCode + "]]>").append("</site_code>");
valueXmlString.append("<cust_code protect = \"1\">").append("<![CDATA[" + custCode + "]]>").append("</cust_code>"); valueXmlString.append("<cust_code protect = \"1\">").append("<![CDATA[" + custCode + "]]>").append("</cust_code>");
valueXmlString.append("<curr_code protect = \"1\">").append("<![CDATA[" + currCode + "]]>").append("</curr_code>"); valueXmlString.append("<curr_code protect = \"1\">").append("<![CDATA[" + currCode + "]]>").append("</curr_code>");
valueXmlString.append("<sale_order protect = \"1\">").append("<![CDATA[" + saleOrder + "]]>").append("</sale_order>"); valueXmlString.append("<sale_order protect = \"1\">").append("<![CDATA[" + saleOrder + "]]>").append("</sale_order>");
errCode = checkBadDebtAmt(0, conn, dom); errCode = checkBadDebtAmt(0, conn, dom);
if(errCode == null && errCode.trim().length() == 0) if(errCode == null && errCode.trim().length() == 0)
{ {
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
rcpAutoFinchg = getfinparm("999999", "RCP_AUTO_FINCHG", conn); rcpAutoFinchg = finCommon.getFinparams("999999", "RCP_AUTO_FINCHG", conn);
if (rcpAutoFinchg.equals("") || rcpAutoFinchg == null) if (rcpAutoFinchg.equals("") || rcpAutoFinchg == null)
{
rcpAutoFinchg = "N";
}
if (rcpAutoFinchg.equals("Y"))
{
sql = "select count(*) from receivables where tran_ser = ? and ref_ser__org = ? and ref_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "R-IBCA");
pstmt.setString(2, "S-INV");
pstmt.setString(3, refNo);
rs = pstmt.executeQuery();
if (rs.next())
{ {
rcpAutoFinchg = "N"; ctr = rs.getInt(1);
} }
if (rcpAutoFinchg.equals("Y")) rs.close();
rs = null;
pstmt.close();
pstmt = null;
rcpAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt", dom));
if ((tranSer == "S-INV") || (ctr == 1))
{ {
sql = "select count(*) from receivables where tran_ser = ? and ref_ser__org = ? and ref_no = ?"; sql = "select due_date,cr_term from invoice where invoice_id = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "R-IBCA"); pstmt.setString(1, refNo);
pstmt.setString(2, "S-INV");
pstmt.setString(3, refNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
ctr = rs.getInt(1); dueDate = rs.getDate(1);
crTrem = rs.getString(2);
} }
rcpAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt", dom)); rs.close();
if ((tranSer == "S-INV") || (ctr == 1)) rs = null;
pstmt.close();
pstmt = null;
tranDate = dateFormat1.parse(genericUtility.getColumnValue("tran_date", dom));
if (tranDate.before(dueDate))
{ {
sql = "select due_date,cr_term from invoice where invoice_id = ?"; days = (int)(dueDate.getTime() - tranDate.getTime()) / 361440000;
pstmt = conn.prepareStatement(sql); if (days > 0)
pstmt.setString(1, refNo);
rs = pstmt.executeQuery();
if (rs.next())
{ {
dueDate = rs.getDate(1); sql = "select fchg_type,case when fin_chg is null then 0 else fin_chg end from crtermfc where (min_day <= ? and max_day >= ? ) and cr_term = ?";
crTrem = rs.getString(2);
} pstmt = conn.prepareStatement(sql);
tranDate = dateFormat1.parse(genericUtility.getColumnValue("tran_date", dom)); pstmt.setInt(1, days);
if (tranDate.before(dueDate)) pstmt.setInt(2, days);
{ pstmt.setString(3, crTrem);
days = (int)(dueDate.getTime() - tranDate.getTime()) / 361440000; rs = pstmt.executeQuery();
if (days > 0) if (rs.next())
{ {
sql = "select fchg_type,case when fin_chg is null then 0 else fin_chg end from crtermfc where (min_day <= ? and max_day >= ? ) and cr_term = ?"; finChg = rs.getDouble(1);
fchgType = rs.getString(2);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (finChg == 0.0D) finChg = 0.0D;
if (discountLc == 0.0D) discountLc = 0.0D;
if (fchgType == "P")
{
discountLc = rcpAmt * (finChg / 36500.0D) * days;
}
else
{
discountLc = finChg;
}
discountLc = Math.round(discountLc) * -1L;
valueXmlString.append("<fin_chg>").append("<![CDATA[" + discountLc + "]]>").append("</fin_chg>");
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, days);
pstmt.setInt(2, days);
pstmt.setString(3, crTrem);
rs = pstmt.executeQuery();
if (rs.next())
{
finChg = rs.getDouble(1);
fchgType = rs.getString(2);
if (finChg == 0.0D) finChg = 0.0D;
if (discountLc == 0.0D) discountLc = 0.0D;
if (fchgType == "P")
{
discountLc = rcpAmt * (finChg / 36500.0D) * days;
}
else
{
discountLc = finChg;
}
discountLc = Math.round(discountLc) * -1L;
valueXmlString.append("<fin_chg>").append("<![CDATA[" + discountLc + "]]>").append("</fin_chg>");
}
}
} }
} }
} }
} }
pstmt.close();
pstmt = null;
rs.close();
rs = null;
}
else if (currentColumn.trim().equalsIgnoreCase("bad_debt_amt"))
{
errCode = checkBadDebtAmt(1, conn, dom);
if(errCode == null && errCode.trim().length() == 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} }
valueXmlString.append("</Detail2>"); valueXmlString.append("</Detail2>");
break; break;
case 3: case 3:
...@@ -3224,6 +3383,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3224,6 +3383,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
totAmt = rs.getDouble(5); totAmt = rs.getDouble(5);
adv = rs.getDouble(6); adv = rs.getDouble(6);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>"); valueXmlString.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>");
valueXmlString.append("<exch_rate__vouch>").append("<![CDATA[" + exch + "]]>").append("</exch_rate__vouch>"); valueXmlString.append("<exch_rate__vouch>").append("<![CDATA[" + exch + "]]>").append("</exch_rate__vouch>");
valueXmlString.append("<tot_amt>").append("<![CDATA[" + totAmt + "]]>").append("</tot_amt>"); valueXmlString.append("<tot_amt>").append("<![CDATA[" + totAmt + "]]>").append("</tot_amt>");
...@@ -3238,10 +3402,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3238,10 +3402,6 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
valueXmlString.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>"); valueXmlString.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>");
valueXmlString.append("<sale_order>").append("<![CDATA[" + saleOrder + "]]>").append("</sale_order>"); valueXmlString.append("<sale_order>").append("<![CDATA[" + saleOrder + "]]>").append("</sale_order>");
pstmt.close();
pstmt = null;
rs.close();
rs = null;
} }
else if (currentColumn.trim().equalsIgnoreCase("adj_amt")) else if (currentColumn.trim().equalsIgnoreCase("adj_amt"))
{ {
...@@ -3283,6 +3443,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3283,6 +3443,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
refNo = genericUtility.getColumnValue("ref_no", dom); refNo = genericUtility.getColumnValue("ref_no", dom);
refSer = genericUtility.getColumnValue("ref_ser", dom); refSer = genericUtility.getColumnValue("ref_ser", dom);
if ((refNo == null) || (refNo.trim().length() == 0)) refNo = ""; if ((refNo == null) || (refNo.trim().length() == 0)) refNo = "";
sql = "select ref_no,ref_date,curr_code,exch_rate,due_date,tot_amt,sundry_type,sundry_code,case when adj_amt is null then 0 else adj_amt end,ACCT_CODE,CCTR_CODE from misc_payables where ref_no = ? and tran_ser = 'E-FUND'"; sql = "select ref_no,ref_date,curr_code,exch_rate,due_date,tot_amt,sundry_type,sundry_code,case when adj_amt is null then 0 else adj_amt end,ACCT_CODE,CCTR_CODE from misc_payables where ref_no = ? and tran_ser = 'E-FUND'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo); pstmt.setString(1, refNo);
...@@ -3301,6 +3462,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3301,6 +3462,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
acctCode = rs.getString(10); acctCode = rs.getString(10);
cctrCode = rs.getString(11); cctrCode = rs.getString(11);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select descr from currency where currency.curr_code = ?"; sql = "select descr from currency where currency.curr_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currCode); pstmt.setString(1, currCode);
...@@ -3309,6 +3475,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3309,6 +3475,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
currDescr = rs.getString(1); currDescr = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>"); valueXmlString.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>");
valueXmlString.append("<currency_descr>").append("<![CDATA[" + currDescr + "]]>").append("</currency_descr>"); valueXmlString.append("<currency_descr>").append("<![CDATA[" + currDescr + "]]>").append("</currency_descr>");
...@@ -3329,10 +3500,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3329,10 +3500,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
valueXmlString.append("<diff_amt__exch>").append("<![CDATA[" + ((amount * hexchRate )- (amount * exchRate)) + "]]>").append("</diff_amt__exch>"); valueXmlString.append("<diff_amt__exch>").append("<![CDATA[" + ((amount * hexchRate )- (amount * exchRate)) + "]]>").append("</diff_amt__exch>");
} }
pstmt.close();
pstmt = null;
rs.close();
rs = null;
} }
else if ((currentColumn.trim().equalsIgnoreCase("exch_rate")) || (currentColumn.trim().equalsIgnoreCase("amount"))) else if ((currentColumn.trim().equalsIgnoreCase("exch_rate")) || (currentColumn.trim().equalsIgnoreCase("amount")))
...@@ -3398,12 +3566,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3398,12 +3566,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
accDescr = rs.getString(1); accDescr = rs.getString(1);
} }
valueXmlString.append("<accounts_descr>").append("<![CDATA[" + accDescr + "]]>").append("</accounts_descr>");
pstmt.close();
pstmt = null;
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<accounts_descr>").append("<![CDATA[" + accDescr + "]]>").append("</accounts_descr>");
} }
else if (currentColumn.trim().equalsIgnoreCase("emp_code")) else if (currentColumn.trim().equalsIgnoreCase("emp_code"))
...@@ -3422,10 +3591,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3422,10 +3591,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
valueXmlString.append("<emp_fname>").append("<![CDATA[" + empFname + "]]>").append("</emp_fname>"); valueXmlString.append("<emp_fname>").append("<![CDATA[" + empFname + "]]>").append("</emp_fname>");
valueXmlString.append("<emp_lname>").append("<![CDATA[" + empLname + "]]>").append("</emp_lname>"); valueXmlString.append("<emp_lname>").append("<![CDATA[" + empLname + "]]>").append("</emp_lname>");
pstmt.close();
pstmt = null;
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close();
pstmt = null;
} }
else if (currentColumn.trim().equalsIgnoreCase("curr_code")) else if (currentColumn.trim().equalsIgnoreCase("curr_code"))
...@@ -3444,6 +3613,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3444,6 +3613,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
fcurrCode = rs.getString(1); fcurrCode = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (fcurrCode.trim().equalsIgnoreCase(currCode.trim())) if (fcurrCode.trim().equalsIgnoreCase(currCode.trim()))
{ {
valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA[" + mexchrate + "]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA[" + mexchrate + "]]>").append("</exch_rate>");
...@@ -3471,10 +3645,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3471,10 +3645,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
exchRate = Double.parseDouble(genericUtility.getColumnValue("exch_rate", dom)); exchRate = Double.parseDouble(genericUtility.getColumnValue("exch_rate", dom));
valueXmlString.append("<amount__bc>").append("<![CDATA[" + (amount * exchRate) + "]]>").append("</amount__bc>"); valueXmlString.append("<amount__bc>").append("<![CDATA[" + (amount * exchRate) + "]]>").append("</amount__bc>");
pstmt.close();
pstmt = null;
rs.close();
rs = null;;
} }
else if ((currentColumn.trim().equalsIgnoreCase("amount")) || (currentColumn.trim().equalsIgnoreCase("exch_rate"))) else if ((currentColumn.trim().equalsIgnoreCase("amount")) || (currentColumn.trim().equalsIgnoreCase("exch_rate")))
{ {
...@@ -3642,6 +3813,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3642,6 +3813,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
finEntity = rs.getString(1); finEntity = rs.getString(1);
} }
rs.close();
rs = null;;
pstmt.close();
pstmt = null;
sql = "select curr_code from finent where fin_entity = ?"; sql = "select curr_code from finent where fin_entity = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, finEntity); pstmt.setString(1, finEntity);
...@@ -3650,10 +3826,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3650,10 +3826,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
currCodeSql = rs.getString(1); currCodeSql = rs.getString(1);
} }
pstmt.close();
pstmt = null;
rs.close(); rs.close();
rs = null;; rs = null;;
pstmt.close();
pstmt = null;
} }
else else
...@@ -3677,6 +3853,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3677,6 +3853,11 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
exchRate = rs.getDouble(1); exchRate = rs.getDouble(1);
} }
rs.close();
rs = null;;
pstmt.close();
pstmt = null;
if (exchRate == 0.0D) if (exchRate == 0.0D)
{ {
sql = "select exch_rate from daily_exch_rate_sell_buy where curr_code = ? and curr_code__to = ? and ? between from_date and to_date "; sql = "select exch_rate from daily_exch_rate_sell_buy where curr_code = ? and curr_code__to = ? and ? between from_date and to_date ";
...@@ -3693,10 +3874,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3693,10 +3874,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
exchRate = 1.0D / exchRate; exchRate = 1.0D / exchRate;
} }
pstmt.close();
pstmt = null;
rs.close(); rs.close();
rs = null;; rs = null;;
pstmt.close();
pstmt = null;
} }
} }
...@@ -3713,6 +3894,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3713,6 +3894,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
exchRate = rs.getDouble(1); exchRate = rs.getDouble(1);
} }
rs.close();
rs = null;;
pstmt.close();
pstmt = null;
if (exchRate == 0.0D) if (exchRate == 0.0D)
{ {
...@@ -3726,11 +3911,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3726,11 +3911,13 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
exchRate = rs.getDouble(1); exchRate = rs.getDouble(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
pstmt.close();
pstmt = null;
rs.close();
rs = null;;
} }
if (exchRate == 0.0D) if (exchRate == 0.0D)
...@@ -3742,6 +3929,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3742,6 +3929,12 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
rtrim = rs.getString(1); rtrim = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (rtrim.equals("Y")) if (rtrim.equals("Y"))
{ {
sql = "select std_exrt from currency where curr_code = ?"; sql = "select std_exrt from currency where curr_code = ?";
...@@ -3752,6 +3945,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3752,6 +3945,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
{ {
exchRate = rs.getDouble(1); exchRate = rs.getDouble(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
...@@ -3802,10 +3999,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3802,10 +3999,10 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
balAmt = rs.getDouble(1); balAmt = rs.getDouble(1);
badAmt = rs.getDouble(2); badAmt = rs.getDouble(2);
} }
pstmt.close();
pstmt = null;
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close();
pstmt = null;
if (badAmt > 0.0D) if (badAmt > 0.0D)
{ {
...@@ -3870,7 +4067,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3870,7 +4067,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
} }
private String checkPeriod(String mode, String siteCode, java.util.Date tranDate, Connection con) /*private String checkPeriod(String mode, String siteCode, java.util.Date tranDate, Connection con)
{ {
String errorCode = ""; String errorCode = "";
String sql = ""; String sql = "";
...@@ -3943,7 +4140,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt ...@@ -3943,7 +4140,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
return errorCode; return errorCode;
} }
*/
private String checkNull(String str) private String checkNull(String str)
{ {
......
...@@ -1933,7 +1933,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -1933,7 +1933,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
glTraceMap.put("eff_date",new Timestamp(effDate.getTime())); glTraceMap.put("eff_date",new Timestamp(effDate.getTime()));
glTraceMap.put("fin_entity", finEntity); glTraceMap.put("fin_entity", finEntity);
glTraceMap.put("site_code", siteCode); glTraceMap.put("site_code", siteCode);
glTraceMap.put("sundry_type", "C");//OPEN WITH B glTraceMap.put("sundry_type", "B");
glTraceMap.put("sundry_code", bankCode); glTraceMap.put("sundry_code", bankCode);
glTraceMap.put("acct_code", acctCodeBal); glTraceMap.put("acct_code", acctCodeBal);
glTraceMap.put("cctr_code", cctrCodeBal); glTraceMap.put("cctr_code", cctrCodeBal);
......
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