private void PrintCreditNoteFromTicketPleaseWait()
        {
            string error    = "";
            var    number   = BusinessPropsHelper.GenerateNextCreditNoteNumber();
            var    checkSum = new PasswordGenerator().Generate(4, 4, true);


            var result = TransactionQueueHelper.TryDepositByTicketMoneyOnHub(BusinessPropsHelper.GetNextTransactionId(), StationRepository.GetUid(ChangeTracker.CurrentUser), CurrentTicket.ticketNbr, CurrentTicket.checkSum, number, checkSum, ref error);

            if (!result)
            {
                ShowError(error);
            }
            else
            {
                var sucess = PrinterHandler.PrintCreditNote(CurrentTicket.wonAmount, number, checkSum, false, DateTime.MinValue, DateTime.MinValue);

                if (!sucess)
                {
                    GetMoneyFromCreditNote(new CreditNoteWS()
                    {
                        amount = CurrentTicket.wonAmount, number = number, code = checkSum
                    });
                    ShowError(TranslationProvider.Translate(MultistringTags.UNABLE_TO_PRINT_CREDITNOTE) + "\r\n" + TranslationProvider.Translate(MultistringTags.SHOP_FORM_CREDITNOTE) + ": " + number + " " + checkSum);
                }
            }
            Log.Error(error, new Exception(error));

            CurrentTicket = WsdlRepository.LoadTicket(CurrentTicket.ticketNbr, CurrentTicket.checkSum, StationRepository.StationNumber, SelectedLanguage, SelectedLanguage, true);
            ReloadTicket(CurrentTicket);
        }
Beispiel #2
0
        public int StoreTicket(User uid, TicketWS TicketDataWS, string StationNumber, bool IsOffLineTicket, string pin, bool livebet)
        {
            StationRepository.SetStationAppConfigValue("LastTicketNbr", TicketDataWS.ticketNbr + " " + TicketDataWS.checkSum);

            int iResult = TransactionQueueHelper.TryStoreTicketOnHub(BusinessPropsHelper.GetNextTransactionId(), StationRepository.GetUid(uid), TicketDataWS, StationNumber, IsOffLineTicket, pin);

            return(iResult);
        }
        public void AddMoney(object sender, CashInEventArgs e)
        {
            ChangeTracker.CurrentUser.DailyLimit   -= e.MoneyIn;
            ChangeTracker.CurrentUser.MonthlyLimit -= e.MoneyIn;
            ChangeTracker.CurrentUser.WeeklyLimit  -= e.MoneyIn;
            Exception error   = null;
            var       balance = TransactionQueueHelper.TryDepositMoneyOnHub(BusinessPropsHelper.GetNextTransactionId(), StationRepository.GetUid(ChangeTracker.CurrentUser), e.MoneyIn, true, ref error, e.IsCoin ? CashAcceptorType.CoinAcceptor : CashAcceptorType.BillValidator);

            AddMoneyToTerminal(e.MoneyIn, error == null ? "" : error.ToString(), balance);
        }
        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 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;
        }
        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);
        }