// GET: TotalOfProfits/Details/5



        public IActionResult Summation(DateTime Date)
        {
            SummationVm model = new SummationVm();
            string      Datee = Date.ToShortDateString();

            var IMerchantReciepts = _context.IMerchantReciept.Include(m => m.Merchant).ToList();

            model.IMerchantReciepts = IMerchantReciepts.Where(m => m.Date.ToShortDateString() == Datee).ToList();

            var ISellerReciepts = _context.ISellerReciepts.Include(m => m.Merchant).ToList();

            model.ISellerReciepts = ISellerReciepts.Where(m => m.Date.ToShortDateString() == Datee).ToList();
            // labour
            var additionalLabour = _context.AdditionalPayments.ToList().Where(x => x.Date.ToShortDateString() == Date.ToShortDateString() && x.Name == "عمال").Sum(x => x.Value);
            //var debtSarhaLabour = _context.Debts_Sarhas.Include(x=>x.Debt).ToList().Where(x => x.Date.ToShortDateString() == Date.ToShortDateString() && x.Debt.DebtName == "عمال").Sum(x => x.Price);
            var HalakaHalekLabour = _context.HalakaHaleks.Include(x => x.Debt).ToList().Where(x => x.Date.ToShortDateString() == Date.ToShortDateString() && x.Debt.DebtName == "عمال").Sum(x => x.Price);

            model.Labour = additionalLabour + HalakaHalekLabour;
            // ice
            var additionalIce = _context.AdditionalPayments.ToList().Where(x => x.Date.ToShortDateString() == Date.ToShortDateString() && x.Name == "ثلج").Sum(x => x.Value);
            //var debtSarhaIce = _context.Debts_Sarhas.Include(x => x.Debt).ToList().Where(x => x.Date.ToShortDateString() == Date.ToShortDateString() && x.Debt.DebtName == "ثلج").Sum(x => x.Price);
            var HalakaHalekIce = _context.HalakaHaleks.Include(x => x.Debt).ToList().Where(x => x.Date.ToShortDateString() == Date.ToShortDateString() && x.Debt.DebtName == "ثلج").Sum(x => x.Price);

            model.Ice = additionalIce + HalakaHalekIce;
            var TodayProfit = _context.TotalOfProfits.ToList().Where(x => x.Date.ToShortDateString() == Date.ToShortDateString());

            if (TodayProfit.Count() > 0)
            {
                ViewBag.Profit = TodayProfit.FirstOrDefault().Profit;
            }
            return(View(model));
        }
        public IActionResult SummationOfAday()
        {
            SummationVm model = new SummationVm();
            string      Datee = TimeNow().AddDays(10).ToShortDateString();

            var IMerchantReciepts = _context.IMerchantReciept.Include(m => m.Merchant).ToList();

            model.IMerchantReciepts = IMerchantReciepts.Where(m => m.Date.ToShortDateString() == Datee).ToList();

            var ISellerReciepts = _context.ISellerReciepts.Include(m => m.Merchant).ToList();

            model.ISellerReciepts = ISellerReciepts.Where(m => m.Date.ToShortDateString() == Datee).ToList();
            return(View(model));
        }