Commit a59837f4 authored by arawankar's avatar arawankar

Changes made in PayrvoucherPos.java

-Updated total amount in header as 0.0 if detail records are not exist

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@189185 ce508802-f39f-4f6c-b175-0d175dae99d5
parent eaaa1d1f
...@@ -122,6 +122,8 @@ public class PayrVoucherPos extends ValidatorEJB implements PayrVoucherPosLocal ...@@ -122,6 +122,8 @@ public class PayrVoucherPos extends ValidatorEJB implements PayrVoucherPosLocal
} }
System.out.println("code field is"+code); System.out.println("code field is"+code);
//Modified by Anjali R. on [25/07/2018]
close(pstmt , rs);
sql = ""; sql = "";
sql = "SELECT CONFIRMED FROM PAYROLL WHERE EMP_CODE = ? AND PRD_CODE = (SELECT MAX(CODE) FROM PERIOD WHERE ACCT_PRD = ?)"; sql = "SELECT CONFIRMED FROM PAYROLL WHERE EMP_CODE = ? AND PRD_CODE = (SELECT MAX(CODE) FROM PERIOD WHERE ACCT_PRD = ?)";
...@@ -170,6 +172,54 @@ public class PayrVoucherPos extends ValidatorEJB implements PayrVoucherPosLocal ...@@ -170,6 +172,54 @@ public class PayrVoucherPos extends ValidatorEJB implements PayrVoucherPosLocal
System.out.println("Update loop 'N'"); System.out.println("Update loop 'N'");
} }
} }
//Modified by Anjali R. on [25/07/2018][To update total amount and tot amount bc from post save][Start]
double amount = 0.0;
double adjAmt = 0.0;
double totAmt = 0.0;
double totAmtBC = 0.0;
int cnt = 0;
//Get sum of amount for same tran id
sql = "select sum(amount) as amount from payr_vouchdet where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
amount = rs.getDouble("amount");
}
System.out.println("amount---["+amount+"]");
close(pstmt , rs);
//Get sum of adj_amt for same tran id
sql = "select sum(adj_amt) as adj_amount from payr_vouchadv where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
adjAmt = rs.getDouble("adj_amount");
}
System.out.println("adjAmt--["+adjAmt+"]");
close(pstmt , rs);
totAmt = amount + adjAmt;
//update in header tot_amt,tot_amt__bc
sql = "update payr_voucher set tot_amt = ?, tot_amt__bc = ? * exch_rate where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, totAmt);
pstmt.setDouble(2, totAmt);
pstmt.setString(3, tranId);
cnt = pstmt.executeUpdate();
System.out.println("Updates ["+cnt +"] rows in payr_voucher table");
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on [25/07/2018][To update total amount and tot amount bc from post save][End]
} }
catch(Exception e) catch(Exception e)
{ {
......
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