public async Task <(OrderInformationWashingDetailingBll, EmployeeSalariesBll)> SelectCash(DateTime?startDate) { OrderInformationWashingDetailingBll orderInformation = new OrderInformationWashingDetailingBll(); var employeeSalaries = await EmployeeSalaries(startDate); // ЗП // Запрос на выборку var orderServices = await _orderServicesCarWash.Reports(startDate.Value); var selectCash = orderServices.Where(x => x.PaymentState == 1); // Мойка var OrderCarWashList = selectCash.Where(x => x.typeOfOrder == 2); orderInformation.OrderCarWashSum = OrderCarWashList.Sum(x => x.DiscountPrice); // Касса мойки var numberOfUnpaidOrdersCarWash = OrderCarWashList.Where(x => x.StatusOrder == 4); orderInformation.carWashCashSum = numberOfUnpaidOrdersCarWash.Sum(x => x.DiscountPrice); // Детейлинг var OrderDetelingList = selectCash.Where(x => x.typeOfOrder == 1); orderInformation.OrderDetailing = OrderDetelingList.Sum(x => x.DiscountPrice); // Касса детейлинг var numberOfUnpaidOrdersDetailings = OrderDetelingList.Where(x => x.StatusOrder == 4); orderInformation.detailingCashSum = numberOfUnpaidOrdersDetailings.Sum(x => x.DiscountPrice); // Ковры var OrderCarpetList = orderServices.Where(x => x.typeOfOrder == 3); orderInformation.carpetOrder = OrderCarpetList.Sum(x => x.DiscountPrice); // Касса ковров var numberOfUnpaidOrdersCarpetWashing = OrderCarpetList.Where(x => x.StatusOrder == 4); orderInformation.cashCarpets = numberOfUnpaidOrdersCarpetWashing.Sum(x => x.DiscountPrice); // шиномонтаж var OrderTireList = orderServices.Where(x => x.typeOfOrder == 4); orderInformation.TireOrders = OrderTireList.Sum(x => x.DiscountPrice); // Касса шиномонтаж var numberOfUnpaidOrdersTire = OrderTireList.Where(x => x.StatusOrder == 4); orderInformation.tireCeash = numberOfUnpaidOrdersTire.Sum(x => x.DiscountPrice); orderInformation.ordersInProgressCarWash = OrderCarWashList.Count(); // заказы мойки ожидают оплаты orderInformation.ordersInProgressDetailings = OrderDetelingList.Count(); // заказы детейлиинг ожидает оплаты orderInformation.ordersInProgressCarpetWashing = OrderCarpetList.Count(); // заказы чистка ковров ожидает оплаты orderInformation.OrderCount = OrderCarWashList.Count(); orderInformation.CarCountDetailings = OrderDetelingList.Count(); orderInformation.CauntCarpet = OrderCarpetList.Count(); orderInformation.CauntTire = OrderTireList.Count(); var resul = (orderInformation, employeeSalaries); return(resul); }
public OrderInformationWashingDetailingBll InfoOrder(IEnumerable <OrderServicesCarWashBll> orderServices) { var OrderCarWashList = orderServices.Where(x => x.typeOfOrder == 2); var OrderDetelingList = orderServices.Where(x => x.typeOfOrder == 1); var OrderCarpetList = orderServices.Where(x => x.typeOfOrder == 3); var OrderTireList = orderServices.Where(x => x.typeOfOrder == 4); var cashWhere = orderServices.Where(x => x.PaymentState == 1); var nonCashWhere = orderServices.Where(x => x.PaymentState == 2); var numberOfUnpaidOrdersCarWash = OrderCarWashList.Where(x => x.StatusOrder == 4); var numberOfUnpaidOrdersDetailings = OrderDetelingList.Where(x => x.StatusOrder == 4); var numberOfUnpaidOrdersCarpetWashing = OrderCarpetList.Where(x => x.StatusOrder == 4); var numberOfUnpaidOrdersTire = OrderTireList.Where(x => x.StatusOrder == 4); OrderInformationWashingDetailingBll orderInformation = new OrderInformationWashingDetailingBll(); orderInformation.OrderCarWashSum = OrderCarWashList.Sum(x => x.DiscountPrice); // Касса мойки orderInformation.OrderDetailing = OrderDetelingList.Sum(x => x.DiscountPrice); // Касса детейлинг orderInformation.carpetOrder = OrderCarpetList.Sum(x => x.DiscountPrice); // Касса ковров orderInformation.TireOrders = OrderTireList.Sum(x => x.DiscountPrice); // Касса шиномонтаж orderInformation.cash = cashWhere.Sum(s => s.DiscountPrice); // Наличный расчет orderInformation.nonCash = nonCashWhere.Sum(s => s.DiscountPrice); // Безналичный расчет // Количество заказов ожидающих оплату orderInformation.numberOfUnpaidOrdersCarWash = numberOfUnpaidOrdersCarWash.Sum(x => x.DiscountPrice); // Количество заказов ожидающих оплату (мойка) orderInformation.numberOfUnpaidOrdersDetailings = numberOfUnpaidOrdersDetailings.Sum(x => x.DiscountPrice); // Количество заказов ожидающих оплату (Детейлинг) orderInformation.numberOfUnpaidOrdersCarpetWashing = numberOfUnpaidOrdersCarpetWashing.Sum(x => x.DiscountPrice); // Количество заказов ожидающих оплату (Ковры) orderInformation.numberOfUnpaidTire = numberOfUnpaidOrdersTire.Sum(x => x.DiscountPrice); // касса наличных var carWashCash = numberOfUnpaidOrdersCarWash.Where(x => x.PaymentState == 1); //автомойка наличные var detailingCash = numberOfUnpaidOrdersDetailings.Where(x => x.PaymentState == 1); // детейлинг наличные var cashCarpets = numberOfUnpaidOrdersCarpetWashing.Where(x => x.PaymentState == 1); // ковры наличные var tireCash = numberOfUnpaidOrdersTire.Where(x => x.PaymentState == 1); //шиномонтаж наличные orderInformation.carWashCashSum = carWashCash.Sum(x => x.DiscountPrice); orderInformation.detailingCashSum = detailingCash.Sum(x => x.DiscountPrice); orderInformation.cashCarpets = cashCarpets.Sum(x => x.DiscountPrice); orderInformation.tireCeash = tireCash.Sum(x => x.DiscountPrice); orderInformation.ordersInProgressCarWash = OrderCarWashList.Count(); // заказы мойки ожидают оплаты orderInformation.ordersInProgressDetailings = OrderDetelingList.Count(); // заказы детейлиинг ожидает оплаты orderInformation.ordersInProgressCarpetWashing = OrderCarpetList.Count(); // заказы чистка ковров ожидает оплаты orderInformation.OrderCount = OrderCarWashList.Count(); orderInformation.CarCountDetailings = OrderDetelingList.Count(); orderInformation.CauntCarpet = OrderCarpetList.Count(); orderInformation.CauntTire = OrderTireList.Count(); return(orderInformation); }