Files
HRMS/hrmsEjb/wenrgise/hrms/businessdelegate/HrmEmpAdvAppBD.java
2025-07-28 13:56:49 +05:30

184 lines
8.5 KiB
Java

package wenrgise.hrms.businessdelegate;
import java.rmi.RemoteException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.ejb.CreateException;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.EnrgiseUtil;
import wenrgise.common.utility.RecordMetaInfo;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.ejb.common.utility.ServiceLocator;
import wenrgise.hrms.bean.HrmEmpAdvAppHdrBean;
import wenrgise.hrms.ejb.facade.HrmFacade;
import wenrgise.hrms.ejb.facade.HrmFacadeHome;
import wenrgise.hrms.vo.HrmEmpAdvAppQueryVO;
public class HrmEmpAdvAppBD extends HrmBaseBD {
public RecordMetaInfo getHeaderMetaImpl(BaseQueryVO oQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
try {
HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade");
HrmFacade oHrmFacade = oHome.create();
return oHrmFacade.getHrmEmpAdvAppHdrMetaInfo((HrmEmpAdvAppQueryVO)oQueryVO);
} catch (RemoteException oRe) {
throw new EnrgiseSystemException(oRe);
} catch (CreateException oCrt) {
throw new EnrgiseSystemException(oCrt);
}
}
public ArrayList getHeaderRecordImpl(BaseQueryVO oQueryVO, long lStartPosition, long lLastPosition) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
try {
HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade");
HrmFacade oHrmFacade = oHome.create();
ArrayList oHeaderList = oHrmFacade.getHrmEmpAdvAppHeaderInfo((HrmEmpAdvAppQueryVO)oQueryVO, lStartPosition, lLastPosition);
return oHeaderList;
} catch (RemoteException oRe) {
throw new EnrgiseSystemException(oRe);
} catch (CreateException oCrt) {
throw new EnrgiseSystemException(oCrt);
}
}
public RecordMetaInfo getTotalDetailRecordCountImpl(String lPrimaryKey, String sScreenName) throws EnrgiseApplicationException, EnrgiseSystemException {
RecordMetaInfo oRecordMetaInfo = null;
return oRecordMetaInfo;
}
public ArrayList getDetailRecordImpl(String lPrimaryKey, String sScreenName, long lAbsoluteStart, long lAbsoluteEnd) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oRet = null;
return oRet;
}
public boolean updateHeaderRecordImpl(BaseHeaderBean oBaseHeaderBean) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
return true;
}
public String saveImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
try {
HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade");
HrmFacade oHrmFacade = oHome.create();
return oHrmFacade.saveData((HrmEmpAdvAppHdrBean)oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked, this.oUserInfo);
} catch (CreateException oCrtExcep) {
throw new EnrgiseSystemException(oCrtExcep);
}
}
public String getInsertDataImpl(BaseQueryVO oQueryVO) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
return "Only Implementation";
}
public String submitImpl(String sButtonName, BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
try {
String sHeaderPrimaryKey = null;
HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade");
HrmFacade oHrmFacade = oHome.create();
if (sButtonName.equalsIgnoreCase("butBulkSettlement"))
sHeaderPrimaryKey = oHrmFacade.advAppBulkSettlePayment((HrmEmpAdvAppHdrBean)oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked, this.oUserInfo);
return sHeaderPrimaryKey;
} catch (RemoteException oRe) {
throw new EnrgiseSystemException(oRe);
} catch (CreateException oCrt) {
throw new EnrgiseSystemException(oCrt);
}
}
public Map getDisabledFieldsImpl(ThisPageVO oThisPageVO) throws EnrgiseApplicationException, EnrgiseSystemException {
HashMap oHashMap = new HashMap();
ArrayList oEnableList = new ArrayList();
ArrayList oDisableList = new ArrayList();
HrmEmpAdvAppHdrBean oHrmEmpAdvAppHdrBean = (HrmEmpAdvAppHdrBean)oThisPageVO.getOHeaderBean();
ArrayList oDetailList = oThisPageVO.getODetailList();
if (!oHrmEmpAdvAppHdrBean.equals(null))
if (oThisPageVO.getScreenMode().equalsIgnoreCase("Q")) {
oEnableList.add("butEmployeeNo");
if (EnrgiseUtil.checkString(oHrmEmpAdvAppHdrBean.getEmployeeId())) {
oEnableList.add("butAdvanceCode");
} else {
oDisableList.add("butAdvanceCode");
}
oEnableList.add("butFromDate");
oEnableList.add("butToDate");
oDisableList.add("butDateApplied");
oDisableList.add("amountApplied");
oDisableList.add("sanctionedAmount");
oDisableList.add("butSanctionDate");
oDisableList.add("reason");
oDisableList.add("butApproverNo");
oDisableList.add("remarks");
oDisableList.add("payrollMonth");
oDisableList.add("butBulkSettlement");
oDisableList.add("bulkSettleAmount");
} else if (oThisPageVO.getScreenMode().equalsIgnoreCase("U")) {
oDisableList.add("butEmployeeNo");
oDisableList.add("butAdvanceCode");
oDisableList.add("butFromDate");
oDisableList.add("butToDate");
oEnableList.add("butDateApplied");
oEnableList.add("amountApplied");
oEnableList.add("sanctionedAmount");
oEnableList.add("butSanctionDate");
oEnableList.add("reason");
oEnableList.add("butApproverNo");
oEnableList.add("remarks");
if (EnrgiseUtil.checkString(oHrmEmpAdvAppHdrBean.getPaidInstallments())) {
if (Integer.parseInt(oHrmEmpAdvAppHdrBean.getPaidInstallments()) > 0) {
oDisableList.add("payrollMonth");
} else {
oEnableList.add("payrollMonth");
}
} else {
oEnableList.add("payrollMonth");
}
if (EnrgiseUtil.checkString(oHrmEmpAdvAppHdrBean.getBalance()))
if (Float.parseFloat(oHrmEmpAdvAppHdrBean.getBalance()) == false) {
oDisableList.add("bulkSettleAmount");
oDisableList.add("butBulkSettlement");
oHrmEmpAdvAppHdrBean.setMode("M");
}
if (EnrgiseUtil.checkString(oHrmEmpAdvAppHdrBean.getMode())) {
if (oHrmEmpAdvAppHdrBean.getMode().equalsIgnoreCase("B")) {
oDisableList.add("butBulkSettlement");
oEnableList.add("bulkSettleAmount");
} else if (oHrmEmpAdvAppHdrBean.getMode().equalsIgnoreCase("M")) {
oDisableList.add("butBulkSettlement");
oDisableList.add("bulkSettleAmount");
} else {
oEnableList.add("butBulkSettlement");
oDisableList.add("bulkSettleAmount");
}
} else {
oEnableList.add("butBulkSettlement");
oDisableList.add("bulkSettleAmount");
}
} else if (oThisPageVO.getScreenMode().equalsIgnoreCase("N")) {
oDisableList.add("bulkSettleAmount");
oDisableList.add("butBulkSettlement");
oEnableList.add("butEmployeeNo");
if (EnrgiseUtil.checkString(oHrmEmpAdvAppHdrBean.getEmployeeId())) {
oEnableList.add("butAdvanceCode");
} else {
oDisableList.add("butAdvanceCode");
}
oDisableList.add("butFromDate");
oDisableList.add("butToDate");
oEnableList.add("butDateApplied");
oEnableList.add("amountApplied");
oEnableList.add("sanctionedAmount");
oEnableList.add("butSanctionDate");
oEnableList.add("reason");
oEnableList.add("butApproverNo");
oEnableList.add("remarks");
oEnableList.add("payrollMonth");
}
oHashMap.put("D", oDisableList);
oHashMap.put("E", oEnableList);
return oHashMap;
}
}