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
......@@ -44,8 +44,6 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
}
return errString;
}
public String postSave(Document dom,String tranId,String xtraParams,Connection conn)
{
System.out.println("in SaleOrderPostSave postSave tran_id---->>["+tranId+"]");
......@@ -56,7 +54,8 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
ordAmtH=0,ordValueH=0,ordValue=0,totOrdValueH=0,
billBackAmt=0,offInvAmt=0,netTotAmtDet=0,netTotAmtHdr=0,ordBillBackAmt=0,ordOffInvAmt=0,lineBillBackAmt=0,lineOffInvAmt=0;
int count=0,lineNo=0;
try{
try
{
GenericUtility genericUtility = GenericUtility.getInstance();
tranId = GenericUtility.getInstance().getColumnValue("sale_order",dom);
......@@ -67,7 +66,8 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs=pstmt.executeQuery();
while(rs.next()){
while(rs.next())
{
quantityStduom=rs.getDouble(1);
rateStduom=rs.getDouble(2);
discount=rs.getDouble(3);
......@@ -86,11 +86,11 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
/**
* VALLABH KADAM [20/JUL/15]
* Calculate net_tot_det
* Calculate net_tot_amt
* for every detail
* */
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 = ?";
pstmt1=conn.prepareStatement(sql1);
......@@ -108,14 +108,14 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
totAmtH=totAmtH + netAmt;
totOrdValueH=totOrdValueH + ordValue;
} //end while
if (pstmt != null){
if (pstmt != null)
{
pstmt.close();
pstmt=null;
}
if (rs !=null){
if (rs !=null)
{
rs.close();
rs=null;
}
......@@ -127,27 +127,29 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
/**
* VALLABH KADAM [20/JUL/15]
* 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=?";
pstmt=conn.prepareStatement(sql1);
pstmt.setString(1, tranId);
rs=pstmt.executeQuery();
if(rs.next())
sql1="SELECT ORD_BILLBACK_AMT,ORD_OFFINV_AMT, LINE_BILLBACK_AMT,LINE_OFFINV_AMT FROM SORDER WHERE SALE_ORDER=?";
pstmt1=conn.prepareStatement(sql1);
pstmt1.setString(1, tranId);
rs1=pstmt1.executeQuery();
if(rs1.next())
{
ordBillBackAmt=rs.getDouble("ORD_BILLBACK_AMT");
ordOffInvAmt=rs.getDouble("ORD_OFFINV_AMT");
lineBillBackAmt=rs.getDouble("LINE_BILLBACK_AMT");
lineOffInvAmt=rs.getDouble("LINE_OFFINV_AMT");
ordBillBackAmt=rs1.getDouble("ORD_BILLBACK_AMT");
ordOffInvAmt=rs1.getDouble("ORD_OFFINV_AMT");
lineBillBackAmt=rs1.getDouble("LINE_BILLBACK_AMT");
lineOffInvAmt=rs1.getDouble("LINE_OFFINV_AMT");
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
pstmt1.close();
pstmt1=null;
rs1.close();
rs1=null;
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 = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1, taxAmtH);
......@@ -158,21 +160,25 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
pstmt.setString(6, tranId);
count=pstmt.executeUpdate();
System.out.println("post count---->>["+count+"]");
if(count >0 ){
if(count >0 )
{
conn.commit();
}
}else{
}else
{
conn.rollback();
}
}
catch(Exception e){
catch(Exception e)
{
System.out.println("Exception : SaleOrderPostSave -->["+e.getMessage()+"]");
e.printStackTrace();
try{
try
{
conn.rollback();
}catch(Exception e1){
}
catch(Exception e1)
{
System.out.println("Exception while rollbacking transaction....");
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