public ActionResult CreateNonLaborContract(int id, PreviewRemunerationBillViewModel nonLaborContractModel) { var grossSalary = nonLaborContractModel.GrossSalary; var isMaxSSI = this.calculate.CheckMaxSocialSecurityIncome(grossSalary); nonLaborContractModel.SocialSecurityIncome = isMaxSSI ? ValidationConstants.MaxSocialSecurityIncome : grossSalary; nonLaborContractModel.PersonalInsurance = this.calculate.GetPersonalInsurance(grossSalary); nonLaborContractModel.IncomeTax = this.calculate.GetIncomeTax(grossSalary, nonLaborContractModel.PersonalInsurance); nonLaborContractModel.NetWage = this.calculate.GetNetWage(grossSalary, nonLaborContractModel.PersonalInsurance, nonLaborContractModel.IncomeTax); nonLaborContractModel.LawGrantedCosts = grossSalary * 0.25m; nonLaborContractModel.TaxableAmount = grossSalary - nonLaborContractModel.LawGrantedCosts; nonLaborContractModel.AdvanceTaxAmount = nonLaborContractModel.TaxableAmount - nonLaborContractModel.PersonalInsurance; nonLaborContractModel.EmployeeId = id; var employee = this.employeeService.GetById(id); nonLaborContractModel.EmployeeFullName = employee.FirstName + " " + employee.MiddleName + " " + employee.LastName; if (this.ModelState.IsValid) { var bill = this.mapService.Map <RemunerationBill>(nonLaborContractModel); this.remunerationBillService.Create(bill); return(View("Details", nonLaborContractModel)); } return(View(nonLaborContractModel)); }
public ActionResult Edit(PreviewRemunerationBillViewModel remunerationBillViewModel) { if (this.ModelState.IsValid) { var remunerationBill = this.mapService.Map <RemunerationBill>(remunerationBillViewModel); remunerationBill.EmployeeId = remunerationBillViewModel.EmployeeId; this.remunerationBillService.UpdateById(remunerationBill.Id, remunerationBill); return(RedirectToAction("Details", "Employees", new { id = remunerationBill.EmployeeId })); } return(View(remunerationBillViewModel)); }
public ActionResult DeleteConfirmed(int id, PreviewRemunerationBillViewModel remunerationBillViewModel) { this.remunerationBillService.DeleteById(id); return(RedirectToAction("Index", "Employees")); }