Combine Tables to a Head Table and/or Set Table as Occupied

Combine Tables to a Head Table and/or Set Table as Occupied

Features:

  • Visually see what tables are being used.
  • Will not interfere with normal table/ticket operations.
  • Combined Tables displays the Head Table.
  • Tables can returned to Available using normal table/ticket operation.
  • When the head table is paid, all combined tables will returned to Available state.
  • On Modes will automatically be turned off when navigating away from Table Operations screen.

Mark Table as Combined & Occupied Animation


Things needed to accomplish this:

  • 2 new Entity States
  • 1 new Custom Fields for Table Entities
  • 8 new Actions
  • 12 new Rules
  • 1 new Entity Screen

:warning: When copying from this tutorial, be careful of an extra space behind the pasted text.

:warning: If you are implementing this on a new database or after a Clear Database Transactions, you will need to open and close each Table to set the Table state to “Available”.


Entity States

Combined Tables State (1 of 2)

Manage → Settings → States → Add State

Name: Combined Tables
State Name: Status
State Type: Entity State
Color: Orange
Display Format: $1<br/>Combined w/Table<br/><b>{ENTITY CUSTOMDATA BY NAME:Tables.$1:Combined Tables}</b>
Quantity Format: (blank)
Price Format: (blank)
Show on End of Day Records: (unchecked)
Show on Product Reports: (unchecked)
Show on Ticket: (unchecked)

Occupied State (2 of 2)

Manage → Settings → States → Add State

Name: Occupied
State Name: Status
State Type: Entity State
Color: Yellow
Display Format: $1<br/><b>Table Occupied</b><br/><sym></sym> {ENTITY STATE MINUTES:Status} Mins
Quantity Format: (blank)
Price Format: (blank)
Show on End of Day Records: (unchecked)
Show on Product Reports: (unchecked)
Show on Ticket: (unchecked)

Add Custom Field to Tables Entity

Manage → Entities → Entity Types → Tables → Custom Field (tab) → Add Custom Field

Custom Field Name: Combined Tables
Field Type: String
Mask Type: Simple
Editing Format: (blank)
Default Format: (blank)
Values: (blank)
Value Mappings: (blank)

Actions

Manage → Automation → Actions → Add Action

(1 of 8) CMBTBL - Clear Combined Tables Field (Loop Values)

Action Name: CMBTBL - Clear Combined Tables Field (Loop Values)
Action Type: Loop Values
Name: CMBTBL-Clear Combined Tables Field
Values: {REPORT ENTITY DETAILS:E.Name:(ET=Tables) && (EC.Combined Tables={ENTITY NAME:Tables})::,}
Split Char: , (comma)
Display Progress For Items: (blank)
Progress Title: (blank)

(2 of 8) CMBTBL - Refresh Tables Widget

Action Name: CMBTBL - Refresh Tables Widget
Action Type: Refresh Widgets
Widget Names: cmbtbl-tables

(3 of 8) CMBTBL - Show Head Table Message

Action Name: CMBTBL - Show Head Table Message
Action Type: Show Message
Message: Select the first table as\r the Head Table.

(4 of 8) CMBTBL - Update Combined Table Field (Entity)

Action Name: CMBTBL - Update Combined Table Field (Entity)
Action Type: Update Entity Data
Entity Type Name: Tables
Entity Name: [:Table Name]
Field Name: Combined Tables
Field Value: [:Head Table Name]

(5 of 8) CMBTBL - Set Table State

Action-CMBTBL - Set Table State

Action Name: CMBTBL - Set Table State
Action Type: Update Entity State
Entity Type Name: Tables
Entity Name: [:Table Name]
Entity State Name: Status
Current State: [:Present State]
Entity State: [:State]
Quantity Exp: (blank)

(6 of 8) CMBTBL - Combine Tables Mode (Settings)

