908 lines
44 KiB
Java
908 lines
44 KiB
Java
package wenrgise.hrms.ejb.business;
|
|
|
|
import java.sql.Timestamp;
|
|
import java.text.DateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import wenrgise.common.bean.BaseHeaderBean;
|
|
import wenrgise.common.bean.LOVBean;
|
|
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.vo.BaseDetailVO;
|
|
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.helper.QueryValue;
|
|
import wenrgise.ejb.common.utility.DBUtilitiesBean;
|
|
import wenrgise.hrms.bean.HrmLnMstDtlBean;
|
|
import wenrgise.hrms.bean.HrmLnMstHdrBean;
|
|
import wenrgise.hrms.vo.HrmLnMstQVO;
|
|
|
|
public class HrmLnMstBO extends HrmBaseBO {
|
|
public HrmLnMstBO() {}
|
|
|
|
public HrmLnMstBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo getHrmLoanMstHdrMetaInfo(HrmLnMstQVO oHrmLoanMstQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, oHrmLoanMstQueryVO.getHeaderPrimaryKey()));
|
|
arylstParam.add(new DBObject(2, 1, 12, oHrmLoanMstQueryVO.getChartNameId()));
|
|
arylstParam.add(new DBObject(3, 2, -5));
|
|
arylstParam.add(new DBObject(4, 2, 93));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 12));
|
|
arylstParam.add(new DBObject(7, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNMST.procHrLoanMstHdrCount(?,?,?,?,?,?,?)");
|
|
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject oTimeObject = oOutArray.get(1);
|
|
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
|
|
DBObject oTotalRecord = oOutArray.get(0);
|
|
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
|
|
return oRecordMetaInfo;
|
|
}
|
|
|
|
public ArrayList getHrmLoanMstHeaderInfo(HrmLnMstQVO oHrmLoanMstQueryVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
ArrayList oHeaderList = null;
|
|
if (oHrmLoanMstQueryVO == null)
|
|
oHrmLoanMstQueryVO = new HrmLnMstQVO();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, -5, new Long(lStartPosition)));
|
|
arylstParam.add(new DBObject(2, 1, -5, new Long(lLastPosition)));
|
|
arylstParam.add(new DBObject(3, 1, 12, oHrmLoanMstQueryVO.getHeaderPrimaryKey()));
|
|
arylstParam.add(new DBObject(4, 1, 12, oHrmLoanMstQueryVO.getChartNameId()));
|
|
arylstParam.add(new DBObject(5, 2, -10));
|
|
arylstParam.add(new DBObject(6, 2, 12));
|
|
arylstParam.add(new DBObject(7, 2, 12));
|
|
arylstParam.add(new DBObject(8, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNMST.procGetHrLoanMstHdr(?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
if (oList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
HashMap oColumns = null;
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
oHeaderList = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
HrmLnMstHdrBean oLoanMstHeader = new HrmLnMstHdrBean();
|
|
oLoanMstHeader.setHeaderPrimaryKey(oRow.get("ID").getString());
|
|
oLoanMstHeader.setLoanCode(oRow.get("CODE").getString());
|
|
oLoanMstHeader.setLoanName(oRow.get("NAME").getString());
|
|
oLoanMstHeader.setChartNameId(oRow.get("chart_hdr_id").getString());
|
|
oLoanMstHeader.setChartName(oRow.get("CHART_NAME").getString());
|
|
oLoanMstHeader.setTypeOfInterest(oRow.get("INT_TYPE").getString());
|
|
oLoanMstHeader.setNatureOfPayment(oRow.get("FIRST_PAYMENT_FLAG").getString());
|
|
oHeaderList.add(oLoanMstHeader);
|
|
}
|
|
return oHeaderList;
|
|
}
|
|
|
|
public RecordMetaInfo getHrmLoanMstDetailMetaInfo(String lPrimaryKey) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, lPrimaryKey));
|
|
arylstParam.add(new DBObject(2, 2, -5));
|
|
arylstParam.add(new DBObject(3, 2, 93));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNMST.procHrLoanMstDtlCount(?,?,?,?,?,?)");
|
|
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject oTotalRecord = oOutArray.get(0);
|
|
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
|
|
DBObject oTimeObject = oOutArray.get(1);
|
|
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
|
|
return oRecordMetaInfo;
|
|
}
|
|
|
|
public ArrayList getHrmLoanMstDetailInfo(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
BaseDetailVO oBaseDetailVO = null;
|
|
ArrayList oHrmLoanMstDetail = null;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, -5, new Long(lDetailFirstPosition)));
|
|
arylstParam.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
|
|
arylstParam.add(new DBObject(3, 1, 12, lPrimaryKey));
|
|
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 oOutArray = oBean.callProc(arylstParam, "HRMLNMST.procGetHrLoanMstDtl(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
if (oList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy");
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
boolean all;
|
|
if (count == 0)
|
|
oHrmLoanMstDetail = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
HrmLnMstDtlBean oLoanMstDetailBean = new HrmLnMstDtlBean();
|
|
oLoanMstDetailBean.setDetailId(oRow.get("ID").getString());
|
|
oLoanMstDetailBean.setTxtLoanDetailCode(oRow.get("NAME").getString());
|
|
oLoanMstDetailBean.setTxtGreaterLessNotApplicable(oRow.get("GREATER_LESSER_FLAG").getString());
|
|
oLoanMstDetailBean.setTxtMaxLimit(oRow.get("FLAT_AMOUNT").getString());
|
|
oLoanMstDetailBean.setTxtMaximumLoanPerc(oRow.get("MAX_LOAN_PERC").getString());
|
|
oLoanMstDetailBean.setTxtNoOfMonthsSalary(oRow.get("NO_OF_MTHS_SALARY").getString());
|
|
oLoanMstDetailBean.setTxtMinYrsOfRemainingService(oRow.get("MIN_YR_SERVICE_LEFT").getString());
|
|
oLoanMstDetailBean.setTxtMinYrsOfServiceToBeCompleted(oRow.get("MIN_YEAR_IN_SERVICE").getString());
|
|
String effecDate = String.valueOf(oRow.get("EFFECT_DATE").getDate());
|
|
System.out.println(effecDate);
|
|
if (effecDate.equalsIgnoreCase("null")) {
|
|
oLoanMstDetailBean.setTxtCompanyPolicyStDate("");
|
|
} else {
|
|
oLoanMstDetailBean.setTxtCompanyPolicyStDate(EnrgiseUtil.convertToString(oRow.get("EFFECT_DATE").getDate()));
|
|
}
|
|
String toDate = String.valueOf(oRow.get("TO_DATE").getDate());
|
|
System.out.println(toDate);
|
|
if (toDate.equalsIgnoreCase("null")) {
|
|
oLoanMstDetailBean.setTxtCompanyPolicyToDate("");
|
|
} else {
|
|
oLoanMstDetailBean.setTxtCompanyPolicyToDate(EnrgiseUtil.convertToString(oRow.get("TO_DATE").getDate()));
|
|
}
|
|
String allFlag = oRow.get("ALL_FLAG").getString();
|
|
allFlag = allFlag.trim();
|
|
if (allFlag.equalsIgnoreCase("Y")) {
|
|
all = true;
|
|
} else {
|
|
all = false;
|
|
}
|
|
oLoanMstDetailBean.setTxtAppliedToAllEmployee(all);
|
|
oHrmLoanMstDetail.add(oLoanMstDetailBean);
|
|
}
|
|
return oHrmLoanMstDetail;
|
|
}
|
|
|
|
public LovVO getHrmLoanCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("hrm.HrmAdvertisementAttribute.id");
|
|
oHeaderList.add("hrm.HrmLoanMst.loanCode");
|
|
oHeaderList.add("hrm.HrmLoanMst.loanName");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
String sQuerySearch1 = new String();
|
|
String sQuerySearch2 = new String();
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuerySearch1 = oLovQueryVO.getSearchField1();
|
|
if (oLovQueryVO.getSearchField2() != null)
|
|
sQuerySearch2 = oLovQueryVO.getSearchField2();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2));
|
|
arylstParam.add(new DBObject(3, 2, -10));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNLOV.proc_GetLoanCodeLOV(?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = oList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CODE").getString());
|
|
oLOVBean.setDetailField3(oRow.get("NAME").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmChartNameLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("hrm.HrmAdvertisementAttribute.id");
|
|
oHeaderList.add("hrm.HrmLoanMst.chartName");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
String sQuerySearch1 = new String();
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuerySearch1 = oLovQueryVO.getSearchField1();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
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 oOutArray = oBean.callProc(arylstParam, "HRMLNLOV.proc_GetLoanChartNameLOV(?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = oList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("chart_hdr_id").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CHART_NAME").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmLoanCodeLOVdataNew(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("hrm.HrmAdvertisementAttribute.id");
|
|
oHeaderList.add("hrm.HrmLoanMst.loanCode");
|
|
oHeaderList.add("hrm.HrmLoanMst.loanName");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
String sQuerySearch1 = new String();
|
|
String sQuerySearch2 = new String();
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuerySearch1 = oLovQueryVO.getSearchField1();
|
|
if (oLovQueryVO.getSearchField2() != null)
|
|
sQuerySearch2 = oLovQueryVO.getSearchField2();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2));
|
|
arylstParam.add(new DBObject(3, 2, -10));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNLOV.proc_GetLoanCodeLOVNew(?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = oList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("global_code").getString());
|
|
oLOVBean.setDetailField3(oRow.get("global_code_desc").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmChartNameLOVdataNew(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("hrm.HrmAdvertisementAttribute.id");
|
|
oHeaderList.add("hrm.HrmLoanMst.chartName");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
String sQuerySearch1 = new String();
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuerySearch1 = oLovQueryVO.getSearchField1();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
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 oOutArray = oBean.callProc(arylstParam, "HRMLNLOV.proc_GetLoanChartNameLOVNew(?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = oList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CHART_NAME").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public ArrayList getHrmCurLoanMstDetailInfo() throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
BaseDetailVO oBaseDetailVO = null;
|
|
ArrayList oHrmCurLoanMstDetail = null;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 2, -10));
|
|
arylstParam.add(new DBObject(2, 2, 12));
|
|
arylstParam.add(new DBObject(3, 2, 12));
|
|
arylstParam.add(new DBObject(4, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNMST.proc_GetHrCurLoanInfo(?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
if (oList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
oHrmCurLoanMstDetail = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
HrmLnMstDtlBean oLoanMstDetailBean = new HrmLnMstDtlBean();
|
|
oLoanMstDetailBean.setTxtLoanDetailCode(oRow.get("NAME").getString());
|
|
oLoanMstDetailBean.setDetailId(oRow.get("ID").getString());
|
|
oHrmCurLoanMstDetail.add(oLoanMstDetailBean);
|
|
}
|
|
return oHrmCurLoanMstDetail;
|
|
}
|
|
|
|
public LovVO getHrmLoanDetailLOVInfo(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderNames = new ArrayList();
|
|
arylstHeaderNames.add("ID");
|
|
arylstHeaderNames.add("hrm.HrmLoanMst.loanName");
|
|
arylstHeaderNames.add("hrm.HrmLoanMst.effectiveDate");
|
|
arylstHeaderNames.add("hrm.HrmLoanMst.toDate");
|
|
oLovVO.setHeaderList(arylstHeaderNames);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 2, -10));
|
|
arylstParam.add(new DBObject(2, 2, 12));
|
|
arylstParam.add(new DBObject(3, 2, 12));
|
|
arylstParam.add(new DBObject(4, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNMST.proc_GetHrCurLoanInfo(?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
Iterator iter = oList.iterator();
|
|
while (iter.hasNext()) {
|
|
String datenewformat1, datenewformat2;
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("NAME").getString());
|
|
String effecDate = String.valueOf(oRow.get("EFFECT_DATE").getDate());
|
|
System.out.println(effecDate);
|
|
if (effecDate.equalsIgnoreCase("null")) {
|
|
datenewformat1 = "";
|
|
} else {
|
|
datenewformat1 = formatter.format(oRow.get("EFFECT_DATE").getDate());
|
|
}
|
|
String toDate = String.valueOf(oRow.get("TO_DATE").getDate());
|
|
System.out.println(toDate);
|
|
if (toDate.equalsIgnoreCase("null")) {
|
|
datenewformat2 = "";
|
|
} else {
|
|
datenewformat2 = formatter.format(oRow.get("TO_DATE").getDate());
|
|
}
|
|
oLOVBean.setDetailField3(datenewformat1);
|
|
oLOVBean.setDetailField4(datenewformat2);
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public void updateLoanMst(String sSql, String sId, String sUserId, String sUserSiteId) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sSql));
|
|
arylstParam.add(new DBObject(2, 1, 12, sId));
|
|
arylstParam.add(new DBObject(3, 1, 12, sUserId));
|
|
arylstParam.add(new DBObject(4, 1, 12, sUserSiteId));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 12));
|
|
arylstParam.add(new DBObject(7, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNMST.proc_UpdateHrLoanDtl(?,?,?,?,?,?,?)");
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "HRM_LOAN_MST";
|
|
}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
|
|
String returnString = null;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
DateUtility d = new DateUtility();
|
|
HrmLnMstHdrBean oHrmLnMstHdrBean = (HrmLnMstHdrBean)oBaseHeaderBean;
|
|
String taxReb = null;
|
|
String priTaxReb = null;
|
|
String settAuto = null;
|
|
if (ScreenMode.equalsIgnoreCase("N")) {
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, "N"));
|
|
arylstParam.add(new DBObject(2, 1, 12, oHrmLnMstHdrBean.getLoanCode()));
|
|
arylstParam.add(new DBObject(3, 1, 12, oHrmLnMstHdrBean.getLoanName()));
|
|
arylstParam.add(new DBObject(4, 1, 12, oHrmLnMstHdrBean.getChartNameId()));
|
|
arylstParam.add(new DBObject(5, 1, 12, oHrmLnMstHdrBean.getTypeOfInterest()));
|
|
arylstParam.add(new DBObject(6, 1, 12, oHrmLnMstHdrBean.getNatureOfPayment()));
|
|
arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
|
|
arylstParam.add(new DBObject(9, 1, 12, null));
|
|
arylstParam.add(new DBObject(10, 2, 12));
|
|
arylstParam.add(new DBObject(11, 2, 12));
|
|
arylstParam.add(new DBObject(12, 2, 12));
|
|
arylstParam.add(new DBObject(13, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNMST.procUpsertHrLoanMstHdr(?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
} else if (ScreenMode.equalsIgnoreCase("U")) {
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParam.add(new DBObject(2, 1, 12, oHrmLnMstHdrBean.getLoanCode()));
|
|
arylstParam.add(new DBObject(3, 1, 12, oHrmLnMstHdrBean.getLoanName()));
|
|
arylstParam.add(new DBObject(4, 1, 12, oHrmLnMstHdrBean.getChartNameId()));
|
|
arylstParam.add(new DBObject(5, 1, 12, oHrmLnMstHdrBean.getTypeOfInterest()));
|
|
arylstParam.add(new DBObject(6, 1, 12, oHrmLnMstHdrBean.getNatureOfPayment()));
|
|
arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
|
|
arylstParam.add(new DBObject(9, 1, 12, oHrmLnMstHdrBean.getHeaderPrimaryKey()));
|
|
arylstParam.add(new DBObject(10, 2, 12));
|
|
arylstParam.add(new DBObject(11, 2, 12));
|
|
arylstParam.add(new DBObject(12, 2, 12));
|
|
arylstParam.add(new DBObject(13, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNMST.procUpsertHrLoanMstHdr(?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
} else if (ScreenMode.equalsIgnoreCase("D")) {
|
|
arylstParam.add(new DBObject(1, 1, 12, oHrmLnMstHdrBean.getHeaderPrimaryKey()));
|
|
arylstParam.add(new DBObject(2, 2, 12));
|
|
arylstParam.add(new DBObject(3, 2, 12));
|
|
arylstParam.add(new DBObject(4, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMLNMST.procDeleteHrmLoanMstHdr(?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
returnString = null;
|
|
}
|
|
return returnString;
|
|
}
|
|
|
|
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
|
|
if (sScreenName.equalsIgnoreCase("HrmLnMst"))
|
|
saveHrmLoanMstDetail(sHeaderPrimaryKey, oDetailBeanArray);
|
|
}
|
|
|
|
private void saveHrmLoanMstDetail(String sHeaderPrimaryKey, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
|
|
boolean bInsert = false;
|
|
boolean bUpdate = false;
|
|
boolean bDelete = false;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = null;
|
|
DBUtilitiesBean oBean1 = null;
|
|
String applToEmp = null;
|
|
Iterator oIt = oDetailBeanArray.iterator();
|
|
while (oIt.hasNext()) {
|
|
HrmLnMstDtlBean oHrmLnMstDtlBean = oIt.next();
|
|
if (oHrmLnMstDtlBean.getStatus().equals("N")) {
|
|
if (!bInsert) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMLNMST.procUpsertHrLoanMstDtl(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
bInsert = true;
|
|
}
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, "N"));
|
|
arylstParam.add(new DBObject(2, 1, 12, null));
|
|
arylstParam.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
arylstParam.add(new DBObject(4, 1, 12, "200"));
|
|
arylstParam.add(new DBObject(5, 1, 12, oHrmLnMstDtlBean.getAllEmployeeApplicable()));
|
|
arylstParam.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLnMstDtlBean.getTxtCompanyPolicyStDate())));
|
|
arylstParam.add(new DBObject(7, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLnMstDtlBean.getTxtCompanyPolicyToDate())));
|
|
arylstParam.add(new DBObject(8, 1, 12, oHrmLnMstDtlBean.getTxtGreaterLessNotApplicable()));
|
|
arylstParam.add(new DBObject(9, 1, 12, oHrmLnMstDtlBean.getTxtLoanDetailCode()));
|
|
arylstParam.add(new DBObject(10, 1, 12, oHrmLnMstDtlBean.getTxtMaximumLoanPerc()));
|
|
arylstParam.add(new DBObject(11, 1, 12, oHrmLnMstDtlBean.getTxtMaxLimit()));
|
|
arylstParam.add(new DBObject(12, 1, 12, oHrmLnMstDtlBean.getTxtNoOfMonthsSalary()));
|
|
arylstParam.add(new DBObject(13, 1, 12, oHrmLnMstDtlBean.getTxtMinYrsOfRemainingService()));
|
|
arylstParam.add(new DBObject(14, 1, 12, oHrmLnMstDtlBean.getTxtMinYrsOfServiceToBeCompleted()));
|
|
arylstParam.add(new DBObject(15, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParam.add(new DBObject(16, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(arylstParam);
|
|
continue;
|
|
}
|
|
if (oHrmLnMstDtlBean.getStatus().equals("U")) {
|
|
if (!bUpdate) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMLNMST.procUpsertHrLoanMstDtl(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
bUpdate = true;
|
|
}
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParam.add(new DBObject(2, 1, 12, oHrmLnMstDtlBean.getDetailId()));
|
|
arylstParam.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
arylstParam.add(new DBObject(4, 1, 12, "200"));
|
|
arylstParam.add(new DBObject(5, 1, 12, oHrmLnMstDtlBean.getAllEmployeeApplicable()));
|
|
arylstParam.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLnMstDtlBean.getTxtCompanyPolicyStDate())));
|
|
arylstParam.add(new DBObject(7, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLnMstDtlBean.getTxtCompanyPolicyToDate())));
|
|
arylstParam.add(new DBObject(8, 1, 12, oHrmLnMstDtlBean.getTxtGreaterLessNotApplicable()));
|
|
arylstParam.add(new DBObject(9, 1, 12, oHrmLnMstDtlBean.getTxtLoanDetailCode()));
|
|
arylstParam.add(new DBObject(10, 1, 12, oHrmLnMstDtlBean.getTxtMaximumLoanPerc()));
|
|
arylstParam.add(new DBObject(11, 1, 12, oHrmLnMstDtlBean.getTxtMaxLimit()));
|
|
arylstParam.add(new DBObject(12, 1, 12, oHrmLnMstDtlBean.getTxtNoOfMonthsSalary()));
|
|
arylstParam.add(new DBObject(13, 1, 12, oHrmLnMstDtlBean.getTxtMinYrsOfRemainingService()));
|
|
arylstParam.add(new DBObject(14, 1, 12, oHrmLnMstDtlBean.getTxtMinYrsOfServiceToBeCompleted()));
|
|
arylstParam.add(new DBObject(15, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParam.add(new DBObject(16, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(arylstParam);
|
|
continue;
|
|
}
|
|
if (oHrmLnMstDtlBean.getStatus().equals("D")) {
|
|
if (!bDelete) {
|
|
oBean1 = new DBUtilitiesBean();
|
|
oBean1.createBatch("HRMLNMST.procDeleteLoanMstDtl(?)");
|
|
bDelete = true;
|
|
}
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, oHrmLnMstDtlBean.getDetailId()));
|
|
oBean1.addToBatch(arylstParam);
|
|
}
|
|
}
|
|
if (bInsert)
|
|
oBean.executeBatch();
|
|
if (bUpdate)
|
|
oBean.executeBatch();
|
|
if (bDelete)
|
|
oBean1.executeBatch();
|
|
}
|
|
|
|
public String getChartId(String chartName) throws EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
String chartId = null;
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, chartName));
|
|
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 oOutArray = oBean.callProc(arylstParam, "HRMLNMST.proc_GetChartIdByName(?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
oRow = oIt.next();
|
|
chartId = oRow.get("ID").getString();
|
|
}
|
|
return chartId;
|
|
}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
return new String();
|
|
}
|
|
|
|
public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
HrmLnMstHdrBean oHrmLnMstHdrBean = (HrmLnMstHdrBean)oBaseHeaderBean;
|
|
if (bHeaderDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
checkMandatoryHeader((HrmLnMstHdrBean)oBaseHeaderBean);
|
|
if (bDetailDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
if (sScreenName.equalsIgnoreCase("HrmLnMst")) {
|
|
Iterator oIt1 = oDetailBeanArray.iterator();
|
|
int rowCount = 1;
|
|
while (oIt1.hasNext()) {
|
|
HrmLnMstDtlBean oHrmLnMstDtlBean = oIt1.next();
|
|
if (!oHrmLnMstDtlBean.getStatus().equalsIgnoreCase("D"))
|
|
checkMandatoryDtls(oHrmLnMstDtlBean, rowCount, oErrorList);
|
|
rowCount++;
|
|
}
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
private void checkMandatoryHeader(HrmLnMstHdrBean oHrmLnMstHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstHdrBean.getLoanCode())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.loanCode");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstHdrBean.getTypeOfInterest())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.typeOfInterest");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstHdrBean.getNatureOfPayment())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.natureOfPayment");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
} else if (oHrmLnMstHdrBean.getTypeOfInterest().equalsIgnoreCase("A")) {
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstHdrBean.getChartName())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.chartName");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
private void checkMandatoryDtls(HrmLnMstDtlBean oHrmLnMstDtlBean, int rowCount, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstDtlBean.getTxtLoanDetailCode())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.loanDetailCode");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(rowCount));
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstDtlBean.getTxtGreaterLessNotApplicable())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.greaterLessNotApplicable");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(rowCount));
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (oHrmLnMstDtlBean.getTxtGreaterLessNotApplicable().equalsIgnoreCase("G") || oHrmLnMstDtlBean.getTxtGreaterLessNotApplicable().equalsIgnoreCase("L") || oHrmLnMstDtlBean.getTxtGreaterLessNotApplicable().equalsIgnoreCase("F"))
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstDtlBean.getTxtMaxLimit())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.maxLimit");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(rowCount));
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstDtlBean.getTxtCompanyPolicyStDate())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.companyPolicyStDate");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(rowCount));
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (oHrmLnMstDtlBean.getTxtGreaterLessNotApplicable().equalsIgnoreCase("G") || oHrmLnMstDtlBean.getTxtGreaterLessNotApplicable().equalsIgnoreCase("L") || oHrmLnMstDtlBean.getTxtGreaterLessNotApplicable().equalsIgnoreCase("S")) {
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstDtlBean.getTxtMaximumLoanPerc())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.maximumLoanPerc");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(rowCount));
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstDtlBean.getTxtNoOfMonthsSalary())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.noOfMonthsSalary");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(rowCount));
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
private void checkDatesConstraint(HrmLnMstDtlBean oHrmLnMstDtlBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
if (EnrgiseUtil.checkString(oHrmLnMstDtlBean.getTxtCompanyPolicyToDate())) {
|
|
int dateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmLnMstDtlBean.getTxtCompanyPolicyToDate(), oHrmLnMstDtlBean.getTxtCompanyPolicyStDate());
|
|
if (dateFlag == -1 && dateFlag != -2)
|
|
oErrorList.add(new EnrgiseApplicationException("wenrgise.hrm.loanMst.dateError"));
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
public void additionalBusinessValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
HrmLnMstHdrBean oHrmLnMstHdrBean = (HrmLnMstHdrBean)oBaseHeaderBean;
|
|
if (sScreenMode.equalsIgnoreCase("D"))
|
|
ArrayList arrayList = new ArrayList();
|
|
if (bHeaderDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D")) {
|
|
checkUniqueHeader((HrmLnMstHdrBean)oBaseHeaderBean);
|
|
} else {
|
|
checkIfDetailExist((HrmLnMstHdrBean)oBaseHeaderBean);
|
|
}
|
|
if (bDetailDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
if (sScreenName.equalsIgnoreCase("HrmLnMst")) {
|
|
Iterator oIt1 = oDetailBeanArray.iterator();
|
|
while (oIt1.hasNext()) {
|
|
HrmLnMstDtlBean oHrmLnMstDtlBean = oIt1.next();
|
|
if (!oHrmLnMstDtlBean.getStatus().equalsIgnoreCase("D")) {
|
|
checkUniqueDtl(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oErrorList);
|
|
checkDatesConstraint(oHrmLnMstDtlBean, oErrorList);
|
|
checkAllEmployee(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oErrorList);
|
|
checkNumericLocationDtl(oDetailBeanArray, oErrorList);
|
|
continue;
|
|
}
|
|
checkDetailChildRecord(oHrmLnMstDtlBean);
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
}
|
|
|
|
private void checkNumericLocationDtl(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
int count = 1;
|
|
Iterator oIt1 = oDetailBeanArray.iterator();
|
|
while (oIt1.hasNext()) {
|
|
HrmLnMstDtlBean oHrmLnMstDtlBean = oIt1.next();
|
|
if (EnrgiseUtil.checkString(oHrmLnMstDtlBean.getTxtMaximumLoanPerc())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.maximumLoanPerc");
|
|
ArrayList oParam = new ArrayList();
|
|
oParam.add(oMessageKey);
|
|
oParam.add(new Integer(count));
|
|
if (!EnrgiseUtil.checkNumber(oHrmLnMstDtlBean.getTxtMaximumLoanPerc(), 2, 4, "P")) {
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.invalidNumber", oParam));
|
|
} else if (Double.parseDouble(oHrmLnMstDtlBean.getTxtMaximumLoanPerc()) <= false) {
|
|
oErrorList.add(new EnrgiseMessageKeyException("hrm.recadvattrwork.numberZero", oParam));
|
|
}
|
|
}
|
|
if (EnrgiseUtil.checkString(oHrmLnMstDtlBean.getTxtMaxLimit())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.maxLimit");
|
|
ArrayList oParam = new ArrayList();
|
|
oParam.add(oMessageKey);
|
|
oParam.add(new Integer(count));
|
|
if (!EnrgiseUtil.checkNumber(oHrmLnMstDtlBean.getTxtMaxLimit(), 8, 9, "P")) {
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.invalidNumber", oParam));
|
|
} else if (Double.parseDouble(oHrmLnMstDtlBean.getTxtMaxLimit()) <= false) {
|
|
oErrorList.add(new EnrgiseMessageKeyException("hrm.recadvattrwork.numberZero", oParam));
|
|
}
|
|
}
|
|
count++;
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
private void checkDetailChildRecord(HrmLnMstDtlBean oHrmLnMstDtlBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = String.valueOf(" select lon_dtl_ID as ID from hrm_emp_loan where lon_dtl_ID=").concat(String.valueOf(oHrmLnMstDtlBean.getDetailId()));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oList = oBean.executeQuery(sQuery);
|
|
if (oList.size() > 0) {
|
|
ArrayList oParam = new ArrayList();
|
|
throw new EnrgiseApplicationException("hrm.loan.detail.detailFound", oParam, "E");
|
|
}
|
|
}
|
|
|
|
private void checkAllEmployee(String sHeaderPrimaryKey, ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
Iterator oIt1 = oDetailBeanArray.iterator();
|
|
int rowCount = 1;
|
|
int allEmp = 1;
|
|
while (oIt1.hasNext()) {
|
|
HrmLnMstDtlBean oHrmLnMstDtlBean = oIt1.next();
|
|
if (oHrmLnMstDtlBean.getAllEmployeeApplicable().equalsIgnoreCase("Y"))
|
|
allEmp++;
|
|
if (allEmp > 1 && rowCount > 1) {
|
|
System.out.println(allEmp);
|
|
System.out.println(rowCount);
|
|
ArrayList oParam = new ArrayList();
|
|
throw new EnrgiseApplicationException("hrm.loan.detail.allemployeeerror", oParam, "E");
|
|
}
|
|
rowCount++;
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
private void checkUniqueHeader(HrmLnMstHdrBean oHrmLnMstHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = String.valueOf(String.valueOf(" Select ID as ID from hrm_loan_mst where code= '").concat(String.valueOf(oHrmLnMstHdrBean.getLoanCode()))).concat(String.valueOf("'"));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oList = oBean.executeQuery(sQuery);
|
|
Iterator oIt = oList.iterator();
|
|
if (oIt.hasNext()) {
|
|
QueryRow oRow = oIt.next();
|
|
if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmLnMstHdrBean.getHeaderPrimaryKey())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.loanCode");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
throw new EnrgiseMessageKeyException("wenrgise.common.header.uniqueConstraintViolated", oParams, "E");
|
|
}
|
|
}
|
|
}
|
|
|
|
private void checkIfDetailExist(HrmLnMstHdrBean oHrmLnMstHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = String.valueOf(" Select loan_mst_id as ID from hrm_loan_dtl where loan_mst_id= ").concat(String.valueOf(oHrmLnMstHdrBean.getHeaderPrimaryKey()));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oList = oBean.executeQuery(sQuery);
|
|
if (oList.size() > 0) {
|
|
ArrayList oParam = new ArrayList();
|
|
throw new EnrgiseApplicationException("hrm.loan.hdr.detailFound", oParam, "E");
|
|
}
|
|
}
|
|
|
|
private void checkUniqueDtl(String sHeaderPrimaryKey, ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
Iterator oIt1 = oDetailBeanArray.iterator();
|
|
int rowCount = 1;
|
|
while (oIt1.hasNext()) {
|
|
HrmLnMstDtlBean oHrmLnMstDtlBean = oIt1.next();
|
|
if (!EnrgiseUtil.checkString(oHrmLnMstDtlBean.getDetailId())) {
|
|
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select id as ID from hrm_loan_dtl where name= '").concat(String.valueOf(oHrmLnMstDtlBean.getTxtLoanDetailCode()))).concat(String.valueOf("' and loan_mst_id="))).concat(String.valueOf(sHeaderPrimaryKey))).concat(String.valueOf(" and EFFECT_DATE=to_date('"))).concat(String.valueOf(oHrmLnMstDtlBean.getTxtCompanyPolicyStDate()))).concat(String.valueOf("','DD-MON-YYYY')"));
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oList = oBean.executeQuery(sQuery);
|
|
System.out.println(sQuery);
|
|
Iterator oIt = oList.iterator();
|
|
if (oIt.hasNext()) {
|
|
ArrayList oParams = new ArrayList();
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLoanMst.loanDetailCode");
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(rowCount));
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.uniqueKeyViolated", oParams));
|
|
}
|
|
}
|
|
rowCount++;
|
|
}
|
|
}
|
|
}
|