private bool GenerateORSOData(int PaySlipID, ArrayList orsoRecords) { bool hasORSO = false; DataSet.Payroll_PaySlip.PaySlip_ORSORow orsoRow = null; foreach (EORSORecord orsoRecord in orsoRecords) { hasORSO = true; if (orsoRow == null) { orsoRow = CreatePaySlipORSORow(PaySlipID, orsoRecord.ORSORecPeriodFr, orsoRecord.ORSORecPeriodTo); } if (!(orsoRecord.ORSORecPeriodFr.Equals(orsoRow.PeriodFr) && orsoRecord.ORSORecPeriodTo.Equals(orsoRow.PeriodTo))) { dataSet.PaySlip_ORSO.Rows.Add(orsoRow); orsoRow = CreatePaySlipORSORow(PaySlipID, orsoRecord.ORSORecPeriodFr, orsoRecord.ORSORecPeriodTo); } // Start 0000206, Ricky So, 2015-05-22 //orsoRow.RelevantIncome += orsoRecord.ORSORecActRI; // End 0000206, Ricky So, 2015-05-22 orsoRow.EE += orsoRecord.ORSORecActEE; orsoRow.ER += orsoRecord.ORSORecActER; } // Start 0000206, Ricky So, 2015-05-22 if (orsoRow != null) { EEmpPayroll m_empPayroll = EEmpPayroll.GetObject(dbConn, ((EORSORecord)orsoRecords[0]).EmpPayrollID); EPayrollPeriod m_payPeriod = EPayrollPeriod.GetObject(dbConn, m_empPayroll.PayPeriodID); DBFilter m_basicSalaryFilter = new DBFilter(); m_basicSalaryFilter.add(AppUtils.GetPayemntCodeDBTermByPaymentType(dbConn, "PayCodeID", "BASICSAL")); m_basicSalaryFilter.add(new Match("EmpID", m_empPayroll.EmpID)); m_basicSalaryFilter.add(new Match("EmpRPEffFr", "<=", m_payPeriod.PayPeriodTo)); OR m_or = new OR(); m_or.add(new Match("EmpRPEffTo", ">=", m_payPeriod.PayPeriodFr)); m_or.add(new NullTerm("EmpRPEffTo")); m_basicSalaryFilter.add(m_or); foreach (EEmpRecurringPayment m_payment in EEmpRecurringPayment.db.select(dbConn, m_basicSalaryFilter)) { orsoRow.RelevantIncome += m_payment.EmpRPAmount; } } // End 0000206, Ricky So, 2015-05-22 if (orsoRow != null) { dataSet.PaySlip_ORSO.Rows.Add(orsoRow); } return(hasORSO); }
protected DataTable LoadORSODetail() { DataTable _table = new DataSet.Payroll_MPFRemittanceStatement.ExistingMemberDataTable(); DBFilter _payPeriodFilter = new DBFilter(); _payPeriodFilter.add(new Match("PayPeriodFr", "<=", this.PayPeriodTo)); _payPeriodFilter.add(new Match("PayPeriodTo", ">=", this.PayPeriodFr)); DBFilter _empPayrollFilter = new DBFilter(); _empPayrollFilter.add(new IN("PayPeriodID", "SELECT PayPeriodID FROM PayrollPeriod", _payPeriodFilter)); DBFilter _orsoRecordFilter = new DBFilter(); _orsoRecordFilter.add(new Match("ORSOPlanID", this.ORSOPlanID)); _orsoRecordFilter.add(new IN("EmpPayrollID", "SELECT EmpPayrollID FROM EmpPayroll", _empPayrollFilter)); foreach (EORSORecord _orsoRecord in EORSORecord.db.select(dbConn, _orsoRecordFilter)) { DataRow _newRow = _table.NewRow(); EEmpPayroll _payroll = EEmpPayroll.GetObject(dbConn, _orsoRecord.EmpPayrollID); EEmpPersonalInfo _empInfo = EEmpPersonalInfo.GetObject(dbConn, _payroll.EmpID); _newRow["EmpID"] = _empInfo.EmpID; _newRow["MPFPlanID"] = _orsoRecord.ORSOPlanID; _newRow["EmpNo"] = _empInfo.EmpNo; _newRow["EmpName"] = _empInfo.EmpEngFullName; _newRow["SchemeJoinDate"] = _empInfo.EmpDateOfJoin; if (string.IsNullOrEmpty(_empInfo.EmpHKID)) { _newRow["HKID"] = _empInfo.EmpPassportNo; } else { _newRow["HKID"] = _empInfo.EmpHKID; } _newRow["PeriodFrom"] = _orsoRecord.ORSORecPeriodFr; _newRow["PeriodTo"] = _orsoRecord.ORSORecPeriodTo; _newRow["RelevantIncome"] = 0; //_orsoRecord.ORSORecActRI; _newRow["MCEE"] = _orsoRecord.ORSORecActEE; _newRow["MCER"] = _orsoRecord.ORSORecActER; _newRow["VCEE"] = 0; _newRow["VCER"] = 0; EEmpTermination _empTermination = EEmpTermination.GetObjectByEmpID(dbConn, _empInfo.EmpID); if (_empTermination != null && _empTermination.EmpTermLastDate.Ticks != 0) { _newRow["LastEmploymentDate"] = _empTermination.EmpTermLastDate; _newRow["IsBackPayRecord"] = (_empTermination.EmpTermLastDate > this.PayPeriodFr); } else { _newRow["LastEmploymentDate"] = DBNull.Value; _newRow["IsBackPayRecord"] = false; } _newRow["IsLSP"] = false; _newRow["IsSP"] = false; _newRow["LSPSPAmount"] = 0; _newRow["LSPSPAmountPaidByER"] = 0; _table.Rows.Add(_newRow); } return(_table); }