Commit 5de5b6d7 authored by msalla's avatar msalla

On confirmation of bank receipt coin difference error is coming.

This receipt is created for invoice for which bill discounting is done.(pont no:661)

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@211565 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6fdf1ab1
......@@ -7,12 +7,13 @@ package ibase.webitm.ejb.fin.adv;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
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 java.rmi.RemoteException;
import java.sql.Connection;
......@@ -457,7 +458,8 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
//Added by varsha v for truncating time from tran_date on 07-05-18
java.sql.Timestamp today = null;
java.util.Date date = null;
GenericUtility genericUtility = new GenericUtility();
// GenericUtility genericUtility = new GenericUtility();
E12GenericUtility genericUtility = new E12GenericUtility();
//Ended by varsha v for truncating time from tran_date on 07-05-18
try
{
......@@ -586,6 +588,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
RcpHdrMap.put("ref_date",rs.getDate("ref_date"));
RcpHdrMap.put("remarks",rs.getString("remarks"));
RcpHdrMap.put("net_amt",rs.getDouble("net_amt"));
System.out.println("net amt in reterive from receipt:["+RcpHdrMap.get("net_amt"));
RcpHdrMap.put("exch_rate",rs.getDouble("exch_rate"));
RcpHdrMap.put("curr_code",rs.getString("curr_code"));
RcpHdrMap.put("net_amt__bc",rs.getDouble("net_amt__bc"));
......@@ -614,7 +617,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
RcpHdrMap.put("cctr_code__adv",rs.getString("cctr_code__adv")==null?" ":rs.getString("cctr_code__adv"));
RcpHdrMap.put("tax_amt",rs.getDouble("tax_amt"));
RcpHdrMap.put("item_ser",rs.getString("item_ser"));
//System.out.println(" Header Map..........");
System.out.println(" Header Map..........");
//System.out.println(RcpHdrMap.toString());
}
pstmt.close();
......@@ -687,8 +690,8 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
DetMap.put("effect_party", rs.getString("effect_party")); // 29/01/14 manoharan
DetMap.put("eff_bank", rs.getString("eff_bank")); // 03/02/14 Manoj
DetList.add(DetMap);
//System.out.println(" receipt Acct Map..........");
// System.out.println("DetList initial [" + DetList.toString() + "]");
System.out.println(" receipt Acct Map..........");
System.out.println("DetList initial [" + DetList.toString() + "]");
}
rs.close();
rs = null;
......@@ -731,8 +734,8 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
ADetMap.put("cctr_code", rs.getString("cctr_code"));
ADetMap.put("exch_rate__vouch", rs.getDouble("exch_rate__vouch"));
ADetList.add(ADetMap);
//System.out.println("receipt Adv Map..........");
//System.out.println(ADetMap.toString());
System.out.println("receipt Adv Map..........");
System.out.println(ADetMap.toString());
}
rs.close();
rs = null;
......@@ -758,8 +761,8 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
EpcAdjMap.put("sundry_type", rs.getString("sundry_type"));
EpcAdjMap.put("sundry_code", rs.getString("sundry_code"));
EpcAdjList.add(EpcAdjMap);
//System.out.println(" Rcpepc Adj Map..........");
//System.out.println(EpcAdjList.toString());
System.out.println(" Rcpepc Adj Map..........");
System.out.println(EpcAdjList.toString());
}
rs.close();
......@@ -789,8 +792,8 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
RcpDetMap.put("bill_disc_amt", rs.getDouble("bill_disc_amt")); //ADDED BY RITESH ON 24/05/13
RcpDetList.add(RcpDetMap);
//System.out.println(" DetMap Map..........");
//System.out.println(RcpDetMap.toString());
System.out.println(" DetMap Map..........");
System.out.println(RcpDetMap.toString());
}
......@@ -813,7 +816,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
//finTotal = finTotal + (double) Double.parseDouble( "" + RcpDetMap.get("fin_chg"));
tFin = tFin + (double) Double.parseDouble( "" + RcpDetMap.get("fin_chg"));
//System.out.println("LINE NO 541"+total);
// System.out.println("LINE NO 541"+total);
if(rcpClubPost.equals("Y"))
{
......@@ -926,7 +929,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
}
// populate bill if bill is discounted
// then credit the amount to the BD
//System.out.println("DetList*****************************811******************"+DetList.toString());
// System.out.println("DetList*****************************811******************"+DetList.toString());
total=0;
for(i=0 ; i<RcpDetList.size() ; i++)
{
......@@ -1100,7 +1103,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
}
}
//System.out.println("DetList*****************984******************************"+DetList.toString());
// System.out.println("DetList*****************984******************************"+DetList.toString());
//adjust for advances adjusted
for(i=0 ; i<ADetList.size() ; i++)
......@@ -1115,7 +1118,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
amount = (double) Double.parseDouble( "" + ADetMap.get("adj_amt"));
total = total + amount;
//System.out.println("LINE NO 743"+total);
// System.out.println("LINE NO 743"+total);
if(rcpClubPost.equals("Y"))
{
findIndex = findExistingIndex(DetList, acct, cctr, exch);
......@@ -1348,7 +1351,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
}
// System.out.println("DetList**************************1231*********************"+DetList.toString());
//System.out.println("DetList**************************1231*********************"+DetList.toString());
// insert data for advance
advAmt = (double) Double.parseDouble( "" + RcpHdrMap.get("adv_amt"));
......@@ -1385,7 +1388,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
rs=null;
pstmt.close();
pstmt=null;
//System.out.println("total in adv"+amtNoBankEffect);
// System.out.println("total in adv"+amtNoBankEffect);
if (findIndex > -1)
{
detMap = (HashMap) DetList.get(findIndex);
......@@ -1425,7 +1428,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
detMap.put("eff_bank", "Y"); // 03/02/14 Manoj
DetList.add(detMap);
}
// System.out.println("1273---DetList.toString()----"+DetList.toString());
//System.out.println("1273---DetList.toString()----"+DetList.toString());
/*sql = "select count(*) from rcpacct where acct_code = ? and cctr_code = ? and exch_rate = ? and tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acct);
......@@ -1522,7 +1525,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
isEpcCurrSame = true;//added by monika on 8 august 2019 to set isEpcCurrSame to true
totEpcBc = totEpcBc + (hexchRate * amount);
}
//added to by monika
//added to by monika
// System.out.println("epccurrsame value:::"+isEpcCurrSame);
if(rcpClubPost.equals("Y"))
......@@ -1803,7 +1806,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
amtRev = Math.min(badDebtAmt,amtProv);
totBad = totBad + amtRev;
System.out.println("LINE NO 1164"+total);
//System.out.println("LINE NO 1164"+total);
if(rcpClubPost.equals("Y"))
{
......@@ -2012,10 +2015,10 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
pstmt = null;
totBad = 0;
}
//System.out.println("aaaaaaaaaaaa"+total);
// System.out.println("aaaaaaaaaaaa"+total);
//System.out.println("BBBBBBBBBBB"+total);
//System.out.println("CCCCCCCCCCCC"+total);
System.out.println("CCCCCCCCCCCC"+total);
}
exchRate = (double) Double.parseDouble( "" + RcpHdrMap.get("exch_rate"));
......@@ -2098,21 +2101,42 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
//added by monika to 15 oct 19 -to check coin difference in billdiscounting
billDiscountAmt=((double) Double.parseDouble( "" + RcpHdrMap.get("bill_disc_amt")));
//System.out.println("bill discount amount and ["+billDiscountAmt+"] total::>>["+total+"]");
//to check validation for chq_amt and net_amt is 0 or not in receivables--8 nov 2019--by monika
if ((double) Double.parseDouble( "" + RcpHdrMap.get("net_amt")) != 0 && (double) Double.parseDouble( "" + RcpHdrMap.get("chq_amt")) != 0)
{//end
if(total>0) //to check billdiscounting accounting effect -07 nov -19
{
total=total-billDiscountAmt;
chq=chq-billDiscountAmt;
//end
// System.out.println("chq and ["+chq+"] total ["+total + "] other_amount ]"+othAmt+" ] diff [" + Math.abs(chq - (total -taxAmt)+othAmt ) +"]");
if(Math.abs(chq - (total - taxAmt)+othAmt) > 1)//end
// System.out.println("chq and ["+chq+"] total ["+total + "] other_amount ]"+othAmt+" ] diff [" + Math.abs(chq +(total -taxAmt)+othAmt ) +"]");
//if(Math.abs(chq + (total - taxAmt)+othAmt) > 1)//end
if(Math.abs(chq -(total -taxAmt)+othAmt) > 1)
{
errString = itmDBAccessEJB.getErrorString("","VTRCPT8","","",conn);
conn.rollback();
return errString;
}
}
else
{
chq=chq-billDiscountAmt;
//end
//System.out.println("chq and ["+chq+"] total ["+total + "] other_amount ]"+othAmt+" ] diff [" + Math.abs(chq +(total -taxAmt)+othAmt ) +"]");
//if(Math.abs(chq + (total - taxAmt)+othAmt) > 1)//end
if(Math.abs(chq +(total -taxAmt)+othAmt) > 1)
{
errString = itmDBAccessEJB.getErrorString("","VTRCPT8","","",conn);
conn.rollback();
return errString;
}
}//end
}
RcpHdrMap.put("net_amt", total);
RcpHdrMap.put("net_amt__bc", totBc);
//System.out.println("net_amt ["+total+"] net_amt__bc ["+totBc + "]");
// System.out.println("net_amt ["+total+"] net_amt__bc ["+totBc + "]");
// 14/01/14 manoharan details has to be inserted
sql = "select max(line_no) from rcpacct where tran_id = ?";
......@@ -2476,8 +2500,8 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
pstmt1=null;
pstmt.close();
pstmt=null;
// System.out.println("netAmountBc+taxAmt amount --------->"+netAmount);
//System.out.println("netAmountBc+taxAmt amount --------->"+amount);
//System.out.println("netAmountBc+taxAmt amount --------->"+netAmount);
// System.out.println("netAmountBc+taxAmt amount --------->"+amount);
//end
if(! isPreview)//if isPreview is false
......@@ -2519,7 +2543,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
pstmt1.close();
pstmt1 = null;
//System.out.println("balamount in advbking=[");
// System.out.println("balamount in advbking=[");
}
}
rs.close();
......@@ -2808,6 +2832,8 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
netAmt = (double) Double.parseDouble( "" + RcpHdrMap.get("net_amt"));
currCode = (String)RcpHdrMap.get("curr_code");
exchRate = (double) Double.parseDouble( "" + RcpHdrMap.get("exch_rate"));
//System.out.println("exchange_rate in diff hdr"+exchRate);
projCode = (String)RcpHdrMap.get("proj_code");
projCode = (String)RcpHdrMap.get("proj_code");
refNO = (String)RcpHdrMap.get("ref_no");
......@@ -2871,11 +2897,11 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
if(isInBaseCurr == true)
{
//netAmountBc = netAmountBc+taxAmt;//added by akhilesh on 31/july/13 for tax provision
System.out.println("IN TRUE!!!!!!!!!!!!!!!!!");
// System.out.println("IN TRUE!!!!!!!!!!!!!!!!!");
glTraceMap.put("curr_code", basecurrCode);
glTraceMap.put("exch_rate", 1.0);
System.out.println("NET AMOUNT BC..["+RcpHdrMap.get("net_amt__bc"));
// System.out.println("NET AMOUNT BC..["+RcpHdrMap.get("net_amt__bc"));
if((double) Double.parseDouble( "" + RcpHdrMap.get("net_amt__bc")) < 0 )
{
glTraceMap.put("dr_amt", 0.0);
......@@ -2889,14 +2915,14 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
}
else
{
//netAmt = netAmt+taxAmt;//added by akhilesh on 31/july/13 for tax provision
netAmt = netAmt+taxAmt;//added by akhilesh on 31/july/13 for tax provision
System.out.println("IN FALSE!!!!!!!!!!!!!!!!!");
//System.out.println("IN FALSE!!!!!!!!!!!!!!!!!");
glTraceMap.put("curr_code", currCode);
glTraceMap.put("exch_rate", exchRate);
System.out.println("NET AMOUNT BC..["+RcpHdrMap.get("net_amt"));
// System.out.println("NET AMOUNT BC..["+RcpHdrMap.get("net_amt"));
if((double) Double.parseDouble( "" + RcpHdrMap.get("net_amt")) < 0 )
{
glTraceMap.put("dr_amt", 0.0);
......@@ -2981,7 +3007,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
//Added by Sharon as instructed by Shiri madam on 29-July-2004
if (chqAmt != 0 || advAmt > 0 )
{
//System.out.println("In 1826 SUNDRY-BAL !!!!!!!!!!!!!!!!!!!!!!!!!!");
// System.out.println("In 1826 SUNDRY-BAL !!!!!!!!!!!!!!!!!!!!!!!!!!");
if (! isPreview)//if isPreview is false *****vishakha
{
errString = finCommon.gbf_sundrybal_upd(sundryBalMap,conn);
......@@ -3045,7 +3071,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
//bankTranLogMap.put("exch_rate", exchRate);
bankTranLogMap.put("entry_batch_no",(String)RcpHdrMap.get("entry_batch_no") );
//ls_errcode = gbf_banktranlog_upd(lstr_banktranlog)
//System.out.println("545 bankTranLogUpdateeUpdate Called..............");
// System.out.println("545 bankTranLogUpdateeUpdate Called..............");
errString = finCommon.bankTranLogUpdate(bankTranLogMap, xtraParams, conn);
if(errString != null && errString.trim().length() > 0)
{
......@@ -3083,11 +3109,14 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
glTraceMap.put("exch_rate", 1.0);
if((double) Double.parseDouble( "" + RcpHdrMap.get("diff_amt__exch")) > 0)
{
// System.out.println("inside true-- difference amount in gltrace"+ RcpHdrMap.get("diff_amt__exch"));
glTraceMap.put("dr_amt",(double) Double.parseDouble( "" + RcpHdrMap.get("diff_amt__exch")));
glTraceMap.put("cr_amt", 0);
cnt1=1;
}else
{
// System.out.println("inside false--- difference amount in gltrace"+ RcpHdrMap.get("diff_amt__exch"));
glTraceMap.put("dr_amt", 0.0);
glTraceMap.put("cr_amt", -1 * (double) Double.parseDouble( "" + RcpHdrMap.get("diff_amt__exch")));
cnt1=2;
......@@ -3114,10 +3143,12 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
}
//System.out.println("exchange rate---in difference amount---"+glTraceMap.get("exch_rate"));
debit = debit + ((double) Double.parseDouble( "" + glTraceMap.get("dr_amt")) * (double) Double.parseDouble( "" + glTraceMap.get("exch_rate")));
credit = credit + ((double) Double.parseDouble( "" + glTraceMap.get("cr_amt")) * (double) Double.parseDouble( "" + glTraceMap.get("exch_rate")));
//System.out.println("credit difference>>["+credit+"] debit >>>["+debit+"]");
// insert into receivables for advance amount
......@@ -3172,7 +3203,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
receivablesMap.put("cust_ref_date",null);
receivablesMap.put("cust_ref_amt","");
//System.out.println("In 1997 receivablesMap [" + receivablesMap + "]");
// System.out.println("In 1997 receivablesMap [" + receivablesMap + "]");
errString = finCommon.gbfReceivablesUpd(receivablesMap,conn);
if(errString != null && errString.trim().length() > 0)
{
......@@ -3196,7 +3227,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
sundryBalMap.put("adv_amt", ((double) Double.parseDouble( "" + RcpHdrMap.get("adv_amt"))));
contactCode = finCommon.getContactCode(sundryType, sundryCode, conn);
sundryBalMap.put("contact_code",contactCode );
//System.out.println("In 2021 sundryBalMap [" + sundryBalMap + "]");
// System.out.println("In 2021 sundryBalMap [" + sundryBalMap + "]");
errString = finCommon.gbf_sundrybal_upd(sundryBalMap,conn);
if(errString != null && errString.trim().length() > 0)
......@@ -3439,7 +3470,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
for (int ctr =0; ctr < DetList.size(); ctr++)
{
//System.out.println("no of times "+ctr);
// System.out.println("no of times "+ctr);
//DetMap = new HashMap();
DetMap = (HashMap) DetList.get(ctr);
......@@ -3470,13 +3501,15 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
glTraceMap.put("sundry_type",(String)DetMap.get("sundry_type")==null?"O":(String)DetMap.get("sundry_type"));
glTraceMap.put("sundry_code",(String)DetMap.get("sundry_code")== null?"":(String)DetMap.get("sundry_code"));
glTraceMap.put("acct_code", (String)DetMap.get("acct_code"));
System.out.println("818 account chek ="+acctCode+" "+sundryType+" "+sundryCode);
// System.out.println("818 account chek ="+acctCode+" "+sundryType+" "+sundryCode);
glTraceMap.put("cctr_code", (String)DetMap.get("cctr_code")==null?" ":(String)DetMap.get("cctr_code"));
glTraceMap.put("emp_code", (String)DetMap.get("emp_code"));
glTraceMap.put("anal_code", (String)DetMap.get("anal_code"));
glTraceMap.put("curr_code", (String)DetMap.get("curr_code")==null?hcurrCode:(String)DetMap.get("curr_code"));
glTraceMap.put("proj_code", projectCode);
glTraceMap.put("exch_rate", (double) Double.parseDouble( "" + DetMap.get("exch_rate")));
// System.out.println("818 exchrate ="+acctCode+" "+sundryType+" "+sundryCode+" exchrate sundry bal"+DetMap.get("exch_rate"));
amount = (double) Double.parseDouble( "" + DetMap.get("amount"));
if(amount > 0)
......@@ -3506,14 +3539,14 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
return errString;
}
debit = debit + ((double) Double.parseDouble( "" + glTraceMap.get("dr_amt")) * (double) Double.parseDouble( "" + glTraceMap.get("exch_rate")));
credit = credit + ((double) Double.parseDouble( "" + glTraceMap.get("cr_amt")) * (double) Double.parseDouble( "" + glTraceMap.get("exch_rate")));
// System.out.println("dr in receivables "+debit+" credit "+credit);
/// update sundrybal for customer code
if((String)glTraceMap.get("sundry_type") != null && !((String)glTraceMap.get("sundry_type")).trim().equalsIgnoreCase("O") && (! isPreview))//if is Preview is false **vishakha
{
// System.out.println("COMES INTO CONDITION ...........");
//System.out.println("COMES INTO CONDITION ...........");
sundryBalMap = new HashMap();
......@@ -3539,6 +3572,9 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
sundryBalMap.put("dr_amt", -1 * amount);
sundryBalMap.put("cr_amt", 0.0);
}
// System.out.println("dr in sundry "+amount);
sundryBalMap.put("adv_amt", 0.0);
contactCode = finCommon.getContactCode(sundryType, sundryCode, conn);
sundryBalMap.put("contact_code",contactCode );
......@@ -3608,7 +3644,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
double tempAmt=distCommon.getRequiredDecimal(Math.abs(totAmt - adjAmt), 3);
//System.out.println("@V@ TempAmt :- ["+tempAmt+"]");
///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(tempAmt,2) < getReqDecimal(Math.abs(amount),2))
{
......@@ -3749,6 +3785,7 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
sundryBalMap.put("acct_code", (String)ADetMap.get("acct_code"));
sundryBalMap.put("cctr_code", (String)ADetMap.get("cctr_code"));
sundryBalMap.put("curr_code", hcurrCode);
//System.out.println("884 sundryBaleUpdate Called.............."+ ADetMap.get("exch_rate__vouch"));
sundryBalMap.put("exch_rate", (double) Double.parseDouble( "" + ADetMap.get("exch_rate__vouch")));
sundryBalMap.put("dr_amt", 0.0);
sundryBalMap.put("cr_amt", 0.0);
......
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