public async Task GeneratePayrollAsync(PayrollRequestDto payrollRequestDto) { foreach (var employee in payrollRequestDto.Employees) { double afpRetention = this.GetAfpRetention(payrollRequestDto.Afp, employee.Salary); double arsRetention = this.GetArsRetention(payrollRequestDto.ARS, employee.Salary); double taxableSalary = employee.Salary - (afpRetention + arsRetention); double isrRetention = this.GetIsrRetention(taxableSalary); await _payrollRepository.AddAsync( new Payroll() { AfpRetention = afpRetention, ArsRetention = arsRetention, EmployeeId = employee.Id, RawSalary = employee.Salary, IsrRetention = isrRetention, TaxableSalary = taxableSalary, NetSalary = taxableSalary - isrRetention, PayrollDate = payrollRequestDto.Date, CreatedAt = DateTime.Now, Status = true } ); } }
public async Task GenerateAsync(PayrollRequestDto payrollRequestDto) { await _payrollService.GeneratePayrollAsync(payrollRequestDto); }