public static PayrollRecord Create(PayrollReport pr, Salary sal) { return(new PayrollRecord { _payroll_report = pr, _salary = sal, _employee = sal.GetEmployee(), // copy the gross value to avoid miscalculation in future _gross = sal.Gross.PreciseValue * (decimal)pr.MonthlyUnit }); }
/// <summary> /// Given deduction total /// </summary> public static Deduction Create(Salary salary, int amortization, MonetaryValue total, Date dt_granted = null, DeductionMode mode = DeductionMode.TEMPORARY) { var record = new Deduction { _salary = salary , Employee = salary.GetEmployee() , Total = total , _amortization = amortization , DateGranted = dt_granted ?? Date.TryParse(DateTime.Now.ToLongDateString()) , Mode = mode }; EventBroker.getInstance().Emit(new EventSalaryDeductionCreated(record, salary)); return(record); }