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>
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
Save and restart