Printer Template Formatting Tags

##General

  • <T> (Title) : When used it will format line as a title.
  • <F> (Fill) : For example <F>- creates a line with - chars or <F>= creates a line with = chars.
  • <EB> (Enable Bold) Prints everything Bold until <DB> command.
  • <DB> (Disable Bold) Ends <EB> command
  • <Jxy> (Justified) Justifies a line from pipe char. <J00>Total:|0.00 separates line from pipe (|) char. It aligns Total: part left and 0.00 part right. When used on a ESC/POS compatible ticket printer numeric parts sets font size. First number sets font height and second number sets font width. For example <J10> sets font height to 1 and font width to 0.
  • <Cxy> (Center) Same as <J00> but this command centers text.
  • <Lxy> (Left) Same as <J00> but this one left aligns text.
  • <Rxy> (Right) Same as <J00> but this one right aligns text.
  • <Jxy:n>(Justify Wide) Same as <J> tag but if you’re using wide char languages such as Chinese you can define char length here. For example <J00:2> means characters are 2 characters wide.

##Custom Commands

  • <XCT> (Execute) Useful to send escape commands to printers or data to port printers. For example <XCT>27,112,0,25,250 to send open drawer command to printer.
  • <BEEP> (Beep Sound) If ticket printer supports printer will beep on this command. Generally used at the end of ticket template to inform user about something printed. Generally useful on kitchen printers.
  • <Bxy> (Custom Beep)
  • x: Beep Count
  • y: Beep Duration. <B22> beeps two times.
  • <CUT> Sends paper cut command to printer.

##Logo printing, Barcode Printing and Bitmaps

  • <BMP>[FileName] Prints Bitmap file. <BMP>C:\logo.bmp.
  • <BAR> Prints bar code in code 128 format. <BAR>123456789
    • Supports 13,39,08,93,11,25 barcode types. <BAR13> prints Ean13 format.
  • <QR> Prints QR Code. <QR>ABCDEFG
    • x: Bitmap size. [1-9]
    • y: Error Correction. [1-4] <QR23>55aa

##Positioning

  • <el> Enable Left
  • <ec> Enable Center
  • <er> Enable Right

These tags are useful to position bitmaps. For example after <ec> tag everything (including logos & bitmaps) prints center aligned. To disable it you can change alignment with <el> or <er> tag.

For positioning more precisely you can use space characters. For example <QR> 12313 tag has two spaces between tag and code. That means bitmap will slide right by two pixels. It works with <BAR>, <QR> and <BMP> tags.

##Expressions

Printer Templates supports custom expressions to make some simple calculations.

Syntax: [=<expression>]

For example: [=2+3] expression prints 5.

You can use current printer template tags to make calculations based on ticket values.

[={TICKET TOTAL}*0.1] Prints %10 of the ticket total.

Numeric tags such as {TICKET TOTAL} prints formatted numbers such as 1,523.00. To be able to use these numbers safely in expressions we need to convert them to numbers by stripping thousand separators and correcting decimal separator. To be able to do this we can use (ToNumber) TN function. So our expression becomes [=TN('{TICKET TOTAL}')*0.1]

