SambaPOS

Documentation Website

User Tools

Site Tools


Sidebar

Installation

User interface

Basic concepts

  • Departments
  • Terminals
  • Users & user roles
  • Work periods
  • Tickets & orders
  • The POS menu
    • Products & product categories
    • Menus
    • Recipes
    • Product modifiers

Quick-start: setting up a (very basic) POS configuration

Advanced concepts

Customizing your POS system

Extra

Mobile Client

SambaPOS License

rules

Parts of a rule

You can create a new rule by going to the Manage screen, and then under “Automation”/“Rules”, you click the button “add rule”.

forum.sambapos.com_uploads_default_4483_527ca134c3c95ce4.jpg

To setup the rule, SambaPOS needs the following information:

  • Rule name: this can be any name you want (as long as there's no other rule with the same name).
  • Event name: this is the event that this rule will respond to.
  • Custom constraint list: a list of prerequisites that need to be met for the rule to have any effect.
  • Actions: the actions which will be executed if the constraints (prerequisites) are met.
  • Mappings: this will tell SambaPOS what terminals, what type of users, which departments etc this rule should apply for.

Custom Constraints

The custom constraints (or prerequisites) are made of two parts:

1. Execute rule if

Optionthe rule will execute …
Matches anyIf any one of the constraints are met
Matches allOnly if all of the constraints are met
Not matches anyIf none of the constraints are met
Not matches allIf just one of the constraints is not met
Matches This is a mixture of matches any and matches all. Constraints that have same name should match any and other constraints should match all. For example if we have three constraints as
  User Name Equals Admin
  User Name Equals Waiter 
  {TICKET TOTAL} Greater than 100 

That means User Name can be Admin or Waiter and Ticket Total should be greater than 100.

2. The Constraints

In a constraint, two values are compared to see if a variable has a certain value, or a bigger/smaller value than another variable, etc.

the left part: this can be a variable made available by the [event chosen][2], or a variable which is available at the time in the system (for example information about the current ticket, order, customer, table, etc).

the middle part: how to compare the left value with the value on the right

OperatorThe constraint will be met if…
Equals left and right part are exactly the same
Not Equals left and right part are not the same
Greater left part (a numeric value) is bigger than the right part
Less left part (a numeric value) is smaller than the right part
Is Null left part is not defined (NULL value in the database)
Is Not Null left right part is defined (not a NULL value in the database)
Starts left part (a string) starts with the value on the right
Ends left part (a string) ends with the value on the right
Contains left part (a string) contains the value on the right
Length Equals length of the left and right parts (strings) is the same
Matches left part matches to a regular expression defined in right part
Not Matches left part not matches to a regular expression defined in right part
Matches Mod10 left part is a numeric value validates modulus 10 (check digit) algorithm. For example we can use it to test if left part contains a valid Ean 13 Barcode. Luhn_algorithm
After left part (a date) is After the date value on the right
Before left part (a date) is Before the date value on the right

the right part: this can also be a variable, or an expression, or a set value.

Actions

Actions have 1 or more fields that can be filled in (or left empty if not needed):

  • Constraint: this is similar to the Rule's constraint, but it applies only to this specific action. In other words, if this prerequisite is not met, this action will not execute (but the other action's in the rule may execute, depending on their own constraints).
  • Any custom fields which have been defined in the action with a [:value] part in any of its parameters.

Here you can either type in a value or [?Message], in which case SambaPOS will ask the user to type in the value:

forum.sambapos.com_uploads_default_4714_c225887bed5d9172.jpg forum.sambapos.com_uploads_default_61_08ec3ef2ee93875d.jpg

The format for this is: [?Question] or [?Question:Mask] (Question is the text displayed next to the input box, Mask is the format of the value that can be typed, and is a regular expression)

For example:

  [1-9]|[1-4][0-9]|50 means: (1 to 9) or ((1 to 4) AND (0 to 9)) or 50. In other words: 1 to 50

(this works in V4.1.7 or later)

Mappings

Here you can decide that the rule should only apply for certain terminals, user roles, departments and/or ticket types.

forum.sambapos.com_uploads_default_4488_41232e4954ae8dc8.jpg

TerminalSometimes you want to have a rule which only works for a certain physical machine. For example if you want to setup an employee clock-in module, but you only want staff to be able to clock in from one specific computer, you can set the terminal here for that.
User RoleIt can be handy to have rules only apply to certain user roles. For example you can have a Refund rule which you map to the “Admin” user role, then normal users cannot do refunds, but will need an administrator to do it for them.
DepartmentSome rules you only want to have executed in a certain department. For example if you want to see different tickets printed depending on the department, you could setup separate ticket print rules mapped to each department.
Ticket TypeYou can also map the rule to one or more Ticket types. For example if you had setup a Delivery ticket, you could create rules which will only apply to this kind of ticket by adding only this ticket type to the mappings.

You can either have no mapping at all (this will actually disable the rule), or one or more mappings. You can mix these mappings in many ways. When you select a “*” for a terminal, user role, department or ticket type it means it will apply for all terminals or user roles etc..

You can for example tell SambaPOS to execute a rule:

  • always in this department (one mapping where everything is “*”, and department is set to one specific department)

and

  • in another department only if a certain ticket type is used (another mapping where department is set to a certain value, ticket type is also set to another value, and the others are all set to “*”)
  • in all other departments if the user is an administrator

(then you need another mapping for each department which doesn't have a mapping yet, where everything is “*”, but User role is set to “admin”)

Rule Tags

You can tag rules for easier listing, exporting features. You can use multiple tags by separating them , (comma) character.

To list rules that have a specific tag you can use this syntax.

  tags:Category Discount

While exporting rules with Database Tools Module you can select rules with a specific tag by right clicking on list and choosing Select Rules by Tag menu item.

rules.txt · Last modified: 2019/04/19 03:23 by 93.179.68.108