<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="top10sales" pageWidth="595" pageHeight="842" columnWidth="536" leftMargin="30" rightMargin="29" topMargin="20" bottomMargin="20" uuid="d7d82d43-9c85-4f9f-8d80-d0074f8c97fa">
	<property name="ireport.scriptlethandling" value="0"/>
	<property name="ireport.encoding" value="UTF-8"/>
	<property name="ireport.zoom" value="3.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<import value="net.sf.jasperreports.engine.*"/>
	<import value="java.util.*"/>
	<import value="net.sf.jasperreports.engine.data.*"/>
	<parameter name="ARG" class="java.lang.Object" isForPrompting="false"/>
	<queryString>
		<![CDATA[SELECT
			PRODUCTS.NAME,PRODUCTS.PRICEBUY,PRODUCTS.PRICESELL,
			SUM(TICKETLINES.UNITS) AS UNITS,
                        SUM(TICKETLINES.PRICE * TICKETLINES.UNITS) AS SUBTOTAL,
                        SUM((TICKETLINES.PRICE * TICKETLINES.UNITS) * TAXES.RATE) As TAXES,
                        SUM(TICKETLINES.PRICE * TICKETLINES.UNITS) + SUM((TICKETLINES.PRICE * TICKETLINES.UNITS) * TAXES.RATE) AS GROSSTOTAL
			FROM TICKETLINES
			LEFT OUTER JOIN PRODUCTS ON TICKETLINES.PRODUCT = PRODUCTS.ID
			LEFT OUTER JOIN TICKETS ON TICKETS.ID = TICKETLINES.TICKET
                        LEFT OUTER JOIN RECEIPTS ON RECEIPTS.ID = TICKETS.ID, TAXES
			WHERE RECEIPTS.ID = TICKETS.ID
                        AND TICKETS.ID = TICKETLINES.TICKET
                        AND TICKETLINES.PRODUCT = PRODUCTS.ID
                        AND TICKETLINES.TAXID = TAXES.ID

			GROUP BY PRODUCTS.NAME,PRODUCTS.PRICEBUY,PRODUCTS.PRICESELL
			ORDER BY GROSSTOTAL DESC
			LIMIT 10]]>
	</queryString>
	<field name="NAME" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="UNITS" class="java.lang.Double"/>
	<field name="PRICEBUY" class="java.lang.Double">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="PRICESELL" class="java.lang.Double">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SUBTOTAL" class="java.lang.Double"/>
	<field name="TAXES" class="java.lang.Double"/>
	<field name="GROSSTOTAL" class="java.lang.Double"/>
	<group name="PRODUCTNAME">
		<groupExpression><![CDATA[$F{NAME}]]></groupExpression>
		<groupHeader>
			<band splitType="Stretch"/>
		</groupHeader>
		<groupFooter>
			<band splitType="Stretch"/>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="52" splitType="Stretch">
			<textField pattern="" isBlankWhenNull="false">
				<reportElement key="textField-1" mode="Transparent" x="0" y="0" width="375" height="30" forecolor="#33CCFF" backcolor="#FFFFFF" uuid="36bb6038-8844-4087-81b5-3f3407a55b27"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#FFFFFF"/>
				</box>
				<textElement textAlignment="Left" verticalAlignment="Top" rotation="None">
					<font fontName="SansSerif" size="14" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{label.title.top10}]]></textFieldExpression>
			</textField>
			<textField pattern="" isBlankWhenNull="false">
				<reportElement key="textField-10" mode="Opaque" x="400" y="0" width="135" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="e26579d6-8d38-4614-891b-23913b0ab8b1"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Top" rotation="None">
					<font fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{label.printed}]]></textFieldExpression>
			</textField>
			<textField evaluationTime="Report" pattern="dd/MM/yyyy h.mm a" isBlankWhenNull="false">
				<reportElement key="textField" x="400" y="15" width="135" height="15" uuid="346a401a-7295-40f6-8247-601fa9dade23"/>
				<textElement textAlignment="Right">
					<font fontName="SansSerif" size="10"/>
				</textElement>
				<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
			<textField pattern="" isBlankWhenNull="false">
				<reportElement key="textField-19" mode="Opaque" x="1" y="33" width="50" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="ddcd9baf-9c3c-443a-8895-6e7bd752614f"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None">
					<font fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{label.period}]]></textFieldExpression>
			</textField>
			<textField pattern="" isBlankWhenNull="true">
				<reportElement key="textField-2" mode="Transparent" x="50" y="33" width="110" height="15" uuid="d65dbb9f-bd1e-462a-93ab-b7346e82dbed"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#FFFFFF"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None">
					<font fontName="SansSerif" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<textFieldExpression><![CDATA[com.unicenta.format.Formats.DATE.formatValue((java.util.Date)((Object[])((Object[])$P{ARG})[0])[1])]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement key="staticText-1" mode="Transparent" x="160" y="33" width="10" height="15" uuid="d4fa4940-6f33-4bce-ae5b-9f2a8a595199"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#FFFFFF"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
					<font fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<text><![CDATA[-]]></text>
			</staticText>
			<textField pattern="" isBlankWhenNull="true">
				<reportElement key="textField-3" mode="Transparent" x="170" y="33" width="110" height="15" uuid="1445dcb0-53fb-4bcb-beac-9a1c1b39f3c7"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#FFFFFF"/>
				</box>
				<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None">
					<font fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<textFieldExpression><![CDATA[com.unicenta.format.Formats.DATE.formatValue((java.util.Date)((Object[])((Object[])$P{ARG})[0])[3])]]></textFieldExpression>
			</textField>
			<rectangle radius="5">
				<reportElement key="rectangle-1" mode="Opaque" x="0" y="50" width="535" height="2" forecolor="#33CCFF" backcolor="#33CCFF" uuid="0f495ac4-0bfe-43a5-aff6-e0e89f29daa5"/>
				<graphicElement fill="Solid">
					<pen lineWidth="0.25" lineStyle="Solid"/>
				</graphicElement>
			</rectangle>
		</band>
	</title>
	<pageHeader>
		<band splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="15" splitType="Stretch">
			<textField>
				<reportElement key="textField-2" mode="Transparent" x="152" y="0" width="45" height="15" uuid="60460cdb-c61f-418f-9a6d-8583a67bf628"/>
				<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
					<font fontName="SansSerif" size="11" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{label.units}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="textField-4" x="197" y="0" width="65" height="15" uuid="70792588-0243-4fbe-87c6-95e7c2d32464"/>
				<textElement textAlignment="Right" verticalAlignment="Top" markup="none">
					<font size="11" isBold="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{label.pricebuy}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="textField-5" x="262" y="0" width="65" height="15" uuid="3f0ccdeb-a197-4d52-9514-50466f8b5fb6"/>
				<textElement textAlignment="Right" verticalAlignment="Top" markup="none">
					<font size="11" isBold="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{label.pricesell}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="textField-6" x="327" y="0" width="67" height="15" uuid="2fab2647-2fd3-47d6-a3c7-0c65fcfbfe13"/>
				<textElement textAlignment="Right" verticalAlignment="Top" markup="none">
					<font size="11" isBold="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{label.subtotal}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="textField-7" x="394" y="0" width="70" height="15" uuid="2ac5c94a-2770-487f-aada-86f90317f72a"/>
				<textElement textAlignment="Right" verticalAlignment="Top" markup="none">
					<font size="11" isBold="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{label.taxes}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="textField-3" mode="Transparent" x="465" y="0" width="70" height="15" uuid="a04e49e0-b952-4d74-a68e-5be3341501de"/>
				<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
					<font fontName="SansSerif" size="11" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{label.total}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement key="line-4" mode="Opaque" x="0" y="14" width="535" height="1" forecolor="#000000" backcolor="#FFFFFF" uuid="bf6f2473-c4a0-41d5-8de9-9f746d581c63"/>
				<graphicElement fill="Solid">
					<pen lineWidth="0.25" lineStyle="Solid"/>
				</graphicElement>
			</line>
		</band>
	</columnHeader>
	<detail>
		<band height="13" splitType="Stretch">
			<textField isBlankWhenNull="false">
				<reportElement key="textField" x="5" y="0" width="144" height="13" uuid="c3347304-35cb-4ea9-b606-121c04f1d34b"/>
				<textElement>
					<font fontName="SansSerif"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{NAME}]]></textFieldExpression>
			</textField>
			<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
				<reportElement key="textField" x="197" y="0" width="65" height="13" uuid="047cba6a-6790-489d-a6d6-95edf0de7c79"/>
				<textElement textAlignment="Right">
					<font fontName="SansSerif"/>
				</textElement>
				<textFieldExpression><![CDATA[com.unicenta.format.Formats.CURRENCY.formatValue($F{PRICEBUY})]]></textFieldExpression>
			</textField>
			<textField pattern="###0.00" isBlankWhenNull="true">
				<reportElement key="textField" x="152" y="0" width="45" height="13" uuid="7410d330-61fa-4a1f-b361-62bae059be74"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression><![CDATA[com.unicenta.format.Formats.DOUBLE.formatValue($F{UNITS})]]></textFieldExpression>
			</textField>
			<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
				<reportElement key="textField" x="327" y="0" width="67" height="13" uuid="960d857d-aae5-4f7d-b7ac-fdcd6c179d73"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression><![CDATA[com.unicenta.format.Formats.CURRENCY.formatValue($F{SUBTOTAL})]]></textFieldExpression>
			</textField>
			<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
				<reportElement key="textField" x="394" y="0" width="70" height="13" uuid="d8e94503-a455-4775-a564-df1a1a9a96e7"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression><![CDATA[com.unicenta.format.Formats.CURRENCY.formatValue($F{TAXES})]]></textFieldExpression>
			</textField>
			<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
				<reportElement key="textField" x="465" y="0" width="70" height="13" uuid="cbb36144-88c2-41c9-9e11-4ec16f3c9935"/>
				<textElement textAlignment="Right">
					<font fontName="SansSerif"/>
				</textElement>
				<textFieldExpression><![CDATA[com.unicenta.format.Formats.CURRENCY.formatValue($F{GROSSTOTAL})]]></textFieldExpression>
			</textField>
			<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
				<reportElement key="textField" x="262" y="0" width="65" height="13" uuid="02877e11-5137-4486-9dcf-9185fdb27e92"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression><![CDATA[com.unicenta.format.Formats.CURRENCY.formatValue($F{PRICESELL})]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="32" splitType="Stretch">
			<staticText>
				<reportElement x="0" y="10" width="100" height="15" uuid="a7471bb3-9d55-4cb1-a2b1-f271d68011c9"/>
				<textElement>
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<text><![CDATA[rpt:sales_chart_top10]]></text>
			</staticText>
		</band>
	</pageFooter>
	<summary>
		<band height="467" splitType="Stretch">
			<elementGroup/>
			<stackedBar3DChart>
				<chart>
					<reportElement x="6" y="59" width="524" height="394" uuid="41eb42d3-88da-41a8-9e2e-5c7e98407fd6"/>
					<chartTitle/>
					<chartSubtitle/>
					<chartLegend/>
				</chart>
				<categoryDataset>
					<categorySeries>
						<seriesExpression><![CDATA[$R{label.units}]]></seriesExpression>
						<categoryExpression><![CDATA[$F{NAME}]]></categoryExpression>
						<valueExpression><![CDATA[$F{UNITS}]]></valueExpression>
					</categorySeries>
				</categoryDataset>
				<bar3DPlot>
					<plot orientation="Horizontal">
						<seriesColor seriesOrder="0" color="#00CCFF"/>
						<seriesColor seriesOrder="1" color="#333333"/>
					</plot>
					<itemLabel/>
					<categoryAxisFormat>
						<axisFormat/>
					</categoryAxisFormat>
					<valueAxisFormat>
						<axisFormat/>
					</valueAxisFormat>
				</bar3DPlot>
			</stackedBar3DChart>
		</band>
	</summary>
</jasperReport>
