Discount Printer Template Syntax

I dont understand the problem? Whats wrong about it?

I wish to keep the line “Specials:” which has the sum of Discount (standard) + VIP Discount + HH Discount but if I use the “[ ]” brackets it prints nothing? If I remove the brackets it will print “0” values…

Its only printing now because I have added the line “SpecialV:” which places the VIP discount on a separate line? SO not sure if its my ignorance. Yes see your reply below but if I remove the SpecialV line it seems not to calculate.

I am confused you showed it with brackets and then a printout of it working? EDIT: I see what your saying.

Why not just put it under [DISCOUNTS] and simply use {DISCOUNTS} in template?

Ok that’s I think may be the issue as from the V5 Tutorial Q did not say where to place the code… So I think it has to be calculated first in the [DISCOUNT] layout section before using the {DISCOUNT} Tag. That’s why I asked before I do not see the relationship.

Like why does the {DISCOUNT} Tag have a line:

[<J10>Total Gift:|{ORDER STATE TOTAL:Gift}]

Why is that not in the [DISCOUNT] section? I will get this as it my first attempt…

Ok moving it to [DISCOUNTS] did not work.

It doesnt have to be, but [DISCOUNT] is a layout template. It makes your Printer Template easier to read and modify later and easier to spot problems if you use appropriate Layout Template sections.

For example if something messes up with Discounts you know that all Discount Relate Tags are under [DISCOUNTS] layout so you can go straight to it vs having to look through your template to find all related tags.

You could get rid of layout sections completely and template will work fine but it will make it VERY difficult to decipher various sections. Some Layout sections contain specific tags for those sections… Example if its Order Related tags then it will only work under [ORDERS] section.

Thanks kendah, this is the simple thing I was trying to implement into the standard ticket template:

Just not sure where to place it OR get it to work…

Does it explains how Section Tags ([xxx]) works?

1 Like

Yes that is now becoming clear. The confusion was 2 things:

  1. Using a custom format other than the [template] such as [<J10>Total Gift:|{ORDER STATE TOTAL:Gift}] used in the {DISCOUNT} section in the sample Ticket Template.

  2. The other unsolved is why if I am using a custom format in the {DISCOUNT} section I need to list the different {ORDER TAG TOTAL:x} on a separate line before it will print on a line with all {ORDER TAG TOTAL:x’s} added together such as Q’s “Discounts” line?

  3. The “TOTAL SAVINGS” line just has not appeared as yet…

Item (2) & (3) is the things I do not get.

{DISCOUNT} section used to list calculation templates used as discounts (configured to decrease ticket amount). The term confuses you but even it named as Discount what you’re listing there is Order Tags. {ORDER TAG TOTAL:X} is a base template (ticket) tag that returns total price of order tags named as x. As you use these order tags as discounts you’re referring them with discount name. That has no relationship with {DISCOUNT} or [DISCOUNT] sections.

2 Likes

This is not used in [DISCOUNT] section. It appears just after what {DISCOUNT} tag prints.

How am I doing that, in my syntax or just what I am typing here? Ok I see you have replied…
Yes I was slowing getting that by sheer volume of reading threads!

So the reason why Order Tags used for VIP discount needed to be listed separately? OR without the “” at each end (omit blank lines).

Sorry pauln I may have confused you I did poor job explaining it.

No kendash any help is always appreciated! I just needing to “brake the back of this” so to speak and I am getting my head around the concepts. Just difficult starting as you do not know if you (me) have just stuffed something up or the syntax is wrong.

Lol sorry @pauln my English really suckz. Let me explain once more.

{DISCOUNT} is a place holder for Calculation Templates that decreases ticket amount. What appears after this tag will print after discount list.
[DISCOUNT] and what appears under that until next [X] section is… the template we’ll use to render calculation templates.


What you’re doing does have 0 relationship with Discounts (as a ticket template feature). You’re using (what I mean with you is your implementation) Order Tags as Discounts. So you’re calling these order tags as Discount. I think that confuses you. That was my point. Naming something as Discount does not mean it relates with Calculation Templates. Think it like I can create a ticket tag and name it as discount to store some amount. I won’t use [DISCOUNT] section to format it. I’ll use Ticket Tag related tags.

