Happy hour ticket template

Can you tell me what the State is called? and What State your using? Show me a screenshot of the action? and the rule please?

The syntax is {ORDER STATE:X}

So if your state was named HH and the State is Active… then in your template put {ORDER STATE:HH} under [ORDERS]

[ORDERS]
-- Default format for orders
<J00>- {QUANTITY} {NAME}|[=F(TN('{PRICE}')*{QUANTITY},'#')] LBP {ORDER STATE:HH}
{ORDER TAGS}

BTW if you ever wanted to stop using the clunky Trigger method you could use Order Added to Ticket event and you have several constraints…

{DATE:ddd} Equals Mon|Tue|Wed|Sat  for example or

{TIME} Before 700
{TIME} After 1100

Its very simple and doesn’t rely on a trigger… You would never be bound by the fact that triggers cant operate inside an open ticket.



So now you need another trigger to disable it… this can all be done with one single rule and action if you dont use triggers.

@Jesse thank u for this method, its simpler this way without the triggers. But the problem is that I still need 2 actions:

  • 1 for the order state of the happy hour time hh
  • 1 for the order state after the happy hour time

So I defined a new order state called hh

then I defined a new action for the happy hour order state

then I defined a new action for after the happy hour order state

But the problem is that those 2 actions doesn’t work, the only action that works is the predefined action update order status

but I cant use it cz I need 2 of it, one for the happy hour and one to change the order state to nothing for after money, and there is only 1
so any help plz?

Ok why do you need 2? You dont need 2. You can make 1 action and use variables for State like [:State] then you can use same action to disable it. and to disable it you just leave it blank.

Ill show you. Also you probably shouldnt use Status lets use a new one. You also do not have to define it under States that is only if you want color changes.

Here is the only action you need:

Here is a rule that activates Happy hour for Menu Group Code Specials and only on Tuesday and Wednesday between 11am and 10pm.

You would not need a deactivate action because it only sets the order state during specific time…

You can show this state in a ticket template with {ORDER STATE:HH}

1 Like

Well the order state method is not working somehow to display the hh on the bill but the order tag method is working in the happy our time only and its printing on the bill like this way:

so wen I select an item IN the happy hour time an hh button appears and I need to select it so it works

So if there s a way to automatically have an hh order tag without having to click on the hh button ever time I need to select an item

Thank you for ur time

It works fine I tested it. You should show the rule you used. Can you show us a screenshot?

1 Like

OK, i ll show u everything,

First, i defined a new order state called hh:

Then, I created a new action to change the price to a previously defined price tag hh:

Then, i created a new action to update the order state:

Then, i created a new rule to let everything work together:

and my ticket template is:

[LAYOUT]
-- General layout
<BMP>C:\Users\bandy\Desktop\logo.bmp
<T>Ticket
<L00>Date:{TICKET DATE}
<L00>Time:{TIME}
{ENTITIES}
<L00>Ticket No:{TICKET NO}
<F>-
{ORDERS}

<F>=
<EB>
{DISCOUNTS}
[<J10>Total Gift:|{ORDER STATE TOTAL:Gift}]
<J10>Total:|[=F(TN('{TICKET TOTAL}')*1,'#')] LBP
<J10>     :|[=F(TN('{TICKET TOTAL}')*0.00066667,'0.00  ')] $
{PAYMENTS}
<DB>
<F>=
<C10>T H A N K   Y O U

[DISCOUNTS]
<J00>{CALCULATION NAME} %{CALCULATION AMOUNT}|{CALCULATION TOTAL}

[PAYMENTS]
<J00>{PAYMENT NAME}|{PAYMENT AMOUNT}

[ORDERS]
-- Default format for orders
<J00>-  {QUANTITY} {NAME}  |[=F(TN('{PRICE}')*{QUANTITY},'#')] LBP {ORDER STATE:hh}
{ORDER TAGS}

[ORDERS:Gift]
-- Format for gifted orders
<J00>- {QUANTITY} {NAME}|**GIFT**
{ORDER TAGS}

[ORDERS:Void]
-- Nothing will print for void lines

-- Format for order tags
<J00> * {ORDER TAG NAME} | {ORDER TAG PRICE}

[ENTITIES:Table]
-- Table entity format
<L00>Table: {ENTITY NAME}

[ENTITIES:Customer]
-- Customer entity format
<J00>Customer: {ENTITY NAME} | {ENTITY DATA:Phone}

The result is that the price is changing perfectly according to the rule but the hh doesn’t appear on the bill so i guess the problem is with the update order state action

Hh wouldn’t appear. It would say Activated in the ticket.

Does it not print Activated?

Like I mentioned you do not have to define the state under Settings > States

Can you show a printout using that setup?
Also please highlight your template and press the </> button please.

Ok then where shld i define the hh state or u mean i don’t need to define it at all?
this is the template

    [LAYOUT]
-- General layout
<BMP>C:\Users\bandy\Desktop\logo.bmp
<T>Ticket
<L00>Date:{TICKET DATE}
<L00>Time:{TIME}
{ENTITIES}
<L00>Ticket No:{TICKET NO}
<F>-
{ORDERS}

