<?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="Customer Invoice Detail" pageWidth="600" pageHeight="792" columnWidth="600" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
	<property name="com.jasperassistant.designer.GridHeight" value="12"/>
	<property name="com.jasperassistant.designer.GridWidth" value="12"/>
	<property name="com.jasperassistant.designer.HGuides" value="0"/>
	<property name="com.jasperassistant.designer.DataSource" value="genral_ledger"/>
	<property name="com.jasperassistant.designer.SnapToGrid" value="false"/>
	<property name="com.jasperassistant.designer.Units" value="Inches"/>
	<property name="com.jasperassistant.designer.Grid" value="false"/>
	<property name="ireport.zoom" value="1.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<reportFont name="Report_Font" isDefault="false" fontName="Courier New" size="9" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
	<parameter name="as_inv" class="java.lang.String" isForPrompting="false"/>
	<queryString>
		<![CDATA[SELECT	IT.INVOICE_ID,
		IT.ITEM_CODE AS ITEM_CODE,
		(SELECT DESCR FROM ITEM WHERE IT.ITEM_CODE = ITEM.ITEM_CODE) AS ITEM_DESCR,
		IT.UNIT AS UNIT,
		IT.RATE AS RATE,
		SOI.QTY_ORD AS QTY_ORD,
		SOI.QTY_DESP AS QTY_DESP,
		((IT.DISC_SCHEM_BILLBACK_AMT + IT.DISC_SCHEM_OFFINV_AMT)/SOI.QTY_DESP) AS ALL_PROMO
	FROM
		INVOICE_TRACE IT,
		INVOICE I,
		SORDITEM SOI
	where
		 I.INVOICE_ID = IT.INVOICE_ID
	AND ( IT.SORD_NO = SOI.SALE_ORDER )
	AND ( IT.SORD_LINE_NO = SOI.LINE_NO )
	AND ( IT.INVOICE_ID ='$P!{as_inv}')
ORDER BY ITEM_CODE]]>
	</queryString>
	<field name="RATE" class="java.lang.Double"/>
	<field name="UNIT" class="java.lang.String"/>
	<field name="INVOICE_ID" class="java.lang.String"/>
	<field name="ITEM_DESCR" class="java.lang.String"/>
	<field name="ITEM_CODE" class="java.lang.String"/>
	<field name="QTY_ORD" class="java.lang.Double"/>
	<field name="QTY_DESP" class="java.lang.Double"/>
	<field name="ALL_PROMO" class="java.lang.Double"/>
	<variable name="compute_2" class="java.lang.String" resetType="None">
		<variableExpression><![CDATA[new java.lang.String($F{ITEM_CODE} + "\n"+$F{ITEM_DESCR})]]></variableExpression>
	</variable>
	<variable name="compute_1" class="java.lang.Integer" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Integer($V{COLUMN_NUMBER}.intValue())]]></variableExpression>
	</variable>
	<variable name="compute_3" class="java.lang.Double"/>
	<variable name="compute_4" class="java.lang.Double">
		<variableExpression><![CDATA[new java.lang.Double($F{RATE}.doubleValue() - $F{ALL_PROMO}.doubleValue())]]></variableExpression>
	</variable>
	<variable name="compute_5" class="java.lang.Double">
		<variableExpression><![CDATA[new java.lang.Double(($F{RATE}.doubleValue() - $F{ALL_PROMO}.doubleValue()) * $F{QTY_DESP}.doubleValue())]]></variableExpression>
	</variable>
	<variable name="compute_6" class="java.lang.Double">
		<variableExpression><![CDATA[new java.lang.Double($F{QTY_ORD}.doubleValue()-$F{QTY_DESP}.doubleValue())]]></variableExpression>
	</variable>
	<detail>
		<band height="14">
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement positionType="Float" x="21" y="0" width="146" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Left">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_2}]]></textFieldExpression>
			</textField>
			<textField pattern="" isBlankWhenNull="true">
				<reportElement positionType="Float" x="3" y="0" width="14" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{compute_1}]]></textFieldExpression>
			</textField>
			<textField pattern="0" isBlankWhenNull="true">
				<reportElement positionType="Float" x="167" y="0" width="45" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{QTY_ORD}]]></textFieldExpression>
			</textField>
			<textField pattern="0" isBlankWhenNull="true">
				<reportElement positionType="Float" x="210" y="0" width="47" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{QTY_DESP}]]></textFieldExpression>
			</textField>
			<textField pattern="0" isBlankWhenNull="true">
				<reportElement positionType="Float" x="307" y="0" width="23" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Left">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{UNIT}]]></textFieldExpression>
			</textField>
			<textField pattern="0.00" isBlankWhenNull="true">
				<reportElement positionType="Float" x="338" y="0" width="47" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{RATE}]]></textFieldExpression>
			</textField>
			<textField pattern="0.00" isBlankWhenNull="true">
				<reportElement positionType="Float" x="385" y="0" width="47" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{ALL_PROMO}]]></textFieldExpression>
			</textField>
			<textField pattern="0.0000" isBlankWhenNull="true">
				<reportElement positionType="Float" x="432" y="1" width="68" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{compute_4}]]></textFieldExpression>
			</textField>
			<textField pattern="0.00" isBlankWhenNull="true">
				<reportElement positionType="Float" x="500" y="1" width="66" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{compute_5}]]></textFieldExpression>
			</textField>
			<textField pattern="0" isBlankWhenNull="true">
				<reportElement positionType="Float" x="256" y="0" width="47" height="13">
					<printWhenExpression><![CDATA[new Boolean(true)]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right">
					<font fontName="Courier New" size="8" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{compute_6}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band/>
	</pageFooter>
	<summary>
		<band/>
	</summary>
</jasperReport>
