Ticket ID in printer template

{TICKET ID} code is not working in version5

You need to be more specific, your question tells us nothing about the real problem you have. Example of where you are trying to use? Which printer template? Did it work in V4 or earlier version of V5? Without this info, it is pretty impossible to help.

However {TICKET ID} can only print at some points, usually after a ticket has been closed. What do you need to use {TICKET ID} for?

1 Like

TICKET ID only generated after ticket is submitted. So it should be used after ticket closed event or ticket closing event.

Or you can use Save Ticket action however that should be used with caution it could cause undesired results.

1 Like

Sorry guys I been working all day .I just created the action and rule to create barcode after ticket closed just to find tickets later. every is good but when I insert the code {TICKET ID} in ticket template this error show up:

You are getting that error only when simply inserting {TICKET ID} into the Template? Really? That doesn’t sound right. Sounds like something else is going on. Show your Template.

This is my Printer Ticket Template:

[LAYOUT]
-- General layout
<BMP>c:\logos.bmp
<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}]
{SERVICES}
<J10>Total:|{TICKET TOTAL}
{PAYMENTS}
<DB>
<F>=
<C10>T H A N K   Y O U
<F>-

<C00>
<BAR>{TICKET ID}
[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}

Ah… I see, you are using the <BAR> tag. That explains it.

The error you receive must be because the {TICKET ID} is in fact NULL, so the <BAR> tag does not know how to process it and throws an error.

If I remove {TICKET ID}, the printer working ok

Show that Rule.

You may have the Print action in the wrong order/sequence, so {TICKET ID} is no longer valid.

You might try placing the Action in a different Event…

Before Ticket Closing
Ticket Closing
Ticket Closed

The Event can make a difference as to what is “set” and what is not, such as {TICKET ID}.

This is the rule:

Not that Rule. Show the Rule that contains the Execute Print Job Action, since that is where you are getting the error.

LOL, that is the Action. Need to see the Rule that fires that Action.

Right, so like @Jesse said, if the ticket is not yet submitted (closed), then the {TICKET ID} is not available.

You could try putting a Save Ticket Action just before the Execute Bill Print Job Action.

1 Like

Realy my friend Im new in samba I don’t know how to do this I jus followed the steps that find in the forum one action, one rule and the code in the printer template. sorry and thanks for your help

but my printer is printing when the sale or ticket is closed

Ok I will try and explain this better for you to understand. {TICKET ID} is a unique number assigned to tickets. That number is NOT assigned until a ticket is actually closed. So if you try and print a ticket BEFORE the ticket is closed then {TICKET ID} will be blank. This means your action to print the ticket needs to happen AFTER ticket is closed.

If you want to use {TICKET ID} without having to press Close Ticket first then you need to create a Save Ticket action and put that action BEFORE your Execute Bill Print Job action in the rule you showed.

1 Like

Hmm, yah, that’s what I was saying. Just tried it out though, and the {TICKET ID} is still 0, which means the Ticket is not yet created.