<?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="Pallet Shipping Label" pageWidth="283" pageHeight="425" columnWidth="283" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="PALLET_NO" class="java.lang.String"/>
	<parameter name="print_on_printer" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT

DDET.PALLET_NO AS PALLET_NO,
S.DESCR AS SITE_DESCR,
S.ADD1 AS SITE_ADD1,
S.ADD2 AS SITE_ADD2,
S.CITY AS SITE_CITY,
S.STATE_CODE AS SITE_STATE_CODE,
S.PIN AS SITE_PIN,
(SELECT TRAN_NAME FROM TRANSPORTER WHERE TRAN_CODE = SO.TRAN_CODE) AS TRAN_NAME,
SHP.LR_NO AS BOL_NO,
SHP.PRO_NO AS PRO_NO,
(SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE = SO.CUST_CODE__DLV) as cust_name,
SO.CUST_PORD AS CUST_PORD,
SO.DLV_ADD1 AS DLV_ADD1,
SO.DLV_ADD2 AS DLV_ADD2,
SO.DLV_CITY AS DLV_CITY,
SO.STATE_CODE__DLV DLV_STATE,
SO.DLV_PIN AS DLV_PIN,
SUBSTR(SO.DLV_PIN,0,5) AS DLV_PIN_SUB,
SO.CUST_PORD AS CUST_PORD,
SDOC.PTCN AS PTCN,
1 AS COPY_NUMBER

FROM SITE S,SORDER SO,SHIP_DOCS SDOC,SHIPMENT SHP, DESPATCH D, DESPATCHDET DDET

WHERE
DDET.PALLET_NO = '$P!{PALLET_NO}'
AND D.DESP_ID = DDET.DESP_ID
AND D.DESP_ID = SDOC.REF_ID
AND SHP.SHIPMENT_ID = SDOC.SHIPMENT_ID
AND D.SORD_NO = SO.SALE_ORDER
AND S.SITE_CODE = SO.SITE_CODE__SHIP


UNION ALL

SELECT

DDET.PALLET_NO AS PALLET_NO,
S.DESCR AS SITE_DESCR,
S.ADD1 AS SITE_ADD1,
S.ADD2 AS SITE_ADD2,
S.CITY AS SITE_CITY,
S.STATE_CODE AS SITE_STATE_CODE,
S.PIN AS SITE_PIN,
(SELECT TRAN_NAME FROM TRANSPORTER WHERE TRAN_CODE = SO.TRAN_CODE) AS TRAN_NAME,
SHP.LR_NO AS BOL_NO,
SHP.PRO_NO AS PRO_NO,
(SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE = SO.CUST_CODE__DLV) as cust_name,
SO.CUST_PORD AS CUST_PORD,
SO.DLV_ADD1 AS DLV_ADD1,
SO.DLV_ADD2 AS DLV_ADD2,
SO.DLV_CITY AS DLV_CITY,
SO.STATE_CODE__DLV DLV_STATE,
SO.DLV_PIN AS DLV_PIN,
SUBSTR(SO.DLV_PIN,0,5) AS DLV_PIN_SUB,
SO.CUST_PORD AS CUST_PORD,
SDOC.PTCN AS PTCN,
2 AS COPY_NUMBER

FROM SITE S,SORDER SO,SHIP_DOCS SDOC,SHIPMENT SHP, DESPATCH D, DESPATCHDET DDET

