Commit cf9a976f authored by prane's avatar prane

cusrsor and statement closed and nulled for multitenancy

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@195720 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9bce30de
......@@ -2,6 +2,7 @@ package ibase.webitm.ejb.dis;
import org.w3c.dom.Document;
import ibase.utility.BaseLogger;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
......@@ -25,9 +26,10 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
public String postSave(String xmlString,String tranId,String editFlag, String xtraParams,Connection conn) throws RemoteException,ITMException
{
System.out.println("------------ postSave method called-----------------POrderPostSave : ");
System.out.println("tranId111--->>["+tranId+"]");
System.out.println("xml String--->>["+xmlString+"]");
//System.out.println("------------ postSave method called-----------------POrderPostSave : ");
BaseLogger.log("9", null, null, "inside postSave method called--tranId["+tranId+"]xmlString["+xmlString+"]");
//System.out.println("tranId111--->>["+tranId+"]");
//System.out.println("xml String--->>["+xmlString+"]");
Document dom = null;
String errString="";
......@@ -42,7 +44,8 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
}
catch(Exception e)
{
System.out.println("Exception : POrderPostSave.java : postSave : ==>\n"+e.getMessage());
//System.out.println("Exception : POrderPostSave.java : postSave : ==>\n"+e.getMessage());
BaseLogger.log("0", null, null, "Exception : POrderPostSave : postSave : ==>\n"+e.getMessage());
throw new ITMException(e);
}
return errString;
......@@ -68,7 +71,8 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
try{
//GenericUtility genericUtility = GenericUtility.getInstance();
tranId = genericUtility.getColumnValue("purc_order",dom);
System.out.println("purc_order--->>["+tranId+"]");
//System.out.println("purc_order--->>["+tranId+"]");
BaseLogger.log("9", null, null, "purc_order--->>["+tranId+"]");
sql = "Select Quantity__Stduom,Rate__Stduom,Discount,Tax_Amt,line_no from porddet where purc_order = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
......@@ -81,37 +85,41 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
taxAmt = rs.getDouble(4);
lineNo = rs.getInt(5);
System.out.println("QuantityStduom>>>>>>> [" +quantityStduom +"]");
System.out.println("Rate_Stduom>>>>>>>>>>>> [" + rateStduom +"]");
System.out.println("Discount >>>>>>>>>>>>>>>>>> [" + discount +"]");
System.out.println("TaxAmt>>>>>>>>>>>>>>>>> [" +taxAmt +"]" );
//System.out.println("QuantityStduom>>>>>>> [" +quantityStduom +"]");
//System.out.println("Rate_Stduom>>>>>>>>>>>> [" + rateStduom +"]");
//System.out.println("Discount >>>>>>>>>>>>>>>>>> [" + discount +"]");
//System.out.println("TaxAmt>>>>>>>>>>>>>>>>> [" +taxAmt +"]" );
BaseLogger.log("9", null, null, "QuantityStduom[" +quantityStduom +"] Rate_Stduom["+rateStduom+"] Discount["+discount+"] taxAmt["+taxAmt+"]");
totAmtDet= (quantityStduom * rateStduom)-((quantityStduom * rateStduom * discount)/100) + taxAmt;
System.out.println("totamtdet>>>>>>>>>>>>>>>>> [" +totAmtDet +"]" );
//System.out.println("totamtdet>>>>>>>>>>>>>>>>> [" +totAmtDet +"]" );
BaseLogger.log("9", null, null, "totamtdet["+totAmtDet+"]");
sql1 ="update porddet set tot_amt = ? where purc_order = ? and line_no = ?";
pstmt1 =conn.prepareStatement(sql1);
pstmt1.setDouble(1,totAmtDet);
pstmt1.setString(2,tranId);
pstmt1.setInt(3,lineNo);
count = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;//[pstmt closed and nulled by Pavan R]
}
if (rs !=null)
{
rs.close();
rs=null;
}
if (pstmt != null)
{
pstmt.close();
pstmt=null;
}
if(pstmt1 != null)
/*if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if (rs !=null)
{
rs.close();
rs=null;
}
}*/
sql = "select sum(tax_amt),sum(tot_amt),sum(quantity) from porddet where purc_order =? ";
pstmt = conn.prepareStatement(sql);
......@@ -124,10 +132,10 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
quantity = rs.getDouble(3);
}
System.out.println("taxAMthdr>>>>>>>>>>>>>>>>>>> " + taxAmtHdr);
System.out.println("TotalAmtheader!!!!!!!!!!!!!! " + totAmtHdr );
System.out.println("Quantity@@@@@@@@@@@@@@@@@@@ " + quantity);
//System.out.println("taxAMthdr>>>>>>>>>>>>>>>>>>> " + taxAmtHdr);
//System.out.println("TotalAmtheader!!!!!!!!!!!!!! " + totAmtHdr );
//System.out.println("Quantity@@@@@@@@@@@@@@@@@@@ " + quantity);
BaseLogger.log("9", null, null, "taxAMthdr["+taxAmtHdr+"]totAmtHdr["+totAmtHdr+"]quantity["+quantity+"]");
ordAmtHdr = totAmtHdr - taxAmtHdr;
/*sql1 ="select frt_rate,frt_type ,frt_amt__fixed from porder where purc_order = ?";
......@@ -140,7 +148,11 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
frtType = checkNull(rs1.getString(2));
frtAmtFixed = rs1.getDouble(3);
}*/
if (rs !=null)
{
rs.close();
rs=null;
}
if (pstmt != null)
{
pstmt.close();
......@@ -151,11 +163,6 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
pstmt1.close();
pstmt1 = null;
}*/
if (rs !=null)
{
rs.close();
rs=null;
}
/*if(frtType.equalsIgnoreCase("Q"))
{
frtAmtQty = frtRate * quantity;
......@@ -189,19 +196,21 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
pstmt.setDouble(5, frtAmt);*/
pstmt.setString(4, tranId);
count = pstmt.executeUpdate();
System.out.println("post count---->>["+count+"]");
//System.out.println("post count---->>["+count+"]");
if (pstmt != null)
{
pstmt.close();
pstmt=null;
}
BaseLogger.log("9", null, null, "post count---->>["+count+"]");
/*if(count >0 ){
conn.commit();
}*/
// }
//Added by sarita to provide validation on post save as total amount updated on save on 11 JUN 2018 11 JUN 2018 [START]
System.out.println("Post Save Values of ordAmt ["+ordAmtHdr+"] \t totAmt ["+totAmtHdr+"]");
//System.out.println("Post Save Values of ordAmt ["+ordAmtHdr+"] \t totAmt ["+totAmtHdr+"]");
BaseLogger.log("9", null, null, "Post Save Values of ordAmt ["+ordAmtHdr+"] \t totAmt ["+totAmtHdr+"]");
sql = "select type , amt_type , rel_amt from pord_pay_term where purc_order = ?";
pstmt = conn.prepareStatement(sql);
......@@ -215,7 +224,8 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
//relAmt = rs.getString("rel_amt");
relAmt = rs.getDouble("rel_amt");
//Changes by sarita to get relAmt as double on 20 AUG 18 [END]
System.out.println("type ["+type+"] \t amtType ["+amtType+"] \t relAmt ["+relAmt+"]");
//System.out.println("type ["+type+"] \t amtType ["+amtType+"] \t relAmt ["+relAmt+"]");
BaseLogger.log("9", null, null, "type ["+type+"] \t amtType ["+amtType+"] \t relAmt ["+relAmt+"]");
advAmt = 0;
//Commented and added by sarita on 20 AUG 18 to remove parseDouble for relAmt [START]
......@@ -241,19 +251,19 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
lcAmount = lcAmount + advAmt;
System.out.println("@@@@@@@ lcAmount[" + lcAmount
+ "] > totAmt[" + totAmtHdr + "]");
}
if (pstmt != null)
{
pstmt.close();
pstmt=null;
//System.out.println("@@@@@@@ lcAmount[" + lcAmount + "] > totAmt[" + totAmtHdr + "]");
BaseLogger.log("9", null, null, "@@@@@@@ lcAmount[" + lcAmount + "] > totAmt[" + totAmtHdr + "]");
}
if (rs != null)
{
rs.close();
rs=null;
}
if (pstmt != null)
{
pstmt.close();
pstmt=null;
}
if (lcAmount > totAmtHdr)
{
......@@ -269,15 +279,44 @@ public class POrderPostSave extends ValidatorEJB implements POrderPostSaveLocal,
}*/
}
catch(Exception e){
System.out.println("Exception : POrderPostSave -->["+e.getMessage()+"]");
//System.out.println("Exception : POrderPostSave -->["+e.getMessage()+"]");
BaseLogger.log("0", null, null, "Exception : POrderPostSave -->["+e.getMessage()+"]");
e.printStackTrace();
try{
conn.rollback();
}catch(Exception e1){
System.out.println("Exception while rollbacking transaction....");
//System.out.println("Exception while rollbacking transaction....");
BaseLogger.log("0", null, null, "Exception while rollbacking transaction....");
e1.printStackTrace();
}
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs1 != null)
{
rs1.close();
rs1 = null;
}
if (pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
}
catch(Exception e){}
}
return errorString;
}
......
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