Beispiel #1
0
        public ActionResult DetailsOf(int SaleID, int CategoryID, string time)
        {
            var details = db.DetailedSales
                          .Where(n => n.SaleID == SaleID &&
                                 n.CategoryID == CategoryID)
                          .Include(n => n.Category)
                          .Include(n => n.User)
                          .OrderByDescending(n => n.Time)
                          .ToList();

            if (details.Count == 0)
            {
                MessageSetter.Set("Sorry there is no record.");
                return(DetermineSaleDay(SaleID));
            }

            ViewBag.TimeZone  = Zone.Get();
            ViewBag.Cash      = details.Sum(n => n.SoldAt);
            ViewBag.Items     = details.Count(n => !n.IsMarkedDiscard);
            ViewBag.Discounts = details.Sum(n => n.Discount);
            ViewBag.Discards  = details.Count(n => n.IsDiscard);
            return(View(details));
        }