<?xml version="1.0" encoding="UTF-8"?>
<!--
Posics Saleculator - Billing System.
Copyright (C) 2009 Posics
This file is part of Posics Saleculator.
-->
<output>
<sql><![CDATA[
SELECT CATEGORIES.NAME, PRODUCTS.NAME, PRODUCTS.CODE, SUM(TICKETLINES.UNITS) AS UNITS, SUM(TICKETLINES.UNITS * TICKETLINES.PRICE) AS TOTAL
FROM RECEIPTS, TICKETS, TICKETLINES
LEFT JOIN PRODUCTS ON TICKETLINES.PRODUCT = PRODUCTS.ID
LEFT JOIN CATEGORIES ON CATEGORIES.ID=PRODUCTS.CATEGORY
WHERE RECEIPTS.ID = TICKETS.ID AND TICKETS.ID = TICKETLINES.TICKET AND
RECEIPTS.DATENEW >= $startDate AND RECEIPTS.DATENEW <= $endDate
GROUP BY PRODUCTS.ID, CATEGORIES.NAME, PRODUCTS.NAME, PRODUCTS.CODE ORDER BY CATEGORIES.NAME, PRODUCTS.NAME
]]></sql>
<ticket>
<image>Printer.Ticket.Logo</image>
<line></line>
<line size="1">
<text align ="center" length="48" bold="true">Product Sales</text>
</line>
<line></line>
<line>
<text length="12">Start Date:</text>
<text length="36">$startDate</text>
</line>
<line>
<text length="12">End Date:</text>
<text length="36">$endDate</text>
</line>
<line>
</line>
<line>
<text align ="left" length="25">Product</text>
<text align ="right" length="10">Units</text>
<text align ="right" length="13">Total</text>
</line>
<line>
<text>------------------------------------------------</text>
</line>
#foreach ($line in $posreport.getResult())
<line>
<text align ="left" length="25">${line.printValue(1)} (${line.printValue(2)})</text>
<text align ="right" length="10">${line.printValue(3)}</text>
<text align ="right" length="13">${line.printCurrency(4)}</text>
</line>
#end
<line>
<text>------------------------------------------------</text>
</line>
<line>
<text align ="left" length="25">Total</text>
<text align ="right" length="10"></text>
<text align ="right" bold="true" length="13">$posreport.printTotal(4)</text>
</line>
</ticket>
</output>
Leave a Reply