DISCOUNT - Any Item - Ask Custom Amount

Thanks im off out now so ill try this expression later when im back, hopefully will work :slight_smile:

OK @RickH here are several options for you,

Since we are dealing with just the Numberpad and all digits are possible in any sequence we do not need to designate [0-9] format we can use \d{#} We only need 0 in the last option to define 0 to cancel.

[?Enter Discount;\d{1}\d{1}?\.\d{2};;ON]

Would allow XX.XX ( or X.XX if you press the decimal manually from a keyboard ).

[?Enter Discount;\d{2}\.\d{2};;ON]

Would allow XX.XX format.

[?Enter Discount;\d{2}|\d{1}\d{1}?\.\d{2};;ON]

Would allow XX or XX.XX ( or X.XX if you press decimal manually from a keyboard ).

[?Enter Discount; \d{1}\.\d{2}|\d{1}\d{1}?\.\d{2};;ON]

NOTE: There is a space after Discount;

Would allow both X.XX and XX.XX if you press space first then type XXX it will display as X.XX if you do not press space and type XXXX it will display XX.XX

I know space bar is not part of the keypad I am just showing all possibilities.

[?Enter Discount;\d{1}\.\d{2}|\d{1}\d{1}?\.\d{2}|0;;ON]

Would allow X.XX or XX.XX input as well as 0 for cancel
This is what I am using personally.

PS There are many many other versions of this mask syntax you can write. I just showed several that are doing close to what you want. Hopefully you can learn from them and develop something your happy with.

1 Like

try

 [?Enter Discount;  \d{2}%|\d{1}\d{1}?\.\d{2}$;;ON]

NOTE: There is a space after Discount;

The way it works
 if you press a space first then the 2 numbers it will display XX% if you do not press space and just type your numbers it will display XX.XX$

@QMcKay,

I modified this setup just a tad to put a constraint not allowing a discount greater than the items price
 it also prompts the user the mistake they made and makes them enter the discount again.

Here is what I did:

2 Likes

@Jesse i added the constraint so that you cant discount greater than item price but it still lets me, any ideas why?


Set it to Matches All

spot on thanks! i should have seen that!

I wanted it to loop right back to the Entry screen
 which I thought I could do by just calling the Ask automation command
 and it works
 it does go right back to the Numberpad entry for selecting discount amount
 but samba crashes when you press OK after entering discount. I think it is because at some point in the cycle it deselects the order
 I tried the Select Order action and assigning it a state when command value is entered and then resetting the state back to nothing when it loops but its still crashing
I noticed the action does select it but its not highlighted
 not sure if that had anything to do with it.

But for now I am happy with it just taking it back to ticket screen and employee pressing discount again.

Here is a Database Tools import file for the modified version of this tutorial that I spoke about few threads up. I took his tutorial and added constraint so it would not discount more than items price. This has everything you need just import it using Database Tools and your good to go. It uses its own Rules and Action naming so it will not interfere with any default actions.

Discount Custom Ask Any Amount.zip (1.4 KB)

@emre How can I rule discount if one discount applied the second will not example: I have used discount of discount item custom than when settling if I press 10percent further should error and only 1 discount applied pop up may come , also if I given any 1 discount to samba card than promotion 5 percent will ot apply I mean any form only 1 kind of discount applied, u r help needed .

When you need such features you should think about using states because it allows you to enable / disable feature according to state changes. For example you can enable / show a,b,c features for x state and disable / hide them for y state. For example you can’t use Print button when Ticket’s state is New. It automatically enables when ticket’s state becomes New Orders. (after you add lines to ticket)

First of all you won’t use default discount button as you need a custom behavior and implement an automation command button instead. After doing that you may solve it by


  1. Update ticket’s discount state (or name it as something meaningful for you) to Active (or something else meaningful for you) when a custom discount added.
  2. Configure discount button to enable only when Discount state does not have a value by setting discount button’s enabled state to Discount=.

You might want to read more about states here http://www.sambapos.com/wiki/doku.php?id=states

how do i use OT. to show discount report

What do you mean by OT? Did you mean it? If so what do you mean. We talked about multiple things in this thread and ‘IT’ can be a lot of stuff.

i mean how to use order tag in reports to show discount details

Which reports are you talking about? Custom reports?

Look here:
http://sambapos.com/wiki/doku.php?id=custom_reporting_tags

i have set this but empty field display

Ticket No|Date|Time|Table|Discount|Percent|Amount
{REPORT ORDER DETAILS:T.TicketNumber,T.Date,T.Time,EN.Tables,OT.Dish Discount,OTP.Dish Discount,ON.TotalPrice}

Either you didnt show the entire template or your syntax for the custom report is wrong. You are missing the layout format and the Table header format lines.

Look here for better understanding of how to build them and then read the previous link I posted.

i skipped that :smile: here is the complate layout

[Discount:1,2,2,2,2,2, 2]
Ticket No|Date|Time|Table|Discount|Percent|Amount
{REPORT ORDER DETAILS:T.TicketNumber,T.Date,T.Time,EN.Tables,OT.Dish Discount,OTP.Dish Discount,ON.TotalPrice}
Total||||||{REPORT ORDER TOTAL

Ok can you show the Order Tag setup for Dish Discount? BTW OTP. will not show the calculation % it will show the dollar amount.

Order tag: Dish Discount and no mapping done