Commit 988c2c48 authored by manohar's avatar manohar

This commit was generated by cvs2svn to compensate for changes in r48, which

included commits to RCS files with non-trunk default branches.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91113 ce508802-f39f-4f6c-b175-0d175dae99d5
parent bbf95c8c
/********************************************************
Title : SOrderFormPostsaveEJB
Date : 19/03/2009
Author: pankaj singh
********************************************************/
package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Connection;
import java.util.Date;
import javax.ejb.CreateException;
import java.text.SimpleDateFormat;
import java.sql.Timestamp;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.ejb.Stateless;
@Stateless
public class SRetPostSave extends ValidatorEJB implements SRetPostSaveLocal, SRetPostSaveRemote
{
public String postSave() throws RemoteException,ITMException
{
return "";
}
public String postSaveRec() throws RemoteException, ITMException
{
return "";
}
public String postSaveRec(String xmlString1, String domId, String objContext, String editFlag, String xtraParams, Connection conn) throws RemoteException, ITMException
{
return "";
}
public String postSave(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException
{
String sql = "";
GenericUtility genericUtility = GenericUtility.getInstance();
PreparedStatement pstmt = null;
ResultSet rs = null;
double taxAmtHdr = 0.0, netAmtHdr = 0.0, effNetAmtHdr = 0.0,adjAmtHdr = 0.0;
try
{
sql = "update sreturndet set "
+ " net_amt = (quantity__stduom * rate__stduom) - ( (quantity__stduom * rate__stduom * discount) / 100) + tax_amt,"
+ " eff_net_amt = ( case when ret_rep_flag = 'R' then (quantity__stduom * rate__stduom) - ( (quantity__stduom * rate__stduom * discount) / 100) + tax_amt else (-1 * ((quantity__stduom * rate__stduom) - ( (quantity__stduom * rate__stduom * discount) / 100) + tax_amt)) end )"
+ " 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(net_amt), sum(tax_amt),sum(eff_net_amt) "
+ " from sreturndet where tran_id = ? ";
pstmt= conn.prepareStatement(sql);
//System.out.println("Second sql ["+sql + "]");
pstmt.setString( 1, tranId );
rs = pstmt.executeQuery();
if (rs.next())
{
netAmtHdr = rs.getDouble(1);
taxAmtHdr = rs.getDouble(2);
effNetAmtHdr = rs.getDouble(3);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select sum(adj_amt) "
+ " from sreturn_inv where tran_id = ? ";
pstmt= conn.prepareStatement(sql);
//System.out.println("Third sql ["+sql + "]");
pstmt.setString( 1, tranId );
rs = pstmt.executeQuery();
if (rs.next())
{
adjAmtHdr = rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = " update sreturn set "
+ " net_amt = ?, tax_amt = ?, eff_net_amt = ?, adj_amount = ? "
+ " where tran_id = ? " ;
pstmt= conn.prepareStatement( sql );
//System.out.println("Fourth sql ["+sql + "]");
pstmt.setDouble( 1, netAmtHdr );
pstmt.setDouble( 2, taxAmtHdr );
pstmt.setDouble( 3, effNetAmtHdr );
pstmt.setDouble( 4, adjAmtHdr );
pstmt.setString( 5, 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 "";
}
}// END OF MAIN CLASS
\ No newline at end of file
/* This file is Cteated it incorporate the Pre Save logic from Window
* Gulzar 11/09/06
*/
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.sql.Connection;
import javax.ejb.Local;
@Local
public interface SRetPostSaveLocal extends ValidatorLocal
{
public String postSaveRec()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;
}
\ No newline at end of file
/* This file is Cteated it incorporate the Pre Save logic from Window
* Gulzar 11/09/06
*/
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.sql.Connection;
import javax.ejb.Remote;
@Remote
public interface SRetPostSaveRemote extends ValidatorRemote
{
public String postSaveRec()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;
}
\ 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