Commit 477c8c27 authored by caluka's avatar caluka

postSave is written for detail sum of amount is updated in header screen


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98652 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 72f53ebd
package ibase.webitm.ejb.fin;
import org.w3c.dom.Document;
import ibase.utility.CommonConstants;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import javax.ejb.Stateless;
@Stateless
public class EcollectionPostSave extends ValidatorEJB implements EcollectionPostSaveLocal,EcollectionPostSaveRemote {
public String postSave(String xmlString,String tranId,String editFlag, String xtraParams,Connection conn) throws RemoteException,ITMException
{
System.out.println("------------ postSave method called-----------------EcollectionPostSave : ");
System.out.println("tranId111--->>["+tranId+"]");
System.out.println("xml String--->>["+xmlString+"]");
Document dom = null;
String errString="";
try
{
if (xmlString != null && xmlString.trim().length() > 0)
{
dom = parseString(xmlString);
errString = postSave(dom,tranId,xtraParams,conn);
}
}
catch(Exception e)
{
System.out.println("Exception : EcollectionPostSave.java : postSave : ==>\n"+e.getMessage());
throw new ITMException(e);
}
return errString;
}
public String postSave(Document dom,String tranId,String xtraParams,Connection conn)
{
System.out.println("in EcollectionPostSave tran_id---->>["+tranId+"]");
ResultSet rs=null;
PreparedStatement pstmt=null;
String sql="",errorString="";
double rcpamt=0;
double rcpamtSum=0;
int count=0;
try
{
GenericUtility genericUtility = GenericUtility.getInstance();
tranId = GenericUtility.getInstance().getColumnValue("tran_id",dom);
System.out.println("tranId--->>["+tranId+"]");
sql = "SELECT rcp_amt FROM RCPDET_FORM WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while( rs.next() )
{
count++;
rcpamt=rs.getDouble(1);
rcpamtSum=rcpamtSum+rcpamt;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("rcpamtSum>>>>>>>>"+rcpamtSum);
System.out.println("count>>>>>>>>"+count);
if(count >0)
{
sql="update receipt_form set chq_amt = ? where tran_id = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1, rcpamtSum);
pstmt.setString(2, tranId);
count=pstmt.executeUpdate();
System.out.println("post count---->>["+count+"]");
if(count >0 )
{
conn.commit();
}
}else
{
conn.rollback();
}
}
catch(Exception e)
{
System.out.println("Exception : EcollectionPostSave -->["+e.getMessage()+"]");
e.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception while rollbacking transaction....");
e1.printStackTrace();
}
}
return errorString;
}
}
package ibase.webitm.ejb.fin;
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 EcollectionPostSaveLocal extends ValidatorLocal {
public String postSave(String xmlString,String tranId,String editFlag, String xtraParams,Connection conn) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
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 EcollectionPostSaveRemote extends ValidatorRemote {
public String postSave(String xmlString,String tranId,String editFlag, String xtraParams,Connection conn) throws RemoteException,ITMException;
}
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