WHERE
DDET.PALLET_NO = '$P!{PALLET_NO}'
AND D.DESP_ID = DDET.DESP_ID
AND D.DESP_ID = SDOC.REF_ID
AND SHP.SHIPMENT_ID = SDOC.SHIPMENT_ID
AND D.SORD_NO = SO.SALE_ORDER
AND S.SITE_CODE = SO.SITE_CODE__SHIP]]>
	</queryString>
	<field name="TRAN_NAME" class="java.lang.String"/>
	<field name="COPY_NUMBER" class="java.lang.Double"/>
	<field name="CUST_PORD" class="java.lang.String"/>
	<field name="DLV_ADD1" class="java.lang.String"/>
	<field name="DLV_ADD2" class="java.lang.String"/>
	<field name="DLV_CITY" class="java.lang.String"/>
	<field name="DLV_STATE" class="java.lang.String"/>
	<field name="DLV_PIN" class="java.lang.String"/>
	<field name="SITE_ADD1" class="java.lang.String"/>
	<field name="SITE_ADD2" class="java.lang.String"/>
	<field name="SITE_CITY" class="java.lang.String"/>
	<field name="SITE_PIN" class="java.lang.String"/>
	<field name="SITE_STATE_CODE" class="java.lang.String"/>
	<field name="cust_name" class="java.lang.String"/>
	<field name="PALLET_NO" class="java.lang.String"/>
	<field name="SITE_DESCR" class="java.lang.String"/>
	<field name="DLV_PIN_SUB" class="java.lang.String"/>
	<field name="PTCN" class="java.lang.String"/>
	<field name="BOL_NO" class="java.lang.String"/>
	<field name="PRO_NO" class="java.lang.String"/>
	<sortField name="PALLET_NO"/>
	<sortField name="COPY_NUMBER"/>
	<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_SUB})) )]]></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{PALLET_NO}) ) )]]></variableExpression>
	</variable>
	<variable name="COMPUTE_3" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String((ibase.webitm.reports.utility.BaseReportMethods.isNull($F{DLV_CITY}) ? " " : ($F{DLV_CITY}).trim())+" "+(ibase.webitm.reports.utility.BaseReportMethods.isNull($F{DLV_STATE} ) ? " " : ($F{DLV_STATE}).trim())+" "+ (ibase.webitm.reports.utility.BaseReportMethods.isNull($F{DLV_PIN}) ? " " :($F{DLV_PIN}).trim()))]]></variableExpression>
	</variable>
	<variable name="COMPUTE_4" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String((ibase.webitm.reports.utility.BaseReportMethods.isNull($F{SITE_CITY}) ? " " : ($F{SITE_CITY}).trim())+"  "+(ibase.webitm.reports.utility.BaseReportMethods.isNull($F{SITE_STATE_CODE} ) ? " " : ($F{SITE_STATE_CODE}).trim())+" "+ (ibase.webitm.reports.utility.BaseReportMethods.isNull($F{SITE_PIN}) ? " " :($F{SITE_PIN}).trim()))]]></variableExpression>
	</variable>
	<variable name="COMPUTE_5" 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_7" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String("(00) "+ibase.webitm.reports.utility.BaseReportMethods.trim($F{PALLET_NO}))]]></variableExpression>
	</variable>
	<group name="Pallet" isStartNewPage="true">
		<groupExpression><![CDATA[$F{PALLET_NO} + $F{COPY_NUMBER}]]></groupExpression>
		<groupHeader>
			<band/>
		</groupHeader>
		<groupFooter>
			<band/>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<pageHeader>
		<band splitType="Stretch"/>
	</pageHeader>
	<detail>
		<band height="330" splitType="Stretch">
			<line>
				<reportElement x="13" y="327" width="256" height="1">
					<printWhenExpression><![CDATA[new Boolean(false)]]></printWhenExpression>
				</reportElement>
			</line>
			<staticText>
				<reportElement x="15" y="17" width="76" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[FROM:]]></text>
			</staticText>
			<line>
				<reportElement x="13" y="193" width="256" height="1"/>
			</line>
			<line>
				<reportElement x="13" y="243" width="256" height="1"/>
			</line>
			<line>
				<reportElement x="147" y="131" width="1" height="62"/>
			</line>
			<line>
				<reportElement x="13" y="130" width="256" height="1"/>
			</line>
			<line>
				<reportElement x="13" y="73" width="256" height="1"/>
			</line>
			<staticText>
				<reportElement x="15" y="133" width="100" height="11"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="6" isBold="false"/>
				</textElement>
				<text><![CDATA[(420) SHIP TO POSTAL CODE:]]></text>
			</staticText>
			<line>
				<reportElement x="129" y="12" width="1" height="61"/>
			</line>
			<staticText>
				<reportElement x="132" y="20" width="32" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[Carr:]]></text>
			</staticText>
			<staticText>
				<reportElement x="132" y="40" width="32" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[Pro#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="132" y="60" width="32" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[BOL#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="150" y="179" width="28" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="false"/>
				</textElement>
				<text><![CDATA[Ctl#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="150" y="139" width="28" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="false"/>
				</textElement>
				<text><![CDATA[PO#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="150" y="160" width="28" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="false"/>
				</textElement>
				<text><![CDATA[DEPT#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="16" y="77" width="18" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[TO:]]></text>
			</staticText>
			<staticText>
				<reportElement x="19" y="244" width="178" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="false"/>
				</textElement>
				<text><![CDATA[(00) Serial Shipping Container]]></text>
			</staticText>
			<textField isBlankWhenNull="true">
				<reportElement x="15" y="26" width="113" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_DESCR}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="15" y="46" width="113" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_ADD2}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="15" y="56" width="113" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{COMPUTE_4}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="15" y="36" width="113" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_ADD1}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="36" y="98" width="230" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DLV_ADD2}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="37" y="108" width="230" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{COMPUTE_3}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="36" y="88" width="230" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DLV_ADD1}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="166" y="20" width="100" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{TRAN_NAME}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="178" y="139" width="91" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CUST_PORD}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="178" y="179" width="88" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{PTCN}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="17" y="267" width="249" height="60"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="Code 128AB Tall" size="32"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{COMPUTE_2}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="15" y="154" width="132" height="35"/>
				<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="36" y="78" width="230" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{cust_name}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="17" y="143" width="126" height="10"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{COMPUTE_5}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="18" y="257" width="251" height="10"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_7}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement x="12" y="10" width="257" height="1">
					<printWhenExpression><![CDATA[new Boolean(false)]]></printWhenExpression>
				</reportElement>
			</line>
			<line>
				<reportElement x="269" y="10" width="1" height="318">
					<printWhenExpression><![CDATA[new Boolean(false)]]></printWhenExpression>
				</reportElement>
			</line>
			<line>
				<reportElement x="13" y="11" width="1" height="316">
					<printWhenExpression><![CDATA[new Boolean(false)]]></printWhenExpression>
				</reportElement>
			</line>
			<textField isBlankWhenNull="true">
				<reportElement x="166" y="40" width="100" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{PRO_NO}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="166" y="60" width="100" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{BOL_NO}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
</jasperReport>
