Beispiel #1
0
        public void GetDrawerSessionDetails()
        {
            if (DrawerSelector.Instance.DrawerSession == null)
            {
                return;
            }
            using (var ctx = new CashSummaryDBDataContext())

            {
                Instance.DrawerSessionDetails = new ObservableCollection <DrawSessionDetail>(ctx.DrawSessionDetails.Where(x =>
                                                                                                                          x.DrawSessionId == DrawerSelector.Instance.DrawerSession.DrawSessionId));
            }
        }
        public void GetDrawerSessionCashDetails()
        {
            using (var ctx = new CashSummaryDBDataContext())
            {
                var res = ctx.DrawSessionDetails
                          .Where(x => x.DrawSessionId == DrawerSelector.Instance.DrawerSession.DrawSessionId).ToList();
                foreach (var s in res)
                {
                    s.CashDetails = ctx.DrawerCashDetails.Where(x => x.DrawSessionId == s.DrawSessionId.ToString() && x.CashTypeComponent.CashType.Name == s.PayCode).ToList();
                }

                DrawSessionDetails         = new ObservableCollection <DrawSessionDetail>(res.Where(x => x.CashDetails.Any()).ToList());
                DrawerSessionsJournalEntry = ctx.DrawerSessionsJournalEntries.Where(x => x.DrawSessionId == DrawerSelector.Instance.DrawerSession.DrawSessionId)
                                             .ToList()
                                             .Select(x => new List <string>()
                {
                    $@"Debit: {x.DebitAccountNumber}  {x.DebitAccountDescription}  {x.Amount:C}",
                    $@"Credit: {x.CreditAccountNumber}  {x.CreditAccountDescription}  {x.Amount:C}"
                }).SelectMany(x => x).ToList();
            }
        }
        public void GetDrawerSessionDetails()
        {
            if (DrawerSelector.Instance.DrawerSession == null)
            {
                return;
            }
            DrawSessionDetail oldDrawSessionDetail = DrawSessionDetail;

            using (var ctx = new CashSummaryDBDataContext())

            {
                Instance.DrawerSessionDetails = new ObservableCollection <DrawSessionDetail>(ctx.DrawSessionDetails.Where(x =>
                                                                                                                          x.DrawSessionId == DrawerSelector.Instance.DrawerSession.DrawSessionId));
                if (Float == 0)
                {
                    if (DrawerSelector.Instance.DrawerSession.Status == "Posted")
                    {
                        Float = ctx.DrawerSessionStatus.FirstOrDefault(x =>
                                                                       x.DrawSessionId ==
                                                                       DrawerSelector.Instance.DrawerSession.DrawSessionId.ToString())
                                ?.Float ?? 0;
                    }
                    else
                    {
                        Float = ctx.StoreSettings.FirstOrDefault(x => x.StoreId == Convert.ToInt32(DrawerSelector.Instance.DrawerSession.StoreId))
                                ?.Float ?? 0;
                    }
                }



                NotifyDrawTotals();
            }

            if (oldDrawSessionDetail != null)
            {
                _drawSessionDetail = Instance.DrawerSessionDetails.FirstOrDefault(x =>
                                                                                  x.DrawSessionId == oldDrawSessionDetail.DrawSessionId && x.PayCode == oldDrawSessionDetail.PayCode);
            }
        }