Commit 0325ddd4 authored by ngadkari's avatar ngadkari

added component for reconcile button

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205560 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 21da98d7
package ibase.webitm.ejb.fin.adv;
import java.rmi.RemoteException;
import java.util.*;
import java.sql.*;
import org.w3c.dom.*;
import javax.ejb.*;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import javax.ejb.Stateless;
@Stateless
public class BankStatRecoAct extends ActionHandlerEJB
{
public String actionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException {
String retString = "";
try {
retString = actReco(tranId, xtraParams);
} catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return retString;
}
public String actReco(String tranId,String xtraParams) throws ITMException
{
Connection conn = null;
String retString = "", errString = "", sql = "",status="";
PreparedStatement pstmt = null;
ResultSet rs = null;
double adjAmt=0;
int updCnt=0;
ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
try
{
conn = getConnection();
sql = "SELECT STATUS FROM BANK_STATEMENT WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs=pstmt.executeQuery();
if(rs.next())
{
status=checkNull(rs.getString(1));
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
if("R".equalsIgnoreCase(status))
{
retString=itmDBAccess.getErrorString("", "VTEPYREV03", "", "", conn);
}
else
{
sql = "UPDATE BANK_STATEMENT SET STATUS = ?, AMT_ADJ = AMOUNT ,STAT_DATE = sysdate WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,"R");
pstmt.setString(2, tranId);
updCnt = pstmt.executeUpdate();
System.out.println("updCnt. . ."+updCnt);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(updCnt > 0)
{
retString=itmDBAccess.getErrorString("", "VTRECOSUC", "", "", conn);
}
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try {
if(retString.indexOf("VTRECOSUC") > -1)
{
conn.commit();
System.out.println("Connection Committed. . .");
}
else
{
conn.rollback();
System.out.println("Connection Rollback. . .");
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
throw new ITMException(e);
}
}
return retString;
}
private String checkNull(String str)
{
if(str == null)
{
return "";
}
else
{
return str ;
}
}
}
\ 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