631 lines
31 KiB
Java
631 lines
31 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.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.HrmAttEmpAttQueryDtlBean;
|
|
import wenrgise.hrms.bean.HrmAttEmpAttQueryHdrBean;
|
|
import wenrgise.hrms.vo.HrmAttEmpAttQueryQVO;
|
|
|
|
public class HrmAttEmpAttQueryBO extends HrmBaseBO {
|
|
public HrmAttEmpAttQueryBO() {}
|
|
|
|
public HrmAttEmpAttQueryBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo getEmpAttQueryHdrMetaInfo(HrmAttEmpAttQueryQVO oHrmAttEmpAttQueryQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sEmpId = oHrmAttEmpAttQueryQVO.getEmpId();
|
|
String sLocId = null;
|
|
String sStartDate = oHrmAttEmpAttQueryQVO.getPeriodStartDt();
|
|
String sEndDate = null;
|
|
if (EnrgiseUtil.checkString(oHrmAttEmpAttQueryQVO.getHeaderPrimaryKey())) {
|
|
String[] sPrimaryKey = oHrmAttEmpAttQueryQVO.getHeaderPrimaryKey().split(",");
|
|
sLocId = sPrimaryKey[0];
|
|
sStartDate = sPrimaryKey[1];
|
|
}
|
|
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, sEmpId));
|
|
arylstParam.add(new DBObject(2, 1, 12, sLocId));
|
|
arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sStartDate)));
|
|
arylstParam.add(new DBObject(4, 2, -5));
|
|
arylstParam.add(new DBObject(5, 2, 93));
|
|
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, "HRMATTEMPATTQRY.procgetEmpAttHdrcount(?,?,?,?,?,?,?,?)");
|
|
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject oErrorCode = oOutArray.get(2);
|
|
String sErr = oErrorCode.getObject().toString();
|
|
if (sErr.equalsIgnoreCase("Y"))
|
|
throw new EnrgiseMessageKeyException("hrm.HrmAttEmpAttQuery.DeptError", null, "E");
|
|
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 getEmpAttQueryHeader(HrmAttEmpAttQueryQVO oHrmAttEmpAttQueryQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sEmpId = oHrmAttEmpAttQueryQVO.getEmpId();
|
|
String sLocId = null;
|
|
String sStartDate = oHrmAttEmpAttQueryQVO.getPeriodStartDt();
|
|
String sEndDate = null;
|
|
if (EnrgiseUtil.checkString(oHrmAttEmpAttQueryQVO.getHeaderPrimaryKey())) {
|
|
String[] sPrimaryKey = oHrmAttEmpAttQueryQVO.getHeaderPrimaryKey().split(",");
|
|
sLocId = sPrimaryKey[0];
|
|
sStartDate = sPrimaryKey[1];
|
|
}
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
ArrayList oHeaderList = null;
|
|
if (oHrmAttEmpAttQueryQVO == null)
|
|
oHrmAttEmpAttQueryQVO = new HrmAttEmpAttQueryQVO();
|
|
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, sEmpId));
|
|
arylstParam.add(new DBObject(4, 1, 12, sLocId));
|
|
arylstParam.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(sStartDate)));
|
|
arylstParam.add(new DBObject(6, 2, -10));
|
|
arylstParam.add(new DBObject(7, 2, 12));
|
|
arylstParam.add(new DBObject(8, 2, 12));
|
|
arylstParam.add(new DBObject(9, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMATTEMPATTQRY.procgetEmpAttHdr(?,?,?,?,?,?,?,?,?)");
|
|
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();
|
|
HrmAttEmpAttQueryHdrBean oHrmAttEmpAttQueryHdrBean = new HrmAttEmpAttQueryHdrBean();
|
|
String sHdrPrimaryKey = String.valueOf(String.valueOf(String.valueOf(String.valueOf(oRow.get("LOC_ID").getString()).concat(String.valueOf(","))).concat(String.valueOf(EnrgiseUtil.convertToString(oRow.get("START_DATE").getDate())))).concat(String.valueOf(","))).concat(String.valueOf(oRow.get("EMP_ID").getString()));
|
|
oHrmAttEmpAttQueryHdrBean.setHeaderPrimaryKey(sHdrPrimaryKey);
|
|
oHrmAttEmpAttQueryHdrBean.setPeriodStartDt(EnrgiseUtil.convertToString(oRow.get("START_DATE").getDate()));
|
|
oHrmAttEmpAttQueryHdrBean.setEmpId(sEmpId);
|
|
oHeaderList.add(oHrmAttEmpAttQueryHdrBean);
|
|
}
|
|
return oHeaderList;
|
|
}
|
|
|
|
public RecordMetaInfo getEmpAttQueryDtlMetaInfo(String sKey) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean objBean = new DBUtilitiesBean();
|
|
String sLocId = null;
|
|
String sStartDate = null;
|
|
String sEmpId = null;
|
|
if (EnrgiseUtil.checkString(sKey)) {
|
|
String[] sPrimaryKey = sKey.split(",");
|
|
sLocId = sPrimaryKey[0];
|
|
sStartDate = sPrimaryKey[1];
|
|
sEmpId = sPrimaryKey[2];
|
|
}
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sLocId));
|
|
arylstParameters.add(new DBObject(2, 1, 12, sEmpId));
|
|
arylstParameters.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sStartDate)));
|
|
arylstParameters.add(new DBObject(4, 2, -5));
|
|
arylstParameters.add(new DBObject(5, 2, 93));
|
|
arylstParameters.add(new DBObject(6, 2, 12));
|
|
arylstParameters.add(new DBObject(7, 2, 12));
|
|
arylstParameters.add(new DBObject(8, 2, 4));
|
|
ArrayList arylstOutArray = objBean.callProc(arylstParameters, "HRMATTEMPATTQRY.procgetEmpAttentrycount(?,?,?,?,?,?,?,?)");
|
|
RecordMetaInfo objRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject objTotalRecord = arylstOutArray.get(0);
|
|
objRecordMetaInfo.setRecordCount(((Long)objTotalRecord.getObject()).longValue());
|
|
DBObject oTimeObject = arylstOutArray.get(1);
|
|
objRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
|
|
return objRecordMetaInfo;
|
|
}
|
|
|
|
public ArrayList getEmpAttQueryDtlInfo(String sKey, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean objBean = new DBUtilitiesBean();
|
|
String sLocId = null;
|
|
String sStartDate = null;
|
|
String sEmpId = null;
|
|
if (EnrgiseUtil.checkString(sKey)) {
|
|
String[] sPrimaryKey = sKey.split(",");
|
|
sLocId = sPrimaryKey[0];
|
|
sStartDate = sPrimaryKey[1];
|
|
sEmpId = sPrimaryKey[2];
|
|
}
|
|
Timestamp tmstWhenPicked = null;
|
|
int count = 0;
|
|
ArrayList arylstDetailList = null;
|
|
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, sLocId));
|
|
arylstParameters.add(new DBObject(4, 1, 12, sEmpId));
|
|
arylstParameters.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(sStartDate)));
|
|
arylstParameters.add(new DBObject(6, 2, -10));
|
|
arylstParameters.add(new DBObject(7, 2, 12));
|
|
arylstParameters.add(new DBObject(8, 2, 12));
|
|
arylstParameters.add(new DBObject(9, 2, 4));
|
|
ArrayList arylstOutArray = objBean.callProc(arylstParameters, "HRMATTEMPATTQRY.procgetEmpAttentryDtlInfo(?,?,?,?,?,?,?,?,?)");
|
|
DBObject objOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)objOutObject.getObject();
|
|
if (arylstList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
|
|
QueryRow objRow = null;
|
|
QueryValue objValue = null;
|
|
HashMap objColumns = null;
|
|
Iterator itrIt = arylstList.iterator();
|
|
while (itrIt.hasNext()) {
|
|
if (count == 0)
|
|
arylstDetailList = new ArrayList();
|
|
count++;
|
|
objRow = itrIt.next();
|
|
HrmAttEmpAttQueryDtlBean objHrmAttEmpAttQueryDtlBean = new HrmAttEmpAttQueryDtlBean();
|
|
objHrmAttEmpAttQueryDtlBean.setDetailId(objRow.get("ID").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtEmpId(objRow.get("EMPID").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtEmpNo(objRow.get("EMPNO").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtEmpName(objRow.get("EMPNAME").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtShiftMstId(objRow.get("SHIFTID").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtShiftCode(objRow.get("SHIFTCODE").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtChkInDate(EnrgiseUtil.convertToString(objRow.get("CHKINDATE").getDate()));
|
|
objHrmAttEmpAttQueryDtlBean.setTxtCheckInTime(objRow.get("CHKINTIME").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtCheckInTimeMin(objRow.get("CHKINTIMEMIN").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtCheckOutTime(objRow.get("CHKOUTTIME").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtCheckOutTimeMin(objRow.get("CHKOUTTIMEMIN").getString());
|
|
objHrmAttEmpAttQueryDtlBean.setTxtAttStatus(objRow.get("ATTSTATUS").getString());
|
|
String sReasons = objRow.get("REASONS").getString();
|
|
objHrmAttEmpAttQueryDtlBean.setTxtReason(sReasons);
|
|
arylstDetailList.add(objHrmAttEmpAttQueryDtlBean);
|
|
}
|
|
return arylstDetailList;
|
|
}
|
|
|
|
public LovVO getHrmAttQueryLocationLOV(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("Code ID");
|
|
oHeaderList.add("hrm.HrmAttEmpAttQuery.locationCode");
|
|
oHeaderList.add("hrm.HrmEmpPersonalDetails.location");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
String sQuerySearch1 = new String();
|
|
String sQuerySearch2 = new String();
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuerySearch1 = oLovQueryVO.getSearchField1();
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
oParameters.add(new DBObject(2, 2, -10));
|
|
oParameters.add(new DBObject(3, 2, 12));
|
|
oParameters.add(new DBObject(4, 2, 12));
|
|
oParameters.add(new DBObject(5, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMATTEMPATTQRY.proc_GetLocationLOV(?,?,?,?,?)");
|
|
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 getHrmAttEmployeeLOV(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("Code ID");
|
|
oHeaderList.add("hrm.HrmAttEmpAttQuery.employeeNo");
|
|
oHeaderList.add("hrm.HrmAttEmpAttQuery.firstName");
|
|
oHeaderList.add("hrm.HrmAttEmpAttQuery.middleName");
|
|
oHeaderList.add("hrm.HrmAttEmpAttQuery.lastName");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList oParameters = 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();
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
oParameters.add(new DBObject(2, 1, 12, sQuerySearch2));
|
|
oParameters.add(new DBObject(3, 2, -10));
|
|
oParameters.add(new DBObject(4, 2, 12));
|
|
oParameters.add(new DBObject(5, 2, 12));
|
|
oParameters.add(new DBObject(6, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMATTEMPATTQRY.proc_GetEmployeeLOV(?,?,?,?,?,?)");
|
|
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("EMP_NO").getString());
|
|
oLOVBean.setDetailField3(oRow.get("FIRST_NAME").getString());
|
|
oLOVBean.setDetailField4(oRow.get("MIDDLE_NAME").getString());
|
|
oLOVBean.setDetailField5(oRow.get("LAST_NAME").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmAttEmpShftCodeLOV(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("Code ID");
|
|
oHeaderList.add("hrm.HrmAttEmpAttQuery.shiftCode");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("H");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList oParameters = 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();
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
oParameters.add(new DBObject(2, 2, -10));
|
|
oParameters.add(new DBObject(3, 2, 12));
|
|
oParameters.add(new DBObject(4, 2, 12));
|
|
oParameters.add(new DBObject(5, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMATTEMPATTQRY.proc_GetShiftCodeLOV(?,?,?,?,?)");
|
|
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());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmAttQueryDtlEmpLOV(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("ID");
|
|
oHeaderList.add("hrm.HrmAttEmpAttQueryDtl.txtEmployeeNo");
|
|
oHeaderList.add("hrm.HrmAttEmpAttQueryDtl.txtEmployeeName");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
String sSiteId = new String();
|
|
int count = 0;
|
|
ArrayList oParameters = 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();
|
|
sSiteId = oLovQueryVO.getProperty("ListSiteId");
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
oParameters.add(new DBObject(2, 1, 12, sQuerySearch2));
|
|
oParameters.add(new DBObject(3, 1, 12, sSiteId));
|
|
oParameters.add(new DBObject(4, 2, -10));
|
|
oParameters.add(new DBObject(5, 2, 12));
|
|
oParameters.add(new DBObject(6, 2, 12));
|
|
oParameters.add(new DBObject(7, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMATTEMPATTQRY.procGetDtlEmpLOV(?,?,?,?,?,?,?)");
|
|
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("EMP_NO").getString());
|
|
oLOVBean.setDetailField3(oRow.get("EMP_NAME").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "Hrm_Emp_Attnd_Dtl";
|
|
}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
|
|
String returnString = null;
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
DateUtility d = new DateUtility();
|
|
HrmAttEmpAttQueryHdrBean oHrmAttEmpAttQueryHdrBean = (HrmAttEmpAttQueryHdrBean)oBaseHeaderBean;
|
|
if (ScreenMode.equalsIgnoreCase("N")) {
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "N"));
|
|
oParameters.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmAttEmpAttQueryHdrBean.getPeriodStartDt())));
|
|
oParameters.add(new DBObject(3, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
oParameters.add(new DBObject(4, 1, 12, this.oUserInfo.getSiteId()));
|
|
oParameters.add(new DBObject(5, 2, 12));
|
|
oParameters.add(new DBObject(6, 2, 12));
|
|
oParameters.add(new DBObject(7, 2, 12));
|
|
oParameters.add(new DBObject(8, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMATTEMPATTQRY.procUpsertAttendanceHeader(?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
}
|
|
return String.valueOf(String.valueOf(String.valueOf(String.valueOf(this.oUserInfo.getSiteId()).concat(String.valueOf(","))).concat(String.valueOf(oHrmAttEmpAttQueryHdrBean.getPeriodStartDt()))).concat(String.valueOf(","))).concat(String.valueOf(oHrmAttEmpAttQueryHdrBean.getEmpId()));
|
|
}
|
|
|
|
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
|
|
if (sScreenName.equalsIgnoreCase("HrmAttEmpAttQuery"))
|
|
saveHrmAttDetail(sHeaderPrimaryKey, arylstDetailBeanArray);
|
|
}
|
|
|
|
public void saveHrmAttDetail(String sPrimaryKey, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
|
|
boolean bInsert = false;
|
|
boolean bUpdate = false;
|
|
boolean bDelete = false;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = null;
|
|
DBUtilitiesBean oBeanInsert = null;
|
|
DBUtilitiesBean oBeanDelete = null;
|
|
Iterator itrBean = oDetailBeanArray.iterator();
|
|
while (itrBean.hasNext()) {
|
|
HrmAttEmpAttQueryDtlBean oHrmAttEmpAttQueryDtlBean = itrBean.next();
|
|
if (oHrmAttEmpAttQueryDtlBean.getStatus().equals("N")) {
|
|
if (!bInsert) {
|
|
oBeanInsert = new DBUtilitiesBean();
|
|
oBeanInsert.createBatch("HRMATTEMPATTQRY.procUpsertAttendanceDetail(?,?,?,?,?,?,?,?,?,?,?)");
|
|
bInsert = true;
|
|
}
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "N"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtEmpId()));
|
|
arylstParameters.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmAttEmpAttQueryDtlBean.getTxtChkInDate())));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtCheckInTime()));
|
|
arylstParameters.add(new DBObject(5, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtCheckInTimeMin()));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtCheckOutTime()));
|
|
arylstParameters.add(new DBObject(7, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtCheckOutTimeMin()));
|
|
arylstParameters.add(new DBObject(8, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtAttStatus()));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtReason()));
|
|
arylstParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(11, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBeanInsert.addToBatch(arylstParameters);
|
|
continue;
|
|
}
|
|
if (oHrmAttEmpAttQueryDtlBean.getStatus().equals("U")) {
|
|
if (!bUpdate) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMATTEMPATTQRY.procUpsertAttendanceDetail(?,?,?,?,?,?,?,?,?,?,?)");
|
|
bUpdate = true;
|
|
}
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtEmpId()));
|
|
arylstParameters.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmAttEmpAttQueryDtlBean.getTxtChkInDate())));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtCheckInTime()));
|
|
arylstParameters.add(new DBObject(5, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtCheckInTimeMin()));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtCheckOutTime()));
|
|
arylstParameters.add(new DBObject(7, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtCheckOutTimeMin()));
|
|
arylstParameters.add(new DBObject(8, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtAttStatus()));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmAttEmpAttQueryDtlBean.getTxtReason()));
|
|
arylstParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(11, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(arylstParameters);
|
|
}
|
|
}
|
|
if (bInsert)
|
|
oBeanInsert.executeBatch();
|
|
if (bUpdate)
|
|
oBean.executeBatch();
|
|
}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean objBaseHeaderBean) throws EnrgiseSystemException {}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean objBaseHeaderBean) throws EnrgiseSystemException {
|
|
return new String();
|
|
}
|
|
|
|
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 (bDetailDataChanged)
|
|
if (sScreenName.equalsIgnoreCase("HrmAttEmpAttQuery")) {
|
|
Iterator itrBean1 = arylstDetailBeanArray.iterator();
|
|
int iCount = 1;
|
|
while (itrBean1.hasNext()) {
|
|
HrmAttEmpAttQueryDtlBean oHrmAttEmpAttQueryDtlBean = itrBean1.next();
|
|
if (!oHrmAttEmpAttQueryDtlBean.getStatus().equalsIgnoreCase("D"));
|
|
iCount++;
|
|
}
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
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();
|
|
String sQuery = new String();
|
|
DBUtilitiesBean oBean1 = new DBUtilitiesBean();
|
|
ArrayList oList1 = new ArrayList();
|
|
String sDeptId = new String();
|
|
HrmAttEmpAttQueryHdrBean oHrmAttEmpAttQueryHdrBean = (HrmAttEmpAttQueryHdrBean)oBaseHeaderBean;
|
|
if (bHeaderDataChanged) {
|
|
checkDept(oHrmAttEmpAttQueryHdrBean, arylstErrorList);
|
|
if (arylstErrorList.size() == 0) {
|
|
checkUniqueHeader(oHrmAttEmpAttQueryHdrBean, arylstErrorList);
|
|
checkDatesConstraint(oHrmAttEmpAttQueryHdrBean, arylstErrorList);
|
|
}
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkDept(HrmAttEmpAttQueryHdrBean oHrmAttEmpAttQueryHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, oHrmAttEmpAttQueryHdrBean.getEmpId()));
|
|
arylstParam.add(new DBObject(2, 2, 12));
|
|
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, "HRMATTEMPATTQRY.proccheckDept(?,?,?,?,?)");
|
|
DBObject oErr = arylstOutArray.get(0);
|
|
String sErr = ((String)oErr.getObject()).toString();
|
|
if (Integer.parseInt(sErr) == 0) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmAttEmpAttQuery.DeptError");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmAttEmpAttQuery.DeptError", oParams, "E"));
|
|
}
|
|
}
|
|
|
|
private void checkUniqueHeader(HrmAttEmpAttQueryHdrBean oHrmAttEmpAttQueryHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, oHrmAttEmpAttQueryHdrBean.getEmpId()));
|
|
arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmAttEmpAttQueryHdrBean.getPeriodStartDt())));
|
|
arylstParam.add(new DBObject(3, 2, 12));
|
|
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, "HRMATTEMPATTQRY.proccheckuniqueheader(?,?,?,?,?,?)");
|
|
DBObject oErr = arylstOutArray.get(0);
|
|
String sErr = ((String)oErr.getObject()).toString();
|
|
if (Integer.parseInt(sErr) == 0) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmAttEmpAttQuery.uniqueHeader1");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmAttEmpAttQuery.uniqueHeader", oParams, "E"));
|
|
}
|
|
}
|
|
|
|
private void checkDatesConstraint(HrmAttEmpAttQueryHdrBean oHrmAttEmpAttQueryHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
if (EnrgiseUtil.checkString(oHrmAttEmpAttQueryHdrBean.getPeriodStartDt())) {
|
|
int dateFlag1 = EnrgiseUtil.compareDates(dateFormat, EnrgiseUtil.convertToString(EnrgiseUtil.getSysDate()), oHrmAttEmpAttQueryHdrBean.getPeriodStartDt());
|
|
if (dateFlag1 == -1 && dateFlag1 != -2) {
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add("");
|
|
arylstParam.add(new Integer(0));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmAttEmpAttQueryDtl.inDateFuture", arylstParam));
|
|
}
|
|
}
|
|
}
|
|
|
|
private void checkMandatoryDetail(HrmAttEmpAttQueryDtlBean oHrmAttEmpAttQueryDtlBean, int iCount, ArrayList arylstErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
if (!EnrgiseUtil.checkString(oHrmAttEmpAttQueryDtlBean.getTxtEmpId())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmAttEmpAttQueryDtl.txtEmployeeNo");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmAttEmpAttQueryDtlBean.getTxtShiftCode())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmAttEmpAttQuery.shiftCode");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(String.valueOf(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmAttEmpAttQueryDtlBean.getTxtChkInDate())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmAttEmpAttQuery.chkInDate");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(String.valueOf(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkMandatoryHeader(HrmAttEmpAttQueryQVO oHrmAttEmpAttQueryQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oList = new ArrayList();
|
|
if (!EnrgiseUtil.checkString(oHrmAttEmpAttQueryQVO.getPeriodStartDt())) {
|
|
ArrayList oParam = new ArrayList();
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmAttEmpAttQuery.periodStartDt");
|
|
oParam.add(oMessageKey);
|
|
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParam, "E"));
|
|
}
|
|
reportError(oList);
|
|
}
|
|
}
|