<?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="Molecule Sales" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="as_sitecode" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT INVOICE.SITE_CODE as site_code,ddf_get_site_descr(INVOICE.SITE_CODE) as site_descr, GENCODES.DESCR,SUM(INVOICE_TRACE.NET_AMT) AS NET_AMT
FROM INVOICE, ITEM, GENCODES,INVOICE_TRACE
WHERE
INVOICE.SITE_CODE IN ('$P!{as_sitecode}')
AND INVOICE.TRAN_DATE = TRUNC(SYSDATE) - 1
AND
INVOICE.CONFIRMED = 'Y'
AND INVOICE_TRACE.INVOICE_ID = INVOICE.INVOICE_ID
AND ITEM.ITEM_CODE = INVOICE_TRACE.ITEM_CODE
AND GENCODES.FLD_NAME = 'SGRP_CODE'
AND RTRIM(GENCODES.FLD_VALUE) = ITEM.SGRP_CODE
AND MOD_NAME = 'W_ITEM' GROUP BY  INVOICE.SITE_CODE,GENCODES.DESCR]]>
	</queryString>
	<field name="site_code" class="java.lang.String"/>
	<field name="site_descr" class="java.lang.String"/>
	<field name="NET_AMT" class="java.lang.Double"/>
	<field name="DESCR" class="java.lang.String"/>
	<sortField name="site_code"/>
	<variable name="variable1" class="java.util.Date" resetType="None">
		<variableExpression><![CDATA[new java.util.Date()]]></variableExpression>
	</variable>
	<variable name="site_var" class="java.lang.String" resetType="None">
		<variableExpression><![CDATA[new java.lang.String("Site Code : "+$F{site_code} + " "+ $F{site_descr})]]></variableExpression>
	</variable>
	<variable name="variable2" class="java.lang.Double" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Double($F{NET_AMT}.doubleValue())]]></variableExpression>
	</variable>
	<group name="SITE_GROUP" isStartNewPage="true" isResetPageNumber="true">
		<groupExpression><![CDATA[$F{site_code}]]></groupExpression>
		<groupHeader>
			<band/>
		</groupHeader>
		<groupFooter>
			<band/>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<pageHeader>
		<band height="79" splitType="Stretch">
			<staticText>
				<reportElement x="18" y="58" width="427" height="18"/>
				<textElement>
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Description]]></text>
			</staticText>
			<staticText>
				<reportElement x="455" y="58" width="100" height="18"/>
				<textElement textAlignment="Right">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Net Amount]]></text>
			</staticText>
			<line>
				<reportElement x="0" y="77" width="570" height="1"/>
			</line>
			<line>
				<reportElement x="0" y="55" width="570" height="1"/>
			</line>
			<staticText>
				<reportElement x="14" y="26" width="540" height="18"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="12" isBold="true"/>
				</textElement>
				<text><![CDATA[Molecule Sales]]></text>
			</staticText>
			<textField pattern="MM/dd/yy">
				<reportElement x="40" y="3" width="133" height="14"/>
				<textElement>
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[$V{variable1}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="10" y="3" width="28" height="14"/>
				<textElement>
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Date:]]></text>
			</staticText>
			<staticText>
				<reportElement x="504" y="3" width="20" height="14"/>
				<textElement>
					<font fontName="Times New Roman" isBold="false"/>
				</textElement>
				<text><![CDATA[Page]]></text>
			</staticText>
			<staticText>
				<reportElement x="538" y="3" width="10" height="14"/>
				<textElement>
					<font fontName="Times New Roman" isBold="false"/>
				</textElement>
				<text><![CDATA[of]]></text>
			</staticText>
			<textField evaluationTime="Page">
				<reportElement x="526" y="3" width="13" height="14"/>
				<textElement>
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<textField evaluationTime="Report">
				<reportElement x="551" y="3" width="15" height="14"/>
				<textElement>
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="14" y="3" width="540" height="18"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="12" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{site_descr}]]></textFieldExpression>
			</textField>
		</band>
	</pageHeader>
	<detail>
		<band height="18" splitType="Stretch">
			<textField>
				<reportElement x="18" y="0" width="366" height="18"/>
				<textElement>
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESCR}]]></textFieldExpression>
			</textField>
			<textField pattern="0.00">
				<reportElement x="394" y="0" width="160" height="18"/>
				<textElement textAlignment="Right">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{NET_AMT}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band height="20" splitType="Stretch">
			<textField pattern="0.00">
				<reportElement x="455" y="2" width="100" height="18"/>
				<textElement textAlignment="Right">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{variable2}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="349" y="2" width="96" height="18"/>
				<textElement>
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Grand Total]]></text>
			</staticText>
			<line>
				<reportElement x="0" y="0" width="570" height="1"/>
			</line>
		</band>
	</summary>
</jasperReport>