<F>=
<EB>
{DISCOUNTS}
[<J10>Total Gift:|{ORDER STATE TOTAL:Gift}]
<J10>Total:|[=F(TN('{TICKET TOTAL}')*1,'#')] LBP
<J10>     :|[=F(TN('{TICKET TOTAL}')*0.00066667,'0.00  ')] $
{PAYMENTS}
<DB>
<F>=
<C10>T H A N K   Y O U

[DISCOUNTS]
<J00>{CALCULATION NAME} %{CALCULATION AMOUNT}|{CALCULATION TOTAL}

[PAYMENTS]
<J00>{PAYMENT NAME}|{PAYMENT AMOUNT}

[ORDERS]
-- Default format for orders
<J00>-  {QUANTITY} {NAME}  |[=F(TN('{PRICE}')*{QUANTITY},'#')] LBP {ORDER STATE:hh}
{ORDER TAGS}

[ORDERS:Gift]
-- Format for gifted orders
<J00>- {QUANTITY} {NAME}|**GIFT**
{ORDER TAGS}

[ORDERS:Void]
-- Nothing will print for void lines

-- Format for order tags
<J00> * {ORDER TAG NAME} | {ORDER TAG PRICE}

[ENTITIES:Table]
-- Table entity format
<L00>Table: {ENTITY NAME}

[ENTITIES:Customer]
-- Customer entity format
<J00>Customer: {ENTITY NAME} | {ENTITY DATA:Phone}

and this is an order

:

and this is its bill:

Your Rule called Happy Hour Activated should use Matches All, not just Matches.

As is, your Ticket is not showing that the Order State has been updated. This may be because the Rule Constraints with just Matches is somewhat unpredictable.

Also, delete the hh State that you have defined. It is not necessary. You only require the Action that updates the Order State. This may be your problem, since you have defined a hh State Group, but have only hh as a State, and Activated is not a valid State because of your State definition.

@QMcKay your reply touches a point i’ve not quite worked out, what is Matches ment to do?
There is Matches Any and Matches All where does just Matches come?

First, these are fairly intuitive:

  • Matches All : all constraints must evaluate to True before the Rule will fire. This is like AND.
  • Matches Any : any constraint evaluated as True will allow the Rule to fire. This is like OR.
  • Not Matches All : all constraints must evaluate to False before the Rule will fire. This is like NOT AND.
  • Not Matches Any : any constraint evaluated as False will allow the Rule to fire. This is like NOT OR.

Matches is a bit special. If any parameters on the left side of the list have the same name, they will be considered as an OR condition, while the other parameters are considered as AND.

{DATE:ddd} Matches Mon|Tue
{TIME} After 1430
{TIME} Before 1445
Menu Item Group Code Equals Classics

With Matches, the above means:

     (Date is Monday or Tuesday)
 AND (Time is After 1430 OR Before 1445)
 AND (Group Code is Classics)

The issue is the {TIME} parameter … you don’t want it to be an OR condition; instead you want it to be an AND condition in this case.

Using Matches All, the logic is different:

    (Date is Monday or Tuesday)
AND (Time is After 1430)
AND (Time is Before 1445)
AND (Group Code is Classics)

P.S. There are many legitimate cases for the use of Matches, but in this scenario you do not want to use it; you want to use Matches All.

2 Likes

Sorry you are right it should be matches all. I built I quick and I did change it to matches all but I had already took the sshot and forgot to take another.

Also he is right you should delete that state definition its setup wrong but you don’t need it anyway.

Like I said previously state definitions are specifically to show color changes.

I used activated as a sample if you want it to show as HH on ticket replace activated with HH.

Thanks @QMcKay that is a great explanation, much appreciated.
Just to elaborate in my own mind and for anyone else who might read am I right to then say that the reason Matches doesn’t work in the topic situation is that;

{DATE:ddd} Matches Mon|Tue
{TIME} After 1430
{TIME} Before 1445
Menu Item Group Code Equals Classics

Which as you say can be defined as;

(Date is Monday or Tuesday)
 AND (Time is After 1430 OR Before 1445)
 AND (Group Code is Classics)

Would be handled by samba as ‘two constraint’ conditions;

(Time is After 1430) AND (Group Code is Classics)
OR
(Time is Before 1445) AND (Group Code is Classics)

Meaning that the time based constraint is always valid as its always After 1430 or Before 1445 at any time of a particular day.

That wouldn’t explain the state not working. I think that’s simply because he defined the state wrong.

But yes it would always activate which is not what we want. So matches all would fix that.

Exactly correct. The Time constraints are useless in this case with Matches.

1 Like

I agree. I believe the definition of the State is what is making this not work. I think removing the State will fix the issue.

@QMcKay @Jesse No the problem is that the {TIME} constraints are not working somehow , when i remove it the hh appears on the bill, so i dont know what to do , in the happy hour triggers method the time triggers works perfectly and i can change the price List to hh but the rule with the trigger executed event doesn’t seem to have an action based on “update order state”, the only event that accept the update order state action is the “Order added to Ticket” event

So I can have to working rules, one using the “trigger executed” event to set the happy hour time and change the price List and the other using the “order added to ticket” event to update the order state so it can appear on the bill

So is there a way to relate these two rules so they can work at the same time? thank u