<?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="Target shipping label" pageWidth="283" pageHeight="438" columnWidth="263" leftMargin="10" rightMargin="10" topMargin="2" bottomMargin="2">
	<property name="ireport.zoom" value="1.2100000000000062"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="DESP_ID_START" class="java.lang.String"/>
	<parameter name="DESP_ID_LAST" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT
		CASE WHEN S.ADD1 IS NULL THEN ' ' ELSE S.ADD1 END AS ADD1,
		CASE WHEN S.ADD2 IS NULL THEN ' ' ELSE S.ADD2 END AS ADD2,
		CASE WHEN S.CITY IS NULL THEN ' ' ELSE S.CITY END AS CITY,
		CASE WHEN S.PIN IS NULL THEN ' ' ELSE S.PIN END AS PIN,
		CASE WHEN S.STATE_CODE IS NULL THEN ' ' ELSE S.STATE_CODE END AS STATE_CODE,
        (SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE = O.CUST_CODE__DLV) AS CUST_NAME,
		CASE WHEN O.DLV_ADD1 IS NULL THEN ' ' ELSE O.DLV_ADD1 END AS DLV_ADD1,
		CASE WHEN O.DLV_ADD2 IS NULL THEN ' ' ELSE O.DLV_ADD2 END AS DLV_ADD2,
		CASE WHEN O.DLV_ADD3 IS NULL THEN ' ' ELSE O.DLV_ADD3 END AS DLV_ADD3,
		CASE WHEN O.DLV_CITY IS NULL THEN ' ' ELSE O.DLV_CITY END AS DLV_CITY,
		CASE WHEN O.STATE_CODE__DLV IS NULL THEN ' ' ELSE O.STATE_CODE__DLV END AS STATE_CODE__DLV,
		CASE WHEN O.DLV_PIN IS NULL THEN ' ' ELSE O.DLV_PIN END AS DLV_PIN,
		CASE WHEN T.CUST_ITEM__REF IS NULL THEN ' ' ELSE T.CUST_ITEM__REF END AS CUST_ITEM__REF,
		D.NO_ART AS NO_ART,
		(SELECT TRAN_NAME FROM TRANSPORTER WHERE TRAN_CODE = D.TRAN_CODE) AS TRAN_CODE,
		CASE WHEN O.CUST_PORD IS NULL THEN ' ' ELSE O.CUST_PORD END AS CUST_PORD,
		CASE WHEN P.SSCC_18 IS NULL THEN CASE WHEN D.LR_NO IS NULL THEN '' ELSE D.LR_NO END ELSE P.SSCC_18 END AS SSCC_18
FROM
		SITE S, SORDER O, SORDDET T, DESPATCH D, DESPATCHDET E , PACK_HDR P, WAVE_TASK_DET W, SHIP_DOCS SD
