Commit 9b765b28 authored by dsawant's avatar dsawant

updated new method in post save


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96314 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 78edd1f9
...@@ -153,4 +153,148 @@ public class DissIssuePosSave extends ValidatorEJB implements DissIssuePosSave ...@@ -153,4 +153,148 @@ public class DissIssuePosSave extends ValidatorEJB implements DissIssuePosSave
return ""; return "";
} }
public String postSaveCall(String xmlString,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException
{
String sql = "",shipmentId = "";
GenericUtility genericUtility = GenericUtility.getInstance();
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isLocalConn = false;
double amount = 0,netAmount=0,discAmount=0,taxAmount=0,noArt = 0; //net_amt =amount+tax_amt-disc_amt
double grossWeight = 0 ,tareWeight = 0 , netWeight = 0;
try
{
conn = null;
if(conn == null){
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver= null;
isLocalConn = true;
}
conn.setAutoCommit(false);
sql = "update distord_issdet set "
+" amount = quantity * rate , "
+" disc_amt = quantity * rate * discount/100 , "
+ " net_amt = quantity * rate + tax_amt - (quantity * rate * discount/100 ) "
+ " where tran_id = ? ";
pstmt= conn.prepareStatement(sql);
//System.out.println("First sql ["+ sql + "] tranId [" + tranId + "]");
pstmt.setString( 1, tranId );
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
sql = "select sum(amount), sum(net_amt),sum(disc_amt),sum(tax_amt),sum(no_art) , sum(gross_weight) ,sum (tare_weight) , sum(net_weight ) "
+ " from distord_issdet where tran_id = ? ";
pstmt= conn.prepareStatement(sql);
//System.out.println("Second sql ["+sql + "]");
pstmt.setString( 1, tranId );
rs = pstmt.executeQuery();
if (rs.next())
{
amount = rs.getDouble(1);
netAmount = rs.getDouble(2);
discAmount = rs.getDouble(3);
taxAmount = rs.getDouble(4);
noArt = rs.getDouble(5);
//added by kunal on 06/AUG/13
grossWeight = rs.getDouble(6);
tareWeight = rs.getDouble(7);
netWeight = rs.getDouble(8);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//added by kunal on 06/AUG/13
sql = "select shipment_id from distord_iss where tran_id = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString( 1, tranId );
rs = pstmt.executeQuery();
if (rs.next())
{
shipmentId = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(shipmentId != null && shipmentId.trim().length() > 0)
{
grossWeight = 0;
tareWeight = 0;
netWeight = 0;
}
sql = " update distord_iss set "
+ " amount = ?, net_amt = ?, discount = ? , tax_amt = ? , no_art = ? ,gross_weight = ? , tare_weight = ? , net_weight = ? "
+ " where tran_id = ? " ;
pstmt= conn.prepareStatement( sql );
//System.out.println("Fourth sql ["+sql + "]");
pstmt.setDouble( 1, amount );
pstmt.setDouble( 2, netAmount );
pstmt.setDouble( 3, discAmount );
pstmt.setDouble( 4, taxAmount );
pstmt.setDouble( 5, noArt );
pstmt.setDouble( 6, grossWeight );////added by kunal on 06/AUG/13
pstmt.setDouble( 7, tareWeight );//added by kunal on 06/AUG/13
pstmt.setDouble( 8, netWeight );//added by kunal on 06/AUG/13
pstmt.setString( 9, tranId );
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
try {
conn.rollback();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(isLocalConn){
if(conn != null)
{
conn.commit();
conn.close();
conn = null;
}
}
if(pstmt != null)pstmt.close();
pstmt = null;
}catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}
return "";
}
}// end of DissIssuePosSaveEJB class }// end of DissIssuePosSaveEJB class
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
//import javax.ejb.EJBObject; //import javax.ejb.EJBObject;
import java.sql.Connection; import java.sql.Connection;
import ibase.webitm.ejb.ValidatorLocal; import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Local; import javax.ejb.Local;
@Local @Local
public interface DissIssuePosSaveLocal extends ValidatorLocal //, EJBObject public interface DissIssuePosSaveLocal extends ValidatorLocal //, EJBObject
{ {
public String postSave(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException; public String postSave(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException; public String postSaveRec(String xmlString1,String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException;
public String postSaveCall(String xmlString,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException;
} }
\ No newline at end of file
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
//import javax.ejb.EJBObject; //import javax.ejb.EJBObject;
import java.sql.Connection; import java.sql.Connection;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; import ibase.webitm.utility.ITMException;
@Remote import javax.ejb.Remote;
@Remote
public interface DissIssuePosSaveRemote extends ValidatorRemote //, EJBObject
{
public String postSave(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException; public interface DissIssuePosSaveRemote extends ValidatorRemote //, EJBObject
public String postSaveRec(String xmlString1,String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException; {
public String postSave(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException;
public String postSaveCall(String xmlString,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException;
} }
\ No newline at end of file
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