Maintenance > Resources
This formatting in Printer.Ticket print receipt formatted in 80 column paper. It also handle page breaks. Adjust line gaps and set header and footer lines count as required.
<?xml version="1.0" encoding="UTF-8"?> <!-- Posics Saleculator - Billing System. Copyright (C) 2009 Posics This file is part of Posics Saleculator. --> <output> <display> <line> <text align="left" length="10">Total.</text> <text align="right" length="10">${ticket.printTotal()}</text> </line> <line> <text align="center" length="20">Thank you.</text> </line> </display> <ticket> <line></line> <line></line> <line></line> <line></line> <line></line> <line></line> <line></line> <line></line> <line></line> <line></line> <line> <text length="10"></text> #if($ticket.getCustomer()) <text length="45">${ticket.getCustomer().printName()}</text> #elseif($ticket.getProperty("ReceiptNote")) <text length="45" >${ticket.printProperty("ReceiptNote")}</text> #else <text length="45"></text> #end <text length="25" >${ticket.printId()}</text> </line> <line> <text length="10"></text> #if ($ticket.getCustomer()) <text length="68">${ticket.getCustomer().getAddress()}</text> #end </line> <line> <text length="10"></text> #if ($ticket.getCustomer()) <text length="45">${ticket.getCustomer().getSearchkey()}</text> #else <text length="45"></text> #end <text length="25" >${ticket.printDate()}</text> </line> <line></line> <line></line> <line></line> <line></line> <line></line> ##Set below three values according to form settings #set ($itemsperpage = 32) #set ($headerlines = 18) #set ($footerlines = 14) ## #set ($totallines = $ticket.getLines().size()) #set ($currentline = 0) #set ($seqno = 0) #set ($currentpage = 0) ##Counting total page number and rounding. #set ($mod = $totallines % $itemsperpage) #if($mod>0) #set ( $totalpages = ( $totallines + $itemsperpage - $mod ) / $itemsperpage) #else #set ( $totalpages = $totallines / $itemsperpage) #end #foreach ($ticketline in $ticket.getLines()) #set ($currentline = $currentline + 1) #set ($seqno = $seqno + 1) <line> <text length="4">$seqno</text> #if ($ticketline.isProductCom()) <text length="38">*${ticketline.printName()}</text> #else <text length="38">${ticketline.printName()}</text> #end <text align="center" length="10">${ticketline.printMultiply()}</text> <text align="right" length="10">${ticketline.printSalePrice()}</text> <text align="right" length="16">${ticketline.printSubValue()}</text> </line> #if ($ticketline.productAttSetInstId) <line> <text length="40">${ticketline.productAttSetInstDesc}</text> </line> #end ####FORM SETTINGS START #if($currentline == $itemsperpage) #set($currentline = 0) #set($currentpage = $currentpage + 1) #if($totallines - ($currentpage * $itemsperpage) > 0) #set($start = 0) #set($end = $headerlines + $footerlines) #set($range = [$start..$end]) #foreach($i in $range) <line></line> #end #end #end ####FORM SETTINGS END #end ####FORM SETTINGS START ##Final page alignment #if($currentline != 0) #set($currentpage = $currentpage + 1) #set($start = 0) #set($end = $itemsperpage - $currentline) #set($range = [$start..$end]) #foreach ($i in $range) <line></line> #end #end ####FORM SETTINGS END <line></line> <line> <text align="right" length="78" >${ticket.printTotal()}</text> </line> #foreach ($paymentline in $ticket.payments) #if ($paymentline.name == "debt") <line> <text bold="true">Debt</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> <line> <text align="right" length="80">Current Debt: ${ticket.getCustomer().printCurDebt()}</text> </line> #end #end <line></line> </ticket> </output>
Another template for 80 column printers which choose template based on customer.
<?xml version="1.0" encoding="UTF-8"?> <!-- Posics Saleculator - Billing System. Copyright (C) 2009 Posics This file is part of Posics Saleculator. --> <output> <display> <line> <text align="left" length="10">Total.</text> <text align="right" length="10">${ticket.printTotal()}</text> </line> <line> <text align="center" length="20">Thank you.</text> </line> </display> #if ($ticket.getCustomer()) <ticket printer="2"> #set ($itemsperpage = 20) #set ($headerlines = 0) #set ($footerlines = 0) #set ($totallines = $ticket.getLines().size()) #set ($currentline = 0) #set ($seqno = 0) ##Counting total page number and rounding. #set ($mod = $totallines % $itemsperpage) #if($mod>0) #set ( $totalpages = ( $totallines + $itemsperpage - $mod ) / $itemsperpage) #else #set ( $totalpages = $totallines / $itemsperpage) #end <line size="2"> <text align="center" length="48" bold="true">BUSINESS NAME</text> </line> <line> <text align="center" length="80" bold="true">ADDRESS1</text> </line> <line> <text align="center" length="80" bold="true">ADDRESS2</text> </line> <line> <text align="center" length="80" bold="true">TELEPHONE</text> </line> <line> <text>--------------------------------------------------------------------------------</text> </line> <line> <text align="center" length="80" bold="true">TAX-INVOICE</text> </line> <line> <text align="center" length="80" bold="true">TRN: 123123123123</text> </line> <line> <text>--------------------------------------------------------------------------------</text> </line> #if (${ticket.ticketType} == 0) <line> <text align="left" length="15">Invoice No.:</text> <text>${ticket.printId()}</text> </line> #end #if (${ticket.ticketType} == 1) <line> <text align="left" length="15">Refund:</text> <text>${ticket.printId()}</text> </line> #end <line> <text align="left" length="15">Invoice Date:</text> <text>${ticket.printDate()}</text> </line> #if ($ticket.getCustomer()) <line> <text align="left" length="15" bold="true">Customer:</text> <text bold="true">${ticket.getCustomer().printName()}</text> </line> <line> <text align="left" length="15"></text> <text>${ticket.getCustomer().getSearchkey()}</text> </line> #if ($ticket.getCustomer().getAddress()) <line> <text align="left" length="15"></text> <text>${ticket.getCustomer().getAddress()}</text> </line> #end #if ($ticket.getCustomer().printTaxid()) <line> <text align="left" length="15" bold="true">TRN:</text> <text bold="true">${ticket.getCustomer().printTaxid()}</text> </line> #end #end <line></line> <line> <text>--------------------------------------------------------------------------------</text> </line> <line> <text align="left" length="5">Sl.</text> <text align="left" length="30">ITEM</text> <text align="right" length="5">QTY</text> <text align="right" length="10">RATE</text> <text align="right" length="10">AMOUNT</text> <text align="right" length="10">VAT</text> <text align="right" length="10">TOT AMT</text> </line> <line> <text>--------------------------------------------------------------------------------</text> </line> #foreach ($ticketline in $ticket.getLines()) #set ($currentline = $currentline + 1) #set ($seqno = $seqno + 1) <text align="left" length="5">$seqno</text> <line> #if ($ticketline.isProductCom()) <text align="left" length="30">*${ticketline.printName()}</text> #else <text align="left" length="30">${ticketline.printName()}</text> #end <text align="right" length="5">${ticketline.printMultiply()}</text> <text align="right" length="10">${ticketline.printSalePrice()}</text> <text align="right" length="10">${ticketline.printSubValue()}</text> <text align="right" length="10">${ticketline.printTax()}</text> <text align="right" length="10">${ticketline.printValue()}</text> </line> #if ($ticketline.productAttSetInstId) <line> <text align="left" length="80"> ${ticketline.productAttSetInstDesc}</text> </line> #end #end ####FORM SETTINGS START ##Final page alignment #if($currentline < $itemsperpage) #set($start = 0) #set($end = $itemsperpage - $currentline) #set($range = [$start..$end]) #foreach ($i in $range) <line></line> #end #end ####FORM SETTINGS END <line> <text>--------------------------------------------------------------------------------</text> </line> <line> <text>Total Qty: ${ticket.printArticlesCount()}</text> </line> <line> </line> <line> <text align="left" length="20">Subtotal</text> <text align="right" length="60">${ticket.printSubTotal()}</text> </line> <line> <text align="left" length="20">VAT 5%</text> <text align="right" length="60">${ticket.printTax()}</text> </line> <line> <text>--------------------------------------------------------------------------------</text> </line> <line size="2"> <text align="left" length="18" bold="true">Total</text> <text align="right" length="30" bold="true">${ticket.printTotal()}</text> </line> <line> </line> #foreach ($paymentline in $ticket.payments) #if ($paymentline.name == "cash") <line> <text bold="true">Cash</text> </line> #end #if ($paymentline.name == "cashrefund") <line> <text bold="true">Refund</text> </line> <line> <text align="right" length="90">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "magcard") <line> <text bold="true">Mag card</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "magcardrefund") <line> <text bold="true">Mag card refund</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "cheque") <line> <text bold="true">Cheque</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "chequerefund") <line> <text bold="true">Cheque refund</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "paperin") <line> <text bold="true">Voucher</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> <line> <text align="right" length="80">${paymentline.printDenomination()}</text> </line> #end #if ($paymentline.name == "paperout") <line> <text bold="true">Voucher Refund</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "free") <line> <text bold="true">Free</text> </<ticket>line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "debt") <line> <text bold="true">Debt</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> <line> <text align="right" length="80">Total Outstanding: ${ticket.getCustomer().printCurDebt()}</text> </line> #end #if ($paymentline.name == "advance") <line> <text bold="true">Advance</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "pointsin") <line> <text bold="true">Points</text> </line> <line> <text align="right" length="80">${paymentline.printTotal()}</text> </line> #end #end <line></line> <line> <text align="left" length="15">Cashier:</text> <text>${ticket.printUser()}</text> </line> <line> <text align="left" length="15">Station:</text> #if ($ticket.getProperty("orderfrom")) <text>${ticket.getProperty("orderfrom")}</text> #else <text>${ticket.printHost()}</text> #end </line> <line></line> <line></line> <line></line> <line></line> <line></line> <line></line> <line> <text align="left" length="40">Customer Signature:</text> <text align="right" length="40">Thank you. Visit Again.</text> </line> <line> <text align="right" length="80">for BUSINESS NAME</text> </line> <line> <text>--------------------------------------------------------------------------------</text> </line> </ticket> #else <ticket> <image>Printer.Ticket.Logo</image> <line size="1"> <text align="center" length="48">BUSINESS NAME</text> </line> <line> <text align="center" length="48">ADDRESS1, ADDRESS2</text> </line> <line> <text align="center" length="48">TELEPHONE</text> </line> <line> <text>------------------------------------------------</text> </line> <line> <text align="center" length="48">TAX INVOICE</text> </line> <line> <text align="center" length="48">TAX ID: 100030905200003</text> </line> <line> <text>------------------------------------------------</text> </line> <line></line> #if (${ticket.ticketType} == 0) <line> <text align="left" length="15">Receipt:</text> <text>${ticket.printId()}</text> </line> #end #if (${ticket.ticketType} == 1) <line> <text align="left" length="15">Refund:</text> <text>${ticket.printId()}</text> </line> #end <line> <text align="left" length="15">Date:</text> <text>${ticket.printDate()}</text> </line> #if ($ticket.getCustomer()) <line> <text align="left" length="15">Customer:</text> <text>${ticket.getCustomer().printName()}</text> </line> <line> <text align="left" length="15"></text> <text>${ticket.getCustomer().getSearchkey()}</text> </line> #if ($ticket.getCustomer().getAddress()) <line> <text align="left" length="15"></text> <text>${ticket.getCustomer().getAddress()}</text> </line> #end #end <line></line> <line> <text align="left" length="23">Item</text> <text align="right" length="5">QTY</text> <text align="right" length="10">Price</text> <text align="right" length="10">Value</text> </line> <line> <text>------------------------------------------------</text> </line> #foreach ($ticketline in $ticket.getLines()) <line> #if ($ticketline.isProductCom()) <text align="left" length="23">*${ticketline.printName()}</text> #else <text align="left" length="23">${ticketline.printName()}</text> #end <text align="right" length="5"> ${ticketline.printMultiply()}</text> <text align="right" length="10">${ticketline.printSalePrice()}</text> <text align="right" length="10">${ticketline.printValue()}</text> </line> #if ($ticketline.productAttSetInstId) <line> <text align="left" length="48"> ${ticketline.productAttSetInstDesc}</text> </line> #end #end <line> <text>------------------------------------------------</text> </line> <line> <text>Total Qty: ${ticket.printArticlesCount()}</text> </line> <!-- TAXES START--> <line> <text align="left" length="16">Subtotal</text> <text align="right" length="32">${ticket.printSubTotal()}</text> </line> <line> <text align="left" length="16">VAT 5%</text> <text align="right" length="32">${ticket.printTax()}</text> </line> <!-- TAXES END--> <line size="1"> <text align="left" length="12" bold="true">Total</text> <text align="right" length="36" bold="true">${ticket.printTotal()}</text> </line> <line></line> #foreach ($paymentline in $ticket.payments) #if ($paymentline.name == "cash") <line> <text bold="true">Cash</text> </line> <line> <text align="left" length="12">Tendered:</text> <text align="right" length="36">${paymentline.printPaid()}</text> </line> <line> <text align="left" length="12">Change:</text> <text align="right" length="36">${paymentline.printChange()}</text> </line> #end #if ($paymentline.name == "cashrefund") <line> <text bold="true">Refund</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "magcard") <line> <text bold="true">Mag card</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> <!-- <line> <text align="left" length="22">Number:</text> <text>${paymentline.printCardNumber()}</text> </line> <line> <text align="left" length="22">Expiration date:</text> <text>${paymentline.printExpirationDate()}</text> </line> <line> <text align="left" length="22">Operation:</text> <text>${paymentline.printTransactionID()}</text> </line> <line> <text align="left" length="22">Authorization:</text> <text>${paymentline.printAuthorization()}</text> </line> --> #end #if ($paymentline.name == "magcardrefund") <line> <text bold="true">Mag card refund</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "cheque") <line> <text bold="true">Cheque</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "chequerefund") <line> <text bold="true">Cheque refund</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "paperin") <line> <text bold="true">Voucher</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> <line> <text align="right" length="48">${paymentline.printDenomination()}</text> </line> #end #if ($paymentline.name == "paperout") <line> <text bold="true">Voucher Refund</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "free") <line> <text bold="true">Free</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "debt") <line> <text bold="true">Debt</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "advance") <line> <text bold="true">Advance</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "pointsin") <line> <text bold="true">Points</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #if ($paymentline.name == "currency") <line> <text bold="true">Currency - ${paymentline.printCurrency()}</text> </line> <line> <text align="left" length="12">Tendered:</text> <text align ="right" length="36">${paymentline.printCurrency()}${paymentline.printPaidCurrency()}</text> </line> <line> <text align="left" length="15">Conversion Rate:</text> <text align ="right" length="33">${paymentline.printRate()}</text> </line> <line> <text align="left" length="12">Change:</text> <text align ="right" length="36">${paymentline.printChange()}</text> </line> #end #if ($paymentline.name == "online") <line> <text bold="true">Online - $paymentline.getTransactionID()</text> </line> <line> <text align="right" length="48">${paymentline.printTotal()}</text> </line> #end #end <line></line> <line> <text align="left" length="10">Cashier:</text> <text>${ticket.printUser()}</text> </line> <line> <text align="left" length="10">Station:</text> #if ($ticket.getProperty("orderfrom")) <text>${ticket.getProperty("orderfrom")}</text> #else <text>${ticket.printHost()}</text> #end </line> <line></line> <line> <text align="center" length="48">Thank you for your visit.</text> </line> <!-- TICKET COUPON START --> <!-- TICKET COUPON END --> </ticket> #end #foreach ($paymentline in $ticket.payments) #if ($paymentline.name == "cash") <opendrawer/> #end #if ($paymentline.name == "cashrefund") <opendrawer/> #end #end </output> Save & restart
Leave a Reply