Commit b2337356 authored by manohar's avatar manohar

adv_amt set automaticallye based on chq_amt and bill_amt


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94405 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1a0c8d2d
......@@ -56,7 +56,7 @@ public class ReceiptAdvPostSave extends ValidatorEJB implements ReceiptAdvPostSa
String finEntity = null;
String currCode = null;
double exchRate = 0;
double chqAmt = 0;
double chqAmt = 0, chqAmtActual = 0 ;
String tranDate =null;
String custCode =null;
String siteCode = null;
......@@ -123,7 +123,7 @@ public class ReceiptAdvPostSave extends ValidatorEJB implements ReceiptAdvPostSa
rs.close();
rs = null;
sql="select adv_amt, exch_rate from receipt WHERE tran_id = ? ";
sql="select adv_amt, exch_rate,chq_amt from receipt WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId );
rs = pstmt.executeQuery();
......@@ -131,6 +131,7 @@ public class ReceiptAdvPostSave extends ValidatorEJB implements ReceiptAdvPostSa
{
advAmtHdr = rs.getDouble(1);
exchRateHdr = rs.getDouble(2);
chqAmtActual = rs.getDouble(3);
}
rs.close();
rs = null;
......@@ -211,6 +212,23 @@ public class ReceiptAdvPostSave extends ValidatorEJB implements ReceiptAdvPostSa
pstmt = null;
//}
// 21/03/14 manoharan update advance
if (chqAmtActual != 0)
{
sql="UPDATE receipt SET adv_amt = chq_amt - ((case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) - ? + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) WHERE tran_id = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,bdAmt );
pstmt.setString(2,tranId );
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
if( cnt > 0)
{
System.out.println("update successfully ["+cnt+"]");
}
}
// - (case when bill_disc_amt is null then 0 else bill_disc_amt end) removed on 21/01/14
//change done by kunal on 01/feb/14 minus bill_disc_amt
......
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