Commit 3196f59c authored by dpawar's avatar dpawar

added code for tax amt and bc amt


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95975 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a9a1f509
...@@ -41,22 +41,29 @@ public class MiscVchEmpPostSave extends ValidatorEJB implements MiscVchEmpPostSa ...@@ -41,22 +41,29 @@ public class MiscVchEmpPostSave extends ValidatorEJB implements MiscVchEmpPostSa
public String postSave(Document dom,String tranId,String xtraParams,Connection conn) public String postSave(Document dom,String tranId,String xtraParams,Connection conn)
{ {
System.out.println("in MiscVchEmpPostSave postSave tran_id---->>["+tranId+"]"); System.out.println("in MiscVchEmpPostSave postSave tran_id---->>["+tranId+"]");
ResultSet rs=null; ResultSet rs=null;
PreparedStatement pstmt=null; PreparedStatement pstmt=null;
String sql="",errorString=""; String sql="",errorString="",exchRateS="";
double sumAmount=0; double sumAmount=0,netAmt=0,netAmtBc=0,tatAmtBc=0,exchRate=0,taxAmt=0,totAmt=0;
int count=0; int count=0;
try{ try{
tranId = GenericUtility.getInstance().getColumnValue("tran_id",dom); tranId = GenericUtility.getInstance().getColumnValue("tran_id",dom);
exchRateS = GenericUtility.getInstance().getColumnValue("exch_rate",dom);
exchRateS=exchRateS==null ? "0" :exchRateS.trim();
System.out.println("exchRateS---->>["+exchRateS+"]");
if(exchRateS.length() > 0){
exchRate=Double.parseDouble(exchRateS);
}
System.out.println("tran_id123--->>["+tranId+"]"); System.out.println("tran_id123--->>["+tranId+"]");
sql="select sum(amount) from misc_vch_empdet where tran_id = ?"; sql="select sum(amount),sum(tax_amt) from misc_vch_empdet where tran_id = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()){ if(rs.next()){
sumAmount=rs.getDouble(1); sumAmount=rs.getDouble(1);
taxAmt=rs.getDouble(2);
} }
System.out.println("sumAmount---->>["+sumAmount+"]"); System.out.println("sumAmount---->>["+sumAmount+"]");
if (pstmt != null){ if (pstmt != null){
...@@ -67,13 +74,24 @@ public class MiscVchEmpPostSave extends ValidatorEJB implements MiscVchEmpPostSa ...@@ -67,13 +74,24 @@ public class MiscVchEmpPostSave extends ValidatorEJB implements MiscVchEmpPostSa
rs.close(); rs.close();
rs=null; rs=null;
} }
netAmt=sumAmount;
netAmtBc= netAmt * exchRate;
totAmt= netAmt + taxAmt;
tatAmtBc= totAmt * exchRate;
sql="update misc_vch_emp set total_amount = ? where tran_id = ?"; sql="update misc_vch_emp set net_amt = ? ,net_amt__bc = ?,total_amount = ?,"
+ "total_amount__bc = ? where tran_id = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1, sumAmount); pstmt.setDouble(1, netAmt);
pstmt.setString(2, tranId); pstmt.setDouble(2, netAmtBc);
pstmt.setDouble(3, totAmt);
pstmt.setDouble(4, tatAmtBc);
pstmt.setString(5, tranId);
count=pstmt.executeUpdate(); count=pstmt.executeUpdate();
System.out.println("count--->["+count+"]");
if(count > 0){ if(count > 0){
conn.commit(); conn.commit();
}else{ }else{
......
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