Commit ec9147da authored by msalla's avatar msalla

Error in confirmation of Bank Receipt in case of Bill discounting

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@201345 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 72606941
...@@ -42,6 +42,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -42,6 +42,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
Connection conn = null; Connection conn = null;
boolean isPreview = false; boolean isPreview = false;
try try
{ {
retString = confirm( tranID, xtraParams, forcedFlag, conn ,isPreview); retString = confirm( tranID, xtraParams, forcedFlag, conn ,isPreview);
...@@ -131,7 +132,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -131,7 +132,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
FinCommon finCommon = null; FinCommon finCommon = null;
// GenericUtility genericUtility = null; // GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccessEJB = null; ITMDBAccessEJB itmDBAccessEJB = null;
ValidatorEJB validatorEJB = null; ValidatorEJB validatorEJB = null;
System.out.println("tran id = "+tranId); System.out.println("tran id = "+tranId);
...@@ -154,7 +155,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -154,7 +155,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
connStatus = true; connStatus = true;
} }
finCommon = new FinCommon(); finCommon = new FinCommon();
// genericUtility = new GenericUtility(); // genericUtility = new GenericUtility();
itmDBAccessEJB = new ITMDBAccessEJB(); itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB(); validatorEJB = new ValidatorEJB();
//connDriver = new ConnDriver(); //connDriver = new ConnDriver();
...@@ -661,7 +662,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -661,7 +662,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
// populate rcpacct // populate rcpacct
// 29/01/14 manoharan effect_party considered // 29/01/14 manoharan effect_party considered
//if(!isPreview){ commented by vishaka for F14ISUN006 for acct receipt window //if(!isPreview){ commented by vishaka for F14ISUN006 for acct receipt window
sql = "select sundry_type,sundry_code,acct_code,cctr_code,emp_code, anal_code,curr_code ,exch_rate,amount,party_doc_ref,case when effect_party is null then 'N' else effect_party end as effect_party,case when eff_bank is null then 'N' else eff_bank end as eff_bank from rcpacct where tran_id = ?"; sql = "select sundry_type,sundry_code,acct_code,cctr_code,emp_code, anal_code,curr_code ,exch_rate,amount,party_doc_ref,case when effect_party is null then 'N' else effect_party end as effect_party,case when eff_bank is null then 'N' else eff_bank end as eff_bank from rcpacct where tran_id = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId); pstmt.setString(1,tranId);
...@@ -1971,7 +1972,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -1971,7 +1972,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
pstmt = null; pstmt = null;
} }
if(!isPreview){ if(!isPreview){
sql = " update receivables set bad_debt_amt = bad_debt_amt - ? where tran_ser = ? and ref_no = ? and line_no__ref = ?"; sql = " update receivables set bad_debt_amt = bad_debt_amt - ? where tran_ser = ? and ref_no = ? and line_no__ref = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, totBad); pstmt.setDouble(1, totBad);
...@@ -2042,7 +2043,11 @@ if(!isPreview){ ...@@ -2042,7 +2043,11 @@ if(!isPreview){
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
*/ */
chq = ((double) Double.parseDouble( "" + RcpHdrMap.get("chq_amt")) ) - ((double) Double.parseDouble( "" + RcpHdrMap.get("bill_disc_amt")));// + ((double) Double.parseDouble( "" + RcpHdrMap.get("oth_amt")) ); //commented-by-Monika-30-may-2019
// chq = ((double) Double.parseDouble( "" + RcpHdrMap.get("chq_amt")) ) - ((double) Double.parseDouble( "" + RcpHdrMap.get("bill_disc_amt")));// + ((double) Double.parseDouble( "" + RcpHdrMap.get("oth_amt")) );
//changes made-by-monika-30-may-2019
chq = ((double) Double.parseDouble( "" + RcpHdrMap.get("chq_amt")) );
//end
// if EPC adjusted in same currency then // if EPC adjusted in same currency then
if(isEpcCurrSame == true) if(isEpcCurrSame == true)
...@@ -2242,10 +2247,19 @@ if(!isPreview){ ...@@ -2242,10 +2247,19 @@ if(!isPreview){
double debit = 0.0; double debit = 0.0;
double credit = 0.0; double credit = 0.0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null;
ResultSet rs = null; ResultSet rs = null;
ITMDBAccessEJB itmDBAccessEJB = null; ITMDBAccessEJB itmDBAccessEJB = null;
FinCommon finCommon = null; FinCommon finCommon = null;
DistCommon disCommon = null; DistCommon disCommon = null;
int maxline = 0;
String acctCode = "";
String cctrCode = "";
double exchRate = 0.0;
String effectParty = "";
String effectbank = "";
String curr_code="";
double taxAmount = 0.0;
try try
{ {
itmDBAccessEJB = new ITMDBAccessEJB(); itmDBAccessEJB = new ITMDBAccessEJB();
...@@ -2302,9 +2316,68 @@ if(!isPreview){ ...@@ -2302,9 +2316,68 @@ if(!isPreview){
{ {
return errString; return errString;
} }
if(! isPreview)//if isPreview is false //changes made by Monika -27-05-2019-
{ sql = "select max(line_no) from rcpacct where tran_id = ?";
sql = "SELECT ref_no , amount FROM rcpepc_adj WHERE rcpepc_adj.tran_id = ?"; pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
maxline = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Max Line:--"+maxline);
sql = "Insert into rcpacct (TRAN_ID,LINE_NO,ACCT_CODE,CCTR_CODE,AMOUNT,EXCH_RATE,EFFECT_PARTY,AMOUNT__BC,EFF_BANK,CURR_CODE) values (?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt1 = conn.prepareStatement(sql);
sql =" select ACCT_CODE,CCTR_CODE, case when sum(tax_amt) is null then 0 else sum(tax_amt) end as taxAmt "
+" from taxtran where tran_code= ? and "
+" tran_id = ? and tax_amt <> 0 and effect <> 'N' group by acct_code,cctr_code";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,"RCP");
pstmt.setString(2,tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
maxline++;
amount = rs.getDouble("taxAmt");
//taxAmount = taxAmount+ rs.getDouble("taxAmt");
acctCode = rs.getString("acct_code");
cctrCode = rs.getString("cctr_code");
effectParty = "N";
effectbank = "Y";
//detMap.put("curr_code", rs.getString("curr_code"));
exchRate = Double.parseDouble( "" +RcpHdrMap.get("exch_rate"));
curr_code =(String)RcpHdrMap.get("curr_code");
pstmt1.setString(1,tranId);
pstmt1.setInt(2,maxline);
pstmt1.setString(3,acctCode);
pstmt1.setString(4,cctrCode==null?"":cctrCode);
pstmt1.setDouble(5, -1 * amount);
pstmt1.setDouble(6,exchRate);
pstmt1.setString(7,effectParty);
pstmt1.setDouble(8, -1 * amount);
pstmt1.setString(9,effectbank);
pstmt1.setString(10,curr_code);
pstmt1.addBatch();
pstmt1.clearParameters();
}
pstmt1.executeBatch();
rs.close();
rs=null;
pstmt1.close();
pstmt1=null;
pstmt.close();
pstmt=null;
System.out.println("netAmountBc+taxAmt amount --------->"+netAmount);
//end
if(! isPreview)//if isPreview is false
{
sql ="SELECT ref_no , amount FROM rcpepc_adj WHERE rcpepc_adj.tran_id = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId); pstmt.setString(1,tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -2312,7 +2385,10 @@ if(! isPreview)//if isPreview is false ...@@ -2312,7 +2385,10 @@ if(! isPreview)//if isPreview is false
{ {
refNo = rs.getString(1); refNo = rs.getString(1);
amount = rs.getDouble(2); amount = rs.getDouble(2);
if(amount < 0 ){amount = -amount;} if(amount < 0 )
{
amount = -amount;
}
if(amount > 0) if(amount > 0)
{ {
sql = "update advbking set bal_amt = bal_amt - ? where tran_id = ?"; sql = "update advbking set bal_amt = bal_amt - ? where tran_id = ?";
...@@ -2400,7 +2476,7 @@ if(! isPreview)//if isPreview is false ...@@ -2400,7 +2476,7 @@ if(! isPreview)//if isPreview is false
} }
}//end of isPreview condition**vishakha }//end of isPreview condition**vishakha
} }//end of try
catch(Exception e) catch(Exception e)
{ {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
...@@ -2487,7 +2563,7 @@ if(! isPreview)//if isPreview is false ...@@ -2487,7 +2563,7 @@ if(! isPreview)//if isPreview is false
ResultSet rs = null; ResultSet rs = null;
FinCommon finCommon = null; FinCommon finCommon = null;
ValidatorEJB validatorEJB = new ValidatorEJB(); ValidatorEJB validatorEJB = new ValidatorEJB();
// GenericUtility genericUtility = new GenericUtility(); // GenericUtility genericUtility = new GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = null; ITMDBAccessEJB itmDBAccessEJB = null;
String chgTermstr=""; String chgTermstr="";
...@@ -2507,7 +2583,7 @@ if(! isPreview)//if isPreview is false ...@@ -2507,7 +2583,7 @@ if(! isPreview)//if isPreview is false
System.out.println("net_amt AND net_amt__bc 1"+RcpHdrMap.get("net_amt")+""+RcpHdrMap.get("net_amt__bc")); System.out.println("net_amt AND net_amt__bc 1"+RcpHdrMap.get("net_amt")+""+RcpHdrMap.get("net_amt__bc"));
tranId = (String)RcpHdrMap.get("tran_id"); tranId = (String)RcpHdrMap.get("tran_id");
tranType = (String)RcpHdrMap.get("tran_type"); tranType = (String)RcpHdrMap.get("tran_type");
// if(tranType.equalsIgnoreCase("J")) // if(tranType.equalsIgnoreCase("J"))
if("J".equalsIgnoreCase(tranType)) if("J".equalsIgnoreCase(tranType))
{ {
...@@ -2641,7 +2717,6 @@ if(! isPreview)//if isPreview is false ...@@ -2641,7 +2717,6 @@ if(! isPreview)//if isPreview is false
System.out.println("netAmountBc+taxAmt amount --------->"+netAmountBc); System.out.println("netAmountBc+taxAmt amount --------->"+netAmountBc);
//ended by akhilesh on 31/july/13 for tax provision //ended by akhilesh on 31/july/13 for tax provision
...@@ -3211,7 +3286,7 @@ if(! isPreview)//if isPreview is false ...@@ -3211,7 +3286,7 @@ if(! isPreview)//if isPreview is false
DistCommon distCommon = null; DistCommon distCommon = null;
ITMDBAccessEJB itmDBAccessEJB = null; ITMDBAccessEJB itmDBAccessEJB = null;
ValidatorEJB validatorEJB = new ValidatorEJB(); ValidatorEJB validatorEJB = new ValidatorEJB();
// GenericUtility genericUtility = new GenericUtility(); // GenericUtility genericUtility = new GenericUtility();
double nobankEffectAmt=0; double nobankEffectAmt=0;
double exchRateHdr=0; double exchRateHdr=0;
String chgTermstr=""; String chgTermstr="";
...@@ -3408,7 +3483,7 @@ if(! isPreview)//if isPreview is false ...@@ -3408,7 +3483,7 @@ if(! isPreview)//if isPreview is false
System.out.println("@V@ TempAmt :- ["+tempAmt+"]"); System.out.println("@V@ TempAmt :- ["+tempAmt+"]");
System.out.println("@V@ getReqDecimal(tempAmt,2) :- ["+getReqDecimal(tempAmt,2)+"]"); System.out.println("@V@ getReqDecimal(tempAmt,2) :- ["+getReqDecimal(tempAmt,2)+"]");
System.out.println("@V@ getReqDecimal(Math.abs(amount),2) :- ["+getReqDecimal(Math.abs(amount),2)+"]"); System.out.println("@V@ getReqDecimal(Math.abs(amount),2) :- ["+getReqDecimal(Math.abs(amount),2)+"]");
// if(getReqDecimal(Math.abs(totAmt - adjAmt),2) < getReqDecimal(Math.abs(amount),2)) // if(getReqDecimal(Math.abs(totAmt - adjAmt),2) < getReqDecimal(Math.abs(amount),2))
if(getReqDecimal(tempAmt,2) < getReqDecimal(Math.abs(amount),2)) if(getReqDecimal(tempAmt,2) < getReqDecimal(Math.abs(amount),2))
{ {
errString = itmDBAccessEJB.getErrorString("","VTBAL1","","",conn); errString = itmDBAccessEJB.getErrorString("","VTBAL1","","",conn);
...@@ -3509,7 +3584,7 @@ if(! isPreview)//if isPreview is false ...@@ -3509,7 +3584,7 @@ if(! isPreview)//if isPreview is false
System.out.println("@V@ TempAmt :- ["+tempAmt+"]"); System.out.println("@V@ TempAmt :- ["+tempAmt+"]");
System.out.println("@V@ getReqDecimal(tempAmt,2) :- ["+getReqDecimal(tempAmt,2)+"]"); System.out.println("@V@ getReqDecimal(tempAmt,2) :- ["+getReqDecimal(tempAmt,2)+"]");
System.out.println("@V@ getReqDecimal(Math.abs(adjAmt),2) :- ["+getReqDecimal(Math.abs(adjAmt),2)+"]"); System.out.println("@V@ getReqDecimal(Math.abs(adjAmt),2) :- ["+getReqDecimal(Math.abs(adjAmt),2)+"]");
// if(getReqDecimal(Math.abs(amount - adjAmt),2) < getReqDecimal(Math.abs(adjAmt),2)) // if(getReqDecimal(Math.abs(amount - adjAmt),2) < getReqDecimal(Math.abs(adjAmt),2))
if(getReqDecimal(tempAmt,2) < getReqDecimal(Math.abs(adjAmt),2)) if(getReqDecimal(tempAmt,2) < getReqDecimal(Math.abs(adjAmt),2))
{ {
errString = itmDBAccessEJB.getErrorString("","VTBAL1","","",conn); errString = itmDBAccessEJB.getErrorString("","VTBAL1","","",conn);
...@@ -3609,7 +3684,7 @@ if(! isPreview)//if isPreview is false ...@@ -3609,7 +3684,7 @@ if(! isPreview)//if isPreview is false
System.out.println("@V@ TempAmt :- ["+tempAmt+"]"); System.out.println("@V@ TempAmt :- ["+tempAmt+"]");
System.out.println("@V@ getReqDecimal(tempAmt,2) :- ["+getReqDecimal(tempAmt,2)+"]"); System.out.println("@V@ getReqDecimal(tempAmt,2) :- ["+getReqDecimal(tempAmt,2)+"]");
System.out.println("@V@ getReqDecimal(Math.abs(amount),2) :- ["+getReqDecimal(Math.abs(amount),2)+"]"); System.out.println("@V@ getReqDecimal(Math.abs(amount),2) :- ["+getReqDecimal(Math.abs(amount),2)+"]");
// if(getReqDecimal(Math.abs(amount - adjAmt),2) < getReqDecimal(Math.abs(amount),2)) // if(getReqDecimal(Math.abs(amount - adjAmt),2) < getReqDecimal(Math.abs(amount),2))
if(getReqDecimal(tempAmt,2) < getReqDecimal(Math.abs(amount),2)) if(getReqDecimal(tempAmt,2) < getReqDecimal(Math.abs(amount),2))
{ {
errString = itmDBAccessEJB.getErrorString("","VTBAL1","","",conn); errString = itmDBAccessEJB.getErrorString("","VTBAL1","","",conn);
...@@ -3688,7 +3763,7 @@ if(! isPreview)//if isPreview is false ...@@ -3688,7 +3763,7 @@ if(! isPreview)//if isPreview is false
ITMDBAccessEJB itmDBAccessEJB = null; ITMDBAccessEJB itmDBAccessEJB = null;
ValidatorEJB validatorEJB = new ValidatorEJB(); ValidatorEJB validatorEJB = new ValidatorEJB();
String chgTermstr=""; String chgTermstr="";
// GenericUtility genericUtility = new GenericUtility(); // GenericUtility genericUtility = new GenericUtility();
boolean isPreview = false; boolean isPreview = false;
try try
{ {
......
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