Commit 5c932317 authored by vlagad's avatar vlagad

Java component for allowdedn_drop

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@212577 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8e201102
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.itextpdf.text.log.SysoCounter;
import ibase.utility.BaseLogger;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
public class AllowDeductionDropIc extends ValidatorEJB
{
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
AdmCommon admCommon = new AdmCommon();
UtilMethods utilMethod = new UtilMethods();
String userId = "",loginEmpCode = "",runMode = "",chgTerm = "";
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = "";
try
{
if(xmlString != null && xmlString.trim().length() > 0)
{
dom = genericUtility.parseString(xmlString);
}
if(xmlString1 != null && xmlString1.trim().length() > 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if(xmlString2 != null && xmlString2.trim().length() > 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
BaseLogger.log("3",null,null,"ErrString :" + errString);
}
catch(Exception e)
{
BaseLogger.log("0",null,null,"Exception :AllowDeductionDropIc :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String sql = "",empCode= "",prdCode = "",prd_code__adj="",errString = "",adCode = "",errCode = "";
String userId = null,paySite = "",childNodeName = null,balAct="";
Connection conn = null;
Statement stmt = null;
PreparedStatement pstmt = null, pstmt1 =null;
ResultSet rs = null, rs1 = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
int counterChild = 0,noOfChilds = 0,currentFormNo = 0,cnt = 0;
FinCommon finCommon = null;
try
{
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
conn = getConnection();
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
BaseLogger.log("3",null,null,"currentFormNo:::"+currentFormNo);
switch(currentFormNo)
{
case 1:
{
parentList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentList.item(0);
childList = parentNode.getChildNodes();
noOfChilds = childList.getLength();
BaseLogger.log("3",null,null,"noOfChilds == "+noOfChilds);
for(counterChild = 1; counterChild < noOfChilds; counterChild++)
{
childNode = childList.item(counterChild);
childNodeName = childNode.getNodeName();
BaseLogger.log("3",null,null,"childNodeName :: "+childNodeName);
if("tran_date".equalsIgnoreCase(childNodeName))
{
empCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("emp_code", dom));
String tranDate = E12GenericUtility.checkNull(genericUtility.getColumnValue("tran_date", dom));
BaseLogger.log("3",null,null,"Employee Code is ::: ["+empCode+"] \t tran_date ::: ["+tranDate+"]");
sql = "select pay_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
paySite = E12GenericUtility.checkNull(rs.getString("pay_site"));
BaseLogger.log("3",null,null,"paySite is :: "+paySite);
ValidatorEJB validatorEjb = new ValidatorEJB();
java.util.Date currDate = validatorEjb.getDateObject( tranDate );
BaseLogger.log("3",null,null,"currDate = " + currDate);
finCommon = new FinCommon();
errCode = finCommon.nfCheckPeriod("ADM", currDate, paySite, conn);
if( errCode.length() > 0)
{
BaseLogger.log("3",null,null,"Error Code :: "+errCode);
errString = genericUtility.getErrorString("ad_code", "VTDROP1",userId);
break;
}
}
else
{
errString = genericUtility.getErrorString("tran_date", "VMEMP1",userId);
break ;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
else if("emp_code".equalsIgnoreCase(childNodeName))
{
empCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select count(*) from employee where emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errString = genericUtility.getErrorString("emp_code", "VMEMP1",userId);
break;
}
}
else if("ad_code".equalsIgnoreCase(childNodeName))
{
adCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("ad_code", dom));
BaseLogger.log("3",null,null,"AD CODE Code is ::: ["+adCode+"]");
sql = "select count(*) from allwdedn where ad_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
BaseLogger.log("3",null,null,"cnt is :: "+cnt);
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errString = genericUtility.getErrorString("ad_code", "VMAD1",userId);
break;
}
else
{
String dropYN ="";
sql = "select drop_yn from allwdedn where ad_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if(rs.next())
{
dropYN = E12GenericUtility.checkNull(rs.getString(1));
}
if( dropYN.length() == 0 || "N".equalsIgnoreCase(dropYN) )
{
errString = genericUtility.getErrorString("ad_code", "VTDROP1",userId);
break;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
}
else if ("prd_code__ded".equalsIgnoreCase(childNodeName))
{
prdCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__ded", dom));
BaseLogger.log("3",null,null,"Period Code ::: ["+prdCode+"]");
sql = "select count(*) from period where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
BaseLogger.log("3",null,null,"cnt is :: "+cnt);
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errString = genericUtility.getErrorString("prd_code__ded", "VTPRD1",userId);
break;
}
else
{
String voucherNo ="";
empCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("emp_code", dom));
sql= "select voucher_no from payroll where prd_code = ? and emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
pstmt.setString(2, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
voucherNo = E12GenericUtility.checkNull(rs.getString(1));
}
else
{
errString = genericUtility.getErrorString("prd_code__ded", "VTPAYROLL1",userId);
break;
}
if( voucherNo.length() > 0)
{
errString = genericUtility.getErrorString("prd_code__ded", "VTPAYROLL",userId);
break;
}
}
}
else if("prd_code__adj".equalsIgnoreCase(childNodeName))
{
prdCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__ded", dom));
prd_code__adj = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__adj", dom));
BaseLogger.log("3",null,null,"Period Code ::: ["+prd_code__adj+"]");
sql = "select count(*) as count from period where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prd_code__adj);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("count");
}
BaseLogger.log("3",null,null,"cnt is :: "+cnt);
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errString = genericUtility.getErrorString("prd_code__adj", "VTPRD1",userId);
break;
}
admCommon = new AdmCommon();
System.out.println("prdCode ["+prdCode+"] ");
Date prdCodeTs = null,prdCodeAdjTs=null;
try
{
prdCodeTs = new SimpleDateFormat("yyyyMM").parse(prdCode);
prdCodeAdjTs = new SimpleDateFormat("yyyyMM").parse(prd_code__adj);
}
catch (ParseException e)
{
e.printStackTrace();
}
if(prdCodeAdjTs.before(prdCodeTs))
{
errString = genericUtility.getErrorString("prd_code__adj", "VTPRD6",userId);
}
}
else if("drop_amount".equalsIgnoreCase(childNodeName))
{
System.out.println("drop amount....................");
double dropAmount = 0;
String dropAmt = E12GenericUtility.checkNull(genericUtility.getColumnValue("drop_amount", dom));
empCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("emp_code", dom));
String prdCodeDeb = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__ded", dom));
adCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("ad_code", dom));
if(!"".equals(dropAmt))
{
dropAmount = Double.parseDouble((dropAmt));
}
if( dropAmount < 0)
{
errString = genericUtility.getErrorString("drop_amount", "VTDRPAMT01",userId);
break;
}
else
{
double amount = 0;
sql ="select amount from payrolldet where prd_code = ? and emp_code = ? and ad_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCodeDeb);
pstmt.setString(2, empCode);
pstmt.setString(3, adCode);
rs = pstmt.executeQuery();
if (rs.next())
{
amount = rs.getDouble(1);
if(dropAmount > amount)
{
errString = genericUtility.getErrorString("drop_amount", "VTDROP2",userId);
break;
}
else
{
cnt = 0;
sql ="select count(*) as count from allowdedn_drop where prd_code__ded = ? and emp_code = ? and ad_code = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, prdCodeDeb);
pstmt1.setString(2, empCode);
pstmt1.setString(3, adCode);
rs1 = pstmt1.executeQuery();
while (rs1.next())
{
cnt = rs1.getInt(1);
}
if( ("A".equalsIgnoreCase(editFlag) && cnt > 0) || ("E".equalsIgnoreCase(editFlag) && cnt > 1))
{
errString = genericUtility.getErrorString("drop_amount", "VTDROP3",userId);//Already Dropped
break;
}
if (rs1 != null)
{
rs1.close();
rs1 = null;
}
if (pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
}
}
else
{
errString = genericUtility.getErrorString("drop_amount", "VTDROPAD",userId);
break;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
}
else if("bal_act".equalsIgnoreCase(childNodeName))
{
String balOpt ="";
balAct = E12GenericUtility.checkNull(genericUtility.getColumnValue("bal_act", dom));
adCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("ad_code", dom));
sql =" select bal_opt from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
while (rs.next())
{
balOpt = E12GenericUtility.checkNull(rs.getString(1));
}
if("C".equalsIgnoreCase(balOpt) && "N".equalsIgnoreCase(balAct))
{
errString = genericUtility.getErrorString("bal_act", "VTBLACT1",userId);
break;
}
else if(!"C".equalsIgnoreCase(balOpt) && !"N".equalsIgnoreCase(balAct))
{
errString = genericUtility.getErrorString("bal_act", "VTBLACT2",userId);
break;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}//End of Validation for Employee Code
}//end of case statement
}
break;
}
}
}
catch (SQLException e)
{
errString = genericUtility.getErrorString("", "DS000",userId);//Already Dropped
}
catch(Exception e)
{
BaseLogger.log("0",null,null,"Exception :AdvancedAdd :wfValData(Document dom):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(stmt != null)
{
stmt.close();
stmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
BaseLogger.log("0",null,null,"Closing Connection...........");
e.printStackTrace();
throw new ITMException(e);
}
}
BaseLogger.log("3",null,null,"testing : final errString : " + errString);
return errString;
}
public String itemChanged(String xmlString, String xmlStringHdr, String xmlStringAll, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null, domHdr = null, domAll = null;
String valueXmlString = "";
try {
if (xmlString != null && xmlString.trim().length() > 0)
{
dom = genericUtility.parseString(xmlString);
}
if (xmlStringHdr != null && xmlStringHdr.trim().length() > 0)
{
domHdr = genericUtility.parseString(xmlStringHdr);
}
if (xmlStringAll != null && xmlStringAll.trim().length() > 0)
{
domAll = genericUtility.parseString(xmlStringAll);
}
valueXmlString = itemChanged(dom, domHdr, domAll, objContext, currentColumn, editFlag, xtraParams);
}
catch (Exception e)
{
BaseLogger.log("0",null,null,"Exception [" + this.getClass().getSimpleName() + "] : [itemChanged(S)] " + e.getMessage());
throw new ITMException(e);
}
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
BaseLogger.log("2",null,null,"Inside itemChanged AllowDeductionDropIc.................");
String mcode = "", prdCode = "";
String sql = "", adCode = "", empFname = "", empLname = "",descr="";
String propYN="",balOpt="",empCode="",paySite="",dropAmt="",balAct="";
double amt = 0;
int currentFormNo = 0;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuffer valueXmlString = new StringBuffer();
AdmCommon admCommon = null;
UtilMethods utils = new UtilMethods();
java.sql.Date toDate = null;
Timestamp relativeDate = null;
try
{
runMode = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "runMode")));
System.out.println("Value of runMode :: "+runMode);
if( !"I".equalsIgnoreCase(runMode))
return "";
conn = getConnection();
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
BaseLogger.log("3",null,null,"[" + this.getClass().getSimpleName() + "] [itemChanged(D)]:currentFormNo:" + currentFormNo);
BaseLogger.log("3",null,null,"currentColumn:::::" + currentColumn);
valueXmlString = new StringBuffer("<?xml version=\"1.0\" encoding=''?>\r\n<Root>\r\n<header>\r\n<editFlag>");
valueXmlString.append(editFlag).append("</editFlag>\r\n</header>\r\n");
switch (currentFormNo)
{
case 1:
{
valueXmlString.append("<Detail1>\r\n");
if ("itm_default".equalsIgnoreCase(currentColumn))
{
BaseLogger.log("3",null,null," >>>>>>>>> itm_default <<<<<<<<< "+ xtraParams);
Calendar now = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat(CommonConstants.APPL_DATE_FORMAT);
String currentDate = formatter.format(now.getTime());
BaseLogger.log("3",null,null,"currentDate = " + currentDate);
valueXmlString.append("<tran_date><![CDATA["+currentDate+"]]></tran_date>\r\n");
valueXmlString.append("<tran_type><![CDATA[D]]></tran_type>\r\n");
valueXmlString.append("<bal_act><![CDATA[N]]></bal_act>\r\n");
valueXmlString.append("<confirmed><![CDATA[N]]></confirmed>\r\n");
}
else if ("ad_code".equalsIgnoreCase(currentColumn))
{
adCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("ad_code", dom));
prdCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__ded", dom));
empCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("emp_code", dom));
System.out.println("adCode ["+adCode+"] prdCode["+prdCode+"] empCode["+empCode+"]");
sql ="select descr,prop_yn,bal_opt from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString("descr");
propYN = rs.getString("prop_yn");
balOpt = rs.getString("bal_opt");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
sql="select amount from payrolldet where prd_code = ? and emp_code = ? and ad_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
pstmt.setString(2, empCode);
pstmt.setString(3, adCode);
rs = pstmt.executeQuery();
while(rs.next())
{
amt = rs.getDouble("amount");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
valueXmlString.append("<descr><![CDATA["+descr+"]]></descr>\r\n");
valueXmlString.append("<prop_yn ><![CDATA["+propYN+"]]></prop_yn>\r\n");
valueXmlString.append("<bal_opt ><![CDATA["+balOpt+"]]></bal_opt>\r\n");
valueXmlString.append("<drop_amount ><![CDATA["+amt+"]]></drop_amount>\r\n");
valueXmlString.append("<act_amt ><![CDATA["+amt+"]]></act_amt>\r\n");
}
else if ("emp_code".equalsIgnoreCase(currentColumn))
{
empCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("emp_code", dom));
sql="select emp_lname, emp_fname, pay_site from employee where emp_code = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
while(rs.next())
{
empFname = rs.getString("emp_fname");
empLname = rs.getString("emp_lname");
paySite = rs.getString("pay_site");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
prdCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__ded", dom));
adCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("ad_code", dom));
sql="select amount from payrolldet where prd_code = ? and emp_code = ? and ad_code = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
pstmt.setString(2, empCode);
pstmt.setString(3, adCode);
rs = pstmt.executeQuery();
while(rs.next())
{
amt = rs.getDouble("amount");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
valueXmlString.append("<emp_fname ><![CDATA["+empFname+"]]></emp_fname>\r\n");
valueXmlString.append("<emp_lname ><![CDATA["+empLname+"]]></emp_lname>\r\n");
valueXmlString.append("<pay_site ><![CDATA["+paySite+"]]></pay_site>\r\n");
valueXmlString.append("<drop_amount ><![CDATA["+amt+"]]></drop_amount>\r\n");
valueXmlString.append("<act_amt ><![CDATA["+amt+"]]></act_amt>\r\n");
}
else if ("drop_amount".equalsIgnoreCase(currentColumn))
{
dropAmt = E12GenericUtility.checkNull(genericUtility.getColumnValue("drop_amount", dom));
}
else if ("bal_act".equalsIgnoreCase(currentColumn) || "prd_code__ded".equalsIgnoreCase(currentColumn))
{
prdCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__ded", dom));
empCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("emp_code", dom));
adCode = E12GenericUtility.checkNull(genericUtility.getColumnValue("ad_code", dom));
sql="select amount from payrolldet where prd_code = ? and emp_code = ? and ad_code = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
pstmt.setString(2, empCode);
pstmt.setString(3, adCode);
rs = pstmt.executeQuery();
while(rs.next())
{
amt = rs.getDouble("amount");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
valueXmlString.append("<drop_amount ><![CDATA["+amt+"]]></drop_amount>\r\n");
valueXmlString.append("<act_amt ><![CDATA["+amt+"]]></act_amt>\r\n");
balAct = E12GenericUtility.checkNull(genericUtility.getColumnValue("bal_act", dom));
if("N".equalsIgnoreCase(balAct))
{
sql="SELECT to_date FROM period WHERE code = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
rs = pstmt.executeQuery();
while(rs.next())
{
toDate = rs.getDate(("to_date"));
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if( toDate != null )
{
admCommon = new AdmCommon();
try
{
java.util.Date utilDate = new java.util.Date(toDate.getTime());
String fromDate = admCommon.relativeDate(utilDate, 1);
System.out.println("fromDate......"+fromDate);
if( fromDate != null )
{
relativeDate = Timestamp.valueOf(genericUtility.getValidDateTimeString(fromDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
}
}
catch(Exception e)
{
System.out.println("Exception......................"+e.getMessage());
}
sql="SELECT code FROM period WHERE fr_date = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setTimestamp(1, relativeDate);
rs = pstmt.executeQuery();
while(rs.next())
{
prdCode = rs.getString("code");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
valueXmlString.append("<prd_code__adj ><![CDATA["+prdCode+"]]></prd_code__adj>\r\n");
}
}
else if("E".equalsIgnoreCase(balAct))
{
valueXmlString.append("<prd_code__adj ><![CDATA["+prdCode+"]]></prd_code__adj>\r\n");
}
}
valueXmlString.append("</Detail1>\r\n");
}
break;
}
valueXmlString.append("</Root>\r\n");
}
catch (Exception e)
{
BaseLogger.log("0",null,null,"Exception in EJB["+this.getClass().getSimpleName()+"]:[" + e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
BaseLogger.log("3",null,null,"Closed all Database Resource...!");
} catch (Exception e)
{
BaseLogger.log("0",null,null,"Exception in EJB["+this.getClass().getSimpleName()+"]::itemChanged::[" + e.getMessage()+"]");
throw new ITMException(e);
}
}
BaseLogger.log("2",null,null,"Itemchange ::==== ["+valueXmlString.toString()+"]");
return valueXmlString.toString();
}
//gbf_post_logic in nvo_bo_allowdedn_drop [start]
public String gbfPostLogic(String tranIDfrom,String tranIDto,String xtraParams,String forcedFlag,Connection conn,HRLogWriter hrLogWriter,Connection logConn) throws ITMException
{
String errString = "",valueXmlStr="";
PreparedStatement pstmt = null;
ResultSet rs = null;
String tranId = "" , prdCodeDeb = "" , empCode = "" , confirmed = "N",sql="";
String errorCode = "" , voucherNo = "";
// Modified by Piyush on 05/02/2018 [Should get rolledback in case of Payroll is not got processed as the case reported by Vishal from Sun Pharma].Start
Timestamp dTimeBeforePayproc = null , dTimeOfPayproc = null,currDate=null;
Date dateBeforePayproc , dateOfPayproc = null;
Time timeBeforePayproc , timeOfPayproc = null;
int secBeforePayproc = 0 , secOfPayproc = 0;
String adCode = "";
double dropAmt = 0.00 , actAmt = 0.00 , payAmt = -0.00;
// Modified by Piyush on 05/02/2018 [Should get rolledback in case of Payroll is not got processed as the case reported by Vishal from Sun Pharma].End
StringBuffer valueXmlString = null;
StringBuffer valueXmlString1 = null;
StringBuffer valueXmlStringArr = null;
Document arrHeaderDom = null;
AdmCommon admCommon = null;
try
{
Calendar now = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat(CommonConstants.APPL_DATE_FORMAT);
String currentDatestr = formatter.format(now.getTime());
if(currentDatestr != null && currentDatestr.trim().length() > 0)
{
admCommon = new AdmCommon();
currDate = admCommon.getTimeStampValue(currentDatestr);
}
BaseLogger.log("3",null,null,"currDate "+currDate);
userId = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode")));
chgTerm = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId")));
loginEmpCode = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode")));
runMode = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "runMode")));
valueXmlString = new StringBuffer("<DocumentRoot><description>Datawindow Root</description><group0>");
valueXmlString.append("<description>Group0 description</description>").append("<Header0>");
valueXmlString.append("<description>Header0 members</description>");
valueXmlString.append("<Detail1 dbID=\"\" domID=\"1\" objContext=\"1\" objName=\"payroll_splitgen_acc\">");
valueXmlString.append("<attribute pkNames=\"\" selected=\"\" status=\"\" updateFlag=\"\"/>");
valueXmlStr = valueXmlString.toString();
if (tranIDfrom.equals(tranIDto))
tranId = tranIDfrom;
sql="select confirmed , prd_code__ded , emp_code , ad_code , drop_amount , act_amt from allowdedn_drop where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
confirmed = rs.getString("confirmed");
prdCodeDeb = rs.getString("prd_code__ded");
empCode = rs.getString("emp_code");
adCode = rs.getString("ad_code");
dropAmt= rs.getDouble("drop_amount");
actAmt = rs.getDouble("act_amt");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if("Y".equalsIgnoreCase(confirmed))
{
errString = genericUtility.getErrorString("confirmed", "VTMCONF1",userId);
}
else
{
//check point
AllowDeductionDropPrConf allowDedDrop = new AllowDeductionDropPrConf();
errorCode = allowDedDrop.gbfAllowDedDropApprv(tranId , "Y",xtraParams,conn);
if( errorCode != null && errorCode.trim().length() > 0 )
{
/* gbf_insert_err(errorCode , ' ')
goto func_exit*/
}
sql="select voucher_no from payroll where prd_code = ? and emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCodeDeb);
pstmt.setString(2, empCode);
rs = pstmt.executeQuery();
while(rs.next())
{
voucherNo = rs.getString("voucher_no");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if(voucherNo != null && voucherNo.trim().length() > 0)
{
PayrollSplitgenAccPrc payRoll = new PayrollSplitgenAccPrc();
payRoll.isOwrite ="Y";
valueXmlString1 = new StringBuffer();
valueXmlString1.append("<type><![CDATA[").append("PY").append("]]></type>");
valueXmlString1.append("<payroll_date><![CDATA[").append(currentDatestr).append("]]></payroll_date>");
valueXmlString1.append("<emp_code__fr><![CDATA[").append(empCode).append("]]></emp_code__fr>");
valueXmlString1.append("<emp_code__to><![CDATA[").append(empCode).append("]]></emp_code__to>");
valueXmlString1.append("<prd_code__fr><![CDATA[").append(prdCodeDeb).append("]]></prd_code__fr>");
valueXmlString1.append("<prd_code__to><![CDATA[").append(prdCodeDeb).append("]]></prd_code__to>");
valueXmlString1.append("<site_code__fr><![CDATA[00]]></site_code__fr>");
valueXmlString1.append("<site_code__to><![CDATA[ZZ]]></site_code__to>");
valueXmlString1.append("<proc_group__from><![CDATA[00]]></proc_group__from>");
valueXmlString1.append("<proc_group__to><![CDATA[ZZ]]></proc_group__to>");
valueXmlString1.append("<prd_code__arr><![CDATA[").append(prdCodeDeb).append("]]></prd_code__arr>");
valueXmlString1.append("</Detail1></Header0></group0></DocumentRoot>");
valueXmlStringArr = new StringBuffer();
valueXmlStringArr.append(valueXmlStr).append(valueXmlString1);
System.out.println("valueXmlStringArr::: " + valueXmlStringArr);
if(valueXmlStringArr != null)
{
arrHeaderDom = genericUtility.parseString(valueXmlStringArr.toString());
}
//payRoll.ii_commit_rollback_flag=1;
Date dateObj = new Date();
dTimeBeforePayproc = currDate ;
dateBeforePayproc =new Date(dateObj.getTime());
timeBeforePayproc = new Time(dateObj.getTime());
secBeforePayproc=(dateObj.getHours()*60*60)+(dateObj.getSeconds()*60)+dateObj.getMinutes();
//payRoll.is_proc_id = "DropDeduction";
//payRoll.istr_log_writer.process_id = "DropDeduction";
errorCode = payRoll.gbfProcessPayroll(arrHeaderDom, null, xtraParams, hrLogWriter, conn, logConn);
if( errorCode != null && errorCode.trim().length() > 0 )
{
//gbf_insert_err(errorCode , "")
}
sql = "select chg_date from payroll where emp_code = ? and prd_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, prdCodeDeb);
rs = pstmt.executeQuery();
while(rs.next())
{
dTimeOfPayproc = rs.getTimestamp("chg_date");
}
Date date = new Date(dTimeOfPayproc.getTime());
System.out.println("Date.............["+date+"] dateTimeOfPayproc.getTime ["+dTimeOfPayproc.getTime()+"]");
timeOfPayproc =new Time(date.getTime());
dateOfPayproc = date;
secBeforePayproc = (date.getHours()*60*60)+(date.getSeconds()*60)+date.getMinutes();
System.out.println("secOfPayproc............... "+secBeforePayproc);
if( dateBeforePayproc.compareTo(dateOfPayproc) < 0 || dateBeforePayproc.compareTo(dateOfPayproc) == 0 &&
secOfPayproc < secBeforePayproc)
{
//goto func_exit
}
else
{
sql="select amount from payrolldet where prd_code = ? and emp_code = ? and ad_code = ? ";
pstmt.setString(1,prdCodeDeb );
pstmt.setString(2,empCode );
pstmt.setString(3,adCode );
rs = pstmt.executeQuery();
while(rs.next())
{
payAmt = rs.getDouble("amount");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if((actAmt - dropAmt) != payAmt)
{
//goto func_exit
}
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
}
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e1)
{
e1.printStackTrace();
}
}
return errString;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.w3c.dom.Document;
import ibase.utility.BaseLogger;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
public class AllowDeductionDropPrConf extends ActionHandlerEJB
{
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
AdmCommon admCommon = new AdmCommon();
UtilMethods utilMethod = new UtilMethods();
String userId = "",loginEmpCode = "",runMode = "",chgTerm = "";
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
BaseLogger.log("2",null,null,"Inside AllowDeductionDropPrConf confirm...... ");
String retString = null;
Connection conn = null;
try
{
conn = getConnection();
BaseLogger.log("3",null,null,"Conn==>[" + conn + "]");
retString = gbfPostLogic(tranId, tranId,xtraParams,forcedFlag,conn);
BaseLogger.log("3",null,null,"returning String from AllowDeductionDropPrConf :confirm():==>[" + retString + "]");
}
catch(Exception e)
{
try
{
conn.rollback();
} catch (SQLException e1)
{
BaseLogger.log("0",null,null,"Rollback connection..........");
}
BaseLogger.log("0",null,null,"Exception :AllowDeductionDropPrConf :confirm() :" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
if(retString == null || retString.trim().length() == 0)
{
conn.commit();
}
else
{
conn.rollback();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return retString;
}
private String gbfPostLogic(String tranId, String tranId2, String xtraParams, String forcedFlag, Connection conn)
{
String retString = null;
Connection logConn = null;
try
{
HRLogWriter hrLogWriter = new HRLogWriter();
logConn = getConnection();
BaseLogger.log("3",null,null,"Conn==>[" + conn + "]");
retString =gbfPostLogic( tranId, tranId2, xtraParams, forcedFlag, conn, hrLogWriter, logConn);
BaseLogger.log("3",null,null,"returning String from AllowDeductionDropPrConf :confirm():==>[" + retString + "]");
}
catch(Exception e)
{
BaseLogger.log("0",null,null,"Exception :AllowDeductionDropPrConf :confirm() :" + e.getMessage() + ":");
e.printStackTrace();
try
{
throw new ITMException(e);
}
catch (ITMException e1)
{
e1.printStackTrace();
}
}
finally
{
try
{
if(logConn != null)
{
logConn.close();
logConn = null;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return retString;
}
//gbf_post_logic in nvo_bo_allowdedn_drop [start]
public String gbfPostLogic(String tranIdFrom,String tranIdTo,String xtraParams,String forcedFlag,Connection conn,HRLogWriter hrLogWriter,Connection logConn) throws ITMException
{
BaseLogger.log("2",null,null,"#Inside gbfPostLogic..............................");
String errString = "",valueXmlStr="",adCode = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
String tranId = "" , prdCodeDeb = "" , empCode = "" , confirmed = "N",sql="";
String errorCode = "" , voucherNo = "";
// Modified by Piyush on 05/02/2018 [Should get rolledback in case of Payroll is not got processed as the case reported by Vishal from Sun Pharma].Start
Timestamp dateTimeBeforePayproc = null , dateTimeOfPayproc = null,currDate=null;
Date dateBeforePayproc , dateOfPayproc = null;
Time timeBeforePayproc = null , timeOfPayproc = null;
int secBeforePayproc = 0 , secOfPayproc = 0;
double dropAmt = 0.00 , actAmt = 0.00 , payAmt = 0.00;
// Modified by Piyush on 05/02/2018 [Should get rolledback in case of Payroll is not got processed as the case reported by Vishal from Sun Pharma].End
StringBuffer valueXmlString = null;
StringBuffer valueXmlString1 = null;
StringBuffer valueXmlStringArr = null;
Document arrHeaderDom = null;
AdmCommon admCommon = null;
boolean isError = false;
try
{
Calendar now = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat(CommonConstants.APPL_DATE_FORMAT);
String currentDatestr = formatter.format(now.getTime());
admCommon = new AdmCommon();
if(currentDatestr != null && currentDatestr.trim().length() > 0)
{
currDate = admCommon.getTimeStampValue(currentDatestr);
}
BaseLogger.log("3",null,null,"currDate "+currDate);
userId = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode")));
chgTerm = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId")));
loginEmpCode = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode")));
runMode = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "runMode")));
valueXmlString = new StringBuffer("<DocumentRoot><description>Datawindow Root</description><group0>");
valueXmlString.append("<description>Group0 description</description>").append("<Header0>");
valueXmlString.append("<description>Header0 members</description>");
valueXmlString.append("<Detail1 dbID=\"\" domID=\"1\" objContext=\"1\" objName=\"payroll_splitgen_acc\">");
valueXmlString.append("<attribute pkNames=\"\" selected=\"\" status=\"\" updateFlag=\"\"/>");
valueXmlStr = valueXmlString.toString();
if (tranIdFrom == tranIdTo)
tranId = tranIdFrom;
sql = "select confirmed , prd_code__ded , emp_code , ad_code , drop_amount , act_amt from allowdedn_drop where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
confirmed = rs.getString("confirmed");
prdCodeDeb = rs.getString("prd_code__ded");
empCode = rs.getString("emp_code");
adCode = rs.getString("ad_code");
dropAmt= rs.getDouble("drop_amount");
actAmt = rs.getDouble("act_amt");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if("Y".equalsIgnoreCase(confirmed))
{
errString = genericUtility.getErrorString("confirmed", "VTMCONF1",userId);
}
else
{
errorCode = E12GenericUtility.checkNull(gbfAllowDedDropApprv(tranId , "Y",xtraParams,conn));
BaseLogger.log("3",null,null,"gbf_allowdedn_drop_apprv..................123"+errorCode);
if( errorCode.trim().length() > 0 )
{
/* gbf_insert_err(errorCode , ' ')
goto func_exit*/
errString = itmDBAccessEJB.getErrorString("", errorCode, userId, "", conn);
}
sql = "select voucher_no from payroll where prd_code = ? and emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCodeDeb);
pstmt.setString(2, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
voucherNo = E12GenericUtility.checkNull(rs.getString("voucher_no"));
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if(voucherNo.length() == 0)
{
PayrollSplitgenAccPrc payRoll = new PayrollSplitgenAccPrc();
payRoll.isOwrite ="Y";
valueXmlString1 = new StringBuffer();
valueXmlString1.append("<type><![CDATA[").append("PY").append("]]></type>");
valueXmlString1.append("<payroll_date><![CDATA[").append(currentDatestr).append("]]></payroll_date>");
valueXmlString1.append("<emp_code__fr><![CDATA[").append(empCode).append("]]></emp_code__fr>");
valueXmlString1.append("<emp_code__to><![CDATA[").append(empCode).append("]]></emp_code__to>");
valueXmlString1.append("<prd_code__fr><![CDATA[").append(prdCodeDeb).append("]]></prd_code__fr>");
valueXmlString1.append("<prd_code__to><![CDATA[").append(prdCodeDeb).append("]]></prd_code__to>");
valueXmlString1.append("<site_code__fr><![CDATA[00]]></site_code__fr>");
valueXmlString1.append("<site_code__to><![CDATA[ZZ]]></site_code__to>");
valueXmlString1.append("<proc_group__from><![CDATA[00]]></proc_group__from>");
valueXmlString1.append("<proc_group__to><![CDATA[ZZ]]></proc_group__to>");
valueXmlString1.append("<prd_code__arr><![CDATA[").append(prdCodeDeb).append("]]></prd_code__arr>");
valueXmlString1.append("</Detail1></Header0></group0></DocumentRoot>");
valueXmlStringArr = new StringBuffer();
valueXmlStringArr.append(valueXmlStr).append(valueXmlString1);
BaseLogger.log("3",null,null,"valueXmlStringArr::: " + valueXmlStringArr);
if(valueXmlStringArr != null)
{
arrHeaderDom = genericUtility.parseString(valueXmlStringArr.toString());
}
//payRoll.ii_commit_rollback_flag=1;
Date dateObj = new Date();
dateTimeBeforePayproc = currDate ;
dateBeforePayproc =new Date(dateObj.getTime());
timeBeforePayproc = new Time(dateObj.getTime());
secBeforePayproc=(dateObj.getHours()*60*60)+(dateObj.getSeconds()*60)+dateObj.getMinutes();
try
{
errorCode = payRoll.gbfProcessPayroll(arrHeaderDom, arrHeaderDom, xtraParams, hrLogWriter, conn, logConn);
}
catch (Exception e)
{
System.out.println("Exception in gbfProcessPayroll.........."+e.getMessage());
}
BaseLogger.log("3",null,null,"280......................."+errorCode);
if( errorCode != null && errorCode.trim().length() > 0 )
{
//gbf_insert_err(errorCode , "")
}
sql = " select chg_date from payroll where emp_code = ? and prd_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, prdCodeDeb);
rs = pstmt.executeQuery();
while(rs.next())
{
dateTimeOfPayproc = rs.getTimestamp("chg_date");
}
Date date = new Date(dateTimeOfPayproc.getTime());
System.out.println("Date.............["+date+"] dateTimeOfPayproc.getTime ["+dateTimeOfPayproc.getTime()+"]");
timeOfPayproc =new Time(date.getTime());
dateOfPayproc = date;
secOfPayproc = (date.getHours()*60*60)+(date.getSeconds()*60)+date.getMinutes();
System.out.println("secOfPayproc............... "+secOfPayproc);
if( dateBeforePayproc.compareTo(dateOfPayproc) < 0 || (dateBeforePayproc.compareTo(dateOfPayproc) == 0 &&
secOfPayproc < secBeforePayproc))
{
//goto func_exit
conn.rollback();
}
else
{
sql="select amount from payrolldet where prd_code = ? and emp_code = ? and ad_code = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,prdCodeDeb );
pstmt.setString(2,empCode );
pstmt.setString(3,adCode );
rs = pstmt.executeQuery();
while(rs.next())
{
payAmt = rs.getDouble("amount");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
System.out.println("actAmt - dropAmt :: ["+(actAmt - dropAmt)+"] payAmt ["+payAmt+"] "+Double.compare((actAmt - dropAmt), payAmt));
if(Double.compare((actAmt - dropAmt), payAmt) == 0)
{
System.out.println("<<<<< DS000 >>>>>>");
errString = itmDBAccessEJB.getErrorString("", "DS000", userId, "", conn);
}
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
}
}
}
catch (Exception e)
{
isError = true;
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if( !isError )
{
conn.commit();
logConn.commit();
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e1)
{
e1.printStackTrace();
}
}
return errString;
}
//this method is in nvo_emp_ad Start
//public function string gbf_allowdedn_drop_apprv (string tranId, string as_createedi);// This function inserts data into the 'employee_ad' table
public String gbfAllowDedDropApprv (String tranId, String as_createedi,String xtraParams,Connection con)
{
BaseLogger.log("2",null,null,"Inside gbf_allowdedn_drop_apprv.............................");
String sql="",is_mthtbl="";
String action = "",adCode = "",prdCodeAdj = "",empCode = "" ,errorCode = "",ls_tranid = "",prdCodeDeb = "", prdCode = "" ;
String refType = "", refNo = "", confirmed = "", payType = "", payTranId = "", transId = "";
Timestamp fromDate=null;
Timestamp toDate=null,ld_expdate = null, currDate = null,currcurrDate=null;
double dropAmt =0.00;//ls_conf_drpddn_af_ppost
String voucherNo = "", confDrpddnAfPpost, paySite, cadreCode = "", gradeCode = ""; //Added by Raj (AD90SUN036)- 13/05/2010
//Timestamp currDate = null;//Added by Raj (AD90SUN036)- 23/08/2010
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean flag = true;
String month="";
String loginEmpCode="",loginSite="";
try
{
BaseLogger.log("3",null,null,"Inside try....................");
userId = E12GenericUtility.checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
chgTerm = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId")));
loginSite = E12GenericUtility.checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"));
loginEmpCode = E12GenericUtility.checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"));
runMode = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "runMode")));
AdmCommon admCommon = new AdmCommon();
Calendar cal = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat(CommonConstants.APPL_DATE_FORMAT);
String currentDatestr = formatter.format(cal.getTime());
if(currentDatestr != null && currentDatestr.trim().length() > 0)
{
currDate = admCommon.getTimeStampValue(currentDatestr);
}
BaseLogger.log("3",null,null,"currDate "+currDate);
ls_tranid = tranId;
transId = ls_tranid;
sql = "select bal_act, ad_code, prd_code__ded, prd_code__adj, emp_code, drop_amount from allowdedn_drop where tran_id = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString(1,transId );
rs = pstmt.executeQuery();
if(rs.next())
{
action = E12GenericUtility.checkNull(rs.getString("bal_act"));
adCode = E12GenericUtility.checkNull(rs.getString("ad_code"));
prdCodeDeb = E12GenericUtility.checkNull(rs.getString("prd_code__ded"));
prdCodeAdj = E12GenericUtility.checkNull(rs.getString("prd_code__adj"));
empCode = E12GenericUtility.checkNull(rs.getString("emp_code"));
dropAmt = rs.getDouble("drop_amount");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if(!"B".equalsIgnoreCase(runMode))
{
sql = "select pay_site, cadre, grade from employee where emp_code = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, loginEmpCode);
rs = pstmt.executeQuery();
if(rs.next())
{
paySite = rs.getString("pay_site");
cadreCode = rs.getString("cadre");
gradeCode = rs.getString("grade");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
confDrpddnAfPpost = admCommon.getAdmEnv(loginSite, cadreCode, gradeCode, "CONF_DRPDDN_AF_PPOST", currDate, con);
BaseLogger.log("3",null,null,"confDrpddnAfPpost..................498"+confDrpddnAfPpost);
if("NULLFOUND".equalsIgnoreCase(confDrpddnAfPpost))
{
confDrpddnAfPpost = admCommon.getEnv("999999", "CONF_DRPDDN_AF_PPOST", con);
}
if(!"Y".equalsIgnoreCase(confDrpddnAfPpost))
{
sql = "select voucher_no from payroll where prd_code = ? and emp_code = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, prdCodeDeb);
pstmt.setString(2, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
voucherNo = E12GenericUtility.checkNull(rs.getString("voucher_no"));
}
if(voucherNo.trim().length() > 0)
{
errorCode = itmDBAccessEJB.getErrorString("", "VTPAYPOST2", userId, "", con);
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
}
}
sql = "select ref_type, ref_no from payrolldet where prd_code = ? and emp_code = ? and ad_code = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, prdCodeDeb);
pstmt.setString(2, empCode);
pstmt.setString(3, adCode);
rs = pstmt.executeQuery();
if(rs.next())
{
payType = rs.getString("ref_type");
payTranId = rs.getString("ref_no");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if("L".equalsIgnoreCase(payType))
{
ls_tranid = payTranId;
refType = "L";
}
else if("N".equalsIgnoreCase(payType))
{
ls_tranid = payTranId;
refType = "N";
}
else
{
refType = "D";
}
dropAmt = 0 - dropAmt;
prdCode = prdCodeDeb;
sql= "select fr_date,to_date from period where code = ?";
pstmt = con.prepareStatement(sql);
pstmt.setString(1,prdCode );
rs = pstmt.executeQuery();
while(rs.next())
{
fromDate = rs.getTimestamp("fr_date");
toDate = rs.getTimestamp("to_date");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
//int month = getTimeStampValue(prdCode).getMonth();
//month = String.valueOf(month);
UtilMethods utilMethods = new UtilMethods();
month = utilMethods.right(prdCode, 2);
BaseLogger.log("3",null,null,"month["+month+"]");
is_mthtbl = "";
switch (action)
{
case "N":
errorCode = E12GenericUtility.checkNull((gbfDropDedInsert(empCode, adCode, month, fromDate, toDate, ls_tranid, refType, dropAmt, "Y", con, userId)));
if( errorCode.trim().length() == 0 )
{
admCommon = new AdmCommon();
String fromDateStr = admCommon.relativeDate(toDate, 1);
fromDate = admCommon.getTimeStampValue(fromDateStr);
month = utilMethods.right(prdCodeAdj, 2);
BaseLogger.log("3",null,null,"month................"+month);
sql = "select fr_date,to_date from period where fr_date = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setTimestamp(1, fromDate);
rs = pstmt.executeQuery();
while(rs.next())
{
fromDate = rs.getTimestamp("fr_date");
toDate = rs.getTimestamp("to_date");
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if( fromDate !=null || toDate != null)
{
dropAmt = 0 - dropAmt;
errorCode = gbfDropDedInsert (empCode, adCode, month, fromDate, toDate,ls_tranid, refType,dropAmt,"N",con,userId);
}
}
break;
case "E" :
case "I" :
errorCode = gbfDropDedInsert (empCode, adCode, month, fromDate, toDate,ls_tranid,refType,dropAmt,"Y",con,userId);
break;
}
if( errorCode != null && errorCode.trim().length() > 0)
{
BaseLogger.log("3",null,null,"::Break::");
flag = false;
}
sql = "update allowdedn_drop set confirmed = ? where tran_id = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, "Y");
pstmt.setString(2, transId);
int cnt = pstmt.executeUpdate();
BaseLogger.log("3",null,null,"1281 Update Count :: "+cnt);
if(cnt != 1)
{
errorCode = "DS000NR";
}
else if (cnt > 0)
{
errorCode = "VTMAPRV2";
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
}
catch(Exception e)
{
BaseLogger.log("0",null,null,"Inside Exception in gbf_allowdedn_drop_apprv "+e.getMessage());
}
BaseLogger.log("2",null,null,"## Return from errorCode ## "+errorCode);
return errorCode;
}
//this method is in nvo_emp_ad End
// this method is in nvo_emp_ad gbf_drop_dedn_insert
public String gbfDropDedInsert (String empCode, String adCode, String month, Timestamp fromDate, Timestamp toDate,String tranId,
String refType, double acDropAmt, String check,Connection conn,String userId)
{
BaseLogger.log("2",null,null,"gbfDropDedInsert #empCode ["+empCode+"] #adCode ["+adCode+"]");
String is_mthtbl = "";//doubt
PreparedStatement pstmt = null;
ResultSet rs = null;
String errorCode = "",sql="";
int count = 0, count1 = 0;
Timestamp chgDate =null;
try
{
Calendar now = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat(CommonConstants.APPL_DATE_FORMAT);
String currentDatestr = formatter.format(now.getTime());
if(currentDatestr != null && currentDatestr.trim().length() > 0)
{
chgDate = admCommon.getTimeStampValue(currentDatestr);
}
BaseLogger.log("3",null,null,"currDate "+chgDate);
if("Y".equalsIgnoreCase(check))
{
sql = "select count(1) from employee_mthad where emp_code = ? and month_code = ? and ad_code = ? and eff_date = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, month);
pstmt.setString(3, adCode);
pstmt.setTimestamp(4, fromDate);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
}
else
{
count = 1;
}
if( count == 0 || "N".equalsIgnoreCase(is_mthtbl))
{
sql="select count(1) from employee_ad where emp_code = ? and ad_code = ? and eff_date <= ? and exp_date >= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, adCode);
pstmt.setTimestamp(3, fromDate);
pstmt.setTimestamp(4, fromDate);
rs = pstmt.executeQuery();
while(rs.next())
{
count1 = rs.getInt(1);
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if( count1 == 0 )
{
sql = " insert into employee_mthad (emp_code, ad_code, month_code, eff_date, exp_date, type, amount, min_basic," +
" max_basic, min_amt, max_amt, prop_yn, chg_date, chg_user, chg_term,ref_type, ref_no)" +
" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode );
pstmt.setString(2,adCode );
pstmt.setString(3,month );
pstmt.setTimestamp(4,fromDate );
pstmt.setTimestamp(5,toDate );
pstmt.setString(6,"F" );
pstmt.setDouble(7,acDropAmt );
pstmt.setString(8,"" );
pstmt.setString(9,"" );
pstmt.setString(10,"" );
pstmt.setString(11,"" );
pstmt.setString(12,"N" );
pstmt.setTimestamp(13,chgDate );
pstmt.setString(14,"SYSTEM" );
pstmt.setString(15,"SYSTEM" );
pstmt.setString(16,refType );
pstmt.setString(17,tranId );
int insertCount = pstmt.executeUpdate();
BaseLogger.log("2",null,null,"1470 Insert Count :: "+insertCount);
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
}
else if( count1 > 0 )
{
is_mthtbl = "N";
sql="select count(1) from employee_ad where emp_code = ? and ad_code = ? and eff_date = ? and exp_date ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, adCode);
pstmt.setTimestamp(4, fromDate);
pstmt.setTimestamp(5, toDate);
rs = pstmt.executeQuery();
while(rs.next())
{
count1 = rs.getInt(1);
}
if(rs != null)
{
rs.close();
rs=null;
}
if(pstmt != null)
{
pstmt.close();
pstmt=null;
}
if( count1 == 0)
{
sql = " insert into employee_ad (emp_code, ad_code, eff_date, exp_date, type, amount, min_basic , " +
" max_basic, min_amt, max_amt, prop_yn, chg_date, chg_user, chg_term ref_type, ref_no) " +
" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, adCode);
pstmt.setTimestamp(3, fromDate);
pstmt.setTimestamp(4, toDate);
pstmt.setString(5, "F");
pstmt.setDouble(6, acDropAmt);
pstmt.setString(7, "");
pstmt.setString(8, "");
pstmt.setString(9, "");
pstmt.setString(10, "");
pstmt.setString(11, "N");
pstmt.setTimestamp(12 , chgDate);
pstmt.setString(13, "SYSTEM");
pstmt.setString(14, "SYSTEM");
pstmt.setString(15, refType);
pstmt.setString(16, tranId);
int cnt = pstmt.executeUpdate();
BaseLogger.log("3",null,null,"Insert Count :: "+cnt);
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
}
else
{
sql = " update employee_ad set amount = amount + ?,ref_type = ?,ref_no = ? " +
" where emp_code = ? and ad_code = ? and eff_date = ? and exp_date = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, acDropAmt);
pstmt.setString(2, refType);
pstmt.setString(3, tranId);
pstmt.setString(4, empCode);
pstmt.setString(5, adCode);
pstmt.setTimestamp(6, fromDate);
pstmt.setTimestamp(7, toDate);
int cnt = pstmt.executeUpdate();
BaseLogger.log("3",null,null,"1418......."+cnt);
if( cnt != 1)
{
errorCode = itmDBAccessEJB.getErrorString("", "DS000NR", userId, "", conn);
}
if( pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
}
}
else
{
is_mthtbl = "Y";
sql = " select count(1) from employee_mthad where emp_code = ? and month_code = ? "+
" and ad_code = ? and eff_date = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setString(2,month);
pstmt.setString(3,adCode);
pstmt.setTimestamp(4,fromDate);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(rs !=null)
{
rs.close();
rs=null;
}
if(pstmt !=null)
{
pstmt.close();
pstmt=null;
}
if(count > 0)
{
sql = " update employee_mthad set amount = amount + ?, chg_date = ?, chg_user = ?, chg_term = ?,ref_no = ?,ref_type = ? " +
" where emp_code = ? and month_code = ? and ad_code = ? and eff_date = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, acDropAmt);
pstmt.setTimestamp(2, chgDate);
pstmt.setString(3, "SYSTEM");
pstmt.setString(4, "SYSTEM");
pstmt.setString(5, tranId);
pstmt.setString(6, refType);
pstmt.setString(7, empCode);
pstmt.setString(8, month );
pstmt.setString(9, adCode);
pstmt.setTimestamp(10, fromDate);
int cnt = pstmt.executeUpdate();
BaseLogger.log("3",null,null,"1509......."+cnt);
if( cnt!= 1)
{
errorCode = itmDBAccessEJB.getErrorString("", "DS000NR", userId, "", conn);
}
if( pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
else
{
sql= " insert into employee_mthad (emp_code, ad_code, month_code, eff_date, exp_date, type, amount, min_basic," +
" max_basic, min_amt, max_amt, prop_yn, chg_date, chg_user, chg_term, ref_type, ref_no) " +
" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, adCode);
pstmt.setString(3, month);
pstmt.setTimestamp(4, fromDate);
pstmt.setTimestamp(5, toDate);
pstmt.setString(6, "F");
pstmt.setDouble(7, acDropAmt);
pstmt.setString(8, "");
pstmt.setString(9, "");
pstmt.setString(10, "");
pstmt.setString(11, "");
pstmt.setString(12, "N");
pstmt.setTimestamp(13, chgDate);
pstmt.setString(14, userId);
pstmt.setString(15, "SYSTEM");
pstmt.setString(16, refType);
pstmt.setString(17, tranId);
int cnt = pstmt.executeUpdate();
BaseLogger.log("3",null,null,"Update Count :: "+cnt);
}
}
}
catch (Exception e)
{
BaseLogger.log("0",null,null,"Exception In gbf_drop_dedn_insert"+e.getMessage());
}
return errorCode;
}
}
package ibase.webitm.ejb.adm.adv;
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 org.w3c.dom.Document;
import ibase.utility.BaseLogger;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.adm.AdmCommon;
import ibase.webitm.ejb.adm.AllowDeductionDropPrConf;
import ibase.webitm.ejb.adm.HRLogWriter;
import ibase.webitm.ejb.adm.PayrollSplitgenAccPrc;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
public class AllowDeductionDropPrAppr extends ValidatorEJB
{
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
AdmCommon admCommon = new AdmCommon();
UtilMethods utilMethod = new UtilMethods();
String userId = "",loginEmpCode = "",runMode = "",chgTerm = "";
public String approve(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
BaseLogger.log("2",null,null,"Inside AllowDeductionDropPrAppr Approve.........");
String retString = null;
Connection conn = null;
try
{
conn = getConnection();
BaseLogger.log("3",null,null,"Conn==>[" + conn + "]");
retString = gbfPostLogic(tranId, tranId,xtraParams,forcedFlag,conn);
BaseLogger.log("3",null,null,"returning String from AllowDeductionDropPrAppr :approve():==>[" + retString + "]");
if(retString == null || retString.trim().length() == 0)
{
conn.commit();
}
else
{
conn.rollback();
}
}
catch(Exception e)
{
BaseLogger.log("0",null,null,"Exception :AllowDeductionDropPrAppr :approve() :" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return retString;
}
private String gbfPostLogic(String tranId, String tranId2, String xtraParams, String forcedFlag, Connection conn)
{
String retString = null;
Connection logConn = null;
try
{
HRLogWriter hrLogWriter = new HRLogWriter();
logConn = getConnection();
BaseLogger.log("3",null,null,"Conn==>[" + conn + "]");
retString =gbfPostLogic( tranId, tranId2, xtraParams, forcedFlag, conn, hrLogWriter, logConn);
BaseLogger.log("3",null,null,"returning String from AllowDeductionDropPrAppr :gbfPostLogic():==>[" + retString + "]");
if(E12GenericUtility.checkNull(retString).length() == 0)
{
logConn.commit();
}
else
{
logConn.rollback();
}
}
catch(Exception e)
{
BaseLogger.log("0",null,null,"Exception :AllowDeductionDropPrAppr :gbfPostLogic() :" + e.getMessage() + ":");
e.printStackTrace();
try
{
throw new ITMException(e);
}
catch (ITMException e1)
{
e1.printStackTrace();
}
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return retString;
}
//This method is in nvo_bo_ad_drop_approve [start]
public String gbfPostLogic(String tranIdFrom,String tranIdTo,String xtraParams,String forcedFlag,Connection conn,HRLogWriter hrLog ,Connection logConn) throws ITMException
{
String sql="",valueXmlStr="",currentDatestr="";
PreparedStatement pstmt = null;
Timestamp currDate =null;
ResultSet rs = null;
String errorString = "",confirmed = "", ls_tranid = "", prd = "", ls_emp = "";
StringBuffer valueXmlString = null;
StringBuffer valueXmlString1 = null;
StringBuffer valueXmlStringArr = null;
Document arrHeaderDom =null ;
PayrollSplitgenAccPrc payRoll = null;
AdmCommon admCommon = null;
try
{
userId = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode")));
chgTerm = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId")));
loginEmpCode = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode")));
runMode = E12GenericUtility.checkNull((genericUtility.getValueFromXTRA_PARAMS(xtraParams, "runMode")));
Calendar cal = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat(CommonConstants.APPL_DATE_FORMAT);
currentDatestr = formatter.format(cal.getTime());
admCommon = new AdmCommon();
if(currentDatestr != null && currentDatestr.trim().length() > 0)
{
currDate = admCommon.getTimeStampValue(currentDatestr);
}
BaseLogger.log("3",null,null,"currDate "+currDate);
valueXmlString = new StringBuffer("<DocumentRoot><description>Datawindow Root</description><group0>");
valueXmlString.append("<description>Group0 description</description>").append("<Header0>");
valueXmlString.append("<description>Header0 members</description>");
valueXmlString.append("<Detail1 dbID=\"\" domID=\"1\" objContext=\"1\" objName=\"allowdedn_drop\">");
valueXmlString.append("<attribute pkNames=\"\" selected=\"\" status=\"\" updateFlag=\"\"/>");
valueXmlStr = valueXmlString.toString();
if (tranIdFrom.equalsIgnoreCase(tranIdTo))
{
ls_tranid = tranIdFrom;
}
sql = "select confirmed, prd_code__ded, emp_code from allowdedn_drop where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, ls_tranid);
rs = pstmt.executeQuery();
if(rs.next())
{
confirmed = rs.getString("confirmed");
prd = rs.getString("prd_code__ded");
ls_emp = rs.getString("emp_code");
}
else
{
errorString = E12GenericUtility.checkNull(itmDBAccessEJB.getErrorString("", "VTMCONF20", userId, "", conn));
}
if("Y".equalsIgnoreCase(confirmed))
{
errorString = E12GenericUtility.checkNull(itmDBAccessEJB.getErrorString("", "VTMCONF1", userId, "", conn));
}
AllowDeductionDropPrConf ad = new AllowDeductionDropPrConf();
if( errorString.trim().length() == 0)
{
errorString = E12GenericUtility.checkNull(ad.gbfAllowDedDropApprv(ls_tranid, "Y", xtraParams,conn));
}
if( errorString.trim().length() == 0)
{
valueXmlString1 = new StringBuffer();
valueXmlString1.append("<type><![CDATA[").append("PY").append("]]></type>");
valueXmlString1.append("<prd_code__fr><![CDATA[").append(prd).append("]]></prd_code__fr>");
valueXmlString1.append("<prd_code__to><![CDATA[").append(prd).append("]]></prd_code__to>");
valueXmlString1.append("<dataowrite><![CDATA[").append("Y").append("]]></dataowrite>");
valueXmlString1.append("<emp_code__fr><![CDATA[").append(ls_emp).append("]]></emp_code__fr>");
valueXmlString1.append("<emp_code__to><![CDATA[").append(ls_emp).append("]]></emp_code__to>");
valueXmlString1.append("<payroll_date><![CDATA[").append(currentDatestr).append("]]></payroll_date>");
}
valueXmlString1.append("</Detail1></Header0></group0></DocumentRoot>");
valueXmlStringArr = new StringBuffer();
valueXmlStringArr.append(valueXmlStr).append(valueXmlString1);
BaseLogger.log("3",null,null,"valueXmlStringArr::: " + valueXmlStringArr);
if(valueXmlStringArr != null)
{
arrHeaderDom = genericUtility.parseString(valueXmlStringArr.toString());
}
payRoll = new PayrollSplitgenAccPrc();
errorString = payRoll.gbfProcessPayroll(arrHeaderDom, arrHeaderDom, xtraParams, hrLog, conn, logConn);
BaseLogger.log("3",null,null,"errorString ................232"+errorString);
}
catch (SQLException e1)
{
try
{
errorString = E12GenericUtility.checkNull(itmDBAccessEJB.getErrorString("", "VTMCONF20", userId, "", conn));
}
catch (RemoteException e)
{
e.printStackTrace();
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e1)
{
e1.printStackTrace();
}
}
return errorString;
}
//This method is in nvo_bo_ad_drop_approve [End]
}
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