These are the available functions:

  • F: Format Function. [=F(<number>,<format>)].
    Formats numeric values with given format.
  • FF Fix Format Function. [=FF(<string>,<format>)].
    Fixes formatting of the string formatted number.
  • TN: ToNumber Function [=TN(<string>)].
    Converts string formatted number to a numeric value.
  • FD: Format Date Function [=FD(<date>,<format>)].
    Changes formatting of date values.
  • ADD: Add Days Function [=ADD(<date>,<days>].
    Adds days to date values.
  • ADM: Add Months Function [=ADD(<date>,<months>].
    Adds months to date values.

####Examples

[=FF('{TICKET TOTAL}','#')]

Strips decimal parts from numbers.

[=FF('{TICKET TOTAL}','#;-#;0')]

By using semicolon ; character you can define separate formats for positive and negative numbers. First section will be used for positive, second section for negafive numbers. Third section is for zeros.

For example:

-+#;minus #;zero. format will display + infront of positive numbers, minus word in front of negative numbers and zero instead of 0.
-'#,#0.00;#,#0.00' will remove - sign in front of negative numbers.

[=FD(ADD('{TICKET DATE}',1),'dd/MM/yyyy')]

Adds 1 day to date value and prints with dd/mm/yyyy format.

[=F(TN('{TICKET TOTAL}')*0.2,'#')]

Calculates %20 of Ticket Total and strips decimals from number.

10 Likes
Receipt Templates
Need help to create this printer template?
I want to create a custom Table layout and Logo in ticket
Change due and Cash Drawer Open on a receipt
Waiter salory on %age solution
Download SambaPOS 4.1.82 and read Tutorials
I need help for printing bill out in correct size and setup it up
Printer Template
Formatting {ACCOUNT TRANSACTION DETAILS:X} Tag
Is there any branding module
Entity to print two kitchen tickets
Print Customer Receipt after Processing Payment
Arithmetic operation with decimal
Ticket Slip Template Help
SambaPOS Loyalty Card Features
Date e time and decimal format (SOLVED)
Help with ticket template
Print product category in red
Subtotals, syntax and Thai
Printer template repeating totals in ORDER FOOTER
Need your great help...!
Need your great help...!
Making printed ticket receipts more informative
How to remove .00 from price?
How to remove .00 from price?
Specify Font For Controlling Printer Drawer Kick
Welcome to SambaPOS 5
Ticket Customization problems
How to send command to printer to print the logo on receipt
How to flip account balance [Solved]
Kitchen printer font size
How to remove decimal places in a print template function
Age Verification or 18+ reminder with calendar
Order number on bill
Add Wi-fi Password to Printed ticket based on certain condition
Is possible do this with SambaPOS?
Design mode is missing some function
How can i show 1.5% from total sales per work period for waiters i want to give them give them as commission as shown in my snapshot
Help with formating
A few questions for you all
How To Change Decimal Place?
Currency problem
How to change ticket date format
Printer Template Commands Question
When I increase the font size, the printer doesnt print full order
Ticket Print Issue
Trying to understand Ticket Templates
Discount on the total number of positive
Setting up a Kitchen display only for prepaid order
Printing Tutorial in Detail
Printing Customer Reciept
Reports - Unable to divide by a non-whole number
Can any one help meee here
Having trouble initializing printer
[New 4.1.18] HTML Printer Improvements
Welcome to SambaPOS Forum. Start from here!
Strange behaviour trying to write Date to customfield using Automation Command
Character "B" contains my invoice
Increase font size in printing
Increase Font Size in Ticket and Duplicate Ticket
Ticket Template formatting
Developing a template
Is anybody tell me how to make print General Account Name Balance have Date that on printer
How to make text bold in a receipt
How to remove Items from my customer receipt
Kitchen Ticket Template
VFD won't print Change Due and Tendered
Epson TM-T88IV - Font Size
V4 Sales Tax Help (included on specific product groups)
Pole Display and Logo Printing help
Birthday discount or specific category promotion on special day?
Printing Format related Question
Format without negative
Format without negative
Telefonnumber Format in Ticket
Samba pos not showing tendered amount
Samba pos not showing tendered amount
Samba pos not showing tendered amount
A couple questions about Printing
Bigger font display
Help with printer template language
How to show multiple taxes on ticket template
Need help with Bill Template
Phone displaying format on Ticket
How can I print out Tax Base for Zero-Rated Products in TAXES?
Printer layout template question
How to create a tax,total tax, change total,payment total in the bill?
Moving the program to other computer
Write two languages on the invoice
Printing Tutorial in Detail
Customer Receipt Not printing full item name
HTML receipt Order not display correctly
How to achieve LARGE font in Xprinter C58K(Epson Compatible)
Kitchen printout problem
Waiter salory on %age solution
Printing to Kitchen Printer
Epson TM-T88V Beep Command

I moved 2 posts to a new topic: Chinese formatting

I moved a post to a new topic: Reading data from SambaCard

hi @emre
i still confuse how to edit/manage font size at print bill, i need to make font of orders smaller. can you give tell me how i may chance it.

thank you

Thermal Printers are character based printers. On raw printing it supports 42 to 48 chars per line. Some printers supports changing this configuration with DIP switches. By default SambaPOS prints with smallest size available. You can just increase font size.

Just wanted to add number formatting as it took me 20 mins looking through the V2 forum.

[=F(TN(’{TICKET TOTAL}’),’#,##0.00’)]

[=FF('{TICKET TOTAL}','#,##0.00')] is the shortcut for change formatting.

@emre,

How do we format dates.
I would like to be able to get the current year and then increment this by 1,2,3,etc to store against a Customer.
{DATE} returns 14/03/2014, but I only need the year.
Using [=FF('{DATE}','yyyy')] returns ‘yyyy’

FF function does not accept date values. I’ve recently implemented FD (fomat date) function for this so on next release you’ll be able to create expressions like

[=TN(FD('{TICKET DATE}','yyyy'))+1]

If it is a entity custom data also you should be able to use +365 to add 365 days to current value. It should work on Update Entity Data action.

I tried with: [=TN(FD(’{TICKET DATE}’,‘yyyy’))+1]
but change the year
How do I change the day?
example
21/8/2014 + 1 = 22/8/2014
31/8/2014 + 1 = 01/9/2014
thanks

[=TN(FD(’{TICKET DATE}’))+1]

Should work. Using ‘yyyy’ as a format only shows the year and adds 1 to that.

how do you use on the day or month?

if I add: [=TN(FD(’{TICKET DATE}’))+1]
me as a result “1”

It will be a long expression but it may be possible by fragmenting date to parts with ‘yyyy’, ‘MM’ and ‘dd’ formats, increase month and converting it back to date with FD function.

[=TN(FD('{DATE}','dd'))+1]/[=TN(FD('{DATE}','MM'))]/[=TN(FD('{DATE}','yyyy'))]

Will return 25/3/2014 (current date for me is 24/3/2014)

@emre, so how do we compare dates ?
If we add the above to {:ExpiryDate} variable, how would we compare this to {DATE} in a Rule ?
eg, If {DATE} > {:ExpiryDate} then “Membership Has Expired”

in fact! in addition to being a long term, the problem will understand when the month is 30 or 31
if I do: [=TN(FD(’{DATE}’,‘dd’))+10]/[=TN(FD(’{DATE}’,‘MM’))]/[=TN(FD(’{DATE}’,‘yyyy’))]
23/03/2014 + 10 = 33/03/2014 and not 01/04/2014

@JohnS Before and After operators should compare dates.

@spanky You are right that will cause issues. I’ll check if I can implement add day, month expression functions.

@emre, I have got the comparison working now :smiley:
I think we need a simplified way of adding days, months or years to a date, so that the date is calculated correctly for days in month, etc

1 Like

We are running a test and would like to have all of the phases of a bill print to a text file. This includes: 1-When you hit PRINT BILL on the main screen after keying an order, 2-When you hit SETTLE, include tip and choose payment type, and hit CLOSE (both cash and credit would print updated receipt with all fields included), and 3-When you hit UNLOCK TICKET and PRINT BILL on the main screen when displaying Closed Tickets, we would like for this to include the order and payment terms, basically everything listed above (regarding #3, if there’s an easier way to reprint tickets that I missed, please forgive me. I’m just getting used to the system) - Thanks! Gabby

Hi, I am trying to add the Tax amount on a customer receipt template which is fine except I need to limit the figure to only show 2 decimal places. For example - if the total figure is £14.85 the tax amount is printing as 2.475 I need this to print as 2.48. If you can tell me how to round up and only show to 2 decimal places that would be great.

Many Thanks

Rob