public override void Run(ContributionDeductionCmd request) { var ded = p_Processor.Run(new GetDeductionQr(DeductionCodeConstants.PagIBIG)); var existingDeduction = request.m_NewMasterData.MasterEmployeeDeductions .SingleOrDefault(a => a.DeductionID == ded.DeductionID); var newComputedDeduction = new MasterEmployeeDeductionBO { DeductionID = ded.DeductionID, RecordStatus = RecordStatus.Active, EmployeeAmount = 100, ShortDesc = ded.ShortDesc, LongDesc = ded.LongDesc, AltDesc = ded.AltDesc }; if (HasChanges(existingDeduction, newComputedDeduction)) { request.m_NewMasterData.AddNewEmployeeDeduction(newComputedDeduction); } }
public override void Run(ContributionDeductionCmd process) { short planYear = process.m_NewMasterData.PlanYear; short payRunID = process.m_NewMasterData.PayRunID; var ded = p_Processor.Run(new GetDeductionQr(DeductionCodeConstants.PhilHealth)); var existingPhilHealthDed = process.m_NewMasterData.MasterEmployeeDeductions .SingleOrDefault(a => a.DeductionID == ded.DeductionID); var philHealthTable = p_Processor.Run(new GetPhilHealthTableQr(planYear, payRunID)); var range = philHealthTable.Ranges .SingleOrDefault(a => a.Min < process.m_NewMasterData.MonthlyRate && process.m_NewMasterData.MonthlyRate < a.Max); var variables = new Dictionary <string, decimal> { ["Fixed"] = range.Fixed.GetValueOrDefault(), ["MonthlyBasicPay"] = process.m_NewMasterData.MonthlyRate.GetValueOrDefault(), ["Rate"] = range.Rate.GetValueOrDefault() }; var newComputedDeduction = new MasterEmployeeDeductionBO { DeductionID = ded.DeductionID, RecordStatus = RecordStatus.Active, EmployeeAmount = FormulaHelper.Calculate(range.EmployeeFormula, variables), EmployerAmount = FormulaHelper.Calculate(range.EmployerFormula, variables), ShortDesc = ded.ShortDesc, LongDesc = ded.LongDesc, AltDesc = ded.AltDesc }; if (HasChanges(existingPhilHealthDed, newComputedDeduction)) { process.m_NewMasterData.AddNewEmployeeDeduction(newComputedDeduction); } }