Beispiel #1
0
 void TicketCashoutControl_Closed(object sender, EventArgs e)
 {
     if (!paymentControl.IsTicketPayed)
     {
         TicketPayment.DeleteAll(SelectedTicket.PrimaryKey);
     }
 }
Beispiel #2
0
        private static double RefundTicket(Ticket selectedTicket, TicketRefundType refundType)
        {
            double sumOfPayments = TicketPayment.GetAll(selectedTicket.PrimaryKey)
                                   .Sum(payment => payment.Amount);

            // Don't refund money for items that were already returned
            sumOfPayments = TicketItemReturn.GetAllForTicket(selectedTicket.PrimaryKey)
                            .Aggregate(sumOfPayments, (current, ticketItemReturn) => current - ticketItemReturn.Amount);

            RegisterManager.ActiveRegisterDrawer.RemoveFromCurrentAmount(sumOfPayments);
            TicketPayment.DeleteAll(selectedTicket.PrimaryKey);
            TicketRefund.Add(selectedTicket.PrimaryKey, SessionManager.ActiveEmployee.Id,
                             RegisterManager.ActiveRegisterDrawer.Id, sumOfPayments, refundType);
            return(sumOfPayments);
        }
Beispiel #3
0
        // Rule: This should not be called on a cashed-out ticket. A ticket needs to
        // be refunded before it can be voided.
        public static bool VoidTicketCommand(Ticket selectedTicket)
        {
            IEnumerable <TicketPayment> ticketPayments =
                TicketPayment.GetAll(selectedTicket.PrimaryKey);

            if (ticketPayments.Any())
            {
                PosDialogWindow.ShowDialog(
                    Types.Strings.YouCantVoidATicketThatIsCashedoutTheTicketMustBeRefundedFirst,
                    Types.Strings.VoidError);
            }
            else if (ConfirmVoidPrompt())
            {
                VoidTicket(selectedTicket);
                return(true);
            }
            return(false);
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (numberEntryControl.FloatValue != null)
     {
         double amount = numberEntryControl.FloatValue.Value;
         if (amount > 0)
         {
             PaymentSource type         = GetPaymentType(sender);
             double        sum          = GetTotalPayments(TicketPayment.GetAll(SelectedTicket.PrimaryKey));
             double        total        = GetTicketTotal();
             double        due          = total - sum;
             double        actualAmount = amount;
             if (amount > due)
             {
                 amount = due;
             }
             TicketPayment.Add(SelectedTicket.PrimaryKey,
                               RegisterManager.ActiveRegisterDrawer.Id,
                               SessionManager.ActiveEmployee.Id, amount, type);
             InitializeTicket();
             if (IsTicketPayed)
             {
                 double amountPaid = sum + actualAmount;
                 double change     = actualAmount - amount;
                 labelAmountPayed.Content    = amountPaid.ToString("C2");
                 labelAmountDueLabel.Content = Types.Strings.ChangeDue;
                 labelAmountDue.Content      = change.ToString("C2");
                 RegisterManager.ActiveRegisterDrawer.AddToCurrentAmount(total);
                 SelectedTicket.SetCloseTime(DateTime.Now);
                 SelectedTicket.Update();
                 RegisterManager.OpenCashDrawer();
             }
         }
         numberEntryControl.FloatValue = null;
     }
 }
        public IActionResult PayTicket(long ticketNumber, [FromBody] TicketPayment payment)
        {
            IActionResult response = null;

            Ticket paidTicket = _context.Tickets.FirstOrDefault(t => t.TicketNumber == ticketNumber);

            if (paidTicket == null)
            {
                response = NotFound("Ticket not found. Please check your ticket number and try again.");
            }
            else if (paidTicket.TicketNumber != ticketNumber || paidTicket.TicketNumber != payment.TicketNumber)
            {
                response = BadRequest("Could not process your ticket. Please ensure the ticket number is correct.");
            }
            else
            {
                if (string.IsNullOrWhiteSpace(payment.CreditCardNumber))
                {
                    response = BadRequest("Please provide a credit card number");
                }
                else
                {
                    if (IsCreditCardValid(payment.CreditCardNumber))
                    {
                        PayTicket(paidTicket);
                        response = Ok("Your ticket has been paid.");
                    }
                    else
                    {
                        response = BadRequest("Credit card could not be verified. Please try again.");
                    }
                }
            }

            return(response);
        }
 private static void ResetTransactionalTables()
 {
     SettingManager.SetStoreSetting("DailyIdOffset", 0);
     DayOfOperation.Reset(typeof(DayOfOperation));
     EmployeeTimesheet.Reset(typeof(EmployeeTimesheet));
     EmployeeTimesheetChangeLog.Reset(typeof(EmployeeTimesheetChangeLog));
     Lock.Reset(typeof(Lock));
     Party.Reset(typeof(Party));
     PartyInvite.Reset(typeof(PartyInvite));
     RegisterDeposit.Reset(typeof(RegisterDeposit));
     RegisterDrawer.Reset(typeof(RegisterDrawer));
     RegisterDrop.Reset(typeof(RegisterDrop));
     RegisterNoSale.Reset(typeof(RegisterNoSale));
     RegisterPayout.Reset(typeof(RegisterPayout));
     Ticket.Reset(typeof(Ticket));
     TicketCoupon.Reset(typeof(TicketCoupon));
     TicketDiscount.Reset(typeof(TicketDiscount));
     TicketItem.Reset(typeof(TicketItem));
     TicketItemOption.Reset(typeof(TicketItemOption));
     TicketItemReturn.Reset(typeof(TicketItemReturn));
     TicketPayment.Reset(typeof(TicketPayment));
     TicketRefund.Reset(typeof(TicketRefund));
     TicketVoid.Reset(typeof(TicketVoid));
 }