View Categories

Printing discount amount/service charge below the total amount in the receipt

2 min read

Change receipt formatting like below to print discount separately from the item list.

Note: If you are trying to add a service charge below the amount instead of a discount, then please replace the AdditionalDiscount (Mentioned in red font) to ServiceCharge, also replace Discount (Mentioned in red font) to Service Charge

Maintenance > Resources
In Printer.Ticket and Printer.TicketPreview, make the changes like below:
Change the section where items are printed like below:

        <line>
            <text align ="left" length="23">Item</text>
            <text align ="right" length="10">Price</text>
            <text align ="right" length="5"></text>
            <text align ="right" length="10">Value</text>
        </line>
        <line>
             <text>------------------------------------------------</text>
        </line>
        #set($discount=0.0)
        #foreach ($ticketline in $ticket.getLines())
            #if(!$ticketline.printName().equals("AdditionalDiscount"))
            <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="10">${ticketline.printSalePrice()}</text>
                <text align ="right" length="5">x${ticketline.printMultiply()}</text>
                <text align ="right" length="10">${ticketline.printSubValue()}</text>
            </line>
                #if ($ticketline.productAttSetInstId)
                    <line>
                    <text align ="left" length="48">    ${ticketline.productAttSetInstDesc}</text>
                    </line>
                #end
            #else
                #set($discount=$discount+$ticketline.getSubValue())
            #end
        #end
        <line>
             <text>------------------------------------------------</text>
        </line>
Paste it just after the <line></line> and before the line for Items count as shown in this picture

Change the section where the total is printed like below:

        #if ($discount==0)
            <line size="1">
                <text align ="left" length="12" bold="true">Total.</text>
                <text align ="right" length="36" bold="true">${ticket.printTotal()}</text>
            </line>
        #else
            #set($stotal = $ticket.getTotal() - $discount)
            <line>
                <text align ="left" length="12" bold="true">Sub Total.</text>
                <text align ="right" length="36" bold="true">$stotal</text>
            </line>
            <line>
                <text align ="left" length="12" bold="true">Discount.</text>
                <text align ="right" length="36" bold="true">$discount</text>
            </line>
            <line size="1">
                <text align ="left" length="12" bold="true">Total.</text>
                <text align ="right" length="36" bold="true">$ticket.printTotal()</text>
            </line>
        #end
Paste it Just after <!– TAXES END–> line and before <line></line> as shown in this picture

Save and restart

0 Comments

Leave a Reply

Arrow-up