Commit b2afc2bd authored by kmandhre's avatar kmandhre

cross update implement


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93349 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 316f1dc2
......@@ -81,6 +81,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
int detailListLength = 0,currDetailListLength = 0;
String qtyStduomStr = "",updateStatus = "",nodeName = "",tranId = "";
Connection conn1 = null;
try
{
stmt = conn.createStatement();
......@@ -456,6 +457,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
System.out.println("Updated the no of records : updateCnt :"+updateCnt);
pstmt.clearParameters();
}
}//try end
catch (SQLException sqx)
{
......@@ -494,6 +496,117 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
}
return "";
}
//postSave() added by kunal on 11/07/13 FOR cross update
public String postSave(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException
{
String sql = "",saleOrder = "";
int lineNo = 0;
double grossWeight = 0,tareWeight = 0,netWeight = 0,noAart = 0,offinvAmt = 0,billbackAmt = 0 ;
double quantityStduom = 0 ,rateStduom = 0,offinvAmtDet = 0,taxAmtDet = 0 ,discount = 0,totAmt = 0,amount = 0;
//GenericUtility genericUtility = GenericUtility.getInstance();
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null;
//System.out.println("tranId="+tranId+" xtraParams="+xtraParams);
try
{
sql = " select sord_no,line_no__sord ,quantity__stduom,rate__stduom ,disc_schem_offinv_amt,tax_amt from despatchdet where desp_id = ? ";
pstmt1= conn.prepareStatement(sql);
pstmt1.setString( 1, tranId );
rs1 = pstmt1.executeQuery();
while (rs1.next())
{
saleOrder = rs1.getString("sord_no");
lineNo = rs1.getInt("line_no__sord");
quantityStduom = rs1.getDouble("quantity__stduom");
rateStduom = rs1.getDouble("rate__stduom");
offinvAmtDet = rs1.getDouble("disc_schem_offinv_amt");
taxAmtDet = rs1.getDouble("tax_amt");
sql = " select discount from sorddet where sale_order = ? and line_no = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString( 1, saleOrder );
pstmt.setInt( 2, lineNo );
rs = pstmt.executeQuery();
if (rs.next())
{
discount = rs.getDouble("discount");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//[(quantity__stduom*rate__stduom)-((quantity__stduom*rate__stduom*discount)/100)-disc_schem_offinv_amt+tax_amt]
amount = (quantityStduom*rateStduom) - ((quantityStduom*rateStduom*discount)/100) - offinvAmtDet + taxAmtDet;
System.out.println("amount="+amount);
totAmt = totAmt + amount;
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
System.out.println("tot amt = "+totAmt);
sql = "select sum(gross_weight),sum(tare_weight) ,sum(nett_weight) ,sum(no_art) ,sum(disc_schem_offinv_amt) ,sum(disc_schem_billback_amt) "
+" from despatchdet where desp_id = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString( 1, tranId );
rs = pstmt.executeQuery();
if (rs.next())
{
grossWeight = rs.getDouble(1);
tareWeight = rs.getDouble(2);
netWeight = rs.getDouble(3);
noAart = rs.getDouble(4);
offinvAmt = rs.getDouble(5);
billbackAmt = rs.getDouble(6);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("sum ="+grossWeight+" "+tareWeight+" "+netWeight+" "+noAart+" "+offinvAmt+" "+billbackAmt);
sql = " update despatch set gross_weight = ? , tare_weight = ?,nett_weight = ?,no_art = ?, "
+" disc_offinv_amt_det = ?, disc_billback_amt_det = ? ,tot_value = ? where desp_id = ? " ;
pstmt= conn.prepareStatement( sql );
pstmt.setDouble( 1, grossWeight );
pstmt.setDouble( 2, tareWeight );
pstmt.setDouble( 3, netWeight );
pstmt.setDouble( 4, noAart );
pstmt.setDouble( 5, offinvAmt );
pstmt.setDouble( 6, billbackAmt );
pstmt.setDouble( 7, totAmt );
pstmt.setString( 8, tranId );
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(pstmt != null)pstmt.close();
pstmt = null;
}catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}
return "";
}
private Node getCurrentDetailFromDom(Document dom,String domId)
{
......
......@@ -16,4 +16,6 @@ public interface DespatchPosLocal extends ValidatorLocal
{
public String postSaveRec()throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException;
//added by kunal on 09/007/13
public String postSave(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException;
}
\ No newline at end of file
......@@ -14,4 +14,6 @@ public interface DespatchPosRemote extends ValidatorRemote
{
public String postSaveRec()throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException;
//added by kunal on 09/007/13
public String postSave(String winName,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