public void IrpfTest_1() { // Arrange var salaryView = new SalaryView(); double salary = 1000; double expected = 0; // Act double irpf = salaryView.IrpfDiscount(salary); // Assert Assert.AreEqual(expected, irpf); }
public void InssTest_1() { // Arrange var salaryView = new SalaryView(); double salary = 1000; double expected = 86.50; // Act double inss = salaryView.InssDiscount(salary); // Assert Assert.AreEqual(expected, inss); }
public void ChildAllowanceTest_1() { // Arange var salaryView = new SalaryView(); double salary = 1000; int childCount = 2; double expected = 0; // Act double childAllowance = salaryView.ChildAllowance(salary, childCount); // Assert Assert.AreEqual(expected, childAllowance); }
// // GET: /User/Salary/ public async Task <ActionResult> Index() { ISession se = NHibernateHelper.CurrentSession; SalaryView o = new SalaryView(); object id = Session["employee_id"]; Employee employee = se.Get <Employee>(id); o.Employeesalary = EmployeesalaryHelper.Find(id); double adjustment = await SalaryadjustmentHelper.GetSalaryAdjustment(new Dictionary <string, object> { { "staff_id", employee.Staffid }, { "year", DateTime.Now.Year } }); o.BasicPay = o.Employeesalary.Salary + adjustment; return(View(o)); }
public ActionResult SalaryResult(SalaryView sw) { double IYPO = _context.SalaryCalculationConstants.Where(x => x.SCCCode == "IYPO").Select(x => x.SCCRatio).FirstOrDefault(); double IKVSPO = _context.SalaryCalculationConstants.Where(x => x.SCCCode == "IKVSPO").Select(x => x.SCCRatio).FirstOrDefault(); double IGSSPO = _context.SalaryCalculationConstants.Where(x => x.SCCCode == "IGSSPO").Select(x => x.SCCRatio).FirstOrDefault(); double IISO = _context.SalaryCalculationConstants.Where(x => x.SCCCode == "IISO").Select(x => x.SCCRatio).FirstOrDefault(); double IDVO = _context.SalaryCalculationConstants.Where(x => x.SCCCode == "IDVO").Select(x => x.SCCRatio).FirstOrDefault(); Calculate calculation = new Calculate(); double insurance = calculation.EmployeeInsurance(sw.rawSalary, IYPO, IKVSPO, IGSSPO, IISO); string disability = sw.disability; string married = sw.married; string spouseWork = sw.spouseWork; string retired = sw.retired; int numberOfChildren = sw.numberOfChildren; List <double> resultList = new List <double>(); if (sw.hiddenBag == "Brüt") { for (int numberOfMonths = 1; numberOfMonths <= 12; numberOfMonths++) { double salary = calculation.GrossToNet(sw.rawSalary, IYPO, IKVSPO, IGSSPO, IISO, numberOfMonths, IDVO, disability, married, spouseWork, retired, numberOfChildren); resultList.Add(salary); } } else { for (int numberOfMonths = 1; numberOfMonths <= 12; numberOfMonths++) { double salary = calculation.NetToGross(sw.rawSalary, IYPO, IKVSPO, IGSSPO, IISO, numberOfMonths, IDVO, disability, married, spouseWork, retired, numberOfChildren); resultList.Add(salary); } } ViewBag.resultList = resultList; ViewBag.rawSalary = sw.rawSalary; ViewBag.hiddenBag = sw.hiddenBag; return(View()); }
public List <SalaryView> getSalaryByMonth(string paymentDate) { List <SalaryView> salarys = new List <SalaryView>(); using (sys_employeeEntities db = new sys_employeeEntities()) { var query = (from e in db.employee join s in db.salary on e.employeeId equals s.employeeId into esGroup from es in esGroup.DefaultIfEmpty() where es.paymentDate.Substring(0, 7).Equals(paymentDate.Substring(0, 7)) select new { es.employeeId, e.name, es.totalPaidAmount, es.deductionAmount, es.paidAmount, es.salaryDetailFilePath, es.description }).ToList(); foreach (var item in query) { SalaryView salary = new SalaryView(); salary.EmployeeId = item.employeeId; salary.Name = item.name; salary.TotalPaidAmount = item.totalPaidAmount.ToString(); salary.DeductionAmount = item.deductionAmount.ToString(); salary.PaidAmount = item.paidAmount.ToString(); salary.SalaryDetailFilePath = item.salaryDetailFilePath; salary.FileName = item.salaryDetailFilePath.Substring(item.salaryDetailFilePath.LastIndexOf("\\") + 1); salary.Description = item.description; salarys.Add(salary); } } return(salarys); }