Ejemplo n.º 1
0
        public ActionResult PrintCashCount(int id)
        {
            var model   = new CashCountReport();
            var session = CashSession.Find(id);
            var qry     = from x in CustomerPayment.Queryable
                          where x.CashSession.Id == session.Id
                          select new {
                Type   = x.Method,
                Amount = x.Amount
            };
            var list = from x in qry.ToList()
                       group x by x.Type into g
                       select new MoneyCount {
                Type = g.Key, Amount = g.Sum(y => y.Amount)
            };

            model.Cashier      = session.Cashier;
            model.CashDrawer   = session.CashDrawer;
            model.Start        = session.Start;
            model.End          = session.End;
            model.MoneyCounts  = list.ToList();
            model.CashCounts   = session.CashCounts.Where(x => x.Type == CashCountType.CountedCash).ToList();
            model.StartingCash = session.StartingCash;
            model.SessionId    = session.Id;

            return(PdfTicketView("_CashCountTicket", model));
        }
Ejemplo n.º 2
0
        public ActionResult CloseSessionConfirmed(int id)
        {
            var session = CashSession.Find(id);
            var qry     = from x in CustomerPayment.Queryable
                          where x.CashSession.Id == session.Id
                          select new {
                Type   = x.Method,
                Amount = x.Amount
            };
            var list = from x in qry.ToList()
                       group x by x.Type into g
                       select new MoneyCount {
                Type = g.Key, Amount = g.Sum(y => y.Amount)
            };

            return(View(new MasterDetails <CashSession, MoneyCount> {
                Master = session,
                Details = list.ToList()
            }));
        }
Ejemplo n.º 3
0
        public ActionResult CloseSession(CashSession item)
        {
            var cash_counts = item.CashCounts.Where(x => x.Quantity > 0).ToList();

            item     = CashSession.Find(item.Id);
            item.End = DateTime.Now;

            using (var scope = new TransactionScope()) {
                foreach (var x in cash_counts)
                {
                    x.Session = item;
                    x.Type    = CashCountType.CountedCash;
                    x.Create();
                }

                item.UpdateAndFlush();
            }

            return(RedirectToAction("CloseSessionConfirmed", new {
                id = item.Id
            }));
        }