public async Task <ActionResult> EducationOfWages(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IEnumerable <PremiumAndRateView> premiumAndRate; premiumAndRate = Mapper.Map <IEnumerable <PremiumAndRateView> >(await _premiumAndRateServices.SelectPosition(id.Value)).ToList(); if (premiumAndRate.Count() == 0) { var resultCarWashWorkersView = Mapper.Map <CarWashWorkersView>(await _services.CarWashWorkersId(id)); await _premiumAndRateServices.CreatePremiumAndRateServices(resultCarWashWorkersView.IdPosition.Value, id.Value); premiumAndRate = Mapper.Map <IEnumerable <PremiumAndRateView> >(await _premiumAndRateServices.SelectPosition(id.Value)).ToList(); } var position = Mapper.Map <IEnumerable <PositionView> >(await _position.GetTableAll()); ViewBag.Position = new SelectList(position, "idPosition", "name"); ViewBag.PositionAll = position; return(View(premiumAndRate)); }
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")); }
public async Task CurrentShift() { var ordersFulfilled = await _orderCarWashWorkers.SampleForPayroll(DateTime.Now); var DayClose = await _dayResult.DayResultViewInfo(); OrderCarWashWorkersBll orderCarWashWorkers = new OrderCarWashWorkersBll(); foreach (var itemShift in DayClose) { var resultShift = ordersFulfilled.Where(x => x.IdCarWashWorkers == itemShift.carWashWorkersId); foreach (var itemOrder in resultShift) { orderCarWashWorkers.Id = itemOrder.Id; orderCarWashWorkers.IdOrder = itemOrder.IdOrder; orderCarWashWorkers.IdCarWashWorkers = itemOrder.IdCarWashWorkers; orderCarWashWorkers.CalculationStatus = false; orderCarWashWorkers.Payroll = itemOrder.Payroll; orderCarWashWorkers.closedDayStatus = true; orderCarWashWorkers.typeServicesId = itemOrder.typeServicesId; await _orderCarWashWorkers.UpdateOrderCarWashWorkers(orderCarWashWorkers); } var resultCarWashWorkers = await _carWashWorkers.CarWashWorkersId(itemShift.carWashWorkersId); var InterestRate = (double)resultCarWashWorkers.InterestRate.Value / 100; if (resultCarWashWorkers.IdPosition >= 3) { await _bonusModules.PremiumAccrual(itemShift.carWashWorkersId, itemShift.payroll.Value / InterestRate); } else { var bonusAdmin = await _orderCarWashWorkers.SampleForPayroll(itemShift.carWashWorkersId, DateTime.Now); var test1 = bonusAdmin.Where(x => x.typeServicesId == 4).Sum(s => s.Payroll); var test2 = bonusAdmin.Where(x => x.typeServicesId == 6).Sum(s => s.Payroll); var test3 = bonusAdmin.Where(x => x.typeServicesId == 8).Sum(s => s.Payroll); var test4 = bonusAdmin.Where(x => x.typeServicesId == 10).Sum(s => s.Payroll); var result = test1 + test2 + test3 + test4; // await _bonusModules.PremiumAccrual(itemShift.carWashWorkersId, itemShift.payroll.Value / InterestRate); await _bonusModules.PremiumAccrual(itemShift.carWashWorkersId, result.Value / InterestRate); } } }
public async Task <ActionResult> CompletedOrdersOfOneEmployee(int?idEmploee) { if (idEmploee != null) { var carWashWorkersDayTotal = Mapper.Map <IEnumerable <OrderCarWashWorkersView> >(await _orderCarWashWorker.Reports(idEmploee.Value, DateTime.Now)); ViewBag.CarWashWorker = Mapper.Map <CarWashWorkersView>(await _carWashWorkers.CarWashWorkersId(idEmploee)); ViewBag.SumOrder = carWashWorkersDayTotal.Sum(x => x.Payroll); ViewBag.Sum = carWashWorkersDayTotal.Sum(x => x.OrderServicesCarWash.DiscountPrice); return(View(carWashWorkersDayTotal)); } return(View()); }