Action Name: CMBTBL - Combine Tables Mode (Settings)
Action Type: Update Program Setting
Setting Name: CombineTablesMode
Setting Value: [:Mode On/(blank)]
Update Type: Update
Is Local: True

(7 of 8) CMBTBL - Head Table (Settings)

Action Name: CMBTBL - Head Table (Settings)
Action Type: Update Program Setting
Setting Name: CMBTBL-HeadTable
Setting Value: [:Head Table Name]
Update Type: Update
Is Local: True

(8 of 8) CMBTBL - Mark Table as Occupied Mode (Settings)

Action Name: CMBTBL - Mark Table as Occupied Mode (Settings)
Action Type: Update Program Setting
Setting Name: MarkTableasOccupiedMode
Setting Value: [:Mark Table as Occupied On/(blank)]
Update Type: Update
Is Local: True

Rules (12 rules)

Manage → Automation → Rules → Add Rule

(1 of 12) CMBTBL - Turn Mode On - Mark Table as Occupied

Rule Name: CMBTBL - Turn Mode On - Mark Table as Occupied
Event Name: Automation Command Executed

Custom Constraint List

Execute Rule If: Matches
Automation Command Name Equals Mark Table as Occupied
{LOCAL SETTING:MarkTableasOccupiedMode} Is Null (blank)
{LOCAL SETTING:CombineTablesMode} Is Null (blank)

---- Actions ----