So OK here is the source of my confusion from the start. Why does this line print a value without the “[ ]” brackets and then omits the line with them? Here is the syntax and the results:

No Brackets

<J00>TOTAL SAVINGS:|[=F(-1*(TN('{ORDER TAG TOTAL:Discount}')+TN('{ORDER TAG TOTAL:VIP Discount}')+TN('{ORDER TAG TOTAL:HH Discount}'))+TN('{ORDER STATE TOTAL:Gift}'))]

With Brackets

[<J00>TOTAL SAVINGS:|[=F(-1*(TN('{ORDER TAG TOTAL:Discount}')+TN('{ORDER TAG TOTAL:VIP Discount}')+TN('{ORDER TAG TOTAL:HH Discount}'))+TN('{ORDER STATE TOTAL:Gift}'))]]

Ok the line definitely has a 23c value so what is going on here?

That might be just a bug. Let me reproduce it on my side.

On my first try it appears fine when I have a gift in my ticket.

What could be different on your setup?

I think i have this issue too long time ago since V4 (square bracket inside square bracket). I just use ticket tag for total saving.

If I add the calculation {DISCOUNT TOTAL} as below it will work with brackets?

[<J00>TOTAL SAVINGS:|[=F(-1*(TN('{ORDER TAG TOTAL:Discount}')+TN('{ORDER TAG TOTAL:VIP Discount}')+TN('{ORDER TAG TOTAL:HH Discount}')+TN('{DISCOUNT TOTAL}'))+TN('{ORDER STATE TOTAL:Gift}'))]]

You see I am getting this as now I can show total of all discounts; Ticket (DISCOUNT TOTAL), VIP, HH and any Discount Tag. Phew…not sure why it does not print in some cases with “[ ]” as I just copied Q’s syntax out of the V5 tutorial.

Now I need just to alter the format to show Quantity Discount Value when using VIP or HH discount tags as Q’s setup was just for fixed amount whereas I am using percentage (common over here).

PS:@emre if you have your Print Template open and go straight into POS, go back to the template (still open), you can cause the “No Preview”, “No Help” view as I have shown above.

EDIT: Ok further testing it seems unless I have a value in {DISCOUNT TOTAL} nothing will print if I have “[ ]” brackets at the start and end of the line for “TOTAL SAVINGS”? I just duplicated your transaction using “**GIFT” and got a blank line :confused:

FULL TEMPLATE:

[LAYOUT]
-- General layout
<T>Ticket
<L00>Date:{TICKET DATE}
<L00>Time:{TIME}
{ENTITIES}
<L00>Ticket No:{TICKET NO}
<F>-
{ORDERS}
<F>=
<EB>
{DISCOUNTS}
[<J00>Total Gift:|{ORDER STATE TOTAL:Gift}]
[<J00>VIP:|[=F(TN('{ORDER TAG TOTAL:VIP Discount}'),'0.00')]]
[<J00>Happy Hour:|[=F(TN('{ORDER TAG TOTAL:HH Discount}'),'0.00')]]
[<J00>Discount:|[=F(TN('{ORDER TAG TOTAL:Discount}'),'0.00')]]
[<J00>Ticket:|[=F(TN('{DISCOUNT TOTAL}'),'0.00')]]
[<J00>TOTAL SAVINGS:|[=F(-1*(TN('{ORDER TAG TOTAL:Discount}')+TN('{ORDER TAG TOTAL:VIP Discount}')+TN('{ORDER TAG TOTAL:HH Discount}')+TN('{DISCOUNT TOTAL}'))+TN('{ORDER STATE TOTAL:Gift}'))]]

{SERVICES}
<J10>Total:|{TICKET TOTAL}
{PAYMENTS}
<DB>
<F>=
<C10>T H A N K   Y O U

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

[SERVICES]
<J00>{CALCULATION NAME}|{CALCULATION TOTAL}

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

[ORDERS]
-- Default format for orders
<J00>- {QUANTITY} {NAME}|{TOTAL PRICE}
{ORDER TAGS}

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

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

[ORDER TAGS]
-- 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}

RESULT:

(Time 11:45pm - oh Dear)

Hmm. Seems like we never implemented bracketing support for expressions. I don’t know how I’ve assumed it works…

1 Like

It should work fine with expressions on next update. (5.1.54)

2 Likes