예제 #1
0
        public List <PayslipStatement> BuildPayslip(List <Employee> employeeList)
        {
            var employeePayslipsList = new List <PayslipStatement>();

            if (employeeList == null)
            {
                return(employeePayslipsList);
            }

            foreach (var employee in employeeList)
            {
                var taxCalculator = new TaxIncomeCalculations();
                CalculationInformation taxCalculationsForPayslip = taxCalculator.GetPayslipCalculations(employee);

                var payslip = new PayslipStatement
                {
                    FullName    = GetFullNameFrom(employee.FirstName, employee.LastName),
                    PayPeriod   = employee.PayPeriod,
                    GrossIncome = taxCalculationsForPayslip.GrossIncome,
                    IncomeTax   = taxCalculationsForPayslip.IncomeTax,
                    NetIncome   = taxCalculationsForPayslip.NetIncome,
                    SuperAmount = taxCalculationsForPayslip.SuperAmount
                };

                employeePayslipsList.Add(payslip);
            }

            return(employeePayslipsList);
        }
예제 #2
0
        public CalculationInformation GetPayslipCalculations(Employee employeeInformation)
        {
            var calculatedEmployee = new CalculationInformation
            {
                GrossIncome = GetGrossIncome(employeeInformation.Salary),
                IncomeTax   = GetIncomeTax(employeeInformation.Salary)
            };

            calculatedEmployee.NetIncome = GetNetIncome(calculatedEmployee.GrossIncome, calculatedEmployee.IncomeTax);

            calculatedEmployee.SuperAmount =
                GetSuperAmount(calculatedEmployee.GrossIncome, employeeInformation.PayRate);

            return(calculatedEmployee);
        }