WHERE
			 (D.DESP_ID BETWEEN '$P!{DESP_ID_START}' AND '$P!{DESP_ID_LAST}')
		AND O.SALE_ORDER = D.SORD_NO
		AND S.SITE_CODE = O.SITE_CODE
		AND T.SALE_ORDER = O.SALE_ORDER
		AND E.DESP_ID = D.DESP_ID
        AND D.DESP_ID = SD.REF_ID(+)
        AND 'S-DSP' = SD.REF_SER(+)
        AND SD.PTCN = W.PTCN(+)
        AND 'M-PACK' = W.REF_SER(+)
        AND W.REF_ID = P.TRAN_ID(+)]]>
	</queryString>
	<field name="ADD1" class="java.lang.String"/>
	<field name="ADD2" class="java.lang.String"/>
	<field name="CITY" class="java.lang.String"/>
	<field name="PIN" class="java.lang.String"/>
	<field name="STATE_CODE" class="java.lang.String"/>
	<field name="CUST_NAME" class="java.lang.String"/>
	<field name="DLV_ADD1" class="java.lang.String"/>
	<field name="DLV_ADD2" class="java.lang.String"/>
	<field name="DLV_ADD3" class="java.lang.String"/>
	<field name="DLV_CITY" class="java.lang.String"/>
	<field name="STATE_CODE__DLV" class="java.lang.String"/>
	<field name="DLV_PIN" class="java.lang.String"/>
	<field name="CUST_ITEM__REF" class="java.lang.String"/>
	<field name="NO_ART" class="java.lang.String"/>
	<field name="TRAN_CODE" class="java.lang.String"/>
	<field name="CUST_PORD" class="java.lang.String"/>
	<field name="SSCC_18" class="java.lang.String"/>
	<variable name="COMPUTE_1" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String(ibase.webitm.reports.sun.BaseReportGFMethods.gf_bar_code("420"+ibase.webitm.reports.utility.BaseReportMethods.trim($F{DLV_PIN}).substring(0,5)  ) )]]></variableExpression>
	</variable>
	<variable name="COMPUTE_2" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String(ibase.webitm.reports.sun.BaseReportGFMethods.gf_bar_code("00"+ibase.webitm.reports.utility.BaseReportMethods.trim($F{SSCC_18}) ) )]]></variableExpression>
	</variable>
	<variable name="COMPUTE_3" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String("(420) "+ibase.webitm.reports.utility.BaseReportMethods.trim($F{DLV_PIN}).substring(0,5))]]></variableExpression>
	</variable>
	<variable name="COMPUTE_4" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String("(00) "+ibase.webitm.reports.utility.BaseReportMethods.trim($F{SSCC_18}))]]></variableExpression>
	</variable>
	<variable name="TOCUST" class="java.lang.String"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band splitType="Stretch"/>
	</title>
	<pageHeader>
		<band splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band splitType="Stretch"/>
	</columnHeader>
	<detail>
		<band height="434" splitType="Stretch">
			<rectangle>
				<reportElement mode="Transparent" x="2" y="14" width="259" height="390"/>
			</rectangle>
			<staticText>
				<reportElement x="4" y="15" width="120" height="14"/>
				<textElement>
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<text><![CDATA[FROM :]]></text>
			</staticText>
			<line>
				<reportElement x="129" y="12" width="1" height="70"/>
			</line>
			<staticText>
				<reportElement x="132" y="15" width="100" height="14"/>
				<textElement>
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<text><![CDATA[TO :]]></text>
			</staticText>
			<staticText>
				<reportElement x="9" y="87" width="120" height="12"/>
				<textElement>
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[(420) Ship to Postal Code:]]></text>
			</staticText>
			<line>
				<reportElement x="2" y="298" width="260" height="1"/>
			</line>
			<line>
				<reportElement x="2" y="226" width="260" height="1"/>
			</line>
			<staticText>
				<reportElement x="7" y="160" width="30" height="15"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<text><![CDATA[PO#:]]></text>
			</staticText>
			<line>
				<reportElement x="2" y="82" width="260" height="1"/>
			</line>
			<line>
				<reportElement x="2" y="154" width="260" height="1"/>
			</line>
			<line>
				<reportElement x="145" y="82" width="1" height="72"/>
			</line>
			<staticText>
				<reportElement x="149" y="88" width="80" height="12"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[CARRIER:]]></text>
			</staticText>
			<staticText>
				<reportElement x="7" y="178" width="30" height="15"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<text><![CDATA[DPCI:]]></text>
			</staticText>
			<staticText>
				<reportElement x="7" y="196" width="50" height="15"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<text><![CDATA[Casepack :]]></text>
			</staticText>
			<textField isBlankWhenNull="true">
				<reportElement x="4" y="27" width="125" height="15"/>
				<textElement>
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ADD1}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="4" y="42" width="125" height="16"/>
				<textElement>
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ADD2}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="4" y="58" width="61" height="15"/>
				<textElement>
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CITY}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="64" y="58" width="25" height="14"/>
				<textElement>
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{STATE_CODE}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="88" y="58" width="42" height="14"/>
				<textElement>
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{PIN}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="132" y="54" width="131" height="16"/>
				<textElement>
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DLV_ADD2}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="132" y="40" width="130" height="15"/>
				<textElement>
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DLV_ADD1}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="150" y="101" width="112" height="15"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{TRAN_CODE}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="38" y="160" width="225" height="15"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CUST_PORD}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="38" y="178" width="224" height="15"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CUST_ITEM__REF}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="59" y="196" width="204" height="15"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{NO_ART}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="11" y="304" width="179" height="15"/>
				<textElement textAlignment="Left" verticalAlignment="Top">
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<text><![CDATA[(00) SERIAL SHIPPING CONTAINER]]></text>
			</staticText>
			<textField>
				<reportElement x="7" y="117" width="137" height="36"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="Code 128AB" size="24"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{COMPUTE_1}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="3" y="338" width="259" height="66"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="Code 128AB" size="48" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{COMPUTE_2}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="4" y="99" width="141" height="17"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{COMPUTE_3}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="9" y="319" width="245" height="14"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{COMPUTE_4}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="132" y="27" width="130" height="15"/>
				<textElement>
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CUST_NAME}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="132" y="66" width="131" height="16"/>
				<textElement>
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[new java.lang.String($F{DLV_CITY}.trim() + " "+$F{STATE_CODE__DLV}.trim()+" "+$F{DLV_PIN}.trim())]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band splitType="Stretch"/>
	</summary>
</jasperReport>
