Commit ad8c491d authored by cpatil's avatar cpatil

for workflow


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93206 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 810ed9c1
package ibase.webitm.ejb.fin;
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;
import ibase.system.config.ConnDriver;
import ibase.utility.GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.utility.ITMException;
@Stateless
public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMISCVOUCHEREJBLocal, ConfirmMISCVOUCHEREJBRemote{
//MISCVOUCHERWRKFLW
public ConfirmMISCVOUCHEREJB()
{
super();
}
public String confirm(String tranId, String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException, ITMException
{
Connection conn = null;
String retString = null;
ConnDriver connDriver = null,oConn=null;;
//oracle.jdbc.OracleConnection oConn=null;
try
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
//oConn = connDriver.getConnectDB("DriverITM");
//oConn = connDriver.getOracleConnection("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
retString = confirm( conn ,tranId, route_code , operation , prfmrCode , roleCodeAprv , xmlDataAll , prcID );
}
catch (Exception e)
{
System.out.println("Exception :ConfirmMISCVOUCHEREJB :confirm():" + e.getMessage() + ":");
e.printStackTrace();
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn =null;
}
//if(oConn != null)
//{
// oConn.close();
// oConn =null;
//}
}
catch(SQLException sqle)
{
sqle.printStackTrace();
}
}
return retString;
}
public String confirm( Connection conn , String tranId ,String route_code ,String operation , String prfmrCode , String rolecodeAprv , String xmlDataAll ,String prcID ) throws RemoteException, ITMException
{
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String confirmed = "";
//String roleCode = "";
//java.sql.Date actionDateAprv1 = null;
int cnt=0,i=0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0;
boolean amountFlag = false;
String siteCode="",acctCode="",cctrCode="",analCode="",deptCode="";
try
{
System.out.println("tranId-->["+tranId+"],prfmrCode-->["+prfmrCode+"], rolecodeAprv-->["+rolecodeAprv+"],prcID-->["+prcID+"],operation-->["+operation+"]");
sql = "select confirmed from misc_voucher where tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
rs = pStmt.executeQuery();
if (rs.next())
{
confirmed = rs.getString("confirmed");
}
rs.close();
pStmt.close();
rs = null;
pStmt = null;
if(!"Y".equalsIgnoreCase(confirmed))
{
/*
sql = "select max(line_no) from MISC_VOUCHDET WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
rs = pStmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = "select site_code from MISC_VOUCHER WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
rs = pStmt.executeQuery();
if (rs.next())
{
siteCode = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
for ( i=1; i<=cnt ; i++)
{
//FN_GET_BUDGET_AMT('VOUCH',VOUCHER.SITE_CODE,VOUCHRCP.ACCT_CODE,VOUCHRCP.CCTR_CODE,VOUCHRCP.anal_code
// ,VOUCHRCP.DEPT_CODE,'A') BUDGET_AMT_ANAL > FN_GET_CONS_AMT('VOUCH',VOUCHER.SITE_CODE,VOUCHRCP.ACCT_CODE,VOUCHRCP.CCTR_CODE,VOUCHRCP.anal_code,VOUCHRCP.DEPT_CODE,'A')
// CONSUMED_AMT_ANAL
sql = "select ACCT_CODE,CCTR_CODE,anal_code,DEPT_CODE from MISC_VOUCHDET WHERE tran_id = ? and line_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
pStmt.setString( 2, Integer.toString(i) );
rs = pStmt.executeQuery();
if (rs.next())
{
acctCode = rs.getString(1);
cctrCode = rs.getString(2);
analCode = rs.getString(3);
deptCode = rs.getString(4);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = " select FN_GET_BUDGET_AMT('VOUCH',?,?,?,?,?,'A') BUDGET_AMT_ANAL , " +
" FN_GET_CONS_AMT('VOUCH',?,?,?,?,?,'A') CONSUMED_AMT_ANAL from dual";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, siteCode );
pStmt.setString( 2, acctCode );
pStmt.setString( 3, cctrCode );
pStmt.setString( 4, analCode );
pStmt.setString( 5, deptCode );
pStmt.setString( 6, siteCode );
pStmt.setString( 7, acctCode );
pStmt.setString( 8, cctrCode );
pStmt.setString( 9, analCode );
pStmt.setString( 10, deptCode );
rs = pStmt.executeQuery();
if (rs.next())
{
budgetAmtAnal = rs.getDouble(1);
consumedAmtAnal = rs.getDouble(2);
System.out.println("i:["+i+"]:::budgetAmtAnal::["+budgetAmtAnal+"]:::::consumedAmtAnal::["+consumedAmtAnal+"]");
if( budgetAmtAnal > consumedAmtAnal )
{
amountFlag = true;
}
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
*/
//if( amountFlag==true)
{
sql = " UPDATE misc_voucher SET wf_status = ? WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, operation);
pStmt.setString(2, tranId);
int updateCnt = pStmt.executeUpdate();
if (updateCnt>0 )
{
conn.commit();
pStmt.close();
pStmt = null;
System.out.println("ConfirmMISCVOUCHEREJB] : [confirm] : ==> misc_voucher is Updated. with row(s)"+updateCnt);
}
}
}
}
catch (SQLException e)
{
try
{
conn.rollback();
}
catch (Exception e1)
{
System.out.println("Exception :[ConfirmMISCVOUCHEREJB] : [confirm]==>\n" + e1.getMessage());
}
System.out.println("Exception :[ConfirmMISCVOUCHEREJB] : [confirm]==>SQLException :==>\n" + e.getMessage());
throw new ITMException(e);
}
catch (Exception e)
{
System.out.println("Exception :[ConfirmMISCVOUCHEREJB] : [confirm]==>\n" + e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception :[ConfirmMISCVOUCHEREJB] : [confirm]==>\n" + e.getMessage());
throw new ITMException(e);
}
}
return "";
}
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
@Local
public interface ConfirmMISCVOUCHEREJBLocal extends ActionHandlerLocal{
public String confirm(String empCode, String xtraParams, String tranDate) throws RemoteException,ITMException;
public String confirm(String empCode, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException;
public String confirm(String seqNO,String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface ConfirmMISCVOUCHEREJBRemote extends ActionHandlerRemote {
public String confirm(String empCode, String xtraParams, String tranDate) throws RemoteException,ITMException;
public String confirm(String empCode, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException;
public String confirm(String seqNo,String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
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;
import ibase.system.config.ConnDriver;
import ibase.utility.GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.utility.ITMException;
@Stateless
public class ConfirmPURVOUCHEREJB extends ActionHandlerEJB implements ConfirmPURVOUCHEREJBLocal, ConfirmPURVOUCHEREJBRemote{
//MISCVOUCHERWRKFLW
public ConfirmPURVOUCHEREJB()
{
super();
}
public String confirm(String tranId, String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException, ITMException
{
Connection conn = null;
String retString = null;
ConnDriver connDriver = null,oConn=null;;
//oracle.jdbc.OracleConnection oConn=null;
try
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
//oConn = connDriver.getConnectDB("DriverITM");
//oConn = connDriver.getOracleConnection("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
retString = confirm( conn ,tranId, route_code , operation , prfmrCode , roleCodeAprv , xmlDataAll , prcID );
}
catch (Exception e)
{
System.out.println("Exception :ConfirmPURVOUCHEREJB :confirm():" + e.getMessage() + ":");
e.printStackTrace();
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn =null;
}
//if(oConn != null)
//{
// oConn.close();
// oConn =null;
//}
}
catch(SQLException sqle)
{
sqle.printStackTrace();
}
}
return retString;
}
public String confirm( Connection conn , String tranId ,String route_code ,String operation , String prfmrCode , String rolecodeAprv , String xmlDataAll ,String prcID ) throws RemoteException, ITMException
{
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String confirmed = "";
//String roleCode = "";
//java.sql.Date actionDateAprv1 = null;
int cnt=0,i=0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0;
boolean amountFlag = false;
String siteCode="",acctCode="",cctrCode="",analCode="",deptCode="";
try
{
System.out.println("tranId-->["+tranId+"],prfmrCode-->["+prfmrCode+"], rolecodeAprv-->["+rolecodeAprv+"],prcID-->["+prcID+"],operation-->["+operation+"]");
sql = "select confirmed from voucher where tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
rs = pStmt.executeQuery();
if (rs.next())
{
confirmed = rs.getString("confirmed");
}
rs.close();
pStmt.close();
rs = null;
pStmt = null;
if(!"Y".equalsIgnoreCase(confirmed))
{
/*
sql = "select max(line_no) from vouchrcp WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
rs = pStmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = "select site_code from voucher WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
rs = pStmt.executeQuery();
if (rs.next())
{
siteCode = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
for ( i=1; i<=cnt ; i++)
{
//FN_GET_BUDGET_AMT('VOUCH',VOUCHER.SITE_CODE,VOUCHRCP.ACCT_CODE,VOUCHRCP.CCTR_CODE,VOUCHRCP.anal_code
// ,VOUCHRCP.DEPT_CODE,'A') BUDGET_AMT_ANAL > FN_GET_CONS_AMT('VOUCH',VOUCHER.SITE_CODE,VOUCHRCP.ACCT_CODE,VOUCHRCP.CCTR_CODE,VOUCHRCP.anal_code,VOUCHRCP.DEPT_CODE,'A')
CONSUMED_AMT_ANAL
sql = "select ACCT_CODE,CCTR_CODE,anal_code,DEPT_CODE from vouchrcp WHERE tran_id = ? and line_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
pStmt.setString( 2, Integer.toString(i) );
rs = pStmt.executeQuery();
if (rs.next())
{
acctCode = rs.getString(1);
cctrCode = rs.getString(2);
analCode = rs.getString(3);
deptCode = rs.getString(4);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = " select FN_GET_BUDGET_AMT('VOUCH',?,?,?,?,?,'A') BUDGET_AMT_ANAL , " +
" FN_GET_CONS_AMT('VOUCH',?,?,?,?,?,'A') CONSUMED_AMT_ANAL from dual";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, siteCode );
pStmt.setString( 2, acctCode );
pStmt.setString( 3, cctrCode );
pStmt.setString( 4, analCode );
pStmt.setString( 5, deptCode );
pStmt.setString( 6, siteCode );
pStmt.setString( 7, acctCode );
pStmt.setString( 8, cctrCode );
pStmt.setString( 9, analCode );
pStmt.setString( 10, deptCode );
rs = pStmt.executeQuery();
if (rs.next())
{
budgetAmtAnal = rs.getDouble(1);
consumedAmtAnal = rs.getDouble(2);
System.out.println("i:["+i+"]:::budgetAmtAnal::["+budgetAmtAnal+"]:::::consumedAmtAnal::["+consumedAmtAnal+"]");
if( budgetAmtAnal > consumedAmtAnal )
{
amountFlag = true;
}
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
*/
// if( amountFlag==true)
{
sql = " UPDATE voucher SET wf_status = ? WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, operation);
pStmt.setString(2, tranId);
int updateCnt = pStmt.executeUpdate();
if (updateCnt>0 )
{
conn.commit();
pStmt.close();
pStmt = null;
System.out.println("ConfirmPURVOUCHEREJB] : [confirm] : ==> misc_voucher is Updated. with row(s)"+updateCnt);
}
}
}
}
catch (SQLException e)
{
try
{
conn.rollback();
}
catch (Exception e1)
{
System.out.println("Exception :[ConfirmPURVOUCHEREJB] : [confirm]==>\n" + e1.getMessage());
}
System.out.println("Exception :[ConfirmPURVOUCHEREJB] : [confirm]==>SQLException :==>\n" + e.getMessage());
throw new ITMException(e);
}
catch (Exception e)
{
System.out.println("Exception :[ConfirmPURVOUCHEREJB] : [confirm]==>\n" + e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception :[ConfirmPURVOUCHEREJB] : [confirm]==>\n" + e.getMessage());
throw new ITMException(e);
}
}
return "";
}
private java.sql.Timestamp getCurrdateAppFormat()
{
GenericUtility genericUtility = null;
Timestamp timestamp = null;
java.util.Date date = null;
SimpleDateFormat simpledateformat = null;
try
{
genericUtility = GenericUtility.getInstance();
timestamp = new Timestamp(System.currentTimeMillis());
simpledateformat = new SimpleDateFormat(genericUtility.getDBDateFormat());
date = simpledateformat.parse(timestamp.toString());
timestamp = Timestamp.valueOf(simpledateformat.format(date).toString() + " 00:00:00.0");
}
catch (Exception ex)
{
System.out.println("Exception in [ConfirmPURVOUCHEREJB] getCurrdateAppFormat " + ex.getMessage());
try
{
throw new Exception(ex);
}
catch (Exception e)
{
e.printStackTrace();
}
}
return timestamp;
}
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
@Local
public interface ConfirmPURVOUCHEREJBLocal extends ActionHandlerLocal{
public String confirm(String empCode, String xtraParams, String tranDate) throws RemoteException,ITMException;
public String confirm(String empCode, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException;
public String confirm(String seqNO,String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface ConfirmPURVOUCHEREJBRemote extends ActionHandlerRemote {
public String confirm(String empCode, String xtraParams, String tranDate) throws RemoteException,ITMException;
public String confirm(String empCode, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException;
public String confirm(String seqNo,String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
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;
import ibase.system.config.ConnDriver;
import ibase.utility.GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.utility.ITMException;
@Stateless
public class MiscVouchChkAmtEJB extends ActionHandlerEJB implements MiscVouchChkAmtEJBLocal, MiscVouchChkAmtEJBRemote{
//MISCVOUCHERWRKFLW
public MiscVouchChkAmtEJB()
{
super();
}
public String confirm(String tranId, String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException, ITMException
{
Connection conn = null;
String retString = null;
ConnDriver connDriver = null,oConn=null;;
//oracle.jdbc.OracleConnection oConn=null;
try
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
//oConn = connDriver.getConnectDB("DriverITM");
//oConn = connDriver.getOracleConnection("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
retString = confirm( conn ,tranId, route_code , operation , prfmrCode , roleCodeAprv , xmlDataAll , prcID );
}
catch (Exception e)
{
System.out.println("Exception :MiscVouchChkAmtEJB :confirm():" + e.getMessage() + ":");
e.printStackTrace();
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn =null;
}
//if(oConn != null)
//{
// oConn.close();
// oConn =null;
//}
}
catch(SQLException sqle)
{
sqle.printStackTrace();
}
}
return retString;
}
public String confirm( Connection conn , String tranId ,String route_code ,String operation , String prfmrCode , String rolecodeAprv , String xmlDataAll ,String prcID ) throws RemoteException, ITMException
{
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String confirmed = "";
//String roleCode = "";
//java.sql.Date actionDateAprv1 = null;
int cnt=0,i=0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0;
String amountFlag = "false";
String siteCode="",acctCode="",cctrCode="",analCode="",deptCode="";
try
{
System.out.println("tranId-->["+tranId+"],prfmrCode-->["+prfmrCode+"], rolecodeAprv-->["+rolecodeAprv+"],prcID-->["+prcID+"],operation-->["+operation+"]");
sql = "select confirmed from misc_voucher where tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
rs = pStmt.executeQuery();
if (rs.next())
{
confirmed = rs.getString("confirmed");
}
rs.close();
pStmt.close();
rs = null;
pStmt = null;
if(!"Y".equalsIgnoreCase(confirmed))
{
sql = "select max(line_no) from MISC_VOUCHDET WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
rs = pStmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = "select site_code from misc_voucher WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
rs = pStmt.executeQuery();
if (rs.next())
{
siteCode = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
for ( i=1; i<=cnt ; i++)
{
/*
FN_GET_BUDGET_AMT('VOUCH',VOUCHER.SITE_CODE,VOUCHRCP.ACCT_CODE,VOUCHRCP.CCTR_CODE,VOUCHRCP.anal_code
,VOUCHRCP.DEPT_CODE,'A') BUDGET_AMT_ANAL > FN_GET_CONS_AMT('VOUCH',VOUCHER.SITE_CODE,VOUCHRCP.ACCT_CODE,VOUCHRCP.CCTR_CODE,VOUCHRCP.anal_code,VOUCHRCP.DEPT_CODE,'A')
CONSUMED_AMT_ANAL
*/
sql = "select ACCT_CODE,CCTR_CODE,anal_code,DEPT_CODE from MISC_VOUCHDET WHERE tran_id = ? and line_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
pStmt.setString( 2, Integer.toString(i) );
rs = pStmt.executeQuery();
if (rs.next())
{
acctCode = rs.getString(1);
cctrCode = rs.getString(2);
analCode = rs.getString(3);
deptCode = rs.getString(4);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = " select FN_GET_BUDGET_AMT('VOUCH',?,?,?,?,?,'A') BUDGET_AMT_ANAL , " +
" FN_GET_CONS_AMT('VOUCH',?,?,?,?,?,'A') CONSUMED_AMT_ANAL from dual";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, siteCode );
pStmt.setString( 2, acctCode );
pStmt.setString( 3, cctrCode );
pStmt.setString( 4, analCode );
pStmt.setString( 5, deptCode );
pStmt.setString( 6, siteCode );
pStmt.setString( 7, acctCode );
pStmt.setString( 8, cctrCode );
pStmt.setString( 9, analCode );
pStmt.setString( 10, deptCode );
rs = pStmt.executeQuery();
if (rs.next())
{
budgetAmtAnal = rs.getDouble(1);
consumedAmtAnal = rs.getDouble(2);
System.out.println("i:["+i+"]:::budgetAmtAnal::["+budgetAmtAnal+"]:::::consumedAmtAnal::["+consumedAmtAnal+"]");
if( budgetAmtAnal < consumedAmtAnal )
{
amountFlag = "true";
}
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
}
}
catch (SQLException e)
{
try
{
conn.rollback();
}
catch (Exception e1)
{
System.out.println("Exception :[MiscVouchChkAmtEJB] : [confirm]==>\n" + e1.getMessage());
}
System.out.println("Exception :[MiscVouchChkAmtEJB] : [confirm]==>SQLException :==>\n" + e.getMessage());
throw new ITMException(e);
}
catch (Exception e)
{
System.out.println("Exception :[MiscVouchChkAmtEJB] : [confirm]==>\n" + e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception :[MiscVouchChkAmtEJB] : [confirm]==>\n" + e.getMessage());
throw new ITMException(e);
}
}
return amountFlag;
}
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
@Local
public interface MiscVouchChkAmtEJBLocal extends ActionHandlerLocal{
public String confirm(String empCode, String xtraParams, String tranDate) throws RemoteException,ITMException;
public String confirm(String empCode, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException;
public String confirm(String seqNO,String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface MiscVouchChkAmtEJBRemote extends ActionHandlerRemote {
public String confirm(String empCode, String xtraParams, String tranDate) throws RemoteException,ITMException;
public String confirm(String empCode, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException;
public String confirm(String seqNo,String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException,ITMException;
}
//PurVouchChkAmtEJBRemote
package ibase.webitm.ejb.fin;
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;
import ibase.system.config.ConnDriver;
import ibase.utility.GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.utility.ITMException;
@Stateless
public class PurVouchChkAmtEJB extends ActionHandlerEJB implements PurVouchChkAmtEJBLocal, PurVouchChkAmtEJBRemote{
//MISCVOUCHERWRKFLW
public PurVouchChkAmtEJB()
{
super();
}
public String confirm(String tranId, String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException, ITMException
{
Connection conn = null;
String retString = null;
ConnDriver connDriver = null,oConn=null;;
//oracle.jdbc.OracleConnection oConn=null;
try
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
//oConn = connDriver.getConnectDB("DriverITM");
//oConn = connDriver.getOracleConnection("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
retString = confirm( conn ,tranId, route_code , operation , prfmrCode , roleCodeAprv , xmlDataAll , prcID );
}
catch (Exception e)
{
System.out.println("Exception :PurVouchChkAmtEJB :confirm():" + e.getMessage() + ":");
e.printStackTrace();
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn =null;
}
//if(oConn != null)
//{
// oConn.close();
// oConn =null;
//}
}
catch(SQLException sqle)
{
sqle.printStackTrace();
}
}
return retString;
}
public String confirm( Connection conn , String tranId ,String route_code ,String operation , String prfmrCode , String rolecodeAprv , String xmlDataAll ,String prcID ) throws RemoteException, ITMException
{
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String confirmed = "";
//String roleCode = "";
//java.sql.Date actionDateAprv1 = null;
int cnt=0,i=0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0;
String amountFlag = "false";
String siteCode="",acctCode="",cctrCode="",analCode="",deptCode="";
try
{
System.out.println("tranId-->["+tranId+"],prfmrCode-->["+prfmrCode+"], rolecodeAprv-->["+rolecodeAprv+"],prcID-->["+prcID+"]");
sql = "select confirmed from voucher where tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
rs = pStmt.executeQuery();
if (rs.next())
{
confirmed = rs.getString("confirmed");
}
rs.close();
pStmt.close();
rs = null;
pStmt = null;
if(!"Y".equalsIgnoreCase(confirmed))
{
sql = "select max(line_no) from vouchrcp WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
rs = pStmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = "select site_code from voucher WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
rs = pStmt.executeQuery();
if (rs.next())
{
siteCode = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
for ( i=1; i<=cnt ; i++)
{
/*
FN_GET_BUDGET_AMT('VOUCH',VOUCHER.SITE_CODE,VOUCHRCP.ACCT_CODE,VOUCHRCP.CCTR_CODE,VOUCHRCP.anal_code
,VOUCHRCP.DEPT_CODE,'A') BUDGET_AMT_ANAL > FN_GET_CONS_AMT('VOUCH',VOUCHER.SITE_CODE,VOUCHRCP.ACCT_CODE,VOUCHRCP.CCTR_CODE,VOUCHRCP.anal_code,VOUCHRCP.DEPT_CODE,'A')
CONSUMED_AMT_ANAL
*/
sql = "select ACCT_CODE,CCTR_CODE,anal_code,DEPT_CODE from vouchrcp WHERE tran_id = ? and line_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
pStmt.setString( 2, Integer.toString(i) );
rs = pStmt.executeQuery();
if (rs.next())
{
acctCode = rs.getString(1);
cctrCode = rs.getString(2);
analCode = rs.getString(3);
deptCode = rs.getString(4);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = " select FN_GET_BUDGET_AMT('VOUCH',?,?,?,?,?,'A') BUDGET_AMT_ANAL , " +
" FN_GET_CONS_AMT('VOUCH',?,?,?,?,?,'A') CONSUMED_AMT_ANAL from dual";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, siteCode );
pStmt.setString( 2, acctCode );
pStmt.setString( 3, cctrCode );
pStmt.setString( 4, analCode );
pStmt.setString( 5, deptCode );
pStmt.setString( 6, siteCode );
pStmt.setString( 7, acctCode );
pStmt.setString( 8, cctrCode );
pStmt.setString( 9, analCode );
pStmt.setString( 10, deptCode );
rs = pStmt.executeQuery();
if (rs.next())
{
budgetAmtAnal = rs.getDouble(1);
consumedAmtAnal = rs.getDouble(2);
System.out.println("i:["+i+"]:::budgetAmtAnal::["+budgetAmtAnal+"]:::::consumedAmtAnal::["+consumedAmtAnal+"]");
if( budgetAmtAnal < consumedAmtAnal )
{
amountFlag = "true";
}
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
}
}
catch (SQLException e)
{
try
{
conn.rollback();
}
catch (Exception e1)
{
System.out.println("Exception :[PurVouchChkAmtEJB] : [confirm]==>\n" + e1.getMessage());
}
System.out.println("Exception :[PurVouchChkAmtEJB] : [confirm]==>SQLException :==>\n" + e.getMessage());
throw new ITMException(e);
}
catch (Exception e)
{
System.out.println("Exception :[PurVouchChkAmtEJB] : [confirm]==>\n" + e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception :[PurVouchChkAmtEJB] : [confirm]==>\n" + e.getMessage());
throw new ITMException(e);
}
}
return amountFlag;
}
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
@Local
public interface PurVouchChkAmtEJBLocal extends ActionHandlerLocal{
public String confirm(String empCode, String xtraParams, String tranDate) throws RemoteException,ITMException;
public String confirm(String empCode, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException;
public String confirm(String seqNO,String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface PurVouchChkAmtEJBRemote extends ActionHandlerRemote {
public String confirm(String empCode, String xtraParams, String tranDate) throws RemoteException,ITMException;
public String confirm(String empCode, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException;
public String confirm(String seqNo,String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException,ITMException;
}
//PurVouchChkAmtEJBRemote
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