Commit fdef5618 authored by caluka's avatar caluka

For Add Travel,Visa Cancel Button in StarClub Employee details.[W14BSUN003]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95063 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 90b51000
......@@ -41,9 +41,10 @@ public class EmpInfoSubmit extends ActionHandlerEJB implements EmpInfoSubmitRemo
}
public String confirm( String tranId, String xtraParams, String forcedFlag, Connection conn, boolean connStatus ) throws RemoteException,ITMException
{
String retString = "";
String retString = "",status="";
String sql = "";
int count=0,upd=0;
String refSer = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
GenericUtility genericUtility = null;
......@@ -58,10 +59,25 @@ public class EmpInfoSubmit extends ActionHandlerEJB implements EmpInfoSubmitRemo
conn.setAutoCommit(false);
connStatus = true;
sql = " SELECT ref_ser FROM TRANSETUP WHERE TRAN_WINDOW = 'w_emp_travel_info' ";
pstmt = conn.prepareStatement( sql );
System.out.println( "@@@@@ sqlgetdata :: [[" + sql+"]]" );
rs = pstmt.executeQuery( );
if(rs.next())
{
refSer = rs.getString("ref_ser");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println( "@@@@@ refSer :: [[" + refSer+"]]" );
sql = " select count(*) from doc_contents where doc_id in (select doc_id from doc_transaction_link where ref_id = ? ) ";
sql = " select count(*) from doc_contents where doc_id in (select doc_id from doc_transaction_link where ref_id = ? and ref_ser = ? ) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setString(2, refSer);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -76,7 +92,24 @@ public class EmpInfoSubmit extends ActionHandlerEJB implements EmpInfoSubmitRemo
retString = itmDBAccess.getErrorString("","VTNOATCH1","");
return retString;
}
//Changes done by Chandrashekar on 15-may-2014
sql = " select status from emp_travel_info where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
status = rs.getString("status");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if("X".equalsIgnoreCase(status))
{ System.out.println("Travel information Cancelled");
retString = itmDBAccess.getErrorString("","VTNOTSUB","");
return retString;
}
else
{
sql = " select count(*) from emp_travel_info where tran_id = ? and (case when status is null then 'N' else status end = 'Y') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
......@@ -106,6 +139,10 @@ public class EmpInfoSubmit extends ActionHandlerEJB implements EmpInfoSubmitRemo
System.out.println(" information submited::");
}
}
}
//End Changes done by Chandrashekar on 15-may-2014
}
catch( Exception e )
{
......
/**
DEVELOPED BY CHANDRASHEKAR ON 14/05/14
PURPOSE: W14BSUN003 (StarClub Employee details.)
*/
package ibase.webitm.ejb.dis.adv;
import ibase.system.config.ConnDriver;
import ibase.utility.EMail;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import org.w3c.dom.*;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.ejb.Stateless;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import javax.mail.internet.MimeUtility;
import java.lang.reflect.*;
import javax.naming.InitialContext;
import javax.ejb.*;
import javax.rmi.*;
@Stateless
public class EmpTravelInfoCancel extends ActionHandlerEJB implements EmpInfoSubmitRemote, EmpInfoSubmitLocal
{
public String confirm(String tranID,String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String retString = "";
Connection conn = null;
boolean isConn= false;
try
{
retString = this.confirm(tranID, xtraParams, forcedFlag, conn, isConn);
System.out.println("retString:::::"+retString);
}
catch(Exception e)
{
System.out.println("Exception in [EmpTravelInfoCancel] confirm " + e.getMessage());
throw new ITMException(e);
}
return retString;
}
public String confirm( String tranId, String xtraParams, String forcedFlag, Connection conn, boolean connStatus ) throws RemoteException,ITMException
{
String retString = "";
String sql = "";
String userType="",sendTo="", sendCC="",formatCode="",senBCC="";
int count=0,upd=0;
ResultSet rs = null;
PreparedStatement pstmt = null;
GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccess = null;
StringBuffer commInfo = new StringBuffer();
try
{
genericUtility = GenericUtility.getInstance();
itmDBAccess = new ITMDBAccessEJB();
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
connStatus = true;
/*sendTo="chandrashekar.aluka@baseinformation.com";
sendCC="chandrashekar.aluka@baseinformation.com,cpatil@baseinformation.com";
senBCC="chandrashekar.aluka@baseinformation.com";
commInfo.append("<ROOT>");
commInfo.append("<MAIL><EMAIL_TYPE>page</EMAIL_TYPE><ENTITY_CODE>BASE</ENTITY_CODE>");
commInfo.append("<ENTITY_TYPE>"+userType+"</ENTITY_TYPE>");
commInfo.append("<TO_ADD>"+sendTo+"</TO_ADD>");
commInfo.append("<CC_ADD>"+sendCC+"</CC_ADD>");
commInfo.append("<BCC_ADD>"+senBCC+"</BCC_ADD>");
commInfo.append("<FORMAT_CODE></FORMAT_CODE>");
commInfo.append("<EMP_CODE></EMP_CODE>");
commInfo.append("<TRAVEL_CODE></TRAVL_CODE>");
commInfo.append("<NSM_CODE>empcode</NSM_CODE>");
commInfo.append("<EMPNAME></EMPNAME>");
commInfo.append("<ATTACHMENT><BODY>Transaction Cancelled </BODY><LOCATION></LOCATION></ATTACHMENT>");
commInfo.append("</MAIL>");
commInfo.append("</ROOT>");
EMail email = new EMail();
email.sendMail(commInfo.toString(), "");
email = null;*/
sql = " update emp_travel_info set status = 'X' where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
upd = pstmt.executeUpdate();
pstmt.close();pstmt = null;
System.out.println(" status updated:: "+upd);
if(upd > 0)
{
retString = "submited";
System.out.println(" information submited::");
}
}
catch( Exception e )
{
try
{
conn.rollback();
retString = e.getMessage();
e.printStackTrace();
}
catch (Exception e1)
{
System.out.println("Exception : "+e);e.printStackTrace();
}
throw new ITMException(e);
}
finally
{
if(retString != null && retString.indexOf("submited") > -1)
{
try {
conn.commit();
} catch (SQLException e) {
e.printStackTrace();
}
retString = itmDBAccess.getErrorString("","VTCANCEL5","");
}
else
{
retString = itmDBAccess.getErrorString("","VTERRCAN","");
}
try{
if(rs != null)
{
rs.close();rs = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{System.out.println("Exception : "+e);e.printStackTrace();}
}
return retString ;
}
}
/**
DEVELOPED BY CHANDRASHEKAR ON 14/05/14
PURPOSE: W14BSUN003 (StarClub Employee details.)
*/
package ibase.webitm.ejb.dis.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.Connection;
@javax.ejb.Local
public interface EmpTravelInfoCancelLocal extends ActionHandlerLocal
{
public String confirm( String tranId, String xtraParams, String forcedFlag )throws RemoteException,ITMException;
public String confirm( String tranId, String xtraParams,String forcedFlag, Connection conn, boolean connStatus) throws RemoteException,ITMException;
}
/**
DEVELOPED BY CHANDRASHEKAR ON 14/05/14
PURPOSE: W14BSUN003 (StarClub Employee details.)
*/
package ibase.webitm.ejb.dis.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.Connection;
@javax.ejb.Remote
public interface EmpTravelInfoCancelRemote extends ActionHandlerRemote
{
public String confirm( String tranId, String xtraParams, String forcedFlag ) throws RemoteException,ITMException;
public String confirm( String tranId, String xtraParams,String forcedFlag, Connection conn, boolean connStatus) throws RemoteException,ITMException;
}
......@@ -56,7 +56,7 @@ public class EmpTravelInfoConf extends ActionHandlerEJB implements EmpTravelInfo
connDriver = null;
conn.setAutoCommit(false);
connStatus = true;
String userId="",empCode="";
String userId="",empCode="",status="";
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); System.out.println("--login code--"+userId);
......@@ -77,8 +77,24 @@ public class EmpTravelInfoConf extends ActionHandlerEJB implements EmpTravelInfo
retString = itmDBAccess.getErrorString("","VTNTCNF1","");
return retString;
}
//changes done by Chandrashekar on 15-may-2014
sql = " select status from emp_travel_info where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
status = rs.getString("status");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if("X".equalsIgnoreCase(status))
{ System.out.println("Travel information Cancelled");
retString = itmDBAccess.getErrorString("","VTNOTCONF3","");
return retString;
}
else
{
sql = " select count(*) from emp_travel_info where tran_id = ? and (case when confirmed is null then 'N' else confirmed end = 'Y') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
......@@ -109,6 +125,10 @@ public class EmpTravelInfoConf extends ActionHandlerEJB implements EmpTravelInfo
System.out.println(" transaction confirmed::");
}
}
}
//End Changes done by Chandrashekar on 15-may-2014
}
catch( Exception e )
{
......
/**
DEVELOPED BY CHANDRASHEKAR ON 14/05/14
PURPOSE: W14BSUN003 (StarClub Employee details.)
*/
package ibase.webitm.ejb.dis.adv;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
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.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.ejb.Stateless;
@Stateless
public class EmpTravelInfoTicket extends ActionHandlerEJB implements EmpInfoSubmitRemote, EmpInfoSubmitLocal
{
public String confirm(String tranID,String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String retString = "";
Connection conn = null;
boolean isConn= false;
try
{
retString = this.confirm(tranID, xtraParams, forcedFlag, conn, isConn);
System.out.println("retString:::::"+retString);
}
catch(Exception e)
{
System.out.println("Exception in [EmpTravelInfoTicket] confirm " + e.getMessage());
throw new ITMException(e);
}
return retString;
}
public String confirm( String tranId, String xtraParams, String forcedFlag, Connection conn, boolean connStatus ) throws RemoteException,ITMException
{
String retString = "",chgUser="";
String sql = "";
int count=0,upd=0,count1=0;
ResultSet rs = null;
PreparedStatement pstmt = null;
GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccess = null;
try
{
genericUtility = GenericUtility.getInstance();
itmDBAccess = new ITMDBAccessEJB();
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
connStatus = true;
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
sql = " select count(*) from doc_contents where doc_id in (select doc_id from doc_transaction_link where ref_id = ? ) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if(count == 0)
{
System.out.println("No attachment found !");
retString = itmDBAccess.getErrorString("","VTNOATCH1","");
return retString;
}
sql = " select count(*) from emp_travel_info where chg_user=? and tran_id = ? and (case when confirmed is null then 'N' else confirmed end = 'Y') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, chgUser);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if(count == 0 )
{
System.out.println("The transaction not confirmed ");
retString = itmDBAccess.getErrorString("","VTNOTCONF2","");
return retString;
}
else
{ sql = " select count(*) from emp_travel_info where chg_user=? and tran_id = ? and (case when ticket_status is null then 'N' else ticket_status end = 'Y') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, chgUser);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
count1 = rs.getInt(1);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if(count1 > 0 )
{
System.out.println("The ticket status already submited");
retString = itmDBAccess.getErrorString("","VTTCKTCONF","");
return retString;
}
else
{
sql = " update emp_travel_info set ticket_status = 'Y',ticket_stat_date= ? where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, new java.sql.Timestamp( System.currentTimeMillis() ) );
pstmt.setString(2, tranId);
upd = pstmt.executeUpdate();
pstmt.close();pstmt = null;
System.out.println(" status updated:: "+upd);
if(upd > 0)
{
retString = "submited";
System.out.println(" information submited::");
}
}
}
}
catch( Exception e )
{
try
{
conn.rollback();
retString = e.getMessage();
e.printStackTrace();
}
catch (Exception e1)
{
System.out.println("Exception : "+e);e.printStackTrace();
}
throw new ITMException(e);
}
finally
{
if(retString != null && retString.indexOf("submited") > -1)
{
try {
conn.commit();
} catch (SQLException e) {
e.printStackTrace();
}
retString = itmDBAccess.getErrorString("","VTTKTSUC","");
}
else
{
retString = itmDBAccess.getErrorString("","VTERRTIKT","");
}
try{
if(rs != null)
{
rs.close();rs = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{System.out.println("Exception : "+e);e.printStackTrace();}
}
return retString ;
}
}
/**
DEVELOPED BY CHANDRASHEKAR ON 14/05/14
PURPOSE: W14BSUN003 (StarClub Employee details.)
*/
package ibase.webitm.ejb.dis.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.Connection;
@javax.ejb.Local
public interface EmpTravelInfoTicketLocal extends ActionHandlerLocal
{
public String confirm( String tranId, String xtraParams, String forcedFlag )throws RemoteException,ITMException;
public String confirm( String tranId, String xtraParams,String forcedFlag, Connection conn, boolean connStatus) throws RemoteException,ITMException;
}
/**
DEVELOPED BY CHANDRASHEKAR ON 14/05/14
PURPOSE: W14BSUN003 (StarClub Employee details.)
*/
package ibase.webitm.ejb.dis.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.Connection;
@javax.ejb.Remote
public interface EmpTravelInfoTicketRemote extends ActionHandlerRemote
{
public String confirm( String tranId, String xtraParams, String forcedFlag ) throws RemoteException,ITMException;
public String confirm( String tranId, String xtraParams,String forcedFlag, Connection conn, boolean connStatus) throws RemoteException,ITMException;
}
/**
DEVELOPED BY CHANDRASHEKAR ON 14/05/14
PURPOSE: W14BSUN003 (StarClub Employee details.)
*/
package ibase.webitm.ejb.dis.adv;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
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.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.ejb.Stateless;
@Stateless
public class EmpTravelInfoVisa extends ActionHandlerEJB implements EmpInfoSubmitRemote, EmpInfoSubmitLocal
{
public String confirm(String tranID,String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String retString = "";
Connection conn = null;
boolean isConn= false;
try
{
retString = this.confirm(tranID, xtraParams, forcedFlag, conn, isConn);
System.out.println("retString:::::"+retString);
}
catch(Exception e)
{
System.out.println("Exception in [EmpTravelInfoVisa] confirm " + e.getMessage());
throw new ITMException(e);
}
return retString;
}
public String confirm( String tranId, String xtraParams, String forcedFlag, Connection conn, boolean connStatus ) throws RemoteException,ITMException
{
String retString = "",chgUser="";
String sql = "";
int count=0,upd=0,count1=0;
ResultSet rs = null;
PreparedStatement pstmt = null;
GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccess = null;
try
{
genericUtility = GenericUtility.getInstance();
itmDBAccess = new ITMDBAccessEJB();
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
connStatus = true;
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
sql = " select count(*) from doc_contents where chg_user=? and doc_id in (select doc_id from doc_transaction_link where ref_id = ? ) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, chgUser);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if(count == 0)
{
System.out.println("No attachment found !");
retString = itmDBAccess.getErrorString("","VTNOATCH1","");
return retString;
}
sql = " select count(*) from emp_travel_info where chg_user=? and tran_id = ? and (case when confirmed is null then 'N' else confirmed end = 'Y') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, chgUser);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if(count == 0 )
{
System.out.println("The transaction not confirmed ");
retString = itmDBAccess.getErrorString("","VTNOTCONF2","");
return retString;
}
else
{ sql = " select count(*) from emp_travel_info where chg_user=? and tran_id = ? and (case when visa_status is null then 'N' else visa_status end = 'Y') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, chgUser);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
count1 = rs.getInt(1);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if(count1 > 0 )
{
System.out.println("The visa status already submited");
retString = itmDBAccess.getErrorString("","VTVISACONF","");
return retString;
}
else
{
sql = " update emp_travel_info set visa_status = 'Y',visa_stat_date= ? where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, new java.sql.Timestamp( System.currentTimeMillis() ) );
pstmt.setString(2, tranId);
upd = pstmt.executeUpdate();
pstmt.close();pstmt = null;
System.out.println(" status updated:: "+upd);
if(upd > 0)
{
retString = "submited";
System.out.println(" information submited::");
}
}
}
}
catch( Exception e )
{
try
{
conn.rollback();
retString = e.getMessage();
e.printStackTrace();
}
catch (Exception e1)
{
System.out.println("Exception : "+e);e.printStackTrace();
}
throw new ITMException(e);
}
finally
{
if(retString != null && retString.indexOf("submited") > -1)
{
try {
conn.commit();
} catch (SQLException e) {
e.printStackTrace();
}
retString = itmDBAccess.getErrorString("","VTVISASUC","");
}
else
{
retString = itmDBAccess.getErrorString("","VTERRVISA","");
}
try{
if(rs != null)
{
rs.close();rs = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{System.out.println("Exception : "+e);e.printStackTrace();}
}
return retString ;
}
}
/**
DEVELOPED BY CHANDRASHEKAR ON 14/05/14
PURPOSE: W14BSUN003 (StarClub Employee details.)
*/
package ibase.webitm.ejb.dis.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.Connection;
@javax.ejb.Local
public interface EmpTravelInfoVisaLocal extends ActionHandlerLocal
{
public String confirm( String tranId, String xtraParams, String forcedFlag )throws RemoteException,ITMException;
public String confirm( String tranId, String xtraParams,String forcedFlag, Connection conn, boolean connStatus) throws RemoteException,ITMException;
}
/**
DEVELOPED BY CHANDRASHEKAR ON 14/05/14
PURPOSE: W14BSUN003 (StarClub Employee details.)
*/
package ibase.webitm.ejb.dis.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.Connection;
@javax.ejb.Remote
public interface EmpTravelInfoVisaRemote extends ActionHandlerRemote
{
public String confirm( String tranId, String xtraParams, String forcedFlag ) throws RemoteException,ITMException;
public String confirm( String tranId, String xtraParams,String forcedFlag, Connection conn, boolean connStatus) 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