Commit 17bfa083 authored by vkadam's avatar vkadam

Change update 'sql' to 'sql1'


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98420 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8910df17
...@@ -43,9 +43,7 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave ...@@ -43,9 +43,7 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
throw new ITMException(e); throw new ITMException(e);
} }
return errString; return errString;
} }
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 SaleOrderPostSave postSave tran_id---->>["+tranId+"]"); System.out.println("in SaleOrderPostSave postSave tran_id---->>["+tranId+"]");
...@@ -56,7 +54,8 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave ...@@ -56,7 +54,8 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
ordAmtH=0,ordValueH=0,ordValue=0,totOrdValueH=0, ordAmtH=0,ordValueH=0,ordValue=0,totOrdValueH=0,
billBackAmt=0,offInvAmt=0,netTotAmtDet=0,netTotAmtHdr=0,ordBillBackAmt=0,ordOffInvAmt=0,lineBillBackAmt=0,lineOffInvAmt=0; billBackAmt=0,offInvAmt=0,netTotAmtDet=0,netTotAmtHdr=0,ordBillBackAmt=0,ordOffInvAmt=0,lineBillBackAmt=0,lineOffInvAmt=0;
int count=0,lineNo=0; int count=0,lineNo=0;
try{ try
{
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
tranId = GenericUtility.getInstance().getColumnValue("sale_order",dom); tranId = GenericUtility.getInstance().getColumnValue("sale_order",dom);
...@@ -67,7 +66,8 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave ...@@ -67,7 +66,8 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
while(rs.next()){ while(rs.next())
{
quantityStduom=rs.getDouble(1); quantityStduom=rs.getDouble(1);
rateStduom=rs.getDouble(2); rateStduom=rs.getDouble(2);
discount=rs.getDouble(3); discount=rs.getDouble(3);
...@@ -86,11 +86,11 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave ...@@ -86,11 +86,11 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
/** /**
* VALLABH KADAM [20/JUL/15] * VALLABH KADAM [20/JUL/15]
* Calculate net_tot_det * Calculate net_tot_amt
* for every detail * for every detail
* */ * */
netTotAmtDet=netAmt-billBackAmt-offInvAmt; netTotAmtDet=netAmt-billBackAmt-offInvAmt;
System.out.println("Nte Total Amt:- ["+netTotAmtDet+"]"); System.out.println("Nte Total Amt Det:- ["+netTotAmtDet+"]");
sql1="update sorddet set net_amt = ?,net_tot_amt=? where sale_order = ? and line_no = ?"; sql1="update sorddet set net_amt = ?,net_tot_amt=? where sale_order = ? and line_no = ?";
pstmt1=conn.prepareStatement(sql1); pstmt1=conn.prepareStatement(sql1);
...@@ -107,15 +107,15 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave ...@@ -107,15 +107,15 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
taxAmtH=taxAmtH + taxAmt; taxAmtH=taxAmtH + taxAmt;
totAmtH=totAmtH + netAmt; totAmtH=totAmtH + netAmt;
totOrdValueH=totOrdValueH + ordValue; totOrdValueH=totOrdValueH + ordValue;
} //end while } //end while
if (pstmt != null){ if (pstmt != null)
{
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
} }
if (rs !=null){ if (rs !=null)
{
rs.close(); rs.close();
rs=null; rs=null;
} }
...@@ -127,27 +127,29 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave ...@@ -127,27 +127,29 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
/** /**
* VALLABH KADAM [20/JUL/15] * VALLABH KADAM [20/JUL/15]
* find ord_billback_amt, ord_offinv_amt, line_billback_amt, line_offinv_amt * find ord_billback_amt, ord_offinv_amt, line_billback_amt, line_offinv_amt
* to calculate net_tot_amt * to calculate net_tot_amt for header
* */ * */
sql="SELECT ORD_BILLBACK_AMT,ORD_OFFINV_AMT, LINE_BILLBACK_AMT,LINE_OFFINV_AMT FROM SORDER WHERE SALE_ORDER=?"; sql1="SELECT ORD_BILLBACK_AMT,ORD_OFFINV_AMT, LINE_BILLBACK_AMT,LINE_OFFINV_AMT FROM SORDER WHERE SALE_ORDER=?";
pstmt=conn.prepareStatement(sql1); pstmt1=conn.prepareStatement(sql1);
pstmt.setString(1, tranId); pstmt1.setString(1, tranId);
rs=pstmt.executeQuery(); rs1=pstmt1.executeQuery();
if(rs.next()) if(rs1.next())
{ {
ordBillBackAmt=rs.getDouble("ORD_BILLBACK_AMT"); ordBillBackAmt=rs1.getDouble("ORD_BILLBACK_AMT");
ordOffInvAmt=rs.getDouble("ORD_OFFINV_AMT"); ordOffInvAmt=rs1.getDouble("ORD_OFFINV_AMT");
lineBillBackAmt=rs.getDouble("LINE_BILLBACK_AMT"); lineBillBackAmt=rs1.getDouble("LINE_BILLBACK_AMT");
lineOffInvAmt=rs.getDouble("LINE_OFFINV_AMT"); lineOffInvAmt=rs1.getDouble("LINE_OFFINV_AMT");
} }
pstmt.close(); pstmt1.close();
pstmt=null; pstmt1=null;
rs.close(); rs1.close();
rs=null; rs1=null;
netTotAmtHdr=totAmtH-ordBillBackAmt-ordOffInvAmt-lineBillBackAmt-lineOffInvAmt; netTotAmtHdr=totAmtH-ordBillBackAmt-ordOffInvAmt-lineBillBackAmt-lineOffInvAmt;
System.out.println("Net Tot Amt Hdr :- ["+netTotAmtHdr+"]");
if(count >0){ if(count >0)
{
sql="update sorder set tax_amt = ? ,tot_amt= ? ,ord_amt = ?,tot_ord_value= ?,net_tot_amt=? where sale_order = ?"; sql="update sorder set tax_amt = ? ,tot_amt= ? ,ord_amt = ?,tot_ord_value= ?,net_tot_amt=? where sale_order = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1, taxAmtH); pstmt.setDouble(1, taxAmtH);
...@@ -158,21 +160,25 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave ...@@ -158,21 +160,25 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
pstmt.setString(6, tranId); pstmt.setString(6, tranId);
count=pstmt.executeUpdate(); count=pstmt.executeUpdate();
System.out.println("post count---->>["+count+"]"); System.out.println("post count---->>["+count+"]");
if(count >0 ){ if(count >0 )
{
conn.commit(); conn.commit();
} }
}else{ }else
{
conn.rollback(); conn.rollback();
} }
} }
catch(Exception e){ catch(Exception e)
{
System.out.println("Exception : SaleOrderPostSave -->["+e.getMessage()+"]"); System.out.println("Exception : SaleOrderPostSave -->["+e.getMessage()+"]");
e.printStackTrace(); e.printStackTrace();
try{ try
{
conn.rollback(); conn.rollback();
}catch(Exception e1){ }
catch(Exception e1)
{
System.out.println("Exception while rollbacking transaction...."); System.out.println("Exception while rollbacking transaction....");
e1.printStackTrace(); e1.printStackTrace();
} }
......
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