public static PayChecks GeneratePayCheck(Employee employee) { //following semimonthly i.e. 24 paychecks double salary = Math.Round(employee.EmployeeSalary.BaseSalary / 24, 2); double taxableIncome = CalculateTaxableIncome(salary, employee.EmployeeSalary.Deduction401, employee.EmployeeSalary.DeductionMedicare, employee.EmployeeSalary.DeductionDental); double tax = CalculateFederalTax(taxableIncome); double takeHomeSalary = taxableIncome - tax; var payCheckToReturn = new PayChecks { BaseSalary = salary, Deduction401 = salary * employee.EmployeeSalary.Deduction401, DeductionMedicare = salary * employee.EmployeeSalary.DeductionMedicare, DeductionDental = salary * salary * employee.EmployeeSalary.DeductionDental, FederalTax = tax, StateTax = 0, TakeHomSalary = takeHomeSalary, TxnDate = DateTime.Today, EmpId = employee.EmpId, Employee = employee, TxnId = Guid.NewGuid() }; Console.WriteLine("payCheckToReturn" + payCheckToReturn); return(payCheckToReturn); }
public void AddPayCheck(PayChecks payCheck) { payCheck.TxnId = Guid.NewGuid(); _context.PayChecks.Add(payCheck); }