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")); }
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)); }
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() })); }
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)); }
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 })); }
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"); }
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); }
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 }); }