This feature improved with 4.1.9 update. Let me show another example.
We have a discount button under ticket. When we click that a dialog box appears.
I can type a discount rate between 1 to 10. Also I can type a discount reason.
I’ve entered rate as 5 and typed “New Customer” as discount reason.
##Implementation
###Automation Command
We need an Automation Command for discount button.
I named it as “Discount” and the button header is also “Discount”. I’m switching to Mapping tab for configuring button appearance.
This button is enabled when Ticket State is “New Orders” or “Unpaid” so we can’t click it if ticket is paid. I’ve also selected “Display under ticket” setting to make this button appear under ticket.
After saving it I need to click “Sort Automation Commands” link and move it to the top of the list. So it displays just before Settle Button.
###Update Discount Action
I’ll create an action to update Ticket Discount value.
Action type should be Update Ticket Calculation. I need to select “Discount” for Calculation Type and type [:Discount Amount]
for the Amount value. [:Discount Amount]
means we’ll send this value from rule.
###Update Discount Reason Action
This action will store discount reason as a ticket tag.
Action Type will be Update Ticket Tag and I’ll type [:Discount Reason]
to be able to send this value from rule.
###Refresh Ticket Action
This action just needed to refresh ticket display.
When we leave ticket Id as 0 it just refreshes current ticket.
##Discount Button Rule
We need a rule to tell SambaPOS what to do when we click on the Discount button.
The event we need to handle is “Automation Command Executed” It triggered when we click on Discount button. We need to check Command Name with a custom constraint to make sure it is Discount Button.
I’ve clicked “Select Actions” link to map actions to the rule. When we click on discount button these actions starts working one by one.
I’ve expanded “Update Discount Reason” action to configure action values. We want to ask Discount Reason to the operator. I’ll type it as [?Discount Rate]
so SambaPOS displays a dialog box that asks Discount Reason.
On next step I’ll configure Discount Rate value. I’ll also ask this value to operator so I need to type [?Discount Rate]
. We need little more configuration here because it will allow all characters inside Discount Rate. We need to accept only numeric values between 1 and 10. To be able to do this we’ll configure a input mask. We can type input masks by adding a semicolon after value label as [?DiscountRate:Mask]
Masks are configured as Regular Expressions. For accepting values from 1 to 10 we need to type [1-9]|10
It means a single numeric value between 1 and 9 or 10. Pipe character means or.
Feel free to ask how to configure input masks for your needs.