package wenrgise.hrms.ejb.business; import java.util.ArrayList; import java.util.Iterator; import wenrgise.common.ejb.business.HrmCommonBO; import wenrgise.common.exception.EnrgiseApplicationException; import wenrgise.common.exception.EnrgiseSystemException; import wenrgise.common.utility.EnrgiseUtil; import wenrgise.ejb.common.helper.DBObject; import wenrgise.ejb.common.helper.QueryRow; import wenrgise.ejb.common.utility.DBUtilitiesBean; public class HrmLvApplnValidationBO { private double dYearsOfService; private double dEmpYearsOfService; private double dTimesInService; private double dEmpTimesInSevice; private double dDaysInService; private double dEmpDaysInService; private double dTimesInPeriod; private double dMaxDaysPerTransaction; private double dMinDaysPerTransaction; private double dMaxLeaveInPeriod; private double dEmpDaysInPeriod; private double dEmpTimesInPeriod; public void getLeaveAvaliabilityDetails(String sLeaveAttrId) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sLeaveAttrId)); 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, "HRMLVAPPLN.proc_GetLeaveInfo(?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oRow = itrBean.next(); this.dYearsOfService = Double.parseDouble(oRow.get("YEARS_OF_SERVICE").getString()); this.dDaysInService = Double.parseDouble(oRow.get("MAX_AVAIL_SVC_PRD").getString()); this.dTimesInService = Double.parseDouble(oRow.get("txn_per_srv_prd").getString()); this.dMaxLeaveInPeriod = Double.parseDouble(oRow.get("max_avail_cycle").getString()); this.dTimesInPeriod = Double.parseDouble(oRow.get("txn_per_period").getString()); this.dMaxDaysPerTransaction = Double.parseDouble(oRow.get("min_leave_per_txn").getString()); this.dMinDaysPerTransaction = Double.parseDouble(oRow.get("max_leave_per_txn").getString()); } } public void getEmpLeaveAvailedDetails(String sEmpId, String sLeaveAttrId, String sStartDate) throws EnrgiseApplicationException, EnrgiseSystemException { getEmpSrvLeaveAvailedDetails(sEmpId, sLeaveAttrId, sStartDate); DBUtilitiesBean oBean = new DBUtilitiesBean(); HrmCommonBO oBO = new HrmCommonBO(); this.dEmpYearsOfService = Double.parseDouble(oBO.getRefList1("HRM_EMP_PERS", "ID", sEmpId, String.valueOf(String.valueOf("round(months_between('").concat(String.valueOf(sStartDate))).concat(String.valueOf("',comp_join_date ) /12 ,1)")))); getEmpPeriodLeaveAvailedDetails(sEmpId, sLeaveAttrId, sStartDate); } private void getEmpSrvLeaveAvailedDetails(String sEmpId, String sLeaveAttrId, String sStartDate) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 12, sLeaveAttrId)); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sStartDate))); arylstParam.add(new DBObject(4, 2, -10)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLNQUERY.proc_GetEmpSrvLeaveInfo(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); if (arylstList != null) { QueryRow oRow = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oRow = itrBean.next(); this.dEmpDaysInService = Double.parseDouble(oRow.get("days_srv").getString()); this.dEmpTimesInSevice = Double.parseDouble(oRow.get("times_srv").getString()); } } } private void getEmpPeriodLeaveAvailedDetails(String sEmpId, String sLeaveAttrId, String sStartDate) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 12, sLeaveAttrId)); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sStartDate))); arylstParam.add(new DBObject(4, 2, -10)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLNQUERY.proc_GetEmpPeriodLeaveInfo(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); if (arylstList != null) { QueryRow oRow = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oRow = itrBean.next(); this.dEmpTimesInPeriod = Double.parseDouble(oRow.get("times_period").getString()); this.dEmpDaysInPeriod = Double.parseDouble(oRow.get("days_period").getString()); } } } public double getDaysInService() { return this.dDaysInService; } public double getEmpDaysInService() { return this.dEmpDaysInService; } public double getEmpTimesInSevice() { return this.dEmpTimesInSevice; } public double getEmpYearsOfService() { return this.dEmpYearsOfService; } public double getTimesInService() { return this.dTimesInService; } public double getYearsOfService() { return this.dYearsOfService; } public double getMaxDaysPerTransaction() { return this.dMaxDaysPerTransaction; } public double getMinDaysPerTransaction() { return this.dMinDaysPerTransaction; } public double getEmpDaysInPeriod() { return this.dEmpDaysInPeriod; } public double getEmpTimesInPeriod() { return this.dEmpTimesInPeriod; } public double getMaxLeaveInPeriod() { return this.dMaxLeaveInPeriod; } public double getTimesInPeriod() { return this.dTimesInPeriod; } }