Commit 78edd1f9 authored by dpawar's avatar dpawar

added new method for despatch wizard


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96313 ce508802-f39f-4f6c-b175-0d175dae99d5
parent de5f22e7
...@@ -607,6 +607,136 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa ...@@ -607,6 +607,136 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
return ""; return "";
} }
public String postSaveWiz(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException
{
System.out.println("----------postSaveWiz method called......................."+tranId);
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;
boolean isError=false;
//System.out.println("tranId="+tranId+" xtraParams="+xtraParams);
try
{
if(conn!=null){
System.out.println("connection is not null.....................");
}
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)
{
isError=true;
e.printStackTrace();
try
{
conn.rollback();
}catch(Exception d){
d.printStackTrace();
}
throw new ITMException(e);
}
finally
{
System.out.println("in Finally------>>["+isError+"]");
try
{
if(pstmt != null)pstmt.close();
pstmt = null;
}catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
if(!isError){
try
{
conn.commit();
}
catch(Exception d){
d.printStackTrace();
}
}
}
return "";
}
private Node getCurrentDetailFromDom(Document dom,String domId) private Node getCurrentDetailFromDom(Document dom,String domId)
{ {
......
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