public async Task <ActionResult> PaymentForSpecificDays(int?idCarWash, bool message = true, bool messageClose = true) { if (idCarWash != null) { await _totalMonthlySalary.CheckMonthlyPaymentsEmployee(idCarWash); var viewResult = Mapper.Map <IEnumerable <WagesForDaysWorkedView> >(await _wagesForDays.MonthOrderResult(idCarWash, DateTime.Now.Month, DateTime.Now.Year)).OrderByDescending(x => x.carWashWorkersId); var remainingUnpaidWages = Mapper.Map <SalaryArchiveView>(await _salaryArchive.SelectId(idCarWash)); var payouts = Mapper.Map <IEnumerable <SalaryBalanceView> >(await _salaryBalance.SelectIdToDate(idCarWash, DateTime.Now.Month, DateTime.Now.Year)); var salaryBalance = Mapper.Map <SalaryBalanceView>(await _salaryBalance.LastMonthBalance(idCarWash)); var bonusToSalary = Mapper.Map <IEnumerable <BonusToSalaryView> >(await _bonusToSalary.WhereMontsBonusToSalary(idCarWash.Value)); var employeeRate = Mapper.Map <IEnumerable <EmployeeRateView> >(await _employeeRate.WherySumRate(idCarWash.Value)); ViewBag.EmployeeRate = employeeRate; ViewBag.BonusToSalaryList = bonusToSalary; ViewBag.SalaryBalance = salaryBalance; var salaryArxiv = Mapper.Map <SalaryArchiveView>(await _salaryArchive.LastMonth(idCarWash.Value)); double monthlySalary = viewResult.Sum(s => s.payroll).Value; double paidPerMonth = payouts.Sum(s => s.payoutAmount).Value; double bonusToSalarySum = bonusToSalary.Sum(s => s.amount).Value; double rate = employeeRate.Sum(s => s.wage).Value; double lastMonth = 0; if (salaryArxiv != null) { lastMonth = salaryArxiv.balanceAtTheEndOfTheMonth.Value; ViewBag.LastMonthList = salaryArxiv; } ViewBag.Rate = rate; ViewBag.IdCarWash = idCarWash; ViewBag.MonthlySalary = monthlySalary; ViewBag.PaidPerMonth = paidPerMonth; ViewBag.LastMonth = lastMonth; ViewBag.BonusToSalary = bonusToSalarySum; ViewBag.TotalPayable = Math.Round(monthlySalary - paidPerMonth + lastMonth + bonusToSalarySum + rate, 3); ViewBag.Employee = Mapper.Map <CarWashWorkersView>(await _carWashWorkers.CarWashWorkersId(idCarWash)); ViewBag.Payouts = payouts; if (message == false) { ViewBag.Message = "Данная запись не соответствует типу double"; } if (messageClose == false) { ViewBag.MessageClose = "Данная запись не соответствует типу double"; } return(View(viewResult)); } return(RedirectToAction("ShiftInformation")); }
// GET: SalaryArchive/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SalaryArchiveView salaryArchiveView = Mapper.Map <SalaryArchiveView>(await _salaryArchive.SelectId(id)); if (salaryArchiveView == null) { return(HttpNotFound()); } return(View(salaryArchiveView)); }