<?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="Carton Contents" pageWidth="283" pageHeight="438" columnWidth="263" leftMargin="10" rightMargin="10" topMargin="2" bottomMargin="2">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="carton_no" class="java.lang.String"/>
	<queryString>
		<![CDATA[select so.cust_pord,wtdet.ptcn,pdet.item_code,sd.cust_item__ref,
sum(ilpack.shipper_size) as quantity
from pack_hdr phdr,
pack_det pdet,
sorder so,
wave_task_det wtdet,
sorddet sd,
item_lot_packsize ilpack
where
phdr.outer_carton_no = '$P!{carton_no}'
and phdr.tran_id = pdet.tran_id
and so.sale_order = pdet.sale_order
and sd.sale_order = pdet.sale_order
and sd.line_no = pdet.line_no__sord
and wtdet.ref_id = phdr.pick_order
and wtdet.wave_id = phdr.wave_id
and pdet.item_code = ilpack.item_code
and pdet.lot_no between ilpack.lot_no__from and ilpack.lot_no__to
group by
so.cust_pord,wtdet.ptcn,pdet.item_code,sd.cust_item__ref
union all
select so.cust_pord,cm.ptcn,pid.item_code,sd.cust_item__ref,
pid.quantity
from carton_master cm,
sorder so,
sorddet sd,
pick_ord_hdr poh,
pick_ord_det pod,
pick_iss_det pid
where
cm.carton_no = '$P!{carton_no}'
and pid.pick_order = cm.pick_order
and poh.pick_order = cm.pick_order
and pod.pick_order = cm.pick_order
and pod.line_no = pid.line_no__ord
and pod.line_no = cm.line_no__pick
and so.sale_order = poh.sale_order
and sd.sale_order = so.sale_order
and sd.line_no = pod.line_no__sord
and cm.carton_no not in (select outer_carton_no from pack_hdr
where pack_hdr.outer_carton_no = cm.carton_no)]]>
	</queryString>
	<field name="cust_pord" class="java.lang.String"/>
	<field name="ptcn" class="java.lang.String"/>
	<field name="item_code" class="java.lang.String"/>
	<field name="cust_item__ref" class="java.lang.String"/>
	<field name="quantity" class="java.lang.Double"/>
	<variable name="tot_qty" class="java.lang.Double" calculation="Sum">
		<variableExpression><![CDATA[$F{quantity}]]></variableExpression>
	</variable>
	<variable name="date" class="java.lang.String"/>
	<variable name="time" class="java.lang.String"/>
	<title>
		<band splitType="Stretch"/>
	</title>
	<pageHeader>
		<band height="61" splitType="Stretch">
			<staticText>
				<reportElement x="95" y="6" width="80" height="12"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Carton Contents]]></text>
			</staticText>
			<staticText>
				<reportElement x="210" y="7" width="25" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[Page :]]></text>
			</staticText>
			<textField>
				<reportElement x="237" y="7" width="26" height="11"/>
				<textElement>
					<font size="7" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="1" y="18" width="43" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[CARTON#]]></text>
			</staticText>
			<staticText>
				<reportElement x="1" y="28" width="43" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[Cust PO]]></text>
			</staticText>
			<staticText>
				<reportElement x="1" y="38" width="43" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[Cust Dept]]></text>
			</staticText>
			<staticText>
				<reportElement x="42" y="18" width="3" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[:]]></text>
			</staticText>
			<staticText>
				<reportElement x="42" y="38" width="3" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[:]]></text>
			</staticText>
			<staticText>
				<reportElement x="42" y="28" width="3" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[:]]></text>
			</staticText>
			<staticText>
				<reportElement x="162" y="28" width="20" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[Pkt#]]></text>
			</staticText>
			<staticText>
				<reportElement x="139" y="38" width="17" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[Ord]]></text>
			</staticText>
			<staticText>
				<reportElement x="182" y="27" width="3" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[:]]></text>
			</staticText>
			<staticText>
				<reportElement x="155" y="38" width="3" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[:]]></text>
			</staticText>
			<staticText>
				<reportElement x="1" y="51" width="17" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[Ln]]></text>
			</staticText>
			<staticText>
				<reportElement x="32" y="51" width="17" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[SKU]]></text>
			</staticText>
			<staticText>
				<reportElement x="165" y="51" width="17" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[Xref]]></text>
			</staticText>
			<staticText>
				<reportElement x="229" y="51" width="17" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<text><![CDATA[Qty]]></text>
			</staticText>
			<textField>
				<reportElement x="45" y="18" width="126" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{carton_no}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="45" y="28" width="113" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{cust_pord}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="185" y="28" width="78" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ptcn}]]></textFieldExpression>
			</textField>
			<textField pattern="MM/dd/yy" isBlankWhenNull="true">
				<reportElement x="2" y="7" width="44" height="11"/>
				<textElement>
					<font size="7" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
			<textField pattern="HH:mm:ss" isBlankWhenNull="true">
				<reportElement x="32" y="7" width="44" height="11"/>
				<textElement>
					<font size="7" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
		</band>
	</pageHeader>
	<columnHeader>
		<band splitType="Stretch"/>
	</columnHeader>
	<detail>
		<band height="10" splitType="Stretch">
			<textField isBlankWhenNull="true">
				<reportElement x="229" y="0" width="17" height="10"/>
				<textElement textAlignment="Right">
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{quantity}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="32" y="0" width="130" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{item_code}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="165" y="0" width="64" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{cust_item__ref}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="1" y="0" width="17" height="10"/>
				<textElement textAlignment="Right">
					<font fontName="Times New Roman" size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{COLUMN_NUMBER}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="26" splitType="Stretch">
			<staticText>
				<reportElement x="162" y="0" width="53" height="12"/>
				<textElement textAlignment="Left" verticalAlignment="Top">
					<font fontName="Times New Roman" size="9" isBold="true"/>
				</textElement>
				<text><![CDATA[Total Pieces]]></text>
			</staticText>
			<textField isBlankWhenNull="true">
				<reportElement x="215" y="1" width="30" height="10"/>
				<textElement textAlignment="Right">
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{tot_qty}]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
</jasperReport>
