Commit 2333e21a authored by manohar's avatar manohar

Update of bill amount corrected


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93684 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 756ddd34
......@@ -75,6 +75,7 @@ public class ReceiptAdvPostSave extends ValidatorEJB implements ReceiptAdvPostSa
String acctFin = "";
String acctFinS = "";
double rcpAmt=0,finChg=0, diffAmtExchDet = 0, diffAmtExchAdv = 0, diffAmtExchEpc = 0;
double billAmtDet = 0, advAmtHdr = 0, adjAmtAdv = 0, bdAmt =0;
int cnt=0;
try
{
......@@ -121,24 +122,63 @@ public class ReceiptAdvPostSave extends ValidatorEJB implements ReceiptAdvPostSa
rs.close();
rs = null;
sql="select sum(d.rcp_amt * d.exch_rate / h.exch_rate) from receipt h, rcpdet d WHERE h.tran_id = d.tran_id and h.tran_id = ? " ;
sql="select adv_amt from receipt WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId );
rs = pstmt.executeQuery();
if (rs.next())
{
chqAmt = rs.getDouble(1);
advAmtHdr = rs.getDouble(1);
}
rs.close();
rs = null;
sql="UPDATE receipt SET bill_amt = ?, chq_amt = ? WHERE tran_id = ? " ;
pstmt.close();
pstmt = null;
sql="select sum(adj_amt) from rcpadv WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,chqAmt );
pstmt.setDouble(2,chqAmt );
pstmt.setString(3,tranId );
cnt = pstmt.executeUpdate();
pstmt.setString(1,tranId );
rs = pstmt.executeQuery();
if (rs.next())
{
adjAmtAdv = rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql="select sum(d.rcp_amt * d.exch_rate / h.exch_rate), sum(case when r.bill_disc = 'Y' then d.BILL_DISC_AMT + d. FIN_CHG else 0 end ) "
+ " from receipt h, rcpdet d, receivables r "
+ " WHERE h.tran_id = d.tran_id "
+ " and r.tran_ser = d.ref_ser "
+ " and r.ref_no = d.ref_no "
+ " and r.line_no__ref = d.line_no__ref "
+ " and h.tran_id = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId );
rs = pstmt.executeQuery();
if (rs.next())
{
billAmtDet = rs.getDouble(1);
bdAmt = rs.getDouble(2);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
chqAmt = billAmtDet + bdAmt + advAmtHdr + adjAmtAdv;
if (chqAmt != 0)
{
sql="UPDATE receipt SET bill_amt = ? WHERE tran_id = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,chqAmt );
pstmt.setString(2,tranId );
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
......
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