Action (1 of 2): ``CMBTBL - Mark Table as Occupied Mode (Settings)`
Constraint: (blank)
Mark Table as Occupied On/(blank) On
Action (2 of 2): CMBTBL - Refresh Tables Widget
Constraint (blank)
Rule Purpose
  • This will write the word “On” to the Combine Table program setting action when the “Mark Table as Occupied Mode” button is pressed on the entity screen.
  • Constrained to make sure both program settings are blank (null) to prevent both settings being enabled.
  • We use a null program setting for when the SambaPOS is restarted, local program settings are defaulted to being null (erased). If we used the word “Off” we would need some mechanism to automatically write the word “Off” to program settings action.

(2 of 12) CMBTBL - Turn Mode Off - Mark Table as Occupied

Rule Name: CMBTBL - Turn Mode Off - Mark Table as Occupied
Event Name: Automation Command Executed

Custom Constraint List

Execute Rule If: Matches
Automation Command Name Equals Mark Table as Occupied
{LOCAL SETTING:MarkTableasOccupiedMode} Equals On

---- Actions ----

Action (1 of 2): CMBTBL - Mark Table as Occupied Mode (Settings)
Constraint: (blank)
Mark Table as Occupied On/(blank) (blank)
Action (2 of 2): CMBTBL - Refresh Tables Widget
Constraint (blank)
Rule Purpose
  • This will clear the Combine Tables program settings action when the “Mark Table as Occupied Mode” button is pressed.

(3 of 12) CMBTBL - Turn Mode On - Combine Tables

Rule Name: CMBTBL - Turn Mode On - Combine Tables
Event Name: Automation Command Executed

Custom Constraint List

Execute Rule If: Matches
Automation Command Name Equals Combine Mode
{LOCAL SETTING:CombineTablesMode} Is Null (blank)
{LOCAL SETTING:MarkTableasOccupiedMode} Is Null (blank)

---- Actions ----

Action (1 of 3): CMBTBL - Combine Tables Mode (Settings)
Constraint: (blank)
Mark Table as Occupied On/(blank) On
Action (2 of 3): CMBTBL - Refresh Tables Widget
Constraint (blank)
Action (3 of 3): CMBTBL - Show Head Table Message
Constraint (blank)
Rule Purpose
  • This will write the word “On” to the Combine Table program setting action when the “Combine Tables Mode” button is pressed on the entity screen.
  • Constrained to make sure both program settings are blank (null) to prevent both settings being enabled.

(4 of 12) CMBTBL - Turn Mode Off - Combine Tables

Rule Name: CMBTBL - Turn Mode Off - Combine Tables
Event Name: Automation Command Executed

Custom Constraint List

Execute Rule If: Matches All
Automation Command Name Equals Combine Mode
{LOCAL SETTING:CombineTablesMode} Equals On

---- Actions ----

Action (1 of 3): CMBTBL - Combine Tables Mode (Settings)
Constraint: (blank)
Mode On/(blank) (blank)
Action (2 of 3): CMBTBL - Head Table (Settings)
Constraint (blank)
Head Table Name: {blank)
Action (3 of 3): CMBTBL - Refresh Tables Widget
Constraint (blank)
Rule Purpose
  • This will clear the Combine Tables & Head Table program settings action when the “Combine Tables Mode” button is pressed.

(5 of 12) CMBTBL - Mode - On - Set Head Table

Rule Name: CMBTBL - Mode - On - Set Head Table
Event Name: Automation Command Executed

Custom Constraint List

Execute Rule If: Matches All
Automation Command Name Equals Combined Tables
{LOCAL SETTING:CombineTablesMode} Equals On
{LOCAL SETTING:CMBTBL-HeadTable} Is Null (blank)
{ENTITY STATE BY NAME:Tables.[:CommandValue]:Status} Not Equals Combined Tables

---- Actions ----

Action (1 of 2): CMBTBL - Head Table (Settings)
Constraint: (blank)
Head Table Name [:CommandValue]
Action (2 of 2): CMBTBL - Refresh Tables Widget
Constraint (blank)
Rule Purpose
  • This will write the Command Value, sent from the entity screen, to be written to the program settings action. This value will then be written to the tables new custom field.

(6 of 12) CMBTBL - Mode - On - Remove Tables From Head Table

Rule Name: CMBTBL - Mode - On - Remove Tables From Head Table
Event Name: Automation Command Executed

Custom Constraint List

Execute Rule If: Matches All
Automation Command Name Equals Combined Tables
{LOCAL SETTING:CombineTablesMode} Equals On
{ENTITY STATE BY NAME:Tables.[:CommandValue]:Status} Equals Combined Tables

---- Actions ----

Action (1 of 3): CMBTBL - Set Table State
Constraint: (blank)
Table Name [:CommandValue]
Present State (blank)
State Available
Action (2 of 3): CMBTBL - Update Combined Table Field (Entity)
Constraint: (blank)
Table Name [:CommandValue]
Head Table Name (blank)
Action (3 of 3): CMBTBL - Refresh Tables Widget
Constraint (blank)
Rule Purpose

This will remove the state Combined Table back to the state as Available. Usefully for accidently selecting a table or removing a Combined Table.

(7 of 12) CMBTBL - Mode - On - Add Tables to Head Table

Rule Name: CMBTBL - Mode - On - Add Tables to Head Table
Event Name: Automation Command Executed

Custom Constraint List

Execute Rule If: Matches All
Automation Command Name Equals Combined Tables
{LOCAL SETTING:CombineTablesMode} Equals On
{ENTITY STATE BY NAME:Tables.[:CommandValue]:Status} Equals Available
{LOCAL SETTING:CMBTBL-HeadTable} Is Not Null (blank)
{LOCAL SETTING:CMBTBL-HeadTable} Not Equals [:CommandValue]

---- Actions ----

Action (1 of 3): CMBTBL - Set Table State
Constraint: (blank)
Table Name [:CommandValue]
Present State (blank)
State Combined Tables
Action (2 of 3): CMBTBL - Update Combined Table Field (Entity)
Constraint: (blank)
Table Name [:CommandValue]
Head Table Name {LOCAL SETTING:CMBTBL-HeadTable}
Action (3 of 3): CMBTBL - Refresh Tables Widget
Constraint (blank)
Rule Purpose

This will change a table state from Available to the state of Combined Table.

(8 of 12) CMBTBL - Mode - On - Mark Table(s) From Available to Occupied

Rule Name: CMBTBL - Mode - On - Mark Table(s) From Available to Occupied
Event Name: Automation Command Executed

Custom Constraint List

Execute Rule If: Matches All
Automation Command Name Equals Combined Tables
{LOCAL SETTING:MarkTableasOccupiedMode} Equals On
{ENTITY STATE BY NAME:Tables.[:CommandValue]:Status} Equals Available

---- Actions ----

Action (1 of 2): CMBTBL - Set Table State
Constraint: (blank)
Table Name [:CommandValue]
Present State (blank)
State Occupied
Action (2 of 2): CMBTBL - Refresh Tables Widget
Constraint (blank)
Rule Purpose

This will mark selected tables as Occupied.

(9 of 12) CMBTBL - Mode - On - Mark Table(s) From Occupied to Available

Rule Name: CMBTBL - Mode - On - Mark Table(s) From Occupied to Available
Event Name: Automation Command Executed

Custom Constraint List

Execute Rule If: Matches All
Automation Command Name Equals Combined Tables
{LOCAL SETTING:MarkTableasOccupiedMode} Equals On
{ENTITY STATE BY NAME:Tables.[:CommandValue]:Status} Equals Occupied

---- Actions ----

Action (1 of 2): CMBTBL - Set Table State
Constraint: (blank)
Table Name [:CommandValue]
Present State (blank)
State Available
Action (2 of 2): CMBTBL - Refresh Tables Widget
Constraint (blank)
Rule Purpose

This will mark selected tables from Occupied back to Available.

(10 of 12) CMBTBL - Auto set Mode of Off

Rule Name: CMBTBL - Auto set Mode of Off
Event Name: Entity Screen Changed

Custom Constraint List

Execute Rule If: Matches
Previous Entity Screen Name Equals Tables Operations

---- Actions ----

Action (1 of 3): CMBTBL - Mark Table as Occupied Mode (Settings)
Constraint: (blank)
Mark Table as Occupied On/(blank) (blank)
Action (2 of 3): CMBTBL - Combine Tables Mode (Settings)
Constraint (blank)
Mode On/(blank) (blank)
Action (3 of 3): CMBTBL - Refresh Tables Widget
Constraint (blank)
Rule Purpose

This will automatically turn both Modes off when the screen is changed.

(11 of 12) CMBTBL - Loop Combined Tables Fields After Full Payment

Rule Name: CMBTBL - Loop Combined Tables Fields After Full Payment
Event Name: Payment Processed

Custom Constraint List

Execute Rule If: Matches
Remaining Amount Equals 0
{REPORT ENTITY DETAILS:E.Name:(ET=Tables) && (EC.Combined Tables={ENTITY NAME:Tables})} Is Not Null (blank)

---- Actions ----

Action (1 of 1): CMBTBL - Clear Combined Tables Field (Loop Values)
Constraint: (blank)
Rule Purpose
  • After payment, this rule will check if the table that had the payment is listed on any other table entities Combined Tables custom field. Then create a list of those tables to pass along to the looping values rule.

(12 of 12) CMBTBL - Clear Combined Tables Field

Rule Name: CMBTBL - Clear Combined Tables Field
Event Name: Value Looped

Custom Constraint List

Execute Rule If: Matches
Name Equals CMBTBL-Clear Combined Tables Field

---- Actions ----

Action (1 of 2): CMBTBL - Set Table State
Constraint: (blank)
Table Name [:LoopValue]
Present State Combined Tables
State Available
Action (2 of 2): CMBTBL - Update Combined Table Field (Entity)
Constraint: (blank)
Table Name [:LoopValue]
Head Table Name (blank)
Rule Purpose
  • It will also clear the Custom Field value of the table.
  • If present it will change the state from Combined Table to Available. If a table does not a state of Combined Table, it will not change the state.

Entity Screen

Manage → Entities → Entity Screens → select Tables → right click and select Clone

EntityScreen-Tables Operations1of3

Name: Table Operations
Button Header: Table Operations
Ticket Type: (leave as-is)
View Mode: Custom or Layout
Appearance Tab
Use State Display Format 1 Check marked
Mappings Tab
Visibility Column 2 POS
all other fields: (leave the same)

1 - This will also needed to be enabled in your original All Tables entity screen to view the colors and text of the state Display Format.

2 - This option will prevent the Table Operations tab from being displayed when a ticket is open.

Editing the new Entity Screen

  • Navigate to your tables screen, there should be a new tab at the top called “Table Operations”. - Select that tab.
  • Right click and select “Design Mode” from the pop-up.
  • If any widget is present select and move down to leave space near the top.
  • Right click on any blank area and select “Add Widget” → “Automation Command Button”.
  • Select the new button and position near the left upper part of the screen.
  • Right click and select “Settings (Automation Command Button)”



Command Name Combine Mode
Value (blank)
Caption [= '{LOCAL SETTING:CombineTablesMode}' == 'On' ? '<panel Green>Combine Tables Mode\: <bold>On</bold><br/><size 10>Head Table set to: <bold>{LOCAL SETTING:CMBTBL-HeadTable}</bold></size></panel>' : '<panel Orange>Combine Tables Mode\: <bold>Off</bold></panel>']
Button Color
Highlight Color
Font Size 20
All other fields (blank)
  • Click OK

  • Right click again and choose Prosperities (Automation Command Button)

  • Name: cmbtbl-tables
    click OK.

  • Create another Automation Command Button


Command Name Mark Table as Occupied
Value (blank)
Caption [= '{LOCAL SETTING:MarkTableasOccupiedMode}' == 'On' ? '<panel Green><color black>Mark Table as Occupied Mode\: <bold>On</bold></color></panel>' : '<panel Yellow><color Black>Mark Table as Occupied Mode\: <bold>Off</bold></color></panel>']
Button Color
Highlight Color
Font Size 20
All other fields (blank)
  • Click OK

  • Right click again and choose Prosperities (Automation Command Button)

  • Name: cmbtbl-tables
    click OK.

  • Right click on any blank area and select “Add Widget” → “Label Widget”.

  • Select and right click and choose “Settings (Label Widget)”.

  • Text area enter:
    [= '{LOCAL SETTING:CombineTablesMode}' == 'On' ? '<panel Orange></panel>' : '{LOCAL SETTING:MarkTableasOccupiedMode}' == 'On' ? '<panel Yellow></panel>' : '']
    Click OK.

  • Right click, select "Properties (Label Widget).

  • Enter in the Name field: cmbtbl-tables
    Click OK.

  • Right click in a blank area and choose “Design Mode” to exit out of design mode.

From here you should be able to click on one of the 2 buttons to enable the “Label Widget” to change colors. With one of the buttons enabled, enter into Design mode again (this will allow you to see the label area).

  • Select the “Label Widget” and resize the widget and place near the right size. In the animation, I have it set to 1 pixel width.

  • Create 3 more “Label Widgets” with the same settings and place near edge of the screen and 1 under the buttons. You may have to exit out of “Design Mode” and enable a button.

  • Create a “Entity Grid” and resize to take most of the screen.

  • Change these Settings fields:

Entity Type Tables
Display state Status
Automation Command Combined Tables
Command Value {ENTITY NAME}

Properties

  • Name cmbtbl-tables
1 Like

At quick glance, won’t the {LOCAL SETTING:CMBTL-HeadTable} with the trailing space evaluate Is Null as false no matter what’s returned by the tag? Even if the setting returns empty (which technically isn’t null, but that’s an argument for another time), the space will still be there.

I think the forum makers (not SambaPOS) changed some things in the background.

If you triple click on a report tag above and paste it into SambaPOS, it will add a space behind the report tag. I check with a previous tutorial I wrote, and it does not do that.

Regular text works just fine. As well as using the mouse to highlight the whole report tag.