Commit 8dd6ac06 authored by cpatil's avatar cpatil

modify for reject n wf status


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93244 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a80115a7
package ibase.webitm.ejb.fin;
import ibase.utility.CommonConstants;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.system.config.*;
import ibase.wrkflw.*;
import ibase.wrkflw.utility.WorkflowLogger;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import org.w3c.dom.*;
@Stateless
public class BudGrpAmdWS extends ValidatorEJB implements BudGrpAmdWSLocal, BudGrpAmdWSRemote
{
GenericUtility genericUtility = GenericUtility.getInstance();
public String BudGrpAmdWS(String tranID, String processId, String refSeries, String flag ) throws ITMException ,RemoteException
{
Connection conn = null;
ConnDriver connDriver = null;
String retString = "";
try
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
if("A".equalsIgnoreCase(flag) || "R".equalsIgnoreCase(flag))//Quotation Approve
{
System.out.println("updateRejectionRemark() Called !!! ");
retString = updateRejectionRemark(tranID,processId, refSeries,flag);
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return retString;
}
private String getRejectionRemark(Connection conn, String refID, String processId, String refSeries,String flag) throws ITMException ,RemoteException
{
PreparedStatement pstmtCheckStatus = null;
ResultSet rsCheckStatus = null;
String rejectionRemark = "";
try
{
System.out.println("@@@@@ getRejectionRemark()===>>> refID["+refID+"]:::processId["+processId+"]:::refSeries["+refSeries+"]::::flag["+flag+"]");
String getRejectionRemarkSql = "SELECT SIGN_REMARKS FROM OBJ_SIGN_TRANS " +
"WHERE REF_SER = ? AND REF_ID = ? AND LINE_NO = (SELECT MAX(LINE_NO) FROM OBJ_SIGN_TRANS "+
"WHERE REF_SER = ? AND REF_ID = ? AND SIGN_STATUS = ? ) ";
PreparedStatement pstmtGetRejRemark = conn.prepareStatement(getRejectionRemarkSql);
pstmtGetRejRemark.setString(1,refSeries);
pstmtGetRejRemark.setString(2,refID);
pstmtGetRejRemark.setString(3,refSeries);
pstmtGetRejRemark.setString(4,refID);
pstmtGetRejRemark.setString(5,flag );
ResultSet rsGetRejRemark = pstmtGetRejRemark.executeQuery();
if(rsGetRejRemark.next())
{
rejectionRemark = rsGetRejRemark.getString("SIGN_REMARKS");
}
int updateCount = pstmtGetRejRemark.executeUpdate();
rsGetRejRemark.close();
rsGetRejRemark = null;
pstmtGetRejRemark.close();
pstmtGetRejRemark = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
System.out.println("Closing Connection....");
try
{
if(rsCheckStatus != null)
{
rsCheckStatus.close();
rsCheckStatus = null;
}
if(pstmtCheckStatus != null)
{
pstmtCheckStatus.close();
pstmtCheckStatus = null;
}
}catch(Exception e)
{
System.out.println("Exception ::"+e.getMessage());
}
}
System.out.println("rejectionRemark =["+rejectionRemark+"]");
return rejectionRemark;
}
private String updateRejectionRemark(String refID, String processId, String refSeries,String flag) throws ITMException ,RemoteException
{
Connection conn = null;
PreparedStatement pstmtCheckStatus = null;
ResultSet rsCheckStatus = null;
String retString = "1",flagStatus="";
try
{
ConnDriver conDriver = new ConnDriver();
conn = conDriver.getConnectDB("DriverITM");
System.out.println("@@@@@ getRejectionRemark()===>>> refID["+refID+"]:::processId["+processId+"]:::refSeries["+refSeries+"]::::flag["+flag+"]");
if("A".equalsIgnoreCase(flag))
{
flagStatus = "Approved";
}
else if("R".equalsIgnoreCase(flag))
{
String rejectionRemark = getRejectionRemark(conn, refID, processId, refSeries,flag);
flagStatus = "Rejected - " + rejectionRemark;
}
String updateRejectionRemarkSql = "UPDATE budgrp_allo_amd SET WF_STATUS = ? WHERE amd_no = ?";
PreparedStatement pstmtUpdRejRemark = conn.prepareStatement(updateRejectionRemarkSql);
pstmtUpdRejRemark.setString(1,flagStatus );
pstmtUpdRejRemark.setString(2,refID);
int updateCount = pstmtUpdRejRemark.executeUpdate();
pstmtUpdRejRemark.close(); pstmtUpdRejRemark = null;
System.out.println("updateCount[updateRejectionRemark] =["+updateCount+"]");
if( updateCount > 0 )
{
retString = "1";
conn.commit();
}
else
{
retString = "0";
}
}
catch(Exception e)
{
retString = "0";
e.printStackTrace();
throw new ITMException(e);
}
finally
{
System.out.println("Closing Connection....");
try
{
if(rsCheckStatus != null)
{
rsCheckStatus.close();
rsCheckStatus = null;
}
if(pstmtCheckStatus != null)
{
pstmtCheckStatus.close();
pstmtCheckStatus = null;
}
if(conn != null)
{
if(retString == "1")
{
conn.commit();
}
else
{
conn.rollback();
}
conn.close();
conn = null;
}
}catch(Exception e)
{
System.out.println("Exception ::"+e.getMessage());
}
}
System.out.println("retString =["+retString+"]");
return retString;
}
} //confirm end
/********************************************************
Title : SalesQuotationWorkflowLocal
Date : 7/25/2012
Developer:Gulzar Ahmad
********************************************************/
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Local;
@Local
public interface BudGrpAmdWSLocal extends ValidatorLocal
{
public String BudGrpAmdWS(String tranID, String processId, String refSeries, String flag) throws ITMException ,RemoteException;
}
/********************************************************
Title : SalesQuotationWorkflowRemote
Date : 7/25/2012
Developer:Gulzar Ahmad
********************************************************/
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
@Remote
public interface BudGrpAmdWSRemote extends ValidatorRemote
{
public String BudGrpAmdWS(String tranID, String processId, String refSeries, String flag ) throws ITMException ,RemoteException;
}
...@@ -22,7 +22,7 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI ...@@ -22,7 +22,7 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI
} }
public String confirm(String tranId, String route_code, String operation, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException, ITMException public String confirm(String tranId, String refSeries, String flag, String prfmrCode, String roleCodeAprv, String xmlDataAll,String prcID) throws RemoteException, ITMException
{ {
Connection conn = null; Connection conn = null;
...@@ -37,7 +37,7 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI ...@@ -37,7 +37,7 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI
//oConn = connDriver.getOracleConnection("DriverITM"); //oConn = connDriver.getOracleConnection("DriverITM");
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null; connDriver = null;
retString = confirm( conn ,tranId, route_code , operation , prfmrCode , roleCodeAprv , xmlDataAll , prcID ); retString = confirm( conn ,tranId, refSeries , flag , prfmrCode , roleCodeAprv , xmlDataAll , prcID );
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -68,7 +68,7 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI ...@@ -68,7 +68,7 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI
return retString; 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 public String confirm( Connection conn , String tranId ,String refSeries ,String flag , String prfmrCode , String rolecodeAprv , String xmlDataAll ,String prcID ) throws RemoteException, ITMException
{ {
PreparedStatement pStmt = null; PreparedStatement pStmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -79,11 +79,11 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI ...@@ -79,11 +79,11 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI
int cnt=0,i=0; int cnt=0,i=0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0; double budgetAmtAnal = 0.0,consumedAmtAnal=0.0;
boolean amountFlag = false; boolean amountFlag = false;
String siteCode="",acctCode="",cctrCode="",analCode="",deptCode=""; String siteCode="",acctCode="",cctrCode="",analCode="",deptCode="",flagStatus="",rejectionRemark="";
try try
{ {
System.out.println("tranId-->["+tranId+"],prfmrCode-->["+prfmrCode+"], rolecodeAprv-->["+rolecodeAprv+"],prcID-->["+prcID+"],operation-->["+operation+"]"); System.out.println("tranId-->["+tranId+"],prfmrCode-->["+prfmrCode+"], rolecodeAprv-->["+rolecodeAprv+"],prcID-->["+prcID+"]:::refSeries["+refSeries+"flag-->["+flag+"]");
sql = "select confirmed from misc_voucher where tran_id = ? "; sql = "select confirmed from misc_voucher where tran_id = ? ";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
...@@ -188,9 +188,21 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI ...@@ -188,9 +188,21 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI
*/ */
//if( amountFlag==true) //if( amountFlag==true)
{ {
if("A".equalsIgnoreCase(flag))
{
flagStatus = "A";
}
else if("R".equalsIgnoreCase(flag))
{
System.out.println("@@@@@@ getRejectionRemark() Called !!! ");
rejectionRemark = getRejectionRemark(conn,tranId,prcID, refSeries,flag);
System.out.println("@@@@@@ rejectionRemark["+rejectionRemark+"]");
flagStatus = "R - "+rejectionRemark;
}
sql = " UPDATE misc_voucher SET wf_status = ? WHERE tran_id = ? "; sql = " UPDATE misc_voucher SET wf_status = ? WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
pStmt.setString(1, operation); pStmt.setString(1, flagStatus );
pStmt.setString(2, tranId); pStmt.setString(2, tranId);
int updateCnt = pStmt.executeUpdate(); int updateCnt = pStmt.executeUpdate();
if (updateCnt>0 ) if (updateCnt>0 )
...@@ -251,6 +263,69 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI ...@@ -251,6 +263,69 @@ public class ConfirmMISCVOUCHEREJB extends ActionHandlerEJB implements ConfirmMI
} }
return ""; return "";
} }
private String getRejectionRemark(Connection conn, String refID, String processId, String refSeries,String flag) throws ITMException ,RemoteException
{
PreparedStatement pstmtCheckStatus = null;
ResultSet rsCheckStatus = null;
String rejectionRemark = "";
try
{
System.out.println("@@@@@ getRejectionRemark()===>>> refID["+refID+"]:::processId["+processId+"]:::refSeries["+refSeries+"]::::flag["+flag+"]");
String getRejectionRemarkSql = "SELECT SIGN_REMARKS FROM OBJ_SIGN_TRANS " +
"WHERE REF_SER = ? AND REF_ID = ? AND LINE_NO = (SELECT MAX(LINE_NO) FROM OBJ_SIGN_TRANS "+
"WHERE REF_SER = ? AND REF_ID = ? AND SIGN_STATUS = ? ) ";
PreparedStatement pstmtGetRejRemark = conn.prepareStatement(getRejectionRemarkSql);
pstmtGetRejRemark.setString(1,refSeries);
pstmtGetRejRemark.setString(2,refID);
pstmtGetRejRemark.setString(3,refSeries);
pstmtGetRejRemark.setString(4,refID);
pstmtGetRejRemark.setString(5,flag );
ResultSet rsGetRejRemark = pstmtGetRejRemark.executeQuery();
if(rsGetRejRemark.next())
{
rejectionRemark = rsGetRejRemark.getString("SIGN_REMARKS");
}
int updateCount = pstmtGetRejRemark.executeUpdate();
rsGetRejRemark.close();
rsGetRejRemark = null;
pstmtGetRejRemark.close();
pstmtGetRejRemark = null;
System.out.println("@@@@ updateCount["+updateCount+"]");
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
System.out.println("Closing Connection....");
try
{
if(rsCheckStatus != null)
{
rsCheckStatus.close();
rsCheckStatus = null;
}
if(pstmtCheckStatus != null)
{
pstmtCheckStatus.close();
pstmtCheckStatus = null;
}
}catch(Exception e)
{
System.out.println("Exception ::"+e.getMessage());
}
}
System.out.println("rejectionRemark =["+rejectionRemark+"]");
return rejectionRemark;
}
} }
...@@ -68,7 +68,7 @@ public class ConfirmPURVOUCHEREJB extends ActionHandlerEJB implements ConfirmPUR ...@@ -68,7 +68,7 @@ public class ConfirmPURVOUCHEREJB extends ActionHandlerEJB implements ConfirmPUR
return retString; 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 public String confirm( Connection conn , String tranId ,String refSeries ,String flag , String prfmrCode , String rolecodeAprv , String xmlDataAll ,String prcID ) throws RemoteException, ITMException
{ {
PreparedStatement pStmt = null; PreparedStatement pStmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -79,11 +79,11 @@ public class ConfirmPURVOUCHEREJB extends ActionHandlerEJB implements ConfirmPUR ...@@ -79,11 +79,11 @@ public class ConfirmPURVOUCHEREJB extends ActionHandlerEJB implements ConfirmPUR
int cnt=0,i=0; int cnt=0,i=0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0; double budgetAmtAnal = 0.0,consumedAmtAnal=0.0;
boolean amountFlag = false; boolean amountFlag = false;
String siteCode="",acctCode="",cctrCode="",analCode="",deptCode=""; String siteCode="",acctCode="",cctrCode="",analCode="",deptCode="",flagStatus="",rejectionRemark="";
try try
{ {
System.out.println("tranId-->["+tranId+"],prfmrCode-->["+prfmrCode+"], rolecodeAprv-->["+rolecodeAprv+"],prcID-->["+prcID+"],operation-->["+operation+"]"); System.out.println("tranId-->["+tranId+"],prfmrCode-->["+prfmrCode+"], rolecodeAprv-->["+rolecodeAprv+"],prcID-->["+prcID+"]:::refSeries-->["+refSeries+"]::::flag-->["+flag+"]");
sql = "select confirmed from voucher where tran_id = ? "; sql = "select confirmed from voucher where tran_id = ? ";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
...@@ -189,9 +189,22 @@ public class ConfirmPURVOUCHEREJB extends ActionHandlerEJB implements ConfirmPUR ...@@ -189,9 +189,22 @@ public class ConfirmPURVOUCHEREJB extends ActionHandlerEJB implements ConfirmPUR
*/ */
// if( amountFlag==true) // if( amountFlag==true)
{ {
if("A".equalsIgnoreCase(flag))
{
flagStatus = "A";
}
else if("R".equalsIgnoreCase(flag))
{
System.out.println("getRejectionRemark() Called !!! ");
rejectionRemark = getRejectionRemark(conn,tranId,prcID, refSeries,flag);
System.out.println("@@@@@ rejectionRemark["+rejectionRemark+"]");
flagStatus = "R - "+rejectionRemark;
}
sql = " UPDATE voucher SET wf_status = ? WHERE tran_id = ? "; sql = " UPDATE voucher SET wf_status = ? WHERE tran_id = ? ";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
pStmt.setString(1, operation); pStmt.setString(1, flagStatus );
pStmt.setString(2, tranId); pStmt.setString(2, tranId);
int updateCnt = pStmt.executeUpdate(); int updateCnt = pStmt.executeUpdate();
if (updateCnt>0 ) if (updateCnt>0 )
...@@ -253,32 +266,71 @@ public class ConfirmPURVOUCHEREJB extends ActionHandlerEJB implements ConfirmPUR ...@@ -253,32 +266,71 @@ public class ConfirmPURVOUCHEREJB extends ActionHandlerEJB implements ConfirmPUR
return ""; return "";
} }
private java.sql.Timestamp getCurrdateAppFormat()
{ private String getRejectionRemark(Connection conn, String refID, String processId, String refSeries,String flag) throws ITMException ,RemoteException
GenericUtility genericUtility = null; {
Timestamp timestamp = null; PreparedStatement pstmtCheckStatus = null;
java.util.Date date = null; ResultSet rsCheckStatus = null;
SimpleDateFormat simpledateformat = null; String rejectionRemark = "";
try try
{ {
genericUtility = GenericUtility.getInstance(); System.out.println("@@@@@ getRejectionRemark()===>>> refID["+refID+"]:::processId["+processId+"]:::refSeries["+refSeries+"]::::flag["+flag+"]");
timestamp = new Timestamp(System.currentTimeMillis());
simpledateformat = new SimpleDateFormat(genericUtility.getDBDateFormat()); String getRejectionRemarkSql = "SELECT SIGN_REMARKS FROM OBJ_SIGN_TRANS " +
date = simpledateformat.parse(timestamp.toString()); "WHERE REF_SER = ? AND REF_ID = ? AND LINE_NO = (SELECT MAX(LINE_NO) FROM OBJ_SIGN_TRANS "+
timestamp = Timestamp.valueOf(simpledateformat.format(date).toString() + " 00:00:00.0"); "WHERE REF_SER = ? AND REF_ID = ? AND SIGN_STATUS = ? ) ";
PreparedStatement pstmtGetRejRemark = conn.prepareStatement(getRejectionRemarkSql);
pstmtGetRejRemark.setString(1,refSeries);
pstmtGetRejRemark.setString(2,refID);
pstmtGetRejRemark.setString(3,refSeries);
pstmtGetRejRemark.setString(4,refID);
pstmtGetRejRemark.setString(5,flag );
ResultSet rsGetRejRemark = pstmtGetRejRemark.executeQuery();
if(rsGetRejRemark.next())
{
rejectionRemark = rsGetRejRemark.getString("SIGN_REMARKS");
}
int updateCount = pstmtGetRejRemark.executeUpdate();
rsGetRejRemark.close();
rsGetRejRemark = null;
pstmtGetRejRemark.close();
pstmtGetRejRemark = null;
System.out.println("@@@@ updateCount["+updateCount+"]");
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
} }
catch (Exception ex) finally
{ {
System.out.println("Exception in [ConfirmPURVOUCHEREJB] getCurrdateAppFormat " + ex.getMessage()); System.out.println("Closing Connection....");
try try
{ {
throw new Exception(ex); if(rsCheckStatus != null)
} {
catch (Exception e) rsCheckStatus.close();
rsCheckStatus = null;
}
if(pstmtCheckStatus != null)
{
pstmtCheckStatus.close();
pstmtCheckStatus = null;
}
}catch(Exception e)
{ {
e.printStackTrace(); System.out.println("Exception ::"+e.getMessage());
} }
} }
return timestamp; System.out.println("rejectionRemark =["+rejectionRemark+"]");
return rejectionRemark;
} }
} }
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