Changing Ticket Closing (Locking) Workflow

:warning: While applying this tutorial a simple mistake can easily break how tickets works. Don’t forget to create a backup in advance.

When you fully settle a ticket it automatically closes and related table color changes from orange to white. To be able to handle some cases you might need to change this behavior. There might be different reasons for it but most common reasons are…

  • You want to track delivery status after ticket gets fully paid and want to close ticket after delivery status becomes Delivered.
  • You don’t want to change table color to white as soon as ticket gets fully paid. Customer may still sit on the table and you might want to keep ticket open until he leaves to permit adding more orders and keeping table color as orange.

###Implementation

The reason ticket automatically gets closed is Mark Ticket as Closed action that works on Ticket Payment Check rule.

Remove this action to see how SambaPOS behavior changes.

  1. Create a new ticket for a table.
  2. Close ticket without paying it.
  3. Reopen ticket and settle it.

As the result of this

  1. Table will appear still open.
  2. Ticket appears paid but you can still add orders or make changes on ticket.
  3. There is no way to close this ticket.

When ticket state becomes Paid we assume ticket should be closed but as we don’t want to do it we’ll add a new state called Closed and close ticket when ticket state becomes Closed.

We’ll create a new Before Ticket Closing rule for this.

If ticket status becomes Closed we’ll mark ticket as closed. Please keep in mind Mark Ticket as Closed action only works in Before Ticket Closing or Ticket Closing rules. Prefer Before Ticket Closing.

Now we have a new ticket state called Closed and we need to fine tune some current rules to work with this new state.

For Update New Order Entity Color rule I’ll include Paid state as I want to display Paid tickets as orange color.

Ticket Payment Check rule updates ticket state as Paid when Remaining Amount becomes 0. Now it should do it if ticket is not Closed. I’ve also added another constraint to ensure this ticket contains orders.

After this setup changing Ticket Status to Closed will close ticket.

I’ll create an action for this.

:bulb: I can use existing Update Ticket Status action. I’m creating a new action just to demonstrate better how it works. If you know how it works you can use it.

When I execute that action it will mark ticket’s status as closed and Ticket Closing Check rule will mark ticket as closed.

I can execute that action according to my need. For example I can execute it when ticket’s delivery status becomes Delivered or I can manually close it. I’ll show how to close it manually.

I’ll create a new Automation Command called Close Paid Ticket.

I want to see this button only if ticket’s status is Paid. For other states I shouldn’t see this button.

and when this button clicked I’ll execute Close Paid Ticket action. This action will update Ticket Status to Closed. I’ll also execute Close Ticket action to close ticket visually. I’ll create a rule for this.

Now when I open my ticket I should see Close Ticket button.

Clicking this button should close ticket and your table color should appear as White.

2 Likes

I moved 2 posts to a new topic: Attaching barcode reader

The above setup messes with Merging Tickets, leaving Empty, Unpaid, Unclosed tickets that cannot be Settled, and cannot be Closed, preventing Ending of a Workperiod.

To overcome this, you can add another Rule …

The above ensures the empty Tickets are marked as Closed. Their Status State remains Unpaid. You could add another Action to the above Rule to Update Ticket State to set some arbitrary value such as “Abandoned” or “May have been Merged” or “Unknown” or “Empty” or even “Paid” for that matter…

If you allow zero-priced Orders on Tickets, you could also Constrain it further so that it does not close Tickets which contain zero-priced items - in this case, check the {ORDER COUNT}

1 Like