private bool GenerateLeaveBalanceData(int PaySlipID, int EmpID, DateTime AsOfDate) { bool hasLeaveBalance = false; LeaveBalanceCalc calc = new LeaveBalanceCalc(dbConn, EmpID, AsOfDate); ArrayList balanceItems = calc.getCurrentBalanceList(); foreach (ELeaveBalance b in balanceItems) { if (b.LeaveTypeID.Equals(ELeaveType.ANNUAL_LEAVE_TYPE(dbConn).LeaveTypeID)) { hasLeaveBalance = true; DataSet.Payroll_PaySlip.LeaveBalanceRow rr = dataSet.LeaveBalance.NewLeaveBalanceRow(); rr.LeaveBalanceID = b.LeaveBalanceID; rr.EmpID = PaySlipID; rr.LeaveBalanceEffectiveDate = b.LeaveBalanceEffectiveDate; rr.LeaveBalanceBF = b.LeaveBalanceBF; rr.LeaveBalanceEntitled = b.LeaveBalanceEntitled; rr.LeaveBalanceForfeiture = b.LeaveBalanceForfeiture + b.ExpiryForfeit; rr.Taken = b.Taken; rr.Adjust = b.Adjust; rr.Reserved = b.Reserved; rr.Balance = b.getBalance(); rr.Name = b.Name; rr.Description = b.Description; rr.StringFormat = b.StringFormat; dataSet.LeaveBalance.Rows.Add(rr); } } return(hasLeaveBalance); }
protected bool loadObject() { DBFilter filterStatus = new DBFilter(); filterStatus.add(new Match("EmpRequestRecordID", CurRequestID)); filterStatus.add(new Match("EmpRequestType", EEmpRequest.TYPE_EELEAVEAPP)); ArrayList empRequestList = EEmpRequest.db.select(dbConn, filterStatus); if (empRequestList.Count > 0) { EEmpRequest empRequest = (EEmpRequest)empRequestList[0]; if (empRequest.EmpID == UserID) { string submitStatus = empRequest.EmpRequestStatus; if ((submitStatus.Equals(EEmpRequest.STATUS_SUBMITTED) || submitStatus.Equals(EEmpRequest.STATUS_ACCEPTED)) && !submitStatus.Equals(EEmpRequest.STATUS_APPROVED)) { btnCancel.Visible = true; // Start 0000063, KuangWei, 2014-08-25 if (!string.IsNullOrEmpty(empRequest.EmpRequestRejectReason)) { RejectReasonRow.Visible = true; lblReject.Visible = false; lblAuthorize.Visible = true; lblRejectReason.Text = empRequest.EmpRequestRejectReason; } else { RejectReasonRow.Visible = false; } // End 0000063, KuangWei, 2014-08-25 } else { btnCancel.Visible = false; if (!string.IsNullOrEmpty(empRequest.EmpRequestRejectReason)) { RejectReasonRow.Visible = true; // Start 0000063, KuangWei, 2014-08-25 lblReject.Visible = true; lblAuthorize.Visible = false; // End 0000063, KuangWei, 2014-08-25 lblRejectReason.Text = empRequest.EmpRequestRejectReason; } else { RejectReasonRow.Visible = false; } } } else { btnCancel.Visible = false; RejectReasonRow.Visible = false; } obj = new ERequestLeaveApplication(); obj.RequestLeaveAppID = CurRequestID; if (!db.select(dbConn, obj)) { return(false); } Emp_LeaveBalance_List1.EmpID = obj.EmpID; Emp_LeaveBalance_List1.AsOfDate = obj.RequestLeaveAppDateFrom; Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); //EEmpPersonalInfo EmpInfo = new EEmpPersonalInfo(); //EmpInfo.EmpID = obj.EmpID; //if (EEmpPersonalInfo.db.select(dbConn, EmpInfo)) // EmpName.Text = EmpInfo.EmpNo + " - " + EmpInfo.EmpEngFullNameWithAlias; if (obj.RequestLeaveAppUnit.Equals("D")) { TimeRow.Visible = false; LeaveAppDateToPlaceHolder.Visible = true; } else { TimeRow.Visible = true; LeaveAppDateToPlaceHolder.Visible = false; } string leaveAuthorizedMessage = CONFIRM_MESSAGE; ELeaveCode leaveCode = new ELeaveCode(); leaveCode.LeaveCodeID = obj.RequestLeaveCodeID; if (ELeaveCode.db.select(dbConn, leaveCode)) { LeaveCodeIsShowMedicalCertOptionPanel.Visible = leaveCode.LeaveCodeIsShowMedicalCertOption; if (leaveCode.LeaveTypeID.Equals(ELeaveType.COMPENSATION_LEAVE_TYPE(dbConn).LeaveTypeID)) { HoursClaimPanel.Visible = true; } else { HoursClaimPanel.Visible = false; } if (leaveCode.LeaveTypeID.Equals(ELeaveType.ANNUAL_LEAVE_TYPE(dbConn).LeaveTypeID)) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = obj.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { if (AppUtils.ServerDateTime().Date <= empInfo.EmpProbaLastDate || obj.RequestLeaveAppDateFrom <= empInfo.EmpProbaLastDate) { leaveAuthorizedMessage = AL_AUTHORIZED_BEFORE_PROBATION_MESSAGE; } } } } else { HoursClaimPanel.Visible = false; } Authorize.Attributes.Add("onclick", "return confirm(\"" + HROne.Common.WebUtility.GetLocalizedString(leaveAuthorizedMessage) + "\");"); Reject.Attributes.Add("onclick", "return confirm(\"" + HROne.Common.WebUtility.GetLocalizedString(CONFIRM_MESSAGE) + "\");"); return(true); } else { return(false); } }
public AnnualLeaveBalanceProcess(DatabaseConnection dbConn, int EmpID) : base(dbConn, EmpID, 0) { EntitlePeriodUnit = "Y"; m_LeaveTypeID = ELeaveType.ANNUAL_LEAVE_TYPE(dbConn).LeaveTypeID; }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); DateTime currentDate = AppUtils.ServerDateTime().Date; DateTime asOfDate = currentDate; if (!DateTime.TryParse(BalanceAsOfDate.Value, out asOfDate)) { asOfDate = currentDate; } ESSAuthorizationProcess authProcess = new ESSAuthorizationProcess(dbConn); List <EAuthorizationGroup> groupList = authProcess.GetAuthorizerAuthorizationGroupList(CurID); ArrayList EmpIDList = new ArrayList(); if (groupList.Count > 0) { DBFilter authWorkFlowDetailFilter = new DBFilter(); string authGroupIDList = string.Empty; foreach (EAuthorizationGroup group in groupList) { if (string.IsNullOrEmpty(authGroupIDList)) { authGroupIDList = group.AuthorizationGroupID.ToString(); } else { authGroupIDList += ", " + group.AuthorizationGroupID.ToString(); } } authWorkFlowDetailFilter.add(new IN("AuthorizationGroupID", authGroupIDList, null)); DBFilter empPosFilter = EEmpPositionInfo.CreateDateRangeDBFilter("epi", currentDate, currentDate); empPosFilter.add(new IN("epi.AuthorizationWorkFlowIDLeaveApp", "SELECT DISTINCT awfd.AuthorizationWorkFlowID FROM " + EAuthorizationWorkFlowDetail.db.dbclass.tableName + " awfd", authWorkFlowDetailFilter)); DBFilter empInfoFilter = new DBFilter(); empInfoFilter.add(new IN("EmpID", "SELECT DISTINCT epi.EmpID FROM " + EEmpPositionInfo.db.dbclass.tableName + " epi", empPosFilter)); DBFilter empTermFilter = new DBFilter(); empTermFilter.add(new Match("EmpTermLastDate", "<", currentDate < asOfDate?currentDate:asOfDate)); empInfoFilter.add(new IN("NOT EMPID", "SELECT et.EmpID FROM " + EEmpTermination.db.dbclass.tableName + " et", empTermFilter)); ArrayList EmpList = EEmpPersonalInfo.db.select(dbConn, empInfoFilter); foreach (EEmpPersonalInfo empInfo in EmpList) { EmpIDList.Add(empInfo.EmpID); } } // Start Ricky So, 0000119, 2014/10/28 EmpIDList.Add(WebUtils.GetCurUser(Session).EmpID); // End Ricky So, 0000119, 2014/10/28 if (EmpIDList.Count > 0) { ArrayList leaveTypeList = new ArrayList(); leaveTypeList.Add(ELeaveType.ANNUAL_LEAVE_TYPE(dbConn)); // Start 0000057, Ricky So, 2014/07/03 DBFilter m_leaveTypeFilter = new DBFilter(); DBFilter m_leaveCodeFilter = new DBFilter(); OR m_orLeaveType = new OR(); m_orLeaveType.add(new Match("LeaveType", "SLCAT1")); m_orLeaveType.add(new Match("LeaveType", "SLCAT2")); m_leaveTypeFilter.add(m_orLeaveType); m_leaveCodeFilter.add(new IN("LeaveTypeID", "SELECT LeaveTypeID FROM LeaveType", m_leaveTypeFilter)); ArrayList m_leaveCodeList = ELeaveCode.db.select(dbConn, m_leaveCodeFilter); if (m_leaveCodeList.Count > 0) { leaveTypeList.Add(ELeaveType.SLCAT1_LEAVE_TYPE(dbConn)); leaveTypeList.Add(ELeaveType.SLCAT2_LEAVE_TYPE(dbConn)); } // End 0000057, Ricky So, 2014/07/03 HROne.Reports.Employee.LeaveBalanceProcess rpt = new HROne.Reports.Employee.LeaveBalanceProcess(dbConn, EmpIDList, asOfDate, leaveTypeList); string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Employee_LeaveBalance.rpt")); WebUtils.ReportExport(Response, rpt, reportFileName, "PDF", "LeaveBalance"); } else { errors.addError("No employee can be generated"); } }
// Start 000118, Ricky So, 2015-01-15 protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); DateTime m_asOfDate = AppUtils.ServerDateTime().Date; if (!DateTime.TryParse(AsOfDate.Value, out m_asOfDate)) { m_asOfDate = AppUtils.ServerDateTime().Date; } ArrayList EmpIDList = new ArrayList(); DBFilter m_empRosterTableGroupFilter = new DBFilter(); OR m_orEffTo = new OR(); m_orEffTo.add(new Match("EmpRosterTableGroupEffTo", ">=", m_asOfDate)); m_orEffTo.add(new NullTerm("EmpRosterTableGroupEffTo")); m_empRosterTableGroupFilter.add(new Match("EmpID", CurID)); m_empRosterTableGroupFilter.add(new Match("EmpRosterTableGroupEffFr", "<", m_asOfDate)); m_empRosterTableGroupFilter.add(m_orEffTo); m_empRosterTableGroupFilter.add("EmpRosterTableGroupID", true); foreach (EEmpRosterTableGroup m_empRosterTableGroup in EEmpRosterTableGroup.db.select(dbConn, m_empRosterTableGroupFilter)) { if (m_empRosterTableGroup.EmpRosterTableGroupIsSupervisor == true) { DBFilter m_rosterGroupFilter = new DBFilter(); m_rosterGroupFilter.add(new Match("RosterTableGroupID", m_empRosterTableGroup.RosterTableGroupID)); m_rosterGroupFilter.add(new Match("EmpRosterTableGroupEffFr", "<", m_asOfDate)); m_rosterGroupFilter.add(m_orEffTo); m_rosterGroupFilter.add("EmpID", true); foreach (EEmpRosterTableGroup m_groupMemberInfo in EEmpRosterTableGroup.db.select(dbConn, m_rosterGroupFilter)) { if (!EmpIDList.Contains(m_groupMemberInfo.EmpID)) { EmpIDList.Add(m_groupMemberInfo.EmpID); } } } } if (!EmpIDList.Contains(CurID)) { EmpIDList.Add(CurID); } if (EmpIDList.Count > 0) { ArrayList leaveTypeList = new ArrayList(); leaveTypeList.Add(ELeaveType.ANNUAL_LEAVE_TYPE(dbConn)); MonthlyAttendanceReportProcess rpt = new MonthlyAttendanceReportProcess(dbConn, EmpIDList, m_asOfDate.Year, m_asOfDate.Month, Server.MapPath("~/ESS_MonthlyAttendanceReport.xsd")); string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/ESS_MonthlyAttendanceReport.rpt")); WebUtils.ReportExport(Response, rpt, reportFileName, "PDF", "AttendanceReport"); } else { errors.addError("No employee can be generated"); } }