Commit 8c71892e authored by anarvariya's avatar anarvariya

Changes done at sun are merged by piyush on 18/07/2014


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95651 ce508802-f39f-4f6c-b175-0d175dae99d5
parent dbfd8456
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import javax.ejb.*;
import org.w3c.dom.*;
import ibase.system.config.ConnDriver;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless; // added for ejb3
@Stateless
public class PfNumberprs extends ValidatorEJB implements PfNumberprsLocal,PfNumberprsRemote
{
String retString = "";
String objName = "";
Document domStr = null;
ResultSet rs = null;
PreparedStatement pstmt = null;
String sql = "";
String bookType = "";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String itemChanged() throws RemoteException, ITMException
{
return "";
}
public String itemChanged(String currXmlDataStr, String hdrXmlDataStr, String allXmlDataStr, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
System.out.println ( "HELLO_");
Document currDom = null;
Document hdrDom = null;
Document hdrDomNew = null;
Document allDom = null;
String errString = null;
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
if (currXmlDataStr != null && currXmlDataStr.trim().length()!=0)
{
currDom = genericUtility.parseString(currXmlDataStr);
}
if (hdrXmlDataStr != null && hdrXmlDataStr.trim().length()!=0)
{
hdrDom = genericUtility.parseString(hdrXmlDataStr);
}
if (allXmlDataStr != null && allXmlDataStr.trim().length()!=0)
{
allDom = genericUtility.parseString(allXmlDataStr);
}
errString = itemChanged( currDom, hdrDom, allDom, objContext, currentColumn, editFlag, xtraParams );
System.out.println ( "ErrString :" + errString);
}
catch (Exception e)
{
System.out.println ( "Exception :DocMasMapEJB :itemChanged(String,String):" + e.getMessage() + ":" );
errString = genericUtility.createErrorString(e);
}
System.out.println ( "returning from DocMasMapEJB itemChanged" );
return errString;
}
public String itemChanged( Document currDom, Document hdrDom, Document allDom, String objContext, String currentColumn, String editFlag, String xtraParams ) throws RemoteException,ITMException
{
String sql = "";
String columnValue = "";
String userId = "";
String docDescr="";
String docNameDescr="";
String empCode = "";
String empFname = "";
String empMname = "";
String empLname = "";
String designation = "";
String reportTo = "";
String reportToAdmin = "";
String departmentDescr = "";
String reportToAdminFname = "";
String outTime = "";
long strIn_timeLong = 0;
long strOut_timeLong = 0;
StringBuffer valueXmlString = new StringBuffer();
Connection connObject = null;
PreparedStatement pstmt = null;
ResultSet rSet = null;
int currentFormNo = 0;
int count=0;
java.sql.Date currentDate = null;
String retDateStr = "";
GenericUtility genericUtility = GenericUtility.getInstance();
String confirmed = "";
String statusDate1 = "";
String statusDate = "";
String childNodeName = null;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
int childNodeListLength = 0;
int ctr = 0;
try
{
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
DateFormat dateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
java.util.Date todayDt = new java.util.Date();
String todayDateStr = dateFormat.format(todayDt);
System.out.println("todayDateStr date testing"+todayDateStr);
statusDate1 = genericUtility.getValidDateString(todayDateStr,genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
System.out.println("statusDate1 date testing"+statusDate1);
statusDate = todayDateStr;
System.out.println("status date testing"+statusDate + " 00:00:00");
System.out.println("editFlag="+editFlag);
userId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
ConnDriver connDriver = null;
connDriver = new ConnDriver();
connObject = connDriver.getConnectDB("DriverValidator");
parentNodeList = currDom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>");
childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
ctr++;
}
while (ctr < childNodeListLength && !childNodeName.equals(currentColumn));
if( objContext != null && objContext.trim().length() > 0 )
{
currentFormNo = Integer.parseInt( objContext );
}
valueXmlString = new StringBuffer( "<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>" );
valueXmlString.append( editFlag ).append( "</editFlag>\r\n</Header>\r\n" );
valueXmlString.append( "<Detail1>\r\n" );
if(currentColumn.trim().equalsIgnoreCase("itm_default") || currentColumn.trim().equalsIgnoreCase("itm_defaultedit") )
{
System.out.println(" tran date value"+statusDate);
valueXmlString.append( "<tran_date><![CDATA[" ).append( statusDate ).append( "]]></tran_date>\r\n" );
}
valueXmlString.append( "</Detail1>\r\n" );
}//End of TRY itemChanged doc
catch(Exception e)
{
System.out.println( "Exception :DocMasMapEJB :itemChanged:" + e.getMessage() + ":" );
throw new ITMException(e);
}//End of Catch
finally
{
try
{
if( rSet != null )
{
rSet.close();
rSet = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if( connObject != null && ! connObject.isClosed() )
{
connObject.close();
}
}
catch(Exception e)
{
System.out.println( "Exception :DocMasMapEJB:itemChanged :==>\n"+e.getMessage());
throw new ITMException(e);
}
}//End of Finally
valueXmlString.append( "</Root>\r\n" );
return valueXmlString.toString();
}//End of Item changed
public String preSave()throws RemoteException,ITMException
{
return "";
}
public String preSave(String domString, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException
{
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node childNode = null;
Node parentNode = null;
int parentNodeListLength = 0;
int childNodeListLen = 0;
int childNodeListLength = 0;
String childNodeName = "";
String refLineNum = null;
String bkRefLineNum = null;
String lineNum = null;
String lineNum3 = null;
String lineNum4 = null;
String errString = null;
String updateFlag="";
int roomCnt = 0;
int banqCnt = 0;
double payContr = 0.0;
Document domStr = null;
String updtFlag="";
String status = null;
ResultSet rs = null;
PreparedStatement pstmt = null ;
String sqlQuery="";
String key="REQ";
String val="";
int count=0;
double countBudget = 0.0;
String budgetShare = "";
ArrayList sumArrList =new ArrayList();
String acctCode = null;
String deptCode = null;
String cctrCode = null;
String analCode = null;
String checkStr = null;
String confHall = "";
String eventName = "";
String prefHtlBudg = "";
String keyStr = "";
ArrayList checkArrayList = new ArrayList();
String sqlStr = null;
String empCode = "";
String pfNum = "";
Statement stmt = null;
String errorCode = null;
String userId = null;
String tranDate = null;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
System.out.println("Pre_Save start");
if (domString != null && domString.trim().length() != 0 )
{
domStr = parseString(domString);
}
parentNodeList = domStr.getElementsByTagName("Detail1");
parentNodeListLength = parentNodeList.getLength();
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode = childNodeList.item(childRow);
childNodeName = childNode.getNodeName();
// updtFlag = getAttribValue(parentNode,"attribute", "updateFlag");
if(!updtFlag.equalsIgnoreCase("D"))
{
if(childNode.getFirstChild()!=null)
{
if (childNodeName.equals("emp_code"))
{
empCode = (childNode.getFirstChild().getNodeValue().trim());
System.out.println("Inside presave empCode"+empCode);
}
else if (childNodeName.equals("tran_date"))
{
tranDate = (childNode.getFirstChild().getNodeValue().trim());
System.out.println("Inside presave tranDate"+tranDate);
}
else if (childNodeName.equals("pf_no"))
{
pfNum = (childNode.getFirstChild().getNodeValue().trim());
System.out.println("Inside presave pfNum"+pfNum);
}
}
}
}
}
if(tranDate == null || tranDate.trim().length() <= 0 )
{
String errCode = "VTBLKCHDTE";
errString=getError("Tran date should not be left blank",errCode,conn);
return errString;
}
if(empCode == null || empCode.trim().length() <= 0 )
{
String errCode = "VTBLKCHODN";
errString=getError("Employee code should not be left blank",errCode,conn);
return errString;
}
else if(empCode != null && empCode.trim().length() > 0)
{
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt("COUNT");
}
if (count == 0)
{
String errCode = "VTINVCHODN";
errString=getError("Invalid employee code, please enter valid employee code",errCode,conn);
return errString;
}
}
if(pfNum == null || pfNum.trim().length() <= 0 )
{
String errCode = "VTBLKPFODN";
errString=getError("Pf number should not be left blank",errCode,conn);
return errString;
}
if(empCode != null && empCode.trim().length() > 0 && pfNum != null && pfNum.trim().length() > 0)
{
sqlStr = "UPDATE EMPLOYEE SET PF_NO = '"+pfNum+"' WHERE EMP_CODE = '"+empCode+"' ";
System.out.println("sqlStr.........:: " + sqlStr);
stmt = conn.createStatement();
count = stmt.executeUpdate(sqlStr);
conn.commit();
}//End Of if(empStatus)
}//End Of Try Block
catch (SQLException sqe)
{
System.out.println("The SQLException occurs in [EmpAdPrsEJB] :: [executepreSaveRec] :"+sqe);
sqe.printStackTrace();
try
{
conn.rollback();
}
catch(Exception sqe1){}
throw new ITMException(sqe);
}
catch(Exception e)
{
System.out.println("The Exception occurs in [EmpAdPrsEJB] :: [executepreSaveRec] :"+e);
e.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e1){}
throw new ITMException(e);
}
finally
{
try
{
System.out.println("Closing stmt and pstmt In [executepreSaveRec]......");
if (rs != null)
{
rs.close();
rs = null;
}
if(stmt != null)
{
stmt.close();
stmt = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
System.err.println("Exception :[EmpAdPrsEJB] :: [executepreSaveRec] :\n"+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}
return retString;
}
private Node getCurrentDetailFromDom(Document dom,String domId)
{
NodeList detailList = null;
Node currDetail = null,reqDetail = null;
String currDomId = "";
int detailListLength = 0;
detailList = dom.getElementsByTagName("Detail1");
detailListLength = detailList.getLength();
for (int ctr = 0;ctr < detailListLength;ctr++)
{
currDetail = detailList.item(ctr);
currDomId = currDetail.getAttributes().getNamedItem("domID").getNodeValue();
if (currDomId.equals(domId))
{
reqDetail = currDetail;
break;
}
}
return reqDetail;
}
private String getError(String descr,String Code,Connection conn)
throws ITMException, Exception
{
String mainStr ="";
try
{
String errString = "";
errString = new ITMDBAccessEJB().getErrorString("",Code,"","",conn);
String begPart = errString.substring(0,errString.indexOf("<message>")+9);
String endDesc = errString.substring(errString.indexOf("</description>"));
mainStr= begPart+"Invalid Data"+"</message><description>";
mainStr= mainStr+" "+descr+" "+endDesc;
System.out.println("mainStr:::::::::::::::::: "+mainStr);
begPart = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return mainStr;
}
private String getCurrentUpdateFlag(Node currDetail)
{
NodeList currDetailList = null;
String updateStatus = "",nodeName = "";
int currDetailListLength = 0;
currDetailList = currDetail.getChildNodes();
currDetailListLength = currDetailList.getLength();
for (int i=0;i< currDetailListLength;i++)
{
nodeName = currDetailList.item(i).getNodeName();
if (nodeName.equalsIgnoreCase("Attribute"))
{
updateStatus = currDetailList.item(i).getAttributes().getNamedItem("updateFlag").getNodeValue();
break;
}
}
return updateStatus;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import javax.ejb.*;
import org.w3c.dom.*;
import ibase.system.config.ConnDriver;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless; // added for ejb3
@Stateless
public class PfNumberprs extends ValidatorEJB implements PfNumberprsLocal,PfNumberprsRemote
{
String retString = "";
String objName = "";
Document domStr = null;
ResultSet rs = null;
PreparedStatement pstmt = null;
String sql = "";
String bookType = "";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String itemChanged() throws RemoteException, ITMException
{
return "";
}
public String itemChanged(String currXmlDataStr, String hdrXmlDataStr, String allXmlDataStr, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
System.out.println ( "HELLO_");
Document currDom = null;
Document hdrDom = null;
Document hdrDomNew = null;
Document allDom = null;
String errString = null;
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
if (currXmlDataStr != null && currXmlDataStr.trim().length()!=0)
{
currDom = genericUtility.parseString(currXmlDataStr);
}
if (hdrXmlDataStr != null && hdrXmlDataStr.trim().length()!=0)
{
hdrDom = genericUtility.parseString(hdrXmlDataStr);
}
if (allXmlDataStr != null && allXmlDataStr.trim().length()!=0)
{
allDom = genericUtility.parseString(allXmlDataStr);
}
errString = itemChanged( currDom, hdrDom, allDom, objContext, currentColumn, editFlag, xtraParams );
System.out.println ( "ErrString :" + errString);
}
catch (Exception e)
{
System.out.println ( "Exception :DocMasMapEJB :itemChanged(String,String):" + e.getMessage() + ":" );
errString = genericUtility.createErrorString(e);
}
System.out.println ( "returning from DocMasMapEJB itemChanged" );
return errString;
}
public String itemChanged( Document currDom, Document hdrDom, Document allDom, String objContext, String currentColumn, String editFlag, String xtraParams ) throws RemoteException,ITMException
{
String sql = "";
String columnValue = "";
String userId = "";
String docDescr="";
String docNameDescr="";
String empCode = "";
String empFname = "";
String empMname = "";
String empLname = "";
String designation = "";
String reportTo = "";
String reportToAdmin = "";
String departmentDescr = "";
String reportToAdminFname = "";
String outTime = "";
long strIn_timeLong = 0;
long strOut_timeLong = 0;
StringBuffer valueXmlString = new StringBuffer();
Connection connObject = null;
PreparedStatement pstmt = null;
ResultSet rSet = null;
int currentFormNo = 0;
int count=0;
java.sql.Date currentDate = null;
String retDateStr = "";
GenericUtility genericUtility = GenericUtility.getInstance();
String confirmed = "";
String statusDate1 = "";
String statusDate = "";
String childNodeName = null;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
int childNodeListLength = 0;
int ctr = 0;
try
{
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
DateFormat dateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
java.util.Date todayDt = new java.util.Date();
String todayDateStr = dateFormat.format(todayDt);
System.out.println("todayDateStr date testing"+todayDateStr);
statusDate1 = genericUtility.getValidDateString(todayDateStr,genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
System.out.println("statusDate1 date testing"+statusDate1);
statusDate = todayDateStr;
System.out.println("status date testing"+statusDate + " 00:00:00");
System.out.println("editFlag="+editFlag);
userId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
ConnDriver connDriver = null;
connDriver = new ConnDriver();
connObject = connDriver.getConnectDB("DriverValidator");
parentNodeList = currDom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>");
childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
ctr++;
}
while (ctr < childNodeListLength && !childNodeName.equals(currentColumn));
if( objContext != null && objContext.trim().length() > 0 )
{
currentFormNo = Integer.parseInt( objContext );
}
valueXmlString = new StringBuffer( "<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>" );
valueXmlString.append( editFlag ).append( "</editFlag>\r\n</Header>\r\n" );
columnValue = genericUtility.getColumnValue(currentColumn, currDom);
valueXmlString.append( "<Detail1>\r\n" );
if(currentColumn.trim().equalsIgnoreCase("itm_default") || currentColumn.trim().equalsIgnoreCase("itm_defaultedit") )
{
System.out.println(" tran date value"+statusDate);
valueXmlString.append( "<tran_date><![CDATA[" ).append( statusDate ).append( "]]></tran_date>\r\n" );
}
//Added by Hemlata[16/07/2014][For setting site code based on emp code].Start
else if (currentColumn.trim().equals("emp_code"))
{
if(columnValue !=null && columnValue.trim().length() >0)
{
sql="SELECT PAY_SITE FROM EMPLOYEE WHERE EMP_CODE= ? ";
System.out.println("*SQL:****************"+sql);
pstmt = connObject.prepareStatement( sql );
pstmt.setString(1,columnValue);
rs = pstmt.executeQuery();
String paySite ="";
if( rs.next())
{
paySite =checkNull(rs.getString("PAY_SITE"));
}
valueXmlString.append( "<emp_code><![CDATA[" ).append( columnValue ).append( "]]></emp_code>\r\n" );
valueXmlString.append( "<site_code><![CDATA[" ).append( paySite ).append( "]]></site_code>\r\n" );
}
else
{
valueXmlString.append("<site_code><![CDATA[]]></site_code>\r\n");
}
}
// Added by Hemlata[16/07/2014][For setting site code based on emp code].End
valueXmlString.append( "</Detail1>\r\n" );
}//End of TRY itemChanged doc
catch(Exception e)
{
System.out.println( "Exception :DocMasMapEJB :itemChanged:" + e.getMessage() + ":" );
throw new ITMException(e);
}//End of Catch
finally
{
try
{
if( rSet != null )
{
rSet.close();
rSet = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if( connObject != null && ! connObject.isClosed() )
{
connObject.close();
}
}
catch(Exception e)
{
System.out.println( "Exception :DocMasMapEJB:itemChanged :==>\n"+e.getMessage());
throw new ITMException(e);
}
}//End of Finally
valueXmlString.append( "</Root>\r\n" );
return valueXmlString.toString();
}//End of Item changed
// To check Columnvalue is null or not
private String checkNull( String input )
{
if (input == null)
{
input = "";
}
else
{
input = input.trim();
}
return input;
}
public String preSave()throws RemoteException,ITMException
{
return "";
}
public String preSave(String domString, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException
{
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node childNode = null;
Node parentNode = null;
int parentNodeListLength = 0;
int childNodeListLen = 0;
int childNodeListLength = 0;
String childNodeName = "";
String refLineNum = null;
String bkRefLineNum = null;
String lineNum = null;
String lineNum3 = null;
String lineNum4 = null;
String errString = null;
String updateFlag="";
int roomCnt = 0;
int banqCnt = 0;
double payContr = 0.0;
Document domStr = null;
String updtFlag="";
String status = null;
ResultSet rs = null;
PreparedStatement pstmt = null ;
String sqlQuery="";
String key="REQ";
String val="";
int count=0;
double countBudget = 0.0;
String budgetShare = "";
ArrayList sumArrList =new ArrayList();
String acctCode = null;
String deptCode = null;
String cctrCode = null;
String analCode = null;
String checkStr = null;
String confHall = "";
String eventName = "";
String prefHtlBudg = "";
String keyStr = "";
ArrayList checkArrayList = new ArrayList();
String sqlStr = null;
String empCode = "";
String pfNum = "";
Statement stmt = null;
String errorCode = null;
String userId = null;
String tranDate = null;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
System.out.println("Pre_Save start");
if (domString != null && domString.trim().length() != 0 )
{
domStr = parseString(domString);
}
parentNodeList = domStr.getElementsByTagName("Detail1");
parentNodeListLength = parentNodeList.getLength();
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode = childNodeList.item(childRow);
childNodeName = childNode.getNodeName();
// updtFlag = getAttribValue(parentNode,"attribute", "updateFlag");
if(!updtFlag.equalsIgnoreCase("D"))
{
if(childNode.getFirstChild()!=null)
{
if (childNodeName.equals("emp_code"))
{
empCode = (childNode.getFirstChild().getNodeValue().trim());
System.out.println("Inside presave empCode"+empCode);
}
else if (childNodeName.equals("tran_date"))
{
tranDate = (childNode.getFirstChild().getNodeValue().trim());
System.out.println("Inside presave tranDate"+tranDate);
}
else if (childNodeName.equals("pf_no"))
{
pfNum = (childNode.getFirstChild().getNodeValue().trim());
System.out.println("Inside presave pfNum"+pfNum);
}
}
}
}
}
if(tranDate == null || tranDate.trim().length() <= 0 )
{
String errCode = "VTBLKCHDTE";
errString=getError("Tran date should not be left blank",errCode,conn);
return errString;
}
if(empCode == null || empCode.trim().length() <= 0 )
{
String errCode = "VTBLKCHODN";
errString=getError("Employee code should not be left blank",errCode,conn);
return errString;
}
else if(empCode != null && empCode.trim().length() > 0)
{
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt("COUNT");
}
if (count == 0)
{
String errCode = "VTINVCHODN";
errString=getError("Invalid employee code, please enter valid employee code",errCode,conn);
return errString;
}
}
if(pfNum == null || pfNum.trim().length() <= 0 )
{
String errCode = "VTBLKPFODN";
errString=getError("Pf number should not be left blank",errCode,conn);
return errString;
}
if(empCode != null && empCode.trim().length() > 0 && pfNum != null && pfNum.trim().length() > 0)
{
sqlStr = "UPDATE EMPLOYEE SET PF_NO = '"+pfNum+"' WHERE EMP_CODE = '"+empCode+"' ";
System.out.println("sqlStr.........:: " + sqlStr);
stmt = conn.createStatement();
count = stmt.executeUpdate(sqlStr);
conn.commit();
}//End Of if(empStatus)
}//End Of Try Block
catch (SQLException sqe)
{
System.out.println("The SQLException occurs in [EmpAdPrsEJB] :: [executepreSaveRec] :"+sqe);
sqe.printStackTrace();
try
{
conn.rollback();
}
catch(Exception sqe1){}
throw new ITMException(sqe);
}
catch(Exception e)
{
System.out.println("The Exception occurs in [EmpAdPrsEJB] :: [executepreSaveRec] :"+e);
e.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e1){}
throw new ITMException(e);
}
finally
{
try
{
System.out.println("Closing stmt and pstmt In [executepreSaveRec]......");
if (rs != null)
{
rs.close();
rs = null;
}
if(stmt != null)
{
stmt.close();
stmt = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
System.err.println("Exception :[EmpAdPrsEJB] :: [executepreSaveRec] :\n"+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}
return retString;
}
private Node getCurrentDetailFromDom(Document dom,String domId)
{
NodeList detailList = null;
Node currDetail = null,reqDetail = null;
String currDomId = "";
int detailListLength = 0;
detailList = dom.getElementsByTagName("Detail1");
detailListLength = detailList.getLength();
for (int ctr = 0;ctr < detailListLength;ctr++)
{
currDetail = detailList.item(ctr);
currDomId = currDetail.getAttributes().getNamedItem("domID").getNodeValue();
if (currDomId.equals(domId))
{
reqDetail = currDetail;
break;
}
}
return reqDetail;
}
private String getError(String descr,String Code,Connection conn)
throws ITMException, Exception
{
String mainStr ="";
try
{
String errString = "";
errString = new ITMDBAccessEJB().getErrorString("",Code,"","",conn);
String begPart = errString.substring(0,errString.indexOf("<message>")+9);
String endDesc = errString.substring(errString.indexOf("</description>"));
mainStr= begPart+"Invalid Data"+"</message><description>";
mainStr= mainStr+" "+descr+" "+endDesc;
System.out.println("mainStr:::::::::::::::::: "+mainStr);
begPart = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return mainStr;
}
private String getCurrentUpdateFlag(Node currDetail)
{
NodeList currDetailList = null;
String updateStatus = "",nodeName = "";
int currDetailListLength = 0;
currDetailList = currDetail.getChildNodes();
currDetailListLength = currDetailList.getLength();
for (int i=0;i< currDetailListLength;i++)
{
nodeName = currDetailList.item(i).getNodeName();
if (nodeName.equalsIgnoreCase("Attribute"))
{
updateStatus = currDetailList.item(i).getAttributes().getNamedItem("updateFlag").getNodeValue();
break;
}
}
return updateStatus;
}
}
package ibase.webitm.ejb.adm;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
import org.w3c.dom.Document;
// added for ejb3
@Local
public interface PfNumberprsLocal extends ValidatorLocal
{
public String preSave()throws RemoteException,ITMException;
public String preSave( String domString, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString_, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom_, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.adm;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
import org.w3c.dom.Document;
// added for ejb3
@Local
public interface PfNumberprsLocal extends ValidatorLocal
{
public String preSave()throws RemoteException,ITMException;
public String preSave( String domString, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString_, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom_, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.sql.Connection;
import javax.ejb.Remote; // added for ejb3
import org.w3c.dom.Document;
@Remote
public interface PfNumberprsRemote extends ValidatorRemote
{
public String preSave()throws RemoteException,ITMException;
public String preSave( String domString, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString_, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom_, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.sql.Connection;
import javax.ejb.Remote; // added for ejb3
import org.w3c.dom.Document;
@Remote
public interface PfNumberprsRemote extends ValidatorRemote
{
public String preSave()throws RemoteException,ITMException;
public String preSave( String domString, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString_, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom_, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
......@@ -286,6 +286,7 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
errString = getErrorString("stan_code","VMSTANINVD",userId);
break;
}
sql = "SELECT COUNT(*) AS COUNT FROM STATION WHERE STAN_CODE = ? AND STATE_CODE = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stanCode);
......@@ -313,8 +314,48 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
break;
}
}
//Added by Hemlata[17/07/2014][to validate duplicate entry for SITE_STAN_PAYTBL][start]
//Added by Radheshyam[01/03/2014][to validate duplicate entry for SITE_STAN_PAYTBL][start]
siteCode = getColumnValue("site_code",dom1,objContext);
stateCode = getColumnValue("state_code",dom1,objContext);
stanCode = getColumnValue("stan_code",dom1,objContext);
System.out.println("value of count in siteCode:::: "+siteCode);
System.out.println("value of count in stateCode:::: "+stateCode);
System.out.println("value of count in stan_code:::: "+stanCode);
sql = "SELECT COUNT(*) AS COUNT FROM SITE_STAN_PAYTBL WHERE site_code = ? AND STATE_CODE = ? AND STAN_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setString(2,stateCode);
pstmt.setString(3,stanCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count :::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count > 0)
{
System.out.println("Duplicate Entries");
//errString = getErrorString("stan_code","VMSTANDUPL",userId);
errString = getErrorString("stan_code","VMSTNPTBL1",userId);
break;
}
//Added by Radheshyam[01/03/2014][to validate duplicate entry for SITE_STAN_PAYTBL][End]
// Added by Hemlata[17/07/2014][to validate duplicate entry for SITE_STAN_PAYTBL][End]
}
} //END IF (stan_code)
//END IF (stan_code)
else if (childNodeName.equalsIgnoreCase("pay_table"))
{
payTable = getColumnValue("pay_table",dom1,objContext);
......
......@@ -508,8 +508,8 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
log.write("[FullFinalActEJB] wf_calc_lnint() :cctrSalEmp ===============>"+cctrSalEmp);
log.write("[FullFinalActEJB] wf_calc_lnint() :paySite ===============>"+paySite);
sqlStr = "SELECT A.LOAN_NO," +
//Modified by Radheshyam[07/03/2014][ Request ID : AD3GSUN001 ][sql query was not correct at SUM( C.INTEREST_AMT ) should be calculated in column INTEREST_AMT]
/*sqlStr = "SELECT A.LOAN_NO," +
" A.LOAN_AMT, " +
" A.BALANCE_AMT, " +
" A.SCHEME_NO, " +
......@@ -524,8 +524,25 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
" ( CASE WHEN C.CONFIRMED IS NULL THEN 'N' ELSE C.CONFIRMED END = 'Y' ) AND " +
" ( CASE WHEN A.STATUS IS NULL THEN 'U' ELSE A.STATUS END = 'A' ) ) " +
" GROUP BY A.LOAN_NO, A.LOAN_AMT, A.BALANCE_AMT, A.SCHEME_NO, B.AD_CODE__DED, B.AD_CODE__INT " +
" ORDER BY A.LOAN_NO ASC, A.LOAN_AMT ASC, A.BALANCE_AMT ASC, A.SCHEME_NO ASC, B.AD_CODE__DED ASC, B.AD_CODE__INT ASC ";*/
sqlStr = "SELECT A.LOAN_NO," +
" A.LOAN_AMT, " +
" A.BALANCE_AMT, " +
" A.SCHEME_NO, " +
" B.AD_CODE__DED, " +
" B.AD_CODE__INT, " +
" SUM( C.INTEREST_AMT ) AS INTEREST_AMT" +
" FROM LOANS A, LOAN_SCHEME B, LOANS_INTEREST C " +
" WHERE ( A.SCHEME_NO = B.SCHEME_NO ) AND " +
" ( A.LOAN_NO = C.LOAN_NO ) AND " +
" ( ( A.EMP_CODE = '"+empCode+"' ) AND " +
" ( B.SCHEME_NO = A.SCHEME_NO ) AND " +
" ( CASE WHEN C.CONFIRMED IS NULL THEN 'N' ELSE C.CONFIRMED END = 'Y' ) AND " +
" ( CASE WHEN A.STATUS IS NULL THEN 'U' ELSE A.STATUS END = 'A' ) ) " +
" GROUP BY A.LOAN_NO, A.LOAN_AMT, A.BALANCE_AMT, A.SCHEME_NO, B.AD_CODE__DED, B.AD_CODE__INT " +
" ORDER BY A.LOAN_NO ASC, A.LOAN_AMT ASC, A.BALANCE_AMT ASC, A.SCHEME_NO ASC, B.AD_CODE__DED ASC, B.AD_CODE__INT ASC ";
System.out.println("Sql String : "+sqlStr);
log.write("Sql String : "+sqlStr);
......@@ -594,14 +611,25 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
//--- Collect total rercovery done thru payroll (including interest) against each loans
System.out.println("line no : ---------->>> 600");
sqlStr = "SELECT CASE WHEN SUM(CASE WHEN PAYROLLDET.AMOUNT IS NULL THEN 0 ELSE PAYROLLDET.AMOUNT END) IS NULL THEN 0 " +
//Modified by Radheshyam[07/03/2014][Request ID : AD3GSUN001][sql query was not correct at AYROLLDET.AD_CODE and AYROLLDET.REF_NO table name should be PAYROLLDET]
/*sqlStr = "SELECT CASE WHEN SUM(CASE WHEN PAYROLLDET.AMOUNT IS NULL THEN 0 ELSE PAYROLLDET.AMOUNT END) IS NULL THEN 0 " +
" ELSE SUM(CASE WHEN PAYROLLDET.AMOUNT IS NULL THEN 0 ELSE PAYROLLDET.AMOUNT END) END " +
" FROM PAYROLLDET,PERIOD" +
" WHERE PAYROLLDET.EMP_CODE = '"+empCode+"'" +
" AND PAYROLLDET.PRD_CODE = PERIOD.CODE" +
" AND PERIOD.CODE > '0'" +
" AND AYROLLDET.AD_CODE IN( '"+adCodeDed+"' , '"+adCodeInt+"')" +
" AND AYROLLDET.REF_NO = '"+loanNo+"'";
" AND AYROLLDET.REF_NO = '"+loanNo+"'";*/
sqlStr = "SELECT CASE WHEN SUM(CASE WHEN PAYROLLDET.AMOUNT IS NULL THEN 0 ELSE PAYROLLDET.AMOUNT END) IS NULL THEN 0 " +
" ELSE SUM(CASE WHEN PAYROLLDET.AMOUNT IS NULL THEN 0 ELSE PAYROLLDET.AMOUNT END) END " +
" FROM PAYROLLDET,PERIOD" +
" WHERE PAYROLLDET.EMP_CODE = '"+empCode+"'" +
" AND PAYROLLDET.PRD_CODE = PERIOD.CODE" +
" AND PERIOD.CODE > '0'" +
" AND PAYROLLDET.AD_CODE IN( '"+adCodeDed+"' , '"+adCodeInt+"')" +
" AND PAYROLLDET.REF_NO = '"+loanNo+"'";
System.out.println("Sql String : "+sqlStr);
log.write("Sql String : "+sqlStr);
......@@ -669,6 +697,9 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
stmt1.close();
stmt1 = null;
//Added by Radheshyam[15/01/2014][Request ID : AD3GSUN001][to get the remarks dynamically by function]
remarks = getRemarksByFunction(empCode, relieveDate, "LOANINT", "", loanNo, adCodeInt, null, null, intAmt, 0, acctCodeSal,cctrSalAllwdedn, conn, remarks);
System.out.println("[FullFinalActEJB] wf_calc_lnint() :acctCodeSal ===============>"+acctCodeSal);
System.out.println("[FullFinalActEJB] wf_calc_lnint() :cctrSalAllwdedn ===============>"+cctrSalAllwdedn);
System.out.println("[FullFinalActEJB] wf_calc_lnint() :descr ===============>"+descr);
......@@ -979,6 +1010,10 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
cctrCode = cctrSalEmp;
}
remarks = ""+ shDescr + "for " + startDt + " to " + endDt ;
//Added by Radheshyam [15/01/2014][Request ID : AD3GSUN001][to get the remarks dynamically by function]
//remarks = getRemarksByFunction(empCode, relieveDt, "ALDBAL", refType, refNo, adCode, startDate.toString(), endDate.toString(), balanceAmt, 0, acctCodeSal, cctrCode, conn, remarks);//Modified by Radheshyam [04/03/2014]
remarks = getRemarksByFunction(empCode,genericUtility.getValidDateTimeString(relieveDt,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()), "ALDBAL", refType, refNo, adCode, startDate.toString(), endDate.toString(), balanceAmt, 0, acctCodeSal, cctrCode, conn, remarks);
System.out.println("[FullFinalActEJB] wf_calc_allwdedn() :remarks ===============>"+remarks);
System.out.println("[FullFinalActEJB] payable========>"+payable);
......@@ -1088,6 +1123,7 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
String adCode = "", cctrSalEmp = "", paySite = "", refType = "", refNo ="", cctrCode = "";
String finEntity = "", currCodeTo = "", trDate = "", acctCode = "", currFluc = "", descr = "";
String sqlStr = "", sqlStr1 = "", retString = "", errorCode = "", errString = "";
String relieveDt = "";//Added by Radheshyam[15/01/2014][Request ID : AD3GSUN001]
double diffExchrate = 0.0, diffAmt = 0.0, balanceAmt = 0.0, dailyExchrate = 0.0, exchRate = 0.0, netAmt = 0.0;
java.sql.Date nullDate = null, endDate = null;
......@@ -1114,6 +1150,9 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
empCode = genericUtility.getColumnValue("emp_code", dom1,"1");//UPDATED BY NISAR ON 13/12/07
tranID = genericUtility.getColumnValue("tran_id", dom1,"1");
trDate = genericUtility.getColumnValue("tran_date", dom1,"1");
//Added by Radheshyam[15/01/2014][Request ID : AD3GSUN001][to get value of relieve Date from Dom]
relieveDt = genericUtility.getColumnValue("relieve_date", dom1,"1");
java.util.Date tranDate = new java.util.Date();
tranDate = new SimpleDateFormat(genericUtility.getApplDateFormat()).parse(trDate);
sqlStr = "SELECT CCTR_CODE__SAL, PAY_SITE, CADRE, GRADE FROM EMPLOYEE WHERE EMP_CODE = '"+empCode+"'";
......@@ -1267,6 +1306,9 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
stmt1.close();
stmt1 = null;
}
//Added by Radheshyam [15/01/2014][Request ID : AD3GSUN001][to get the remarks dynamically by function]
//remarks = getRemarksByFunction(empCode, relieveDt, "MPAY", refSer, refNo, "", null, null, balanceAmt, 0, acctCode, cctrCode, conn, remarks);//Modified by Radheshyam [04/03/2014]
remarks = getRemarksByFunction(empCode, genericUtility.getValidDateTimeString(relieveDt,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()), "MPAY", refSer, refNo, "", null, null, balanceAmt, 0, acctCode, cctrCode, conn, remarks);
if(dailyExchrate > exchRate)
{
diffExchrate = dailyExchrate - exchRate;
......@@ -1328,6 +1370,9 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
balanceAmt = netAmt;
remarks = "Towards Currency Fluctuation";
//Added by Radheshyam [15/01/2014][Request ID : AD3GSUN001][to get the remarks dynamically by function]
//remarks = getRemarksByFunction(empCode, relieveDt, "MPAYCF", refSer, refNo, "", null, null, balanceAmt, 0, acctCode, cctrCode, conn, remarks);//Modified by Radheshyam [04/03/2014]
remarks = getRemarksByFunction(empCode, genericUtility.getValidDateTimeString(relieveDt,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()), "MPAYCF", refSer, refNo, "", null, null, balanceAmt, 0, acctCode, cctrCode, conn, remarks);
System.out.println("[FullFinalActEJB] wf_calc_miscpay() :netAmt ===============>"+netAmt);
System.out.println("[FullFinalActEJB] wf_calc_miscpay() :balanceAmt ===============>"+balanceAmt);
System.out.println("[FullFinalActEJB] wf_calc_miscpay() :remarks ===============>"+remarks);
......@@ -1879,6 +1924,11 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
cctrCode = cctrCodeSal;
}
remarks = "Towards Notice Pay Recovery of " + diffDays + "days";
//Added by Radheshyam [15/01/2014][Request ID : AD3GSUN001][to get the remarks dynamically by function]
//remarks = getRemarksByFunction(empCode, relieveDate.toString(), "NRECO", "", "", noticeAd, null, null, amount1, diffDays, acctCode, cctrCode, conn, remarks);//Modified by Radheshyam[04/03/2014]
remarks = getRemarksByFunction(empCode, relieveDate.toString(), "NPRECO", "", "", noticeAd, null, null, amount1, diffDays, acctCode, cctrCode, conn, remarks);
detInsert = wf_det_insert(tranID,noticeAd,descr,amount1,nullDate,"","",acctCode,cctrCode,remarks,"","",currCode,1,amount1,1);
System.out.println("After wf_det_insert called detInsert --->> [ "+detInsert+" ]");
noticeAd = "";
......@@ -2032,6 +2082,10 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
cctrCode = cctrCodeSal;
}
remarks = "Towards Notice Pay Payable of " + daysAfter1 + "days";
//Added by Radheshyam [15/01/2014][Request ID : AD3GSUN001][to get the remarks dynamically by function]
remarks = getRemarksByFunction(empCode, relieveDate.toString(), "NPAY", "", "", noticeAd, null, null, amount2, daysAfter1, acctCode, cctrCode, conn, remarks);
detInsert = detInsert + wf_det_insert(tranID,noticeAd,adDescr,amount2,nullDate,"","",acctCode,cctrCode,remarks,"","",currCode,1,amount2,1);
//updated by nisar on 08/12/07
} //end of if(daysAfter1 > 0)
......@@ -2294,9 +2348,11 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
log.write("[FullFinalEJB] wf_calc_np() : amount1=====>"+amount1);
remarks = "Towards Leave Encashment of " + balanceDays1 + "days";
detInsert = detInsert + wf_det_insert(tranID,plEncash,plDescr,amount1,nullDate,"","",acctCode,cctrCode,remarks,"","",currCode,1,amount1,1);
//Added by Radheshyam [15/01/2014][Request ID : AD3GSUN001][to get the remarks dynamically by function][Start]
remarks = getRemarksByFunction(empCode, relieveDate.toString(), "LEAVEENC", "", "", plEncash, null, null, amount1, (int) balanceDays1, acctCode, cctrCode, conn, remarks);
detInsert = detInsert + wf_det_insert(tranID,plEncash,plDescr,amount1,nullDate,"","",acctCode,cctrCode,remarks,"","",currCode,1,amount1,1);
}
rs.close();
}
......@@ -2714,6 +2770,11 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
cctrCode = cctrCodeSal;
}
remarks = "Towards Gratuity For " + totalDays + "days";
//Added by Radheshyam [15/01/2014][Request ID : AD3GSUN001][to get the remarks dynamically by function]
//remarks = getRemarksByFunction(empCode, relieveDate.toString(), "GRATUITY", "", "", adCode, null, null, totalAmt, (int)totalDays, acctCode, cctrCode, conn, remarks);//Modified by Radheshyam[03/03/2014]
remarks = getRemarksByFunction(empCode,genericUtility.getValidDateTimeString( relieveDt,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()), "GRATUITY", "", "", adCode, null, null, totalAmt, (int)totalDays, acctCode, cctrCode, conn, remarks);
detInsertString = wf_det_insert(tranID,adCode,adDescr,totalAmt,nullDate,"","",acctCode,cctrCode,remarks,"","",currCode,1,totalAmt,1);
System.out.println("XML detInsertString line no : ---------->>> 2720 ["+detInsertString+ "]");
......@@ -3181,5 +3242,66 @@ public class FullFinalAct extends ActionHandlerEJB implements FullFinalActLocal,
double reqVal = Double.parseDouble(strValue);
return reqVal;
}
//Added by Radheshyam [15/01/2014][Request ID : AD3GSUN001][to get remarks dynamically from function][Start]
public String getRemarksByFunction(String empCode, String relieveDate, String tranType, String refSer, String refNo, String adCode, String startDate, String endDate, Double amount, int days,String acctCode, String cctrCode, Connection conn, String orgRemarks)
{
String sqlStr = "";
String remarks = "";
PreparedStatement pst = null;
ResultSet rs = null;
try
{
sqlStr = "select FN_HR_GET_FF_REMARKS(?,?,?,?,?,?,?,?,?,?,?,?)as remarks from dual";
pst = conn.prepareStatement(sqlStr);
pst.setString(1, empCode);
//Modified by Radheshyam[04/03/2014][to parse date in sql timestamp]
//pst.setString(2, relieveDate);
pst.setTimestamp( 2, (relieveDate != null ) ? java.sql.Timestamp.valueOf(relieveDate) :null);
pst.setString(3, tranType);
pst.setString(4, refSer);
pst.setString(5, refNo);
pst.setString(6, adCode);
//Modified by Radheshyam[04/03/2014][to parse date in sql timestamp][start]
//pst.setString(7, startDate);
//pst.setString(8, endDate);
pst.setTimestamp( 7, (startDate != null ) ? java.sql.Timestamp.valueOf(startDate) :null);
pst.setTimestamp( 8, (endDate != null ) ? java.sql.Timestamp.valueOf(endDate) :null);
//Modified by Radheshyam[04/03/2014][to parse date in sql timestamp][End]
pst.setDouble(9, amount);
pst.setInt(10, days);
pst.setString(11, acctCode);
pst.setString(12, cctrCode);
rs = pst.executeQuery();
if(rs.next())
{
remarks = rs.getString(1);
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pst != null)
{
pst.close();
pst = null;
}
System.out.println(">>>Computed Value of remarks is::"+remarks);
if(remarks == null || remarks.trim().length() <= 0 )
{
System.out.println(">>>inside condition remarks computed as null value<<<");
remarks = orgRemarks;
}
}
catch(Exception e)
{
System.out.println(e);//Added by Radheshyam[03/03/2014]
System.out.println(">>>inside catch block geting exception<<<");
remarks = orgRemarks;
}
System.out.println(">>>final return value of remarks is::"+remarks);
return remarks;
}
//Added by Radheshyam [15/01/2014][Request ID : AD3GSUN001][to get remarks dynamically from function][End]
}
\ 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