Commit 73a5b9f2 authored by kgaikwad's avatar kgaikwad

Voucher -postsave in case of vouch_type = 'A' not to update the adv_amt in header

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@201939 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e4ef8969
......@@ -36,7 +36,7 @@ public class VoucherPostSave extends ValidatorEJB implements VoucherPostSaveLoca
String tranId = "";
String sql = null, sql2 = null;
String voucherType= "";//declare by kailas gaikwad on 7 june 2019
double diffAmtExch = 0, adjAmt = 0, netAmt = 0, netAmtBc = 0, vouchAmt = 0, billAmt = 0, taxAmt = 0, totAmt = 0;
double netAmtRcp = 0, advAmt = 0, netAmtDet = 0, netAmtBcRcp = 0, taxAmtDet = 0, totAmtDet = 0, netAmtBcDet = 0 ;
double vouchAvdTaxAmt=0;
......@@ -65,7 +65,8 @@ public class VoucherPostSave extends ValidatorEJB implements VoucherPostSaveLoca
pstmt.close();
pstmt = null;
sql="select coalesce(sum(tot_amt),0) + coalesce(sum(adv_amt),0), coalesce(sum(net_amt),0) * coalesce(sum(exch_rate),0) from voucher WHERE tran_id = ? " ;
//sql="select coalesce(sum(tot_amt),0) + coalesce(sum(adv_amt),0), coalesce(sum(net_amt),0) * coalesce(sum(exch_rate),0) from voucher WHERE tran_id = ? " ;
sql = "select coalesce(tot_amt,0) + coalesce(adv_amt,0), coalesce(net_amt,0) * coalesce(exch_rate,0), vouch_type from voucher WHERE tran_id = ? "; //added by kailas gaikwad on 7 june 2019
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId );
rs = pstmt.executeQuery();
......@@ -73,6 +74,7 @@ public class VoucherPostSave extends ValidatorEJB implements VoucherPostSaveLoca
{
netAmt = rs.getDouble(1);
netAmtBc = rs.getDouble(2);
voucherType=rs.getString(3);// added by kailas gaikwad on 7 june 2019
}
rs.close();
rs = null;
......@@ -81,9 +83,11 @@ public class VoucherPostSave extends ValidatorEJB implements VoucherPostSaveLoca
System.out.println("In netAmtBc = "+netAmtBc);
if(!"A".equals(voucherType)) // added condition by kailas gaikwad on 7 june 2019
{
sql="UPDATE voucher set adv_amt = ?, diff_amt__exch = ?, net_amt = ? , net_amt__bc = ? WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,adjAmt );
pstmt.setDouble(1,advAmt);
pstmt.setDouble(2,diffAmtExch );
pstmt.setDouble(3,netAmt );
pstmt.setDouble(4,netAmtBc );
......@@ -96,6 +100,27 @@ public class VoucherPostSave extends ValidatorEJB implements VoucherPostSaveLoca
{
System.out.println("update of advance Screen success ["+cnt+"]");
}
System.out.println("voucher type "+voucherType);
System.out.println("advance amount "+advAmt);
}
else
{
sql="UPDATE voucher set diff_amt__exch = ?, net_amt = ? , net_amt__bc = ? WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,diffAmtExch );
pstmt.setDouble(2,netAmt );
pstmt.setDouble(3,netAmtBc );
pstmt.setString(4,tranId );
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
if( cnt > 0)
{
System.out.println("update of advance Screen success ["+cnt+"]");
}
System.out.println("voucher type "+voucherType);
}
// End Of advance Screen cross Update
//Receipt Screen Cross Update
......@@ -221,7 +246,7 @@ public class VoucherPostSave extends ValidatorEJB implements VoucherPostSaveLoca
pstmt.close();
pstmt = null;
//System.out.println("taxAmtDet ====>>>>> "+taxAmtDet);
//System.out.println("taxAmtDet ====>>>>> "+taxAm01PAD0003tDet);
//System.out.println("advAmt ====>>>>> "+advAmt);
sql="select coalesce((bill_amt + ?),0), coalesce((coalesce((bill_amt + ?),0) + ?),0), coalesce((coalesce((bill_amt + ?),0) + ?),0) * coalesce(exch_rate,0) from voucher WHERE tran_id = ? " ;
......@@ -244,7 +269,8 @@ public class VoucherPostSave extends ValidatorEJB implements VoucherPostSaveLoca
pstmt.close();
pstmt = null;
if(!"A".equals(voucherType)) // condition added by kailas gaikwad on 7 june 2019
{
sql="UPDATE voucher set adv_amt = ?, tax_amt = ?, tot_amt = ?, net_amt = ?, net_amt__bc = ? WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,advAmt );
......@@ -261,7 +287,29 @@ public class VoucherPostSave extends ValidatorEJB implements VoucherPostSaveLoca
{
System.out.println("update of Detail Screen success ["+cnt+"]");
}
System.out.println("voucher type "+voucherType);
System.out.println("advance amount "+advAmt);
}
else
{
sql="UPDATE voucher set tax_amt = ?, tot_amt = ?, net_amt = ?, net_amt__bc = ? WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,taxAmtDet+vouchAvdTaxAmt);
pstmt.setDouble(2,totAmtDet+vouchAvdTaxAmt);
pstmt.setDouble(3,netAmtDet+vouchAvdTaxAmt);
pstmt.setDouble(4,netAmtBcDet+vouchAvdTaxAmt);
pstmt.setString(5,tranId);
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
if( cnt > 0)
{
System.out.println("update of Detail Screen success ["+cnt+"]");
}
System.out.println("voucher type "+voucherType);
}
// End of Cross update of Detail Screen
}
......
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