Ejemplo n.º 1
0
        public ActionResult OpenSession(CashSession item)
        {
            item.CashDrawer = WebConfig.CashDrawer;

            if (item.CashDrawer == null)
            {
                return(View("InvalidCashDrawer"));
            }

            if (GetSession() != null)
            {
                return(RedirectToAction("Index"));
            }

            var cash_counts = item.CashCounts.Where(x => x.Quantity > 0).ToList();

            item.Start   = DateTime.Now;
            item.Cashier = Model.User.Find(User.Identity.Name).Employee;
            item.CashCounts.Clear();

            using (var scope = new TransactionScope()) {
                item.Create();

                foreach (var x in cash_counts)
                {
                    x.Session = item;
                    x.Type    = CashCountType.StartingCash;
                    x.Create();
                }
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
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.º 3
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.º 4
0
        public ActionResult OpenSession()
        {
            if (GetSession() != null)
            {
                return(RedirectToAction("Index"));
            }

            var model = new CashSession {
                Start      = DateTime.Now,
                CashCounts = CashHelpers.ListDenominations(),
                CashDrawer = WebConfig.CashDrawer,
                Cashier    = CurrentUser.Employee
            };

            if (model.CashDrawer == null)
            {
                return(View("InvalidCashDrawer"));
            }

            return(View(model));
        }
Ejemplo n.º 5
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
            }));
        }
Ejemplo n.º 6
0
        public ActionResult OpenSession(CashSession item)
        {
            item.CashDrawer = WebConfig.CashDrawer;

            if (item.CashDrawer == null)
                return View ("InvalidCashDrawer");

            if (GetSession () != null)
                return RedirectToAction ("Index");

            var cash_counts = item.CashCounts.Where (x => x.Quantity > 0).ToList ();

            item.Start = DateTime.Now;
            item.Cashier = Model.User.Find (User.Identity.Name).Employee;
            item.CashCounts.Clear ();

            using (var scope = new TransactionScope ()) {
                item.Create ();

                foreach (var x in cash_counts) {
                    x.Session = item;
                    x.Type = CashCountType.StartingCash;
                    x.Create ();
                }
            }

            return RedirectToAction ("Index");
        }
Ejemplo n.º 7
0
        public ActionResult OpenSession()
        {
            if (GetSession () != null) {
                return RedirectToAction ("Index");
            }

            var model = new CashSession {
                Start = DateTime.Now,
                CashCounts = CashHelpers.ListDenominations (),
                CashDrawer = WebConfig.CashDrawer,
                Cashier = CurrentUser.Employee
            };

            if (model.CashDrawer == null) {
                return View ("InvalidCashDrawer");
            }

            return View (model);
        }
Ejemplo n.º 8
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
            });
        }