<?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="check_sheet_by_pallet_id" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="772" leftMargin="15" rightMargin="5" topMargin="18" bottomMargin="10">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="508"/>
	<property name="ireport.y" value="0"/>
	<parameter name="PALLET_ID" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT
DDF_GET_PTCN_PICKORDER(POD.PICK_ORDER) AS PTCN,
SO.SALE_ORDER AS ORDER_NO,
SD.LINE_NO AS LINE_NO,
PIH.PALLET_NO AS PALLET_ID,
PID.LOC_CODE__TO AS LOC_CODE,
PID.ITEM_CODE AS ITEM_CODE,
(SELECT I.DESCR AS DESCR FROM ITEM I WHERE PID.ITEM_CODE = I.ITEM_CODE) AS ITEM_DESCR,
PID.LOT_NO AS LOT_NO,
SD.QUANTITY__STDUOM AS ORD_QTY,
PID.QUANTITY AS PCKD_QTY,
PID.NO_ART AS NO_OF_CASES,
PIH.PICK_TYPE AS PICK_TYPE
FROM PICK_ISS_HDR PIH,PICK_ISS_DET PID,PICK_ORD_DET POD, SORDER SO, SORDDET SD
WHERE PID.TRAN_ID = PIH.TRAN_ID
AND PID.LINE_NO = POD.LINE_NO
AND SD.LINE_NO = POD.LINE_NO__SORD
AND PID.PICK_ORDER = POD.PICK_ORDER
AND PID.PICK_ORDER = PIH.PICK_ORDER
AND POD.SALE_ORDER = SO.SALE_ORDER
AND SD.SALE_ORDER = SO.SALE_ORDER
AND PIH.PALLET_NO = '$P!{PALLET_ID}']]>
	</queryString>
	<field name="ORDER_NO" class="java.lang.String"/>
	<field name="LINE_NO" class="java.lang.Double"/>
	<field name="PALLET_ID" class="java.lang.String"/>
	<field name="LOC_CODE" class="java.lang.String"/>
	<field name="ITEM_CODE" class="java.lang.String"/>
	<field name="ITEM_DESCR" class="java.lang.String"/>
	<field name="LOT_NO" class="java.lang.String"/>
	<field name="ORD_QTY" class="java.lang.Double"/>
	<field name="PCKD_QTY" class="java.lang.Double"/>
	<field name="NO_OF_CASES" class="java.lang.Double"/>
	<field name="PTCN" class="java.lang.String"/>
	<field name="PICK_TYPE" class="java.lang.String"/>
	<sortField name="PALLET_ID"/>
	<sortField name="ITEM_CODE"/>
	<variable name="line_tot" class="java.lang.Double" resetType="Group" resetGroup="ITEM_CODE" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Double($F{PCKD_QTY}.doubleValue())]]></variableExpression>
	</variable>
	<variable name="ord_tot" class="java.lang.Double" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Double($F{PCKD_QTY}.doubleValue())]]></variableExpression>
	</variable>
	<variable name="ord_qty_eaches" class="java.lang.Double" resetType="Group" resetGroup="ITEM_CODE" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Double($F{ORD_QTY}.doubleValue())]]></variableExpression>
	</variable>
	<variable name="packed_qty_eaches" class="java.lang.Double" resetType="Group" resetGroup="ITEM_CODE" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Double($F{PCKD_QTY}.doubleValue())]]></variableExpression>
	</variable>
	<variable name="packed_qty_cases" class="java.lang.Double" resetType="Group" resetGroup="ITEM_CODE" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Double((!$F{PICK_TYPE}.equals("A"))?$F{NO_OF_CASES}.doubleValue():0)]]></variableExpression>
	</variable>
	<group name="ITEM_CODE">
		<groupExpression><![CDATA[$F{ITEM_CODE}+$F{LOT_NO}]]></groupExpression>
		<groupHeader>
			<band height="30">
				<textField evaluationTime="Group" evaluationGroup="ITEM_CODE" pattern="###0" isBlankWhenNull="true">
					<reportElement x="651" y="10" width="35" height="16" isRemoveLineWhenBlank="true"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{line_tot}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement x="376" y="0" width="135" height="10" isRemoveLineWhenBlank="true"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{ITEM_DESCR}]]></textFieldExpression>
				</textField>
				<textField evaluationTime="Group" evaluationGroup="ITEM_CODE" pattern="###0" isBlankWhenNull="true">
					<reportElement x="710" y="0" width="30" height="10" isRemoveLineWhenBlank="true"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{packed_qty_cases}]]></textFieldExpression>
				</textField>
				<textField evaluationTime="Group" evaluationGroup="ITEM_CODE" pattern="###0" isBlankWhenNull="true">
					<reportElement x="651" y="0" width="35" height="10" isRemoveLineWhenBlank="true"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{packed_qty_eaches}]]></textFieldExpression>
				</textField>
				<textField evaluationTime="Group" evaluationGroup="ITEM_CODE" pattern="###0" isBlankWhenNull="true">
					<reportElement x="588" y="0" width="30" height="10" isRemoveLineWhenBlank="true"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{ord_qty_eaches}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement x="322" y="0" width="55" height="10" isRemoveLineWhenBlank="true"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{ITEM_CODE}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement x="176" y="0" width="93" height="10" isRemoveLineWhenBlank="true"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{PALLET_ID}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement x="513" y="0" width="55" height="10" isRemoveLineWhenBlank="true"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{LOT_NO}]]></textFieldExpression>
				</textField>
				<textField pattern="###0" isBlankWhenNull="true">
					<reportElement x="143" y="0" width="21" height="10" isRemoveLineWhenBlank="true"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Double"><![CDATA[$F{LINE_NO}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement isPrintRepeatedValues="false" x="0" y="0" width="79" height="10"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{PTCN}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement x="273" y="0" width="49" height="10" isRemoveLineWhenBlank="true"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{LOC_CODE}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement isPrintRepeatedValues="false" x="81" y="0" width="60" height="10"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{ORDER_NO}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement x="595" y="10" width="45" height="8"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<text><![CDATA[Line Total]]></text>
				</staticText>
			</band>
		</groupHeader>
		<groupFooter>
			<band/>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band splitType="Stretch"/>
	</title>
	<pageHeader>
		<band height="58" splitType="Stretch">
			<staticText>
				<reportElement x="142" y="36" width="34" height="10"/>
				<textElement>
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Line#]]></text>
			</staticText>
			<staticText>
				<reportElement x="0" y="12" width="772" height="14"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="Courier New" size="10"/>
				</textElement>
				<text><![CDATA[Quality Audit Cartons]]></text>
			</staticText>
			<staticText>
				<reportElement x="273" y="36" width="36" height="10"/>
				<textElement>
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[CnsLoc]]></text>
			</staticText>
			<staticText>
				<reportElement x="0" y="36" width="60" height="10"/>
				<textElement>
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Pktkt Ctl#]]></text>
			</staticText>
			<staticText>
				<reportElement x="81" y="36" width="60" height="10"/>
				<textElement>
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Order#]]></text>
			</staticText>
			<staticText>
				<reportElement x="378" y="36" width="134" height="10"/>
				<textElement>
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Item Description]]></text>
			</staticText>
			<staticText>
				<reportElement x="710" y="36" width="34" height="16"/>
				<textElement textAlignment="Center">
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Pckd Qty Cases]]></text>
			</staticText>
			<staticText>
				<reportElement x="588" y="36" width="35" height="16"/>
				<textElement textAlignment="Center">
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Ord Qty Eaches]]></text>
			</staticText>
			<staticText>
				<reportElement x="651" y="36" width="39" height="16"/>
				<textElement textAlignment="Center">
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Pckd Qty Eaches]]></text>
			</staticText>
			<staticText>
				<reportElement x="177" y="36" width="93" height="10"/>
				<textElement>
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[PalletID]]></text>
			</staticText>
			<staticText>
				<reportElement x="514" y="36" width="63" height="10"/>
				<textElement>
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Lot#]]></text>
			</staticText>
			<textField pattern="HH:mm:ss" isBlankWhenNull="true">
				<reportElement x="45" y="12" width="44" height="11"/>
				<textElement>
					<font fontName="Courier New" size="7" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
			<textField pattern="MM/dd/yy" isBlankWhenNull="true">
				<reportElement x="5" y="12" width="44" height="11"/>
				<textElement>
					<font fontName="Courier New" size="7" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="708" y="12" width="26" height="11"/>
				<textElement>
					<font fontName="Courier New" size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="681" y="12" width="25" height="10"/>
				<textElement>
					<font fontName="Courier New" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[Page :]]></text>
			</staticText>
			<staticText>
				<reportElement x="325" y="36" width="54" height="10"/>
				<textElement>
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Item#]]></text>
			</staticText>
		</band>
	</pageHeader>
	<columnHeader>
		<band splitType="Stretch"/>
	</columnHeader>
	<summary>
		<band height="18" splitType="Stretch">
			<staticText>
				<reportElement x="0" y="0" width="488" height="14"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Courier New" size="10"/>
				</textElement>
				<text><![CDATA[*** END OF REPORT ***]]></text>
			</staticText>
			<textField pattern="###0" isBlankWhenNull="true">
				<reportElement x="651" y="0" width="35" height="16" isRemoveLineWhenBlank="true"/>
				<textElement textAlignment="Right">
					<font fontName="Courier New" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{ord_tot}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="595" y="0" width="47" height="8"/>
				<textElement>
					<font fontName="Courier New" size="7"/>
				</textElement>
				<text><![CDATA[Order Total]]></text>
			</staticText>
		</band>
	</summary>
</jasperReport>
