package wenrgise.hrms.ejb.business; import java.rmi.RemoteException; import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.Iterator; import javax.ejb.CreateException; import javax.ejb.RemoveException; import wenrgise.common.bean.BaseHeaderBean; import wenrgise.common.bean.LOVBean; import wenrgise.common.ejb.business.HrmCommonBO; import wenrgise.common.exception.EnrgiseApplicationException; import wenrgise.common.exception.EnrgiseMessageKeyException; import wenrgise.common.exception.EnrgiseSystemException; import wenrgise.common.utility.DateUtility; import wenrgise.common.utility.EnrgiseUtil; import wenrgise.common.utility.MessageKey; import wenrgise.common.utility.RecordMetaInfo; import wenrgise.common.utility.UserInfo; import wenrgise.common.utility.WorkFlowServiceLocator; import wenrgise.common.vo.BaseHeaderVO; import wenrgise.common.vo.LovQueryVO; import wenrgise.common.vo.LovVO; import wenrgise.ejb.common.helper.DBObject; import wenrgise.ejb.common.helper.QueryRow; import wenrgise.ejb.common.utility.DBUtilitiesBean; import wenrgise.hrms.bean.HrmChargeReportHdrBean; import wenrgise.hrms.vo.HrmATDTransChrgRptQVO; import wenrgise.workflow.bean.WflAuthorizationBean; import wenrgise.workflow.core.WflDocumentInfo; import wenrgise.workflow.core.WflResource; import wenrgise.workflow.core.WflSite; import wenrgise.workflow.core.WflStatus; import wenrgise.workflow.core.impl.WflDocumentInfoImpl; import wenrgise.workflow.core.impl.WflResourceImpl; import wenrgise.workflow.core.impl.WflSiteImpl; import wenrgise.workflow.ejb.facade.WorkFlowFacade; import wenrgise.workflow.ejb.facade.WorkFlowFacadeHome; public class HrmATDTransChrgRptBO extends HrmBaseBO { public HrmATDTransChrgRptBO() {} public HrmATDTransChrgRptBO(UserInfo oUserInfo) { super(oUserInfo); } public RecordMetaInfo getHrmChargeRepHdrMetaInfo(HrmATDTransChrgRptQVO oHrmATDTransChrgRptQVO) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstParameters = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); Timestamp oWhenPicked = null; int iCount = 0; BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO(); arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, oHrmATDTransChrgRptQVO.getHeaderPrimaryKey())); arylstParameters.add(new DBObject(2, 1, 12, oHrmATDTransChrgRptQVO.getTrnOrderNo())); arylstParameters.add(new DBObject(3, 1, 12, oHrmATDTransChrgRptQVO.getChargeType())); arylstParameters.add(new DBObject(4, 1, 12, oHrmATDTransChrgRptQVO.getEmpNameId())); arylstParameters.add(new DBObject(5, 2, -5)); arylstParameters.add(new DBObject(6, 2, 93)); arylstParameters.add(new DBObject(7, 2, 12)); arylstParameters.add(new DBObject(8, 2, 12)); arylstParameters.add(new DBObject(9, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMCHARGEREPORT.proc_HrChargeRepHdrCount(?,?,?,?,?,?,?,?,?)"); RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo(); DBObject oTimeObject = arylstOutArray.get(1); oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject()); DBObject oTotalRecord = arylstOutArray.get(0); oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue()); return oRecordMetaInfo; } public ArrayList getHrmChargeRepHeaderInfo(HrmATDTransChrgRptQVO oHrmATDTransChrgRptQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstParameters = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); Timestamp oWhenPicked = null; int iCount = 0; BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO(); ArrayList arylstHeaderList = null; if (oHrmATDTransChrgRptQVO == null) oHrmATDTransChrgRptQVO = new HrmATDTransChrgRptQVO(); arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, -5, new Long(lStartPosition))); arylstParameters.add(new DBObject(2, 1, -5, new Long(lLastPosition))); arylstParameters.add(new DBObject(3, 1, 12, oHrmATDTransChrgRptQVO.getHeaderPrimaryKey())); arylstParameters.add(new DBObject(4, 1, 12, oHrmATDTransChrgRptQVO.getTrnOrderNo())); arylstParameters.add(new DBObject(5, 1, 12, oHrmATDTransChrgRptQVO.getChargeType())); arylstParameters.add(new DBObject(6, 1, 12, oHrmATDTransChrgRptQVO.getEmpNameId())); arylstParameters.add(new DBObject(7, 2, -10)); arylstParameters.add(new DBObject(8, 2, 12)); arylstParameters.add(new DBObject(9, 2, 12)); arylstParameters.add(new DBObject(10, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMCHARGEREPORT.proc_HrChargeRepHdr(?,?,?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); if (arylstList.size() == 0) throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M"); QueryRow oRow = null; HashMap oColumns = null; Iterator oIt = arylstList.iterator(); SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); while (oIt.hasNext()) { if (iCount == 0) arylstHeaderList = new ArrayList(); iCount++; oRow = oIt.next(); HrmChargeReportHdrBean oChargeRepHeader = new HrmChargeReportHdrBean(); oChargeRepHeader.setHeaderPrimaryKey(oRow.get("ID").getString()); oChargeRepHeader.setChargeType(oRow.get("CHARGE_TYPE").getString()); oChargeRepHeader.setTrnOrderNoId(oRow.get("TRANS_ORDER_NO_ID").getString()); oChargeRepHeader.setTrnOrdrDtlId(oRow.get("TRANS_ORDER_DTL_ID").getString()); oChargeRepHeader.setChargeCode(oRow.get("CHARGE_CODE").getString()); oChargeRepHeader.setNoonFlag(oRow.get("FNOON_ANOON_FLAG").getString()); oChargeRepHeader.setRemarks(oRow.get("HANDOVER_REMARKS").getString()); oChargeRepHeader.setHandOverDate(EnrgiseUtil.convertToString(oRow.get("HANDOVER_DATE").getDate())); oChargeRepHeader.setTransferDate(EnrgiseUtil.convertToString(oRow.get("TRANSFER_ORDER_DATE").getDate())); oChargeRepHeader.setEmpName(oRow.get("EMPNAME").getString()); oChargeRepHeader.setEmpNameId(oRow.get("E_PER_DTL_ID").getString()); oChargeRepHeader.setTrnOrderNo(oRow.get("TRANSFER_ORDER_NO").getString()); oChargeRepHeader.setFromDesignation(oRow.get("FROM_DESIGNATION").getString()); oChargeRepHeader.setFromDesigId(oRow.get("FROM_DESIGNATION_ID").getString()); oChargeRepHeader.setToDesignation(oRow.get("TO_DESIGNATION").getString()); oChargeRepHeader.setToDesigId(oRow.get("TO_DESIGNATION_ID").getString()); oChargeRepHeader.setFromSiteCode(oRow.get("FROM_SITE_NAME").getString()); oChargeRepHeader.setFromSiteId(oRow.get("FROM_SITE_ID").getString()); oChargeRepHeader.setToSiteCode(oRow.get("TO_SITE_NAME").getString()); oChargeRepHeader.setToSiteId(oRow.get("TO_SITE_ID").getString()); oChargeRepHeader.setChargeStatus(oRow.get("APPROVAL_FLAG").getString()); oChargeRepHeader.setOrderType(oRow.get("TRANSFER_ORDER_TYPE").getString()); oChargeRepHeader.setHandoverTakeoverId(oRow.get("CHARGE_EMP_ID").getString()); oChargeRepHeader.setHandTakeEmpNo(oRow.get("CHARGE_EMP_NO").getString()); oChargeRepHeader.setHandoverTakeover(oRow.get("CHARGE_EMP_NAME").getString()); oChargeRepHeader.setFromWorkGroup(oRow.get("FROM_WORKGROUP").getString()); oChargeRepHeader.setToWorkGroup(oRow.get("TO_WORKGROUP").getString()); arylstHeaderList.add(oChargeRepHeader); } return arylstHeaderList; } public void initializeBOImpl() { this.headerTable = "HRM_EMP_CHARGE_REPORT"; } public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {} public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {} public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException { return new String(); } public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException { String returnString = null; String sSiteId = new String(); String sWorkGroupId = new String(); ArrayList arylstParameters = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); DateUtility d = new DateUtility(); HrmChargeReportHdrBean oHrmChargeReportHdrBean = (HrmChargeReportHdrBean)oBaseHeaderBean; if (ScreenMode.equalsIgnoreCase("N")) { arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, "N")); arylstParameters.add(new DBObject(2, 1, 12, oHrmChargeReportHdrBean.getTrnOrdrDtlId())); arylstParameters.add(new DBObject(3, 1, 12, oHrmChargeReportHdrBean.getChargeType())); arylstParameters.add(new DBObject(4, 1, 12, oHrmChargeReportHdrBean.getChargeCode())); arylstParameters.add(new DBObject(5, 1, 12, oHrmChargeReportHdrBean.getHandOverDate())); arylstParameters.add(new DBObject(6, 1, 12, oHrmChargeReportHdrBean.getNoonFlag())); arylstParameters.add(new DBObject(7, 1, 12, oHrmChargeReportHdrBean.getRemarks())); if (oHrmChargeReportHdrBean.getChargeType().equalsIgnoreCase("H")) { sSiteId = oHrmChargeReportHdrBean.getFromSiteId(); } else if (oHrmChargeReportHdrBean.getChargeType().equalsIgnoreCase("T")) { sSiteId = oHrmChargeReportHdrBean.getToSiteId(); } arylstParameters.add(new DBObject(8, 1, 12, null)); arylstParameters.add(new DBObject(9, 1, 12, sSiteId)); arylstParameters.add(new DBObject(10, 1, 12, "A")); arylstParameters.add(new DBObject(11, 1, 12, oHrmChargeReportHdrBean.getHandoverTakeoverId())); arylstParameters.add(new DBObject(12, 1, 12, this.oUserInfo.getUserTypeId())); arylstParameters.add(new DBObject(13, 1, 12, this.oUserInfo.getSiteId())); arylstParameters.add(new DBObject(14, 1, 12, null)); arylstParameters.add(new DBObject(15, 2, 12)); arylstParameters.add(new DBObject(16, 2, 12)); arylstParameters.add(new DBObject(17, 2, 12)); arylstParameters.add(new DBObject(18, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMCHARGEREPORT.proc_UpsertHrChrgRptHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); returnString = (String)oOutObject.getObject(); System.out.println(returnString); updateCLBalance(oHrmChargeReportHdrBean.getEmpNameId(), oHrmChargeReportHdrBean.getHandOverDate(), oHrmChargeReportHdrBean.getToSiteId()); } else if (ScreenMode.equalsIgnoreCase("U")) { arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, "U")); arylstParameters.add(new DBObject(2, 1, 12, oHrmChargeReportHdrBean.getTrnOrdrDtlId())); arylstParameters.add(new DBObject(3, 1, 12, oHrmChargeReportHdrBean.getChargeType())); System.out.println(oHrmChargeReportHdrBean.getChargeType()); arylstParameters.add(new DBObject(4, 1, 12, oHrmChargeReportHdrBean.getChargeCode())); arylstParameters.add(new DBObject(5, 1, 12, oHrmChargeReportHdrBean.getHandOverDate())); arylstParameters.add(new DBObject(6, 1, 12, oHrmChargeReportHdrBean.getNoonFlag())); arylstParameters.add(new DBObject(7, 1, 12, oHrmChargeReportHdrBean.getRemarks())); if (oHrmChargeReportHdrBean.getChargeType().equalsIgnoreCase("H")) { sSiteId = oHrmChargeReportHdrBean.getFromSiteId(); } else if (oHrmChargeReportHdrBean.getChargeType().equalsIgnoreCase("T")) { sSiteId = oHrmChargeReportHdrBean.getToSiteId(); } arylstParameters.add(new DBObject(8, 1, 12, null)); arylstParameters.add(new DBObject(9, 1, 12, sSiteId)); arylstParameters.add(new DBObject(10, 1, 12, oHrmChargeReportHdrBean.getChargeStatus())); arylstParameters.add(new DBObject(11, 1, 12, oHrmChargeReportHdrBean.getHandoverTakeoverId())); arylstParameters.add(new DBObject(12, 1, 12, this.oUserInfo.getUserTypeId())); arylstParameters.add(new DBObject(13, 1, 12, this.oUserInfo.getSiteId())); arylstParameters.add(new DBObject(14, 1, 12, oHrmChargeReportHdrBean.getHeaderPrimaryKey())); arylstParameters.add(new DBObject(15, 2, 12)); arylstParameters.add(new DBObject(16, 2, 12)); arylstParameters.add(new DBObject(17, 2, 12)); arylstParameters.add(new DBObject(18, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMCHARGEREPORT.proc_UpsertHrChrgRptHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); returnString = (String)oOutObject.getObject(); System.out.println(returnString); } else if (ScreenMode.equalsIgnoreCase("D")) { } updateTables((HrmChargeReportHdrBean)oBaseHeaderBean); return returnString; } public LovVO getHrmChrgOrderNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException { LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmChargeReport.trnOrderNo"); arylstHeaderList.add("DTLID"); arylstHeaderList.add("hrm.HrmChargeReport.empName"); arylstHeaderList.add("hrm.HrmChargeReport.transferDate"); arylstHeaderList.add("hrm.HrmChargeReport.fromSiteId"); arylstHeaderList.add("hrm.HrmChargeReport.fromSiteCode"); arylstHeaderList.add("hrm.HrmChargeReport.toSiteId"); arylstHeaderList.add("hrm.HrmChargeReport.toSiteCode"); arylstHeaderList.add("empId"); arylstHeaderList.add("hrm.HrmChargeReport.orderType"); arylstHeaderList.add("hrm.HrmChargeReport.fromDesignation"); arylstHeaderList.add("hrm.HrmChargeReport.toDesignation"); arylstHeaderList.add("hrm.HrmChargeReport.fromWorkGroup"); arylstHeaderList.add("hrm.HrmChargeReport.toWorkGroup"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int iCount = 0; String empNameId = null; String chargeType = null; ArrayList arylstParameters = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getProperty("empNameId") != null) empNameId = oLovQueryVO.getProperty("empNameId"); if (oLovQueryVO.getProperty("chargeType") != null) chargeType = oLovQueryVO.getProperty("chargeType"); String sSiteId = oLovQueryVO.getProperty("ListSiteId"); arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1)); arylstParameters.add(new DBObject(2, 1, 12, empNameId)); arylstParameters.add(new DBObject(3, 1, 12, chargeType)); arylstParameters.add(new DBObject(4, 1, 12, sSiteId)); arylstParameters.add(new DBObject(5, 2, -10)); arylstParameters.add(new DBObject(6, 2, 12)); arylstParameters.add(new DBObject(7, 2, 12)); arylstParameters.add(new DBObject(8, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNSFRLOV.proc_GetHrmChrgTrnNoLOVdata(?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = arylstList.iterator(); while (iter.hasNext()) { if (iCount == 0) arylstList = new ArrayList(); iCount++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("ID").getString()); oLOVBean.setDetailField2(oRow.get("TRANSFER_ORDER_NO").getString()); oLOVBean.setDetailField3(oRow.get("TRANS_DTL_ID").getString()); oLOVBean.setDetailField4(oRow.get("EMPNAME").getString()); oLOVBean.setDetailField5(EnrgiseUtil.convertToString(oRow.get("TRANSFER_ORDER_DATE").getDate())); oLOVBean.setDetailField6(oRow.get("FROM_SITE_ID").getString()); oLOVBean.setDetailField7(oRow.get("FROM_SITE_NAME").getString()); oLOVBean.setDetailField8(oRow.get("TO_SITE_ID").getString()); oLOVBean.setDetailField9(oRow.get("TO_SITE_NAME").getString()); oLOVBean.setDetailField10(oRow.get("E_PER_DTL_ID").getString()); oLOVBean.setDetailField11(oRow.get("ORDER_TYPE").getString()); oLOVBean.setDetailField12(oRow.get("FROM_DESIGNATION").getString()); oLOVBean.setDetailField13(oRow.get("TO_DESIGNATION").getString()); oLOVBean.setDetailField14(oRow.get("FROM_WORKGROUP").getString()); oLOVBean.setDetailField15(oRow.get("TO_WORKGROUP").getString()); arylstList.add(oLOVBean); } oLovVO.setDetailList(arylstList); return oLovVO; } public LovVO getHrmChrgOrderNoQLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException { LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmChargeReport.trnOrderNo"); arylstHeaderList.add("hrm.HrmChargeReport.dtlId"); arylstHeaderList.add("hrm.HrmChargeReport.empName"); arylstHeaderList.add("hrm.HrmChargeReport.transferDate"); arylstHeaderList.add("hrm.HrmChargeReport.fromSiteId"); arylstHeaderList.add("hrm.HrmChargeReport.fromSiteCode"); arylstHeaderList.add("hrm.HrmChargeReport.toSiteId"); arylstHeaderList.add("hrm.HrmChargeReport.toSiteCode"); arylstHeaderList.add("empId"); arylstHeaderList.add("hrm.HrmChargeReport.orderType"); arylstHeaderList.add("hrm.HrmChargeReport.fromDesignation"); arylstHeaderList.add("hrm.HrmChargeReport.toDesignation"); arylstHeaderList.add("hrm.HrmChargeReport.fromWorkGroup"); arylstHeaderList.add("hrm.HrmChargeReport.toWorkGroup"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int iCount = 0; String empNameId = null; ArrayList arylstParameters = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getProperty("empNameId") != null) empNameId = oLovQueryVO.getProperty("empNameId"); String sSiteId = oLovQueryVO.getProperty("ListSiteId"); arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1)); arylstParameters.add(new DBObject(2, 1, 12, empNameId)); arylstParameters.add(new DBObject(3, 1, 12, sSiteId)); arylstParameters.add(new DBObject(4, 2, -10)); arylstParameters.add(new DBObject(5, 2, 12)); arylstParameters.add(new DBObject(6, 2, 12)); arylstParameters.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNSFRLOV.proc_GetHrmChrgTrnNoQLOVdata(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = arylstList.iterator(); while (iter.hasNext()) { if (iCount == 0) arylstList = new ArrayList(); iCount++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("ID").getString()); oLOVBean.setDetailField2(oRow.get("TRANSFER_ORDER_NO").getString()); oLOVBean.setDetailField3(oRow.get("TRANS_DTL_ID").getString()); oLOVBean.setDetailField4(oRow.get("EMPNAME").getString()); oLOVBean.setDetailField5(EnrgiseUtil.convertToString(oRow.get("TRANSFER_ORDER_DATE").getDate())); oLOVBean.setDetailField6(oRow.get("FROM_SITE_ID").getString()); oLOVBean.setDetailField7(oRow.get("SITE_NAME").getString()); oLOVBean.setDetailField8(oRow.get("TO_SITE_ID").getString()); oLOVBean.setDetailField9(oRow.get("TO_SITE_NAME").getString()); oLOVBean.setDetailField10(oRow.get("E_PER_DTL_ID").getString()); oLOVBean.setDetailField11(oRow.get("ORDER_TYPE").getString()); oLOVBean.setDetailField12(oRow.get("FROM_DESIGNATION").getString()); oLOVBean.setDetailField13(oRow.get("TO_DESIGNATION").getString()); oLOVBean.setDetailField14(oRow.get("FROM_WORKGROUP").getString()); oLOVBean.setDetailField15(oRow.get("TO_WORKGROUP").getString()); arylstList.add(oLOVBean); } oLovVO.setDetailList(arylstList); return oLovVO; } public LovVO getHrmChrgCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException { LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmChargeReport.chargeCode"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int iCount = 0; String trnOrderNoId = null; String chargeType = null; ArrayList arylstParameters = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getProperty("trnOrderNoId") != null) { trnOrderNoId = oLovQueryVO.getProperty("trnOrderNoId"); System.out.println(trnOrderNoId); } if (oLovQueryVO.getProperty("chargeType") != null) { chargeType = oLovQueryVO.getProperty("chargeType"); System.out.println(chargeType); } arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1)); arylstParameters.add(new DBObject(2, 2, -10)); arylstParameters.add(new DBObject(3, 2, 12)); arylstParameters.add(new DBObject(4, 2, 12)); arylstParameters.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNSFRLOV.proc_GetHrmTrnsfrChrgCdLOVdata(?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = arylstList.iterator(); while (iter.hasNext()) { if (iCount == 0) arylstList = new ArrayList(); iCount++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("ID").getString()); oLOVBean.setDetailField2(oRow.get("CHARGE_CODE").getString()); arylstList.add(oLOVBean); } oLovVO.setDetailList(arylstList); return oLovVO; } public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstErrorList = new ArrayList(); if (bHeaderDataChanged) if (!sScreenMode.equalsIgnoreCase("D")) checkMandatoryHeader((HrmChargeReportHdrBean)oBaseHeaderBean); reportError(arylstErrorList); } private void checkMandatoryHeader(HrmChargeReportHdrBean oHrmChargeReportHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException { ArrayList arylstErrorList = new ArrayList(); ArrayList arylstParams = new ArrayList(); if (!EnrgiseUtil.checkString(oHrmChargeReportHdrBean.getTrnOrderNo())) { MessageKey oMessageKey = new MessageKey("hrm.HrmChargeReport.trnOrderNo"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } if (!EnrgiseUtil.checkString(oHrmChargeReportHdrBean.getChargeCode())) { MessageKey oMessageKey = new MessageKey("hrm.HrmChargeReport.chargeCode"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } if (!EnrgiseUtil.checkString(oHrmChargeReportHdrBean.getHandOverDate())) { MessageKey oMessageKey = new MessageKey("hrm.HrmChargeReport.handOverDate"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } if (!EnrgiseUtil.checkString(oHrmChargeReportHdrBean.getChargeType())) { MessageKey oMessageKey = new MessageKey("hrm.HrmChargeReport.chargeType"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } reportError(arylstErrorList); } public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList arylstParam6, boolean param7, Timestamp param8) {} private void checkDatesConstraint(HrmChargeReportHdrBean oHrmChargeReportHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException { DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy"); if (EnrgiseUtil.checkString(oHrmChargeReportHdrBean.getHandOverDate())) { int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmChargeReportHdrBean.getHandOverDate(), oHrmChargeReportHdrBean.getTransferDate()); if (iDateFlag == -1 && iDateFlag != -2) arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.dateConstraintViolated")); } } public void additionalBusinessValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstErrorList = new ArrayList(); HrmChargeReportHdrBean oHrmChargeReportHdrBean = (HrmChargeReportHdrBean)oBaseHeaderBean; if (bHeaderDataChanged) { if (!sScreenMode.equalsIgnoreCase("D")) { checkUniqueHeader((HrmChargeReportHdrBean)oBaseHeaderBean); checkDatesConstraint((HrmChargeReportHdrBean)oBaseHeaderBean, arylstErrorList); } if (sScreenMode.equalsIgnoreCase("D")) { HrmCommonBO oCommonBO = new HrmCommonBO(); if (arylstErrorList.isEmpty()) arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.deletion.rejected")); } } reportError(arylstErrorList); } private void checkUniqueHeader(HrmChargeReportHdrBean oHrmChargeReportHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); ArrayList arylstErrorList = new ArrayList(); String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select ID as ID from HRM_EMP_CHARGE_REPORT where TRANS_ORDER_DTL_ID='").concat(String.valueOf(oHrmChargeReportHdrBean.getTrnOrdrDtlId()))).concat(String.valueOf("' And CHARGE_TYPE='"))).concat(String.valueOf(oHrmChargeReportHdrBean.getChargeType()))).concat(String.valueOf("'")); System.out.println(sQuery); DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstList = oBean.executeQuery(sQuery); Iterator itrBean = arylstList.iterator(); if (itrBean.hasNext()) { QueryRow oRow = itrBean.next(); if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmChargeReportHdrBean.getHeaderPrimaryKey())) { arylstParam = new ArrayList(); arylstParam.add(""); arylstParam.add(new Integer(0)); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.uniqueConstraintViolated", arylstParam)); } } reportError(arylstErrorList); } public String approveTranChrgRpt(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = null; HrmChargeReportHdrBean oHrmChargeReportHdrBean = (HrmChargeReportHdrBean)oBaseHeaderBean; updateTables((HrmChargeReportHdrBean)oBaseHeaderBean); String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : ""; WflStatus status = null; if (!EnrgiseUtil.checkString(oBaseHeaderBean.getWorkListId())) { status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Approve", "Initiated"); } else { status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Approve", (String)null); } if (status.getStatus().equalsIgnoreCase("FinallyApproved")) { oBean = new DBUtilitiesBean(); ArrayList arylstParameters = new ArrayList(); arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey)); arylstParameters.add(new DBObject(2, 2, 12)); arylstParameters.add(new DBObject(3, 2, 12)); arylstParameters.add(new DBObject(4, 2, 4)); ArrayList arrayList = oBean.callProc(arylstParameters, "HRMCHARGEREPORT.procApproveTransChrgRpt(?,?,?,?)"); } return sHeaderPrimaryKey; } public String rejectTranChrgRpt(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = null; HrmChargeReportHdrBean oHrmChargeReportHdrBean = (HrmChargeReportHdrBean)oBaseHeaderBean; String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : ""; WflStatus status = null; if (!EnrgiseUtil.checkString(oBaseHeaderBean.getWorkListId())) { status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Reject", "Initiated"); } else { status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Reject", (String)null); } if (status.getStatus().equalsIgnoreCase("Rejected")) { oBean = new DBUtilitiesBean(); ArrayList arylstParameters = new ArrayList(); arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey)); arylstParameters.add(new DBObject(2, 2, 12)); arylstParameters.add(new DBObject(3, 2, 12)); arylstParameters.add(new DBObject(4, 2, 4)); ArrayList arrayList = oBean.callProc(arylstParameters, "HRMCHARGEREPORT.procRejectTransChrgRpt(?,?,?,?)"); } return sHeaderPrimaryKey; } public String submitTranChrgRpt(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = null; HrmChargeReportHdrBean oHrmChargeReportHdrBean = (HrmChargeReportHdrBean)oBaseHeaderBean; String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : ""; WflStatus status = null; if (!EnrgiseUtil.checkString(oBaseHeaderBean.getWorkListId())) { status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Approve", "Initiated"); } else { status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Approve", (String)null); } if (status.getStatus().equalsIgnoreCase("Pending")) { oBean = new DBUtilitiesBean(); ArrayList arylstParameters = new ArrayList(); arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey)); arylstParameters.add(new DBObject(2, 2, 12)); arylstParameters.add(new DBObject(3, 2, 12)); arylstParameters.add(new DBObject(4, 2, 4)); ArrayList arrayList = oBean.callProc(arylstParameters, "HRMCHARGEREPORT.procSubmitTransChrgRpt(?,?,?,?)"); } return sHeaderPrimaryKey; } private void updateTables(HrmChargeReportHdrBean oHrmChargeReportHdrBean) throws EnrgiseSystemException { String sEmpId = oHrmChargeReportHdrBean.getEmpNameId(); String sFromSiteId = oHrmChargeReportHdrBean.getFromSiteId(); String sBaseSiteId = oHrmChargeReportHdrBean.getToSiteId(); String sTransferDate = oHrmChargeReportHdrBean.getTransferDate(); String sHandOverDate = oHrmChargeReportHdrBean.getHandOverDate(); String sFromDesigId = oHrmChargeReportHdrBean.getFromDesigId(); String sToDesigId = oHrmChargeReportHdrBean.getToDesigId(); if (oHrmChargeReportHdrBean.getChargeType().equalsIgnoreCase("T")) { DBUtilitiesBean oBean4 = null; oBean4 = new DBUtilitiesBean(); ArrayList arylstParameters4 = new ArrayList(); arylstParameters4 = new ArrayList(); arylstParameters4.add(new DBObject(1, 1, 12, sEmpId)); arylstParameters4.add(new DBObject(2, 1, 12, sHandOverDate)); arylstParameters4.add(new DBObject(3, 2, 12)); arylstParameters4.add(new DBObject(4, 2, 12)); arylstParameters4.add(new DBObject(5, 2, 4)); ArrayList arrayList = oBean4.callProc(arylstParameters4, "HRMCHARGEREPORT.procUpdateHrmEmpPersTakeOver(?,?,?,?,?)"); } else if (oHrmChargeReportHdrBean.getChargeType().equalsIgnoreCase("H")) { DBUtilitiesBean oBean1 = null; oBean1 = new DBUtilitiesBean(); ArrayList arylstParameters1 = new ArrayList(); arylstParameters1 = new ArrayList(); arylstParameters1.add(new DBObject(1, 1, 12, sEmpId)); arylstParameters1.add(new DBObject(2, 1, 12, sBaseSiteId)); arylstParameters1.add(new DBObject(3, 2, 12)); arylstParameters1.add(new DBObject(4, 2, 12)); arylstParameters1.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray1 = oBean1.callProc(arylstParameters1, "HRMCHARGEREPORT.procUpdateHrmEmpPers(?,?,?,?,?)"); DBUtilitiesBean oBean2 = null; oBean2 = new DBUtilitiesBean(); String sDesigId = new String(); if (sToDesigId != null) { sDesigId = sToDesigId; } else { sDesigId = sFromDesigId; } ArrayList arylstParameters2 = new ArrayList(); arylstParameters2 = new ArrayList(); arylstParameters2.add(new DBObject(1, 1, 12, sEmpId)); arylstParameters2.add(new DBObject(2, 1, 12, sDesigId)); arylstParameters2.add(new DBObject(3, 1, 12, this.oUserInfo.getUserTypeId())); arylstParameters2.add(new DBObject(4, 1, 12, this.oUserInfo.getSiteId())); arylstParameters2.add(new DBObject(5, 2, 12)); arylstParameters2.add(new DBObject(6, 2, 12)); arylstParameters2.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray2 = oBean2.callProc(arylstParameters2, "HRMCHARGEREPORT.procUpsertHrmDesignation(?,?,?,?,?,?,?)"); DBUtilitiesBean oBean3 = null; oBean3 = new DBUtilitiesBean(); ArrayList arylstParameters3 = new ArrayList(); arylstParameters3.add(new DBObject(1, 1, 12, sEmpId)); arylstParameters3.add(new DBObject(2, 1, 12, sFromSiteId)); arylstParameters3.add(new DBObject(3, 1, 12, sBaseSiteId)); arylstParameters3.add(new DBObject(4, 1, 12, sTransferDate)); arylstParameters3.add(new DBObject(5, 1, 12, sHandOverDate)); arylstParameters3.add(new DBObject(6, 1, 12, sFromDesigId)); arylstParameters3.add(new DBObject(7, 1, 12, sToDesigId)); arylstParameters3.add(new DBObject(8, 1, 12, this.oUserInfo.getUserTypeId())); arylstParameters3.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId())); arylstParameters3.add(new DBObject(10, 2, 12)); arylstParameters3.add(new DBObject(11, 2, 12)); arylstParameters3.add(new DBObject(12, 2, 4)); ArrayList arrayList1 = oBean3.callProc(arylstParameters3, "HRMCHARGEREPORT.procUpsertHrmEmpIncr(?,?,?,?,?,?,?,?,?,?,?,?)"); } } public WflStatus callWorkFlow(BaseHeaderBean oBaseHeaderBean, ArrayList arylstDetailBeanArray, String activity, String initiatedFlag) throws EnrgiseApplicationException, EnrgiseSystemException { try { WorkFlowFacadeHome oHome = (WorkFlowFacadeHome)WorkFlowServiceLocator.getLocator().getService("WorkFlowFacade"); WorkFlowFacade workFlowFacade = oHome.create(); HrmChargeReportHdrBean oHrmChargeReportHdrBean = (HrmChargeReportHdrBean)oBaseHeaderBean; WflResourceImpl wflResourceImpl = new WflResourceImpl(); wflResourceImpl.setEmployeeId(this.oUserInfo.getUserTypeId()); WflSiteImpl wflSiteImpl = new WflSiteImpl(); wflSiteImpl.setSiteId(this.oUserInfo.getSiteId()); wflResourceImpl.setLoginSite((WflSite)wflSiteImpl); WflDocumentInfoImpl wflDocumentInfoImpl = new WflDocumentInfoImpl(); wflDocumentInfoImpl.setRequester((WflResource)wflResourceImpl); wflDocumentInfoImpl.setDocumentId(oHrmChargeReportHdrBean.getHeaderPrimaryKey()); wflDocumentInfoImpl.setDocumentType("Transfer"); wflDocumentInfoImpl.setInitiatedFlag(initiatedFlag); String documentTypeId = workFlowFacade.getDocumentTypeId("TransChrgRpt"); if (documentTypeId == null) throw new EnrgiseSystemException(); if (!EnrgiseUtil.checkString(initiatedFlag)) wflDocumentInfoImpl.setWorkListId(oBaseHeaderBean.getWorkListId()); String activityId = workFlowFacade.getActivityId(activity); if (activityId == null) throw new EnrgiseSystemException(); wflDocumentInfoImpl.setDocumentTypeId(documentTypeId); if (!activity.equalsIgnoreCase("Reject")) { wflDocumentInfoImpl.setDocumentNumber(String.valueOf(String.valueOf("Transfer Charge Report No:").concat(String.valueOf(oHrmChargeReportHdrBean.getHeaderPrimaryKey()))).concat(String.valueOf("is pending for approval"))); wflDocumentInfoImpl.setDocDesc(String.valueOf("The following document has been pending for approval:Training Requirement:").concat(String.valueOf(oHrmChargeReportHdrBean.getHeaderPrimaryKey()))); } else if (!activity.equalsIgnoreCase("Approve")) { wflDocumentInfoImpl.setDocumentNumber(String.valueOf(String.valueOf("Transfer Charge Report No:").concat(String.valueOf(oHrmChargeReportHdrBean.getHeaderPrimaryKey()))).concat(String.valueOf("is pending for rejection"))); wflDocumentInfoImpl.setDocDesc(String.valueOf("The following document has been pending for rejection:Deputation Application No:").concat(String.valueOf(oHrmChargeReportHdrBean.getHeaderPrimaryKey()))); } wflDocumentInfoImpl.setModuleId("8"); wflDocumentInfoImpl.setCreator((WflResource)wflResourceImpl); wflDocumentInfoImpl.setRequesterAction(activityId); HashMap oProp = new HashMap(); oProp.put("1", "1"); wflDocumentInfoImpl.setDocumentAttributes(oProp); WflAuthorizationBean wflAuthBean = workFlowFacade.canDo((WflDocumentInfo)wflDocumentInfoImpl); if (EnrgiseUtil.checkString(wflAuthBean.getErrorCode())) throw new EnrgiseApplicationException(wflAuthBean.getErrorCode()); if (!wflAuthBean.isAuthStatus()) throw new EnrgiseApplicationException("wenrgise.workflow.submit.notauthorized"); WflStatus wflStatus = workFlowFacade.process((WflDocumentInfo)wflDocumentInfoImpl); if (wflStatus.getStatus().equals("Error")) throw new EnrgiseSystemException(); workFlowFacade.remove(); return wflStatus; } catch (RemoteException oRtEx) { throw new EnrgiseSystemException("wenrgise.workflow.connect", oRtEx); } catch (CreateException oCx) { throw new EnrgiseSystemException("wenrgise.workflow.connect", oCx); } catch (RemoveException oRx) { throw new EnrgiseSystemException("wenrgise.workflow.connect", oRx); } } private String updateCLBalance(String sEmp, String sEffectDate, String sSite) throws EnrgiseSystemException { String sNoOfCLPrior = null; String sOutStandingLeaves = null; String sAvailedLeaves = null; String sProRataCL = null; String sNewCLBalance = null; ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmp)); arylstParam.add(new DBObject(2, 2, -10)); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVCREDIT.procGetLvInfo(?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; if (arylstList.size() > 0) { Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oRow = itrBean.next(); sNoOfCLPrior = oRow.get("NO_OF_CL").getString(); sOutStandingLeaves = oRow.get("OUTSTANDING_LV").getString(); sAvailedLeaves = oRow.get("lv_availed").getString(); } ArrayList arylstParam1 = new ArrayList(); DBUtilitiesBean oBean1 = new DBUtilitiesBean(); ArrayList arylstOutArray1 = new ArrayList(); String sNoOfCLAfter = null; arylstParam1.add(new DBObject(1, 1, 12, sSite)); arylstParam1.add(new DBObject(2, 2, 12)); arylstParam1.add(new DBObject(3, 2, 12)); arylstParam1.add(new DBObject(4, 2, 12)); arylstParam1.add(new DBObject(5, 2, 4)); arylstOutArray1 = oBean1.callProc(arylstParam1, "HRMLVCREDIT.procGetLvInfoN(?,?,?,?,?)"); DBObject oOutObject1 = arylstOutArray1.get(0); sNoOfCLAfter = ((String)oOutObject1.getObject()).toString(); Calendar cal = Calendar.getInstance(); int iThisMonth = cal.get(2) + 1; int iThisYear = cal.get(1); cal = null; int iNextMonthOffset = 12; HrmCommonBO oBO = new HrmCommonBO(); sEffectDate = oBO.getddmmyyyyDateFormat(sEffectDate); String sYYYY = sEffectDate.substring(6, 10); String sMM = sEffectDate.substring(3, 5); int iMonth = Integer.parseInt(sMM); int iYear = Integer.parseInt(sYYYY); int iMonthDiff = iNextMonthOffset - iMonth; double dProRataLv = Double.parseDouble(sNoOfCLAfter) * iMonthDiff / iNextMonthOffset; sProRataCL = String.valueOf(dProRataLv); if (Integer.parseInt(sNoOfCLPrior) < Integer.parseInt(sNoOfCLAfter)) { double dProRataLv1 = Double.parseDouble(String.valueOf(Integer.parseInt(sNoOfCLAfter) - Integer.parseInt(sNoOfCLPrior))) * iMonthDiff / iNextMonthOffset; sNewCLBalance = String.valueOf(Double.parseDouble(sOutStandingLeaves) + dProRataLv1); } else if (Integer.parseInt(sNoOfCLPrior) > Integer.parseInt(sNoOfCLAfter)) { if (Integer.parseInt(sNoOfCLAfter) <= Integer.parseInt(sAvailedLeaves)) { sNewCLBalance = "0"; } else if (Integer.parseInt(sNoOfCLAfter) > Integer.parseInt(sAvailedLeaves)) { sNewCLBalance = sProRataCL; } } else if (Integer.parseInt(sNoOfCLPrior) == Integer.parseInt(sNoOfCLAfter)) { sNewCLBalance = sOutStandingLeaves; } ArrayList arylstParameters = new ArrayList(); DBUtilitiesBean oBean2 = new DBUtilitiesBean(); arylstParameters.add(new DBObject(1, 1, 12, sEmp)); arylstParameters.add(new DBObject(2, 1, 12, sNewCLBalance)); arylstParameters.add(new DBObject(3, 2, 12)); arylstParameters.add(new DBObject(4, 2, 12)); arylstParameters.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray2 = oBean2.callProc(arylstParameters, "HRMLVCREDIT.procUpdateLvTransfer(?,?,?,?,?)"); return sProRataCL; } return null; } public LovVO getHrmChgRepEmpLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException { LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmTransferOrder.empNo"); arylstHeaderList.add("hrm.HrmTransferOrder.empName"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int iCount = 0; ArrayList arylstParameters = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); String sQuerySearch2 = new String(); String sSiteId = oLovQueryVO.getProperty("ListSiteId"); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getSearchField2() != null) sQuerySearch2 = oLovQueryVO.getSearchField2(); arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1)); arylstParameters.add(new DBObject(2, 1, 12, sQuerySearch2)); arylstParameters.add(new DBObject(3, 1, 12, sSiteId)); arylstParameters.add(new DBObject(4, 2, -10)); arylstParameters.add(new DBObject(5, 2, 12)); arylstParameters.add(new DBObject(6, 2, 12)); arylstParameters.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNSFRLOV.procGetTransRptChgEmpNoLOV(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = arylstList.iterator(); while (iter.hasNext()) { if (iCount == 0) arylstList = new ArrayList(); iCount++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("EMPID").getString()); oLOVBean.setDetailField2(oRow.get("EMPNO").getString()); oLOVBean.setDetailField3(oRow.get("EMPNAME").getString()); arylstList.add(oLOVBean); } oLovVO.setDetailList(arylstList); return oLovVO; } }