public static Payslip Calculatepayslip(Salary_Structure salary) { Payslip payslip = new Payslip(); payslip.emp_id = salary.emp_id; payslip.payslip_month = DateTime.Now.Month; payslip.payslip_year = DateTime.Now.Year; payslip.basic_pay = salary.basic_pay / 12; payslip.HRA = salary.HRA / 12; payslip.FA = salary.FA / 12; payslip.MA = salary.MA / 12; payslip.CA = salary.CA / 12; payslip.PF = salary.PF / 12; payslip.MI = salary.MI / 12; payslip.ESI = salary.ESI / 12; payslip.Gratuity = salary.Gratuity / 12; payslip.SA = salary.SA / 12; payslip.PT = salary.PT / 12; Incometax incometax = IncometaxRepo.GetTaxValueByEmpId(salary.emp_id); if (incometax != null) { payslip.incometax = incometax.income_tax; } else { payslip.incometax = 0; } payslip.arrears = 0; return(payslip); }
public HttpResponseMessage GetTaxValueByEmpId(int employee_id)//e_id employee_id { HttpResponseMessage response = null; try { if (employee_id != 0) { Incometax tax = IncometaxRepo.GetTaxValueByEmpId(employee_id); if (tax != null) { decimal tax_value = tax.income_tax; response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", tax_value)); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_601", "Employee tax value doesnot exists!", "Employee tax value doesnot exists!")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }