698 lines
34 KiB
Java
698 lines
34 KiB
Java
package wenrgise.hrms.ejb.business;
|
|
|
|
import java.sql.Timestamp;
|
|
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.ejb.business.HrmCommonBO;
|
|
import wenrgise.common.exception.EnrgiseApplicationException;
|
|
import wenrgise.common.exception.EnrgiseMessageKeyException;
|
|
import wenrgise.common.exception.EnrgiseSystemException;
|
|
import wenrgise.common.utility.EnrgiseUtil;
|
|
import wenrgise.common.utility.MessageKey;
|
|
import wenrgise.common.utility.RecordMetaInfo;
|
|
import wenrgise.common.utility.UserInfo;
|
|
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.HrmEmpClaimDtlBean;
|
|
import wenrgise.hrms.bean.HrmEmpClaimHdrBean;
|
|
import wenrgise.hrms.vo.HrmEmpClaimQVO;
|
|
|
|
public class HrmEmpClaimBO extends HrmBaseBO {
|
|
public HrmEmpClaimBO() {}
|
|
|
|
public HrmEmpClaimBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo getHrmEmpClaimDetailMetaInfo(HrmEmpClaimQVO oHrmEmpClaimQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
if (EnrgiseUtil.checkString(oHrmEmpClaimQVO.getHeaderPrimaryKey())) {
|
|
String[] sPrimaryKey = oHrmEmpClaimQVO.getHeaderPrimaryKey().split(",");
|
|
System.out.println(sPrimaryKey[0]);
|
|
System.out.println(sPrimaryKey[1]);
|
|
oHrmEmpClaimQVO.setClaimCodeId(sPrimaryKey[0]);
|
|
oHrmEmpClaimQVO.setStartDate(sPrimaryKey[1]);
|
|
oHrmEmpClaimQVO.setEndDate(sPrimaryKey[2]);
|
|
}
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, oHrmEmpClaimQVO.getEmpId()));
|
|
arylstParam.add(new DBObject(2, 1, 12, oHrmEmpClaimQVO.getClaimCodeId()));
|
|
arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpClaimQVO.getStartDate())));
|
|
arylstParam.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpClaimQVO.getEndDate())));
|
|
arylstParam.add(new DBObject(5, 1, 12, oHrmEmpClaimQVO.getClaimNo()));
|
|
arylstParam.add(new DBObject(6, 1, 12, oHrmEmpClaimQVO.getPeriod()));
|
|
arylstParam.add(new DBObject(7, 1, 12, oHrmEmpClaimQVO.getEmpDtlId()));
|
|
arylstParam.add(new DBObject(8, 2, -5));
|
|
arylstParam.add(new DBObject(9, 2, 93));
|
|
arylstParam.add(new DBObject(10, 2, 12));
|
|
arylstParam.add(new DBObject(11, 2, 12));
|
|
arylstParam.add(new DBObject(12, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMEMPCLAIM.procHrmEmpClaimDtlCount(?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject oTotalRecord = arylstOutArray.get(0);
|
|
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
|
|
DBObject oTimeObject = arylstOutArray.get(1);
|
|
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
|
|
return oRecordMetaInfo;
|
|
}
|
|
|
|
public ArrayList getHrmEmpClaimDetail(HrmEmpClaimQVO oHrmEmpClaimQVO, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
if (EnrgiseUtil.checkString(oHrmEmpClaimQVO.getHeaderPrimaryKey())) {
|
|
String[] sPrimaryKey = oHrmEmpClaimQVO.getHeaderPrimaryKey().split(",");
|
|
System.out.println(sPrimaryKey[0]);
|
|
System.out.println(sPrimaryKey[1]);
|
|
oHrmEmpClaimQVO.setClaimCodeId(sPrimaryKey[0]);
|
|
oHrmEmpClaimQVO.setStartDate(sPrimaryKey[1]);
|
|
oHrmEmpClaimQVO.setEndDate(sPrimaryKey[2]);
|
|
}
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
ArrayList arylstList = null;
|
|
Iterator itrBean = null;
|
|
ArrayList arylstHrmEmpClaim = null;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, oHrmEmpClaimQVO.getEmpId()));
|
|
arylstParam.add(new DBObject(2, 1, -5, new Long(lDetailFirstPosition)));
|
|
arylstParam.add(new DBObject(3, 1, -5, new Long(lDetailLastPosition)));
|
|
arylstParam.add(new DBObject(4, 1, 12, oHrmEmpClaimQVO.getClaimCodeId()));
|
|
arylstParam.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpClaimQVO.getStartDate())));
|
|
arylstParam.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpClaimQVO.getEndDate())));
|
|
arylstParam.add(new DBObject(7, 1, 12, oHrmEmpClaimQVO.getClaimNo()));
|
|
arylstParam.add(new DBObject(8, 1, 12, oHrmEmpClaimQVO.getPeriod()));
|
|
arylstParam.add(new DBObject(9, 1, 12, oHrmEmpClaimQVO.getEmpDtlId()));
|
|
arylstParam.add(new DBObject(10, 2, -10));
|
|
arylstParam.add(new DBObject(11, 2, 12));
|
|
arylstParam.add(new DBObject(12, 2, 12));
|
|
arylstParam.add(new DBObject(13, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMEMPCLAIM.prochrmempclaimdetail(?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
arylstList = (ArrayList)((DBObject)arylstOutArray.get(0)).getObject();
|
|
if (arylstList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
count = 0;
|
|
itrBean = arylstList.iterator();
|
|
while (itrBean.hasNext()) {
|
|
if (count == 0)
|
|
arylstHrmEmpClaim = new ArrayList();
|
|
count++;
|
|
oRow = itrBean.next();
|
|
HrmEmpClaimDtlBean oHrmEmpClaimDtlBean = new HrmEmpClaimDtlBean();
|
|
oHrmEmpClaimDtlBean.setDetailId(oRow.get("ID").getString());
|
|
oHrmEmpClaimDtlBean.setTxtApplnDate(EnrgiseUtil.convertToString(oRow.get("APPLICATION_DATE").getDate()));
|
|
oHrmEmpClaimDtlBean.setTxtApprovalDate(EnrgiseUtil.convertToString(oRow.get("SANCTION_DATE").getDate()));
|
|
oHrmEmpClaimDtlBean.setTxtAppliedAmount(oRow.get("APPLIED_AMOUNT").getString());
|
|
oHrmEmpClaimDtlBean.setTxtApprovedAmount(oRow.get("SANCTIONED_AMOUNT").getString());
|
|
oHrmEmpClaimDtlBean.setTxtApproverId(oRow.get("APPROVED_BY").getString());
|
|
oHrmEmpClaimDtlBean.setTxtApprovedBy(oRow.get("APPROVER_NAME").getString());
|
|
oHrmEmpClaimDtlBean.setTxtEligibleAmount(oRow.get("ELIG_AMT").getString());
|
|
oHrmEmpClaimDtlBean.setTxtEmpId(oRow.get("E_PER_DTL_ID").getString());
|
|
oHrmEmpClaimDtlBean.setTxtEmployeeName(oRow.get("EMPNAME").getString());
|
|
oHrmEmpClaimDtlBean.setTxtEmployeeNo(oRow.get("EMP_NO").getString());
|
|
oHrmEmpClaimDtlBean.setTxtPayrollFlag(oRow.get("PAYROLL_FLAG").getString());
|
|
oHrmEmpClaimDtlBean.setTxtReimbursementTillDate(oRow.get("REIMBURSED_TILL_DATE").getString());
|
|
oHrmEmpClaimDtlBean.setTxtClaimDtlId(oRow.get("CLAIM_DTL_ID").getString());
|
|
oHrmEmpClaimDtlBean.setTxtClaimCode(oRow.get("DESCRIPTION").getString());
|
|
oHrmEmpClaimDtlBean.setTxtClaimNo(oRow.get("CLAIM_NO").getString());
|
|
oHrmEmpClaimDtlBean.setTxtNewRemarks(oRow.get("APPROVER_REMARKS").getString());
|
|
arylstHrmEmpClaim.add(oHrmEmpClaimDtlBean);
|
|
}
|
|
return arylstHrmEmpClaim;
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "HRM_CLAIM_DTL";
|
|
}
|
|
|
|
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {}
|
|
|
|
public void saveDetailImpl(BaseHeaderBean oBaseHeaderBean, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
if (sScreenName.equalsIgnoreCase("HrmEmpClaim"))
|
|
saveHrmEmpClaimDetail(oBaseHeaderBean, oDetailBeanArray);
|
|
}
|
|
|
|
public String saveHrmEmpClaimDetail(BaseHeaderBean oBaseHeaderBean, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
|
|
boolean bInsert = false;
|
|
boolean bUpdate = false;
|
|
boolean bDelete = false;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean1 = null;
|
|
DBUtilitiesBean oBean2 = null;
|
|
DBUtilitiesBean oBean3 = null;
|
|
HrmEmpClaimHdrBean oHrmEmpClaimHdrBean = (HrmEmpClaimHdrBean)oBaseHeaderBean;
|
|
Iterator itrBean = arylstDetailBeanArray.iterator();
|
|
while (itrBean.hasNext()) {
|
|
HrmEmpClaimDtlBean oHrmEmpClaimDtlBean = itrBean.next();
|
|
String sEligibleAmount = calculateEligibleAmount(oHrmEmpClaimDtlBean);
|
|
String sReimbursedAmount = calculateReimbursedAmount(oHrmEmpClaimHdrBean.getPeriod(), oHrmEmpClaimDtlBean);
|
|
if (oHrmEmpClaimDtlBean.getStatus().equals("N")) {
|
|
if (!bInsert) {
|
|
oBean1 = new DBUtilitiesBean();
|
|
oBean1.createBatch("HrmEmpClaim.procupserthrmempclaimdtl(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
bInsert = true;
|
|
}
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "N"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmEmpClaimDtlBean.getTxtClaimDtlId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, null));
|
|
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpClaimDtlBean.getTxtApplnDate())));
|
|
arylstParameters.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpClaimDtlBean.getTxtApprovalDate())));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmEmpClaimDtlBean.getTxtAppliedAmount()));
|
|
arylstParameters.add(new DBObject(7, 1, 12, oHrmEmpClaimDtlBean.getTxtApprovedAmount()));
|
|
arylstParameters.add(new DBObject(8, 1, 12, sEligibleAmount));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmEmpClaimDtlBean.getTxtApproverId()));
|
|
arylstParameters.add(new DBObject(10, 1, 12, oHrmEmpClaimDtlBean.getTxtEmpId()));
|
|
arylstParameters.add(new DBObject(11, 1, 12, oHrmEmpClaimDtlBean.getTxtPayrollFlag()));
|
|
arylstParameters.add(new DBObject(12, 1, 12, sReimbursedAmount));
|
|
arylstParameters.add(new DBObject(13, 1, 12, oHrmEmpClaimDtlBean.getTxtNewRemarks()));
|
|
arylstParameters.add(new DBObject(14, 1, 12, oHrmEmpClaimHdrBean.getPeriod()));
|
|
arylstParameters.add(new DBObject(15, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(16, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean1.addToBatch(arylstParameters);
|
|
continue;
|
|
}
|
|
if (oHrmEmpClaimDtlBean.getStatus().equals("U")) {
|
|
if (!bUpdate) {
|
|
oBean2 = new DBUtilitiesBean();
|
|
oBean2.createBatch("HrmEmpClaim.procupserthrmempclaimdtl(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
bUpdate = true;
|
|
}
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmEmpClaimDtlBean.getTxtClaimDtlId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, oHrmEmpClaimDtlBean.getDetailId()));
|
|
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpClaimDtlBean.getTxtApplnDate())));
|
|
arylstParameters.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpClaimDtlBean.getTxtApprovalDate())));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmEmpClaimDtlBean.getTxtAppliedAmount()));
|
|
arylstParameters.add(new DBObject(7, 1, 12, oHrmEmpClaimDtlBean.getTxtApprovedAmount()));
|
|
arylstParameters.add(new DBObject(8, 1, 12, sEligibleAmount));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmEmpClaimDtlBean.getTxtApproverId()));
|
|
arylstParameters.add(new DBObject(10, 1, 12, oHrmEmpClaimDtlBean.getTxtEmpId()));
|
|
arylstParameters.add(new DBObject(11, 1, 12, oHrmEmpClaimDtlBean.getTxtPayrollFlag()));
|
|
arylstParameters.add(new DBObject(12, 1, 12, sReimbursedAmount));
|
|
arylstParameters.add(new DBObject(13, 1, 12, oHrmEmpClaimDtlBean.getTxtNewRemarks()));
|
|
arylstParameters.add(new DBObject(14, 1, 12, oHrmEmpClaimHdrBean.getPeriod()));
|
|
arylstParameters.add(new DBObject(15, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(16, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean2.addToBatch(arylstParameters);
|
|
continue;
|
|
}
|
|
if (oHrmEmpClaimDtlBean.getStatus().equals("D")) {
|
|
if (!bDelete) {
|
|
oBean3 = new DBUtilitiesBean();
|
|
oBean3.createBatch("HrmEmpClaim.procdeletehrmempclaimdtl(?)");
|
|
bDelete = true;
|
|
}
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, oHrmEmpClaimDtlBean.getDetailId()));
|
|
oBean3.addToBatch(arylstParameters);
|
|
}
|
|
}
|
|
if (bInsert)
|
|
oBean1.executeBatch();
|
|
if (bUpdate)
|
|
oBean2.executeBatch();
|
|
if (bDelete)
|
|
oBean3.executeBatch();
|
|
return String.valueOf(String.valueOf(String.valueOf(String.valueOf(oHrmEmpClaimHdrBean.getClaimCodeId()).concat(String.valueOf(","))).concat(String.valueOf(oHrmEmpClaimHdrBean.getStartDate()))).concat(String.valueOf(","))).concat(String.valueOf(oHrmEmpClaimHdrBean.getEndDate()));
|
|
}
|
|
|
|
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();
|
|
if (bDetailDataChanged)
|
|
if (sScreenName.equalsIgnoreCase("HrmEmpClaim")) {
|
|
Iterator oIt1 = oDetailBeanArray.iterator();
|
|
int rowCount = 1;
|
|
while (oIt1.hasNext()) {
|
|
HrmEmpClaimDtlBean oHrmEmpClaimDtlBean = oIt1.next();
|
|
if (!oHrmEmpClaimDtlBean.getStatus().equalsIgnoreCase("D"))
|
|
checkMandatoryDtls(oHrmEmpClaimDtlBean, rowCount, oErrorList);
|
|
rowCount++;
|
|
}
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
private void checkMandatoryDtls(HrmEmpClaimDtlBean oHrmEmpClaimDtlBean, int rowCount, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
if (!EnrgiseUtil.checkString(oHrmEmpClaimDtlBean.getTxtAppliedAmount())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpClaim.txtAppliedAmount");
|
|
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(oHrmEmpClaimDtlBean.getTxtApplnDate())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpClaim.txtApplnDate");
|
|
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(oHrmEmpClaimDtlBean.getTxtApprovedAmount())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpClaim.txtApprovedAmount");
|
|
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(oHrmEmpClaimDtlBean.getTxtApprovalDate())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpClaim.txtApprovalDate");
|
|
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(oHrmEmpClaimDtlBean.getTxtApproverId())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpClaim.txtApprovedBy");
|
|
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(oHrmEmpClaimDtlBean.getTxtPayrollFlag())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpClaim.txtPayrollFlag");
|
|
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(oHrmEmpClaimDtlBean.getTxtEmployeeNo())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpClaim.txtEmployeeNo");
|
|
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(oHrmEmpClaimDtlBean.getTxtClaimDtlId())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpClaim.claimCode");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(rowCount));
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String param1) throws EnrgiseSystemException {
|
|
return new String();
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
return new String();
|
|
}
|
|
|
|
public void additionalBusinessValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oList = new ArrayList();
|
|
HrmEmpClaimHdrBean oHrmEmpClaimHdrBean = (HrmEmpClaimHdrBean)oBaseHeaderBean;
|
|
if (bDetailDataChanged) {
|
|
if (!isCheckDate(oHrmEmpClaimHdrBean.getPeriod())) {
|
|
ArrayList arylstParams = new ArrayList();
|
|
oList.add(new EnrgiseMessageKeyException("hrm.HrmEmpClaim.notAllowed", arylstParams, "E"));
|
|
}
|
|
if (sScreenName.equalsIgnoreCase("HrmEmpClaim")) {
|
|
Iterator oIt1 = oDetailBeanArray.iterator();
|
|
int n = oDetailBeanArray.size();
|
|
int rowCount = 1;
|
|
while (oIt1.hasNext()) {
|
|
HrmEmpClaimDtlBean oHrmEmpClaimDtlBean = oIt1.next();
|
|
if (oHrmEmpClaimDtlBean.getStatus().equalsIgnoreCase("N")) {
|
|
String sElig = calculateEligibleAmount(oHrmEmpClaimDtlBean);
|
|
String sReim = calculateReimbursedAmount(oHrmEmpClaimHdrBean.getPeriod(), oHrmEmpClaimDtlBean);
|
|
String sApp = oHrmEmpClaimDtlBean.getTxtAppliedAmount();
|
|
String sSanc = oHrmEmpClaimDtlBean.getTxtApprovedAmount();
|
|
double reimbTillDate = Double.parseDouble(sReim) - Double.parseDouble(sSanc);
|
|
if (Double.parseDouble(sElig) < Double.parseDouble(sReim)) {
|
|
MessageKey oMessageKey = new MessageKey();
|
|
ArrayList oParams = new ArrayList();
|
|
ArrayList oParams1 = new ArrayList();
|
|
oParams.add(String.valueOf(rowCount));
|
|
oParams1.add(String.valueOf(sElig));
|
|
oParams1.add(String.valueOf(reimbTillDate));
|
|
oList.add(new EnrgiseMessageKeyException("hrm.HrmEmpClaim.validate", oParams, "E"));
|
|
oList.add(new EnrgiseMessageKeyException("hrm.HrmEmpClaim.validate2", oParams1, "E"));
|
|
}
|
|
if (Double.parseDouble(sSanc) > Double.parseDouble(sApp)) {
|
|
MessageKey oMessageKey = new MessageKey();
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(String.valueOf(rowCount));
|
|
oList.add(new EnrgiseMessageKeyException("hrm.HrmEmpClaim.validate1", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmEmpClaimDtlBean.getTxtApprovalDate()))
|
|
if (rowCount < n - 1) {
|
|
HrmEmpClaimDtlBean oHrmEmpClaimDtlBean1 = oDetailBeanArray.get(rowCount + 1);
|
|
if (EnrgiseUtil.checkString(oHrmEmpClaimDtlBean1.getTxtApplnDate()))
|
|
oList.add(new EnrgiseApplicationException("hrm.HrmEmpClaim.date.value"));
|
|
}
|
|
}
|
|
rowCount++;
|
|
}
|
|
reportError(oList);
|
|
}
|
|
}
|
|
}
|
|
|
|
private boolean isCheckDate(String period) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
HrmCommonBO oBo = new HrmCommonBO();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, period));
|
|
arylstParam.add(new DBObject(2, 2, 4));
|
|
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, "HRMEMPCLAIM.procCheckDate(?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
int iVal = ((Integer)oOutObject.getObject()).intValue();
|
|
boolean sReturnValue = !(iVal == 0);
|
|
return sReturnValue;
|
|
}
|
|
|
|
public LovVO getHrmEmpClaimDtlCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmEmpClaim.claimCode");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
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();
|
|
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 arylstOutArray = oBean.callProc(arylstParam, "HRMEMPCLAIM.procGetClaimCodeLOVdata(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
arylstParam = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstParam.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
arylstParam = new ArrayList();
|
|
count++;
|
|
oRow = (QueryRow)iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CLAIM_CODE").getString());
|
|
arylstParam.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstParam);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmEmpClaimEmpLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmEmpClaim.txtEmployeeNo");
|
|
arylstHeaderList.add("hrm.HrmEmpClaim.txtEmployeeName");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
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();
|
|
String sEmpId = new String();
|
|
if (oLovQueryVO.getProperty("SelUser") != null)
|
|
sEmpId = oLovQueryVO.getProperty("SelUser");
|
|
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, 1, 12, sEmpId));
|
|
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, "HRMEMPCLAIM.procGetEmpLOVdata(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
arylstParam = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstParam.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
arylstParam = new ArrayList();
|
|
count++;
|
|
oRow = (QueryRow)iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("EMP_NO").getString());
|
|
oLOVBean.setDetailField3(oRow.get("EMPNAME").getString());
|
|
arylstParam.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstParam);
|
|
return oLovVO;
|
|
}
|
|
|
|
private ArrayList checkLOVConstraint(ArrayList arylstList, LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LOVBean oLOVBean = null;
|
|
ArrayList arylstNewList = new ArrayList();
|
|
Iterator itrBean = arylstList.iterator();
|
|
while (itrBean.hasNext()) {
|
|
oLOVBean = itrBean.next();
|
|
String sId = oLOVBean.getDetailField1();
|
|
String sAllFlag = getAllFlagInfo(sId);
|
|
System.out.println(sAllFlag);
|
|
if (sAllFlag.equalsIgnoreCase("Y")) {
|
|
arylstNewList.add(oLOVBean);
|
|
continue;
|
|
}
|
|
String sClaimId = oLOVBean.getDetailField1();
|
|
String sQuery = String.valueOf(" Select ELIG_SQL as ELIG_SQL from HRM_CLAIM_DTL where ID= ").concat(String.valueOf(sClaimId));
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstList1 = oBean.executeQuery(sQuery);
|
|
Iterator itrBean1 = arylstList1.iterator();
|
|
if (itrBean1.hasNext()) {
|
|
QueryRow oRow = itrBean1.next();
|
|
String sSql = oRow.get("ELIG_SQL").getString();
|
|
if (EnrgiseUtil.checkString(sSql)) {
|
|
String sEmpId = oLovQueryVO.getProperty("txtEmpId");
|
|
StringBuffer s = new StringBuffer(sSql);
|
|
s.replace(s.lastIndexOf("?"), s.lastIndexOf("?") + 1, sEmpId);
|
|
System.out.println(s);
|
|
ArrayList arylstList2 = oBean.executeQuery(s.toString());
|
|
if (arylstList2.size() != 0)
|
|
arylstNewList.add(oLOVBean);
|
|
}
|
|
}
|
|
}
|
|
return arylstNewList;
|
|
}
|
|
|
|
public String getAllFlagInfo(String sAttrId) throws EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
String sAllFlag = null;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sAttrId));
|
|
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, "HRMEMPCLAIM.proc_GetAllFlag(?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = oList.iterator();
|
|
while (itrBean.hasNext()) {
|
|
oRow = itrBean.next();
|
|
sAllFlag = oRow.get("ALL_FLAG").getString();
|
|
}
|
|
return sAllFlag;
|
|
}
|
|
|
|
public LovVO getHrmEmpClaimCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmEmpClaim.claimCode");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
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();
|
|
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 arylstOutArray = oBean.callProc(arylstParam, "HRMEMPCLAIM.procGetClaimCodeLOVdata(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
arylstParam = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstParam.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
arylstParam = new ArrayList();
|
|
count++;
|
|
oRow = (QueryRow)iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CLAIM_CODE").getString());
|
|
arylstParam.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstParam);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmEmpClaimNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("hrm.HrmEmpClaim.txtClaimNo");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
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 arylstOutArray = oBean.callProc(arylstParam, "HRMEMPCLAIM.procGetClaimNoLOVdata(?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
arylstParam = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstParam.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
arylstParam = new ArrayList();
|
|
count++;
|
|
oRow = (QueryRow)iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("CLAIM_NO").getString());
|
|
arylstParam.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstParam);
|
|
return oLovVO;
|
|
}
|
|
|
|
private String calculateEligibleAmount(HrmEmpClaimDtlBean oHrmEmpClaimDtlBean) throws EnrgiseSystemException {
|
|
ArrayList oList = new ArrayList();
|
|
ArrayList oList1 = new ArrayList();
|
|
ArrayList oParameters1 = new ArrayList();
|
|
ArrayList oOutArray1 = new ArrayList();
|
|
DBUtilitiesBean oBean1 = new DBUtilitiesBean();
|
|
QueryRow oRow1 = null;
|
|
String sEligAmount = new String();
|
|
String sEligFactor = new String();
|
|
String sFlatAmt = new String();
|
|
String sMaxAmt = new String();
|
|
String sClaimCodeId = oHrmEmpClaimDtlBean.getTxtClaimDtlId();
|
|
int count2 = 0;
|
|
oParameters1 = new ArrayList();
|
|
oParameters1.add(new DBObject(1, 1, 12, oHrmEmpClaimDtlBean.getTxtEmpId()));
|
|
oParameters1.add(new DBObject(2, 1, 12, sClaimCodeId));
|
|
oParameters1.add(new DBObject(3, 2, -10));
|
|
oParameters1.add(new DBObject(4, 2, 12));
|
|
oParameters1.add(new DBObject(5, 2, 12));
|
|
oParameters1.add(new DBObject(6, 2, 4));
|
|
oOutArray1 = oBean1.callProc(oParameters1, "HRMEMPCLAIM.procCalculateEligAmt(?,?,?,?,?,?)");
|
|
oList1 = (ArrayList)((DBObject)oOutArray1.get(0)).getObject();
|
|
if (oList1.size() == 0)
|
|
return "0";
|
|
count2 = 0;
|
|
Iterator oIt1 = oList1.iterator();
|
|
while (oIt1.hasNext()) {
|
|
count2++;
|
|
oRow1 = oIt1.next();
|
|
sEligFactor = oRow1.get("GREATER_LESSER_FLAG").getString();
|
|
sFlatAmt = oRow1.get("FLAT_AMOUNT").getString();
|
|
sMaxAmt = oRow1.get("MAX_AMT").getString();
|
|
}
|
|
if (String.valueOf(oRow1.get("GREATER_LESSER_FLAG").getString()).equalsIgnoreCase("F"))
|
|
sEligAmount = sFlatAmt;
|
|
if (String.valueOf(oRow1.get("GREATER_LESSER_FLAG").getString()).equalsIgnoreCase("G"))
|
|
if (Integer.parseInt(sFlatAmt) > Integer.parseInt(sMaxAmt)) {
|
|
sEligAmount = sFlatAmt;
|
|
} else {
|
|
sEligAmount = sMaxAmt;
|
|
}
|
|
if (String.valueOf(oRow1.get("GREATER_LESSER_FLAG").getString()).equalsIgnoreCase("L"))
|
|
if (Integer.parseInt(sFlatAmt) < Integer.parseInt(sMaxAmt)) {
|
|
sEligAmount = sFlatAmt;
|
|
} else {
|
|
sEligAmount = sMaxAmt;
|
|
}
|
|
return sEligAmount;
|
|
}
|
|
|
|
private String calculateReimbursedAmount(String period, HrmEmpClaimDtlBean oHrmEmpClaimDtlBean) throws EnrgiseSystemException {
|
|
ArrayList oList = new ArrayList();
|
|
ArrayList oList1 = new ArrayList();
|
|
ArrayList oParameters1 = new ArrayList();
|
|
ArrayList oOutArray1 = new ArrayList();
|
|
DBUtilitiesBean oBean1 = new DBUtilitiesBean();
|
|
QueryRow oRow1 = null;
|
|
String sReimAmount = new String();
|
|
String sClaimCodeId = oHrmEmpClaimDtlBean.getTxtClaimDtlId();
|
|
oParameters1 = new ArrayList();
|
|
oParameters1.add(new DBObject(1, 1, 12, oHrmEmpClaimDtlBean.getTxtEmpId()));
|
|
oParameters1.add(new DBObject(2, 1, 12, sClaimCodeId));
|
|
oParameters1.add(new DBObject(3, 1, 12, oHrmEmpClaimDtlBean.getTxtApprovedAmount()));
|
|
oParameters1.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpClaimDtlBean.getTxtApplnDate())));
|
|
oParameters1.add(new DBObject(5, 1, 12, oHrmEmpClaimDtlBean.getDetailId()));
|
|
oParameters1.add(new DBObject(6, 1, 12, period));
|
|
oParameters1.add(new DBObject(7, 2, 12));
|
|
oParameters1.add(new DBObject(8, 2, 12));
|
|
oParameters1.add(new DBObject(9, 2, 12));
|
|
oParameters1.add(new DBObject(10, 2, 4));
|
|
oOutArray1 = oBean1.callProc(oParameters1, "HRMEMPCLAIM.procCalculateReimbursedAmt(?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oObj = oOutArray1.get(0);
|
|
sReimAmount = oObj.getObject().toString();
|
|
return sReimAmount;
|
|
}
|
|
}
|