Receipt print order aligning

Ive tried various configurations using centre, left, justified and the | symbol but i cant get the order name to stay aligned when the quantity change from single, double, triple digits.

eg

1x Order Name
10x Order Name
100x Order Name

What i want is the Order Name to all be aligned, an added complication is that i have a headed above the orders that say:

Qty Item Description Price

Now i can get my Price to align to the right edge so that is always under the header price, but if the quantities change the Orders also do not align under the header Item Description and i dont know if it is possible to change that as I have just types those headers in (there might be some Samba tags i could use instead i dont know?)

Here is an example of a receipt that shows things not aligning (except for price i did that lol)

and the code

[LAYOUT]
-- General layout
<XCT>27,112,0,25,250
<EC>
<XCT>29,40,76,6,0,48,69,48,48,1,1
<EL>
<F>
<EB>
<F>-
<C10>SALES RECEIPT
<F>-
<F>
<DB>
<EB>
<C11> ORDER {TICKET ID}
<F>
<F>-
Qty  Item Description                      Price
<F>-
<F>
<DB>
{ORDERS}
<F>=
<EB>
{DISCOUNTS}
[<J10>Total Promotion:|{ORDER STATE TOTAL:Gift}]
<J10>Total:|£{TICKET TOTAL}
<F>
{PAYMENTS}
[<L00>Card Type: {TICKET TAG:Credit Card Type}]
[<L00>Card Number: XXXX XXXX XXXX {TICKET TAG:Credit Card Digits}]
<F>=
<J10>Change:|£{CHANGE TOTAL}
<F>=
<F>
<F>
<C11>THANK YOU
<F>
<F>
<EC>
<BAR>{TICKET ID}
<EL>
<F>
<F>
<C00>15% OFF Online, Enter code NEWCUST15 at checkout
{ENTITIES}
<F>
<DB>
<F>-
<C00>Date:{TICKET DATE}   Time:{TIME}   Served By:{USER NAME}
<F>-

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

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

[ORDERS]
-- Default format for orders
<J00>{QUANTITY}x   {NAME}|£{TOTAL AMOUNT}
{ORDER TAGS}
<J00>{TICKET TAG:Think21}

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

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

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

[ENTITIES:Customer]
-- Customer entity format
<EB>
<C00>Customer Details: 
<DB>
<C00>{ENTITY NAME}
<C00>{ENTITY DATA:Address Line 1}
<C00>{ENTITY DATA:Address Line 2}
<C00>{ENTITY DATA:Post Code}
<C00>{ENTITY DATA:Phone}
<C00>{ENTITY DATA:Email Address}
<C00>{ENTITY DATA:Customer Number}

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

indent preformatted text by 4 spaces

Try putting something like |blah |blah

The <J00> tag justifies output, but you need more pipes (|) to separate the columns, as such:

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

Try also as @Jesse mentions using leading/trailing space before/after the pipes.

I tried what you did @QMcKay and it aligned name and total amount to the far right and kept quantity to the left as if it was ignoring the last pipe

Ill try again with more spaces to see if that solves it :slight_smile:

Spaces dont work they just take the item descriotion column out of alignment, this is what happens:

Having one pipe aligns everything to the left of the pipe to the left edge and everything on the right of the pipe to the right edge this would be perfect if i just had to columns

When i insert a second pipe to make three column this is what happens:

First column qty correctly aligns to the left
Third column price correctly aligns to the right
Second column item description also aligns to the right, i want this to align to the left instead so it is next to qty and not to the far right of the receipt next to price

It seems that every pipe that is added after the first aligns everything to the right if that column, is there a way to align to the left?

Spaces do not work they simply move the description closer to the left but as each description is a different length these added spaces cause the alignment to be completely messed up and theres only so many spaces you can do before you exceed the line count of the printer and you get an error message saying this when a receipt tries to print. Adding spaces just seems to act like your adding additional characters to the item description so doesnt help alignment

What im looking for is:

1x Crisps £0.50

That is how it appears if there is only one pipe that is placed before price and it looks perfect until quantity changes from single digits to double or triple digits as quanity and item are in the same column

If i do this and add a pipe inbetween qty and item i get this

1x Crisps£0.50

Item aligns far right next to price, how can i get it to align to the left of its column? Spaces after the item move it left but its still aligning to the right so different item descriptions lengths are still out of alignment as below

1x Crisps £0.50
1x Chocolate bar £0.70

Spaces separate item from price but item description is still aligned right and not left

Any ideas?

EDIT it appears my spaces in my examples dont show and when i submit my post the spaces have been taken out so it doesnt illustrate my point when i get time ill upload copies of receipts to show what happens on each format

Try it like I said. Use

|<J00> blah |blah |blah

On phone so can’t type the code for brackets.

Notice the first | is before your tag - that’s on purpose

when i put another pipe where you suggested before so its formatted as | at the start this makes the other pipes in the line actually print and they do not behave as pipes to separate columns as shown in the screen shot below

if it use formatting as {QUANTITY}x |{NAME}|£{TOTAL AMOUNT} i get:

If i remove the pipe from before {NAME} i get this:

What i want it to look like is this:

Sorry I was on my phone but take a look at this. I meant to type
<J00> |Blah |Blah |Blah

[LAYOUT]

-- General layout

<C100>MOORE'S DAIRY CREME

<C10>OWNER JESSE AND MELISSA PARKER

<C10>( xxx ) xxx - xxxx

<J00>Ticket# {TICKET NO}   |OP# {USER NAME}   |TE# 1   |TR# {TICKET ID}

{ENTITIES}

[<C00>Type:{TICKET TAG:SG}]

<C00>

{ORDERS}

<F>-

<EB>

[<J10>|Subtotal|     {PLAIN TOTAL}]

[|<J00>Total Discounts|    {ORDER TAG TOTAL:Discount Custom}]

<DB>

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

{TAXES}

[<J10>|Tip Amount|     {CALCULATION TOTAL:Tips}]

<EB>

[<J10>|Total|     {TICKET TOTAL}]

<DB>

{DISCOUNTS}

[<L00>CC Info  {TICKET TAG:CCtype} ({TICKET TAG:CCdigits})]

<EB>

{PAYMENTS}

<DB>

[<J10>|Change Due|     {CHANGE TOTAL}]

<C10># ITEMS SOLD {TICKET QUANTITY SUM}

<ec>

<QR>http://www.mooresdairycreme.com

<BAR>{TICKET ID}

<el>



[DISCOUNTS]

[<J00>Tip|{CALCULATION TOTAL}]







[PAYMENTS] 

<J10>| {TICKET TAG:CCtype} {PAYMENT NAME} Tend|     {TENDERED TOTAL}



[ORDERS]

<J00> {QUANTITY} {NAME}|{TOTAL AMOUNT}

{ORDER TAGS}



[ORDERS:Gift]

<J00>- {QUANTITY} {NAME}|**GIFT**

{ORDER TAGS}



[ORDERS:Void]

<J00> {QUANTITY} {NAME}|{TOTAL AMOUNT}  |**VOID**



[ORDER TAGS]

<J00> -{ORDER TAG NAME} [x{ORDER TAG QUANTITY}] {ORDER TAG PRICE}





[TAXES]

<J10>|{TAX NAME}  [=F(TN('{TAX RATE}'))] %|  |     {TAX AMOUNT}

This outputs as :

           MOORE'S DAIRY CREME            
      OWNER JESSE AND MELISSA PARKER      
            ( xxx ) xxx xxx           
Ticket# 20    OP# Admin   TE# 1   TR# 2982
               Type:Dine In               
                                          
 1 Dr Pepper.Medium                   1.55
 1 Burrito                            4.00
 1 Burrito                            4.00
 1 Burrito                            4.00
------------------------------------------
                        Subtotal     13.55
                  Tax 1  6.50 %       0.88
                  Tax 2  1.75 %       0.24
                           Total     14.67
                       Cash Tend     14.67
              # ITEMS SOLD 4

Notice how clean and lined up everything is.

by putting the pipes like you suggested |Blah |Blah |Blah I now get this

I didnt mean copy it exact. Meant for you to play with it and try different spacing. Notice top of my ticket where OP# is etc… those are aligned with | as well.

spacings dont work as they act like printed characters if I add spaces to align my first line with Dry Roasted Peanuts i need a different number of spaces to align Frazzles as the descriptions are different lengths

This is how I had it setup like yours, but if you try and do 3 items the first as quantity 1 then second as 10 and the third as 100 yours wont line up either

This is the same setup as yours and its perfect so long as the quantites are single digits eg 1x

Using the exact same setting if you have different quantities of single, double and triple digits the rest comes out of alignment as qty and product name are in the same column as below

1 Like

Ok I understand what your wanting now. I think @emre would have to come up with a new tag for that… or open up a new way to use | with Justified. You can line it up with character counts etc… but you cant do it from both sides of pipe at same time.

1 Like

Thought i was going crazy lol I was hoping you would say it couldnt be done just so id stop trying to do it lol

@emre anything you can do about this?

Thanks for looking again @kendash

I’ve added a small feature to 4.1.82.

You can pad numbers with F function. For example [=F('{QUANTITY}','{0,2}')] will pad quantity value right with 2 spaces. You can pad it to left with negative values. I know that won’t work flexible as justify feature but it might look better at least for double digit numbers. <J> tag will align first column to left and other columns to right as we generally use it for or values. I’ll try to improve that on next releases.

3 Likes