/// <summary> /// It will Calculate the Salary with different tax slab /// </summary> /// <param name="objSalaryRequest"></param> /// <returns></returns> public IEnumerable <EmployeeSalaryOutput> CalculateSalary(EmployeeSalaryInput objSalaryRequest) { List <EmployeeSalaryOutput> details = new List <EmployeeSalaryOutput>(); decimal tax = 0, taxableIncome = 0, perMonthSalary = 0; EmployeeSalaryOutput objSalaryResponse = null; try { objSalaryResponse = new EmployeeSalaryOutput(); EvaluateTax(objSalaryRequest.GrossIncome, ref tax, taxableIncome); perMonthSalary = (objSalaryRequest.GrossIncome - tax) / Constant.NoOfMonths; objSalaryResponse.GrossIncome = objSalaryRequest.GrossIncome / Constant.NoOfMonths; objSalaryResponse.PayPeriod = Convert.ToString(objSalaryRequest.PayPeriod); objSalaryResponse.IncomeTax = tax / Constant.NoOfMonths; objSalaryResponse.NetIncome = objSalaryResponse.GrossIncome - objSalaryResponse.IncomeTax; objSalaryResponse.FullName = objSalaryRequest.FirstName + " " + objSalaryRequest.LastName; objSalaryResponse.SuperAmount = GetSuperAmount(objSalaryRequest.GrossIncome, objSalaryRequest.SuperRate); details.Add(objSalaryResponse); return(details); } catch (Exception ex) { throw ex; ///todo : We can log exceptions in database/file } }
public ActionResult GenerateSalary(EmployeeSalaryInput emp) { return(PartialView("GenerateSalary", CalculateSalary(emp))); }
public ActionResult GetDetails() { EmployeeSalaryInput empInput = new EmployeeSalaryInput(); return(View(empInput)); }