private decimal RegisterAndGetCashInfo(out DateTime startdate, out DateTime enddate, out Dictionary <decimal, int> cashinNotes)
        {
            var amount = TransactionQueueHelper.TryRegisterMoneyOnHub(StationRepository.GetUid(ChangeTracker.CurrentUser), BusinessPropsHelper.GetNextTransactionId(), false, "STATION_CASH_OUT", (int)ChangeTracker.CurrentUser.AccountId, true, out startdate, out enddate);

            if (enddate - startdate < new TimeSpan(0, 0, 5))
            {
                startdate = DateTime.MinValue;
            }
            cashinNotes = GetNotesValuesAndCount(startdate, enddate);
            amount      = 0;
            foreach (var cashinNote in cashinNotes)
            {
                amount += cashinNote.Key * cashinNote.Value;
            }
            foreach (var cashinNote in cashinNotes)
            {
                Log.Debug("cashin notes:" + cashinNote.Key + " amount: " + cashinNote.Value);
            }
            return(amount);
        }
        public void askWindow_YesClick(object sender, EventArgs e)
        {
            PrinterHandler.InitPrinter(true);
            if (StationRepository.PrinterStatus == 0)
            {
                ShowPrinterErrorMessage();
                return;
            }

            long cashoutId = GetLastCashoutId() + 1;
            Dictionary <Decimal, int> CashinNotes = GetNotesValuesAndCount(cashoutId);

            TransactionQueueHelper.TryRegisterMoneyOnHub(StationRepository.GetUid(ChangeTracker.CurrentUser), BusinessPropsHelper.GetNextTransactionId(), ref _cashinCurrentAmount, false, "STATION_CASH_OUT", (int)ChangeTracker.CurrentUser.AccountId, true);
            foreach (var cashinNote in CashinNotes)
            {
                Log.Debug("cashin notes:" + cashinNote.Key + " amount: " + cashinNote.Value);
            }
            PrinterHandler.PrintCashBalance(CashinNotes, ChangeTracker.LastCashoutDate, DateTime.Now, _cashinCurrentAmount, 0, _cashinCurrentAmount, false, false, ChangeTracker.CurrentUser.Username, GetNumberOfCheckpoints() + 1);
            UpdateCashSummary();
            Mediator.SendMessage("", MsgTag.RefreshCashOperations);
        }
        public void PleaseWaitCloseBalance()
        {
            PrinterHandler.InitPrinter(true);
            if (StationRepository.PrinterStatus == 0)
            {
                ShowPrinterErrorMessage();
                return;
            }

            long cashoutId = GetLastCashoutId() + 1;
            Dictionary <Decimal, int> CashinNotes = GetNotesValuesAndCount(cashoutId);
            decimal cashoutCurrentAmount          = 0;

            TransactionQueueHelper.TryRegisterMoneyOnHub(StationRepository.GetUid(ChangeTracker.CurrentUser), BusinessPropsHelper.GetNextTransactionId(), ref _cashinCurrentAmount, false, "STATION_CASH_OUT", (int)ChangeTracker.CurrentUser.AccountId, true);
            foreach (var cashinNote in CashinNotes)
            {
                Log.Debug("cashin notes:" + cashinNote.Key + " amount: " + cashinNote.Value);
            }
            PrinterHandler.PrintCashBalance(CashinNotes, StartDate, DateTime.Now, _cashinCurrentAmount, 0, _cashinCurrentAmount, false, false, ChangeTracker.CurrentUser.Username, GetNumberOfCheckpoints() + 1);
            BusinessPropsHelper.GetAccountingAmount(out _cashinCurrentAmount, out cashoutCurrentAmount);
            IsEnabledCloseBalance = _cashinCurrentAmount - cashoutCurrentAmount > 0;
        }