private async Task AddSalaryArchive(int?id) { var orderCarWorkers = await _orderCarWashWorkers.SelectMonth(id, DateTime.Now.AddMonths(-1).Month, DateTime.Now.Year); var salaryExpenses = await _salaryExpenses.PayrollExpensesPerMonth(id, DateTime.Now.AddMonths(-1).Month, DateTime.Now.Year); SalaryArchiveBll salaryArchive = new SalaryArchiveBll(); salaryArchive.carWashWorkersId = id.Value; salaryArchive.date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(0).AddDays(-1); salaryArchive.amountOfCompletedOrders = orderCarWorkers.Count(); salaryArchive.monthlySalaryAmountEarned = orderCarWorkers.Sum(x => x.Payroll); salaryArchive.monthlySalaryAmountReceived = salaryExpenses.Sum(x => x.Expenses.Amount); salaryArchive.balanceAtTheEndOfTheMonth = (salaryArchive.monthlySalaryAmountReceived - salaryArchive.monthlySalaryAmountEarned); if (salaryArchive.balanceAtTheEndOfTheMonth == 0) { salaryArchive.salaryStatus = true; } else { salaryArchive.salaryStatus = false; } await _salaryArchive.Insert(salaryArchive); }
public async Task <IEnumerable <WagesForDaysWorkedBll> > MonthOrderResult(int?id, int month, int year) => GroupOrderCarWashWorkers(await _orderCarWash.SelectMonth(id, month, year));