<?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="Rite_Aid_Shipping" pageWidth="283" pageHeight="434" 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="DespId" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT
 		DISTINCT
     CASE WHEN DESPATCH."BOL_NO" IS NULL THEN ' ' ELSE DESPATCH."BOL_NO" END AS DESPATCH_BOL_NO,
     CASE WHEN DESPATCH."LR_NO" IS NULL THEN ' ' ELSE DESPATCH."LR_NO" END AS DESPATCH_PRO_NO,
     CASE WHEN SORDER."CUST_PORD" IS NULL THEN ' ' ELSE SORDER."CUST_PORD" END AS SORDER_CUST_PORD,
    (SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE = SORDER.CUST_CODE__DLV) AS CUST,
     CASE WHEN SORDER."DLV_ADD1" IS NULL THEN ' ' ELSE SORDER."DLV_ADD1" END AS SORDER_DLV_ADD1,
     CASE WHEN SORDER."DLV_ADD2" IS NULL THEN ' ' ELSE SORDER."DLV_ADD2" END AS SORDER_DLV_ADD2,
     CASE WHEN SORDER."DLV_ADD3" IS NULL THEN ' ' ELSE SORDER."DLV_ADD3" END AS SORDER_DLV_ADD3,
     CASE WHEN SORDER."DLV_CITY" IS NULL THEN ' ' ELSE SORDER."DLV_CITY" END AS SORDER_DLV_CITY,
     CASE WHEN SORDER."STATE_CODE__DLV" IS NULL THEN ' ' ELSE SORDER."STATE_CODE__DLV" END AS SORDER_STATE_CODE__DLV,
     CASE WHEN SORDER."DLV_PIN" IS NULL THEN ' ' ELSE SORDER."DLV_PIN" END AS SORDER_DLV_PIN,
     CASE WHEN SITE."ADD1"IS NULL THEN ' ' ELSE SITE."ADD1" END AS SITE_ADD1,
     CASE WHEN SITE."ADD2"IS NULL THEN ' ' ELSE SITE."ADD2" END AS SITE_ADD2,
     CASE WHEN SITE."CITY"IS NULL THEN ' 'ELSE SITE."CITY" END AS SITE_CITY,
     CASE WHEN SITE."PIN" IS NULL THEN ' 'ELSE SITE."PIN" END AS SITE_PIN,
     CASE WHEN SITE."STATE_CODE"IS NULL THEN ' ' ELSE SITE."STATE_CODE" END AS SITE_STATE_CODE,
     CASE WHEN ITEM."DESCR" IS NULL THEN ' ' ELSE ITEM."DESCR" END AS ITEM_DESCR,
     CASE WHEN ITEM."ITEM_CODE__UPC" IS NULL THEN ' ' ELSE ITEM."ITEM_CODE__UPC" END AS ITEM_ITEM_CODE__UPC,
     (SELECT TRAN_NAME FROM TRANSPORTER WHERE TRAN_CODE = DESPATCH.TRAN_CODE) AS DESPATCH_TRAN_CODE,
     CASE WHEN DESPATCH."DESP_ID" IS NULL THEN ' ' ELSE DESPATCH."DESP_ID" END AS DESPATCH_TRAN_ID,
     CASE WHEN DESPATCH."NO_ART" IS NULL THEN 0 ELSE DESPATCH."NO_ART" END AS DESPATCH_NO_ART,
     CASE WHEN P.SSCC_18 IS NULL THEN CASE WHEN DESPATCH.LR_NO IS NULL THEN '' ELSE DESPATCH.LR_NO END ELSE P.SSCC_18 END  AS DESPATCHDET_SSCC_18,
     CASE WHEN SORDDET."CUST_ITEM__REF" IS NULL THEN ' ' ELSE SORDDET."CUST_ITEM__REF" END AS DESPATCHDET_CUST_ITEM__REF
FROM
     "SITE" SITE ,
     "DESPATCH" DESPATCH ,
     "DESPATCHDET" DESPATCHDET ,
     "ITEM" ITEM ,
     "SORDER" SORDER,
     "SORDDET" SORDDET,
		PACK_HDR P,
		WAVE_TASK_DET W,
 		SHIP_DOCS SD
where
		SORDER.SALE_ORDER =  DESPATCH.SORD_NO
		AND SITE.SITE_CODE = SORDER.SITE_CODE
		AND DESPATCHDET.DESP_ID = DESPATCH.DESP_ID
		AND DESPATCHDET.ITEM_CODE = ITEM.ITEM_CODE
		AND SORDDET.SALE_ORDER = DESPATCHDET.SORD_NO
		AND SORDDET.LINE_NO = DESPATCHDET.LINE_NO__SORD
		AND DESPATCH.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(+)
		AND DESPATCH.DESP_ID = '$P!{DespId}']]>
	</queryString>
	<field name="CUST" class="java.lang.String"/>
	<field name="DESPATCH_BOL_NO" class="java.lang.String"/>
	<field name="DESPATCH_PRO_NO" class="java.lang.String"/>
	<field name="SORDER_CUST_PORD" class="java.lang.String"/>
	<field name="SORDER_DLV_ADD1" class="java.lang.String"/>
	<field name="SORDER_DLV_ADD2" class="java.lang.String"/>
	<field name="SORDER_DLV_ADD3" class="java.lang.String"/>
	<field name="SORDER_DLV_CITY" class="java.lang.String"/>
	<field name="SORDER_STATE_CODE__DLV" class="java.lang.String"/>
	<field name="SORDER_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="ITEM_DESCR" class="java.lang.String"/>
	<field name="ITEM_ITEM_CODE__UPC" class="java.lang.String"/>
	<field name="DESPATCH_TRAN_CODE" class="java.lang.String"/>
	<field name="DESPATCH_TRAN_ID" class="java.lang.String"/>
	<field name="DESPATCH_NO_ART" class="java.lang.Integer"/>
	<field name="DESPATCHDET_SSCC_18" class="java.lang.String"/>
	<field name="DESPATCHDET_CUST_ITEM__REF" 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{SORDER_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(ibase.webitm.reports.utility.BaseReportMethods.trim($F{ITEM_ITEM_CODE__UPC}) ) )]]></variableExpression>
	</variable>
	<variable name="compute_3" 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{DESPATCHDET_SSCC_18}) ) )]]></variableExpression>
	</variable>
	<variable name="compute_4" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String("(420) "+ibase.webitm.reports.utility.BaseReportMethods.trim($F{SORDER_DLV_PIN}).substring(0,5))]]></variableExpression>
	</variable>
	<variable name="compute_5" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String("(00) "+ibase.webitm.reports.utility.BaseReportMethods.trim($F{DESPATCHDET_SSCC_18}))]]></variableExpression>
	</variable>
	<variable name="compute_6" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String($F{SORDER_DLV_CITY}.trim() + " "+$F{SORDER_STATE_CODE__DLV}.trim()+" "+$F{SORDER_DLV_PIN}.trim())]]></variableExpression>
	</variable>
	<variable name="compute_7" 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="430" splitType="Stretch">
			<rectangle>
				<reportElement x="2" y="12" width="258" height="388"/>
			</rectangle>
			<line>
				<reportElement x="2" y="73" width="258" height="1"/>
			</line>
			<line>
				<reportElement x="2" y="144" width="258" height="1"/>
			</line>
			<line>
				<reportElement x="2" y="216" width="258" height="1"/>
			</line>
			<line>
				<reportElement x="2" y="287" width="258" height="1"/>
			</line>
			<line>
				<reportElement x="128" y="12" width="1" height="61"/>
			</line>
			<line>
				<reportElement x="144" y="73" width="1" height="72"/>
			</line>
			<line>
				<reportElement x="124" y="216" width="1" height="71"/>
			</line>
			<staticText>
				<reportElement x="6" y="13" width="33" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[FROM:]]></text>
			</staticText>
			<staticText>
				<reportElement x="131" y="13" width="27" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[TO:]]></text>
			</staticText>
			<staticText>
				<reportElement x="5" y="76" width="121" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[(420) Ship To Postal Code ]]></text>
			</staticText>
			<staticText>
				<reportElement x="148" y="76" width="51" height="12"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[CARRIER:]]></text>
			</staticText>
			<staticText>
				<reportElement x="147" y="113" width="24" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[PRO:]]></text>
			</staticText>
			<staticText>
				<reportElement x="147" y="127" width="24" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[B/L:
]]></text>
			</staticText>
			<staticText>
				<reportElement x="5" y="148" width="27" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[PO:]]></text>
			</staticText>
			<staticText>
				<reportElement x="5" y="166" width="27" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Desc:]]></text>
			</staticText>
			<staticText>
				<reportElement x="5" y="200" width="27" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Qty:]]></text>
			</staticText>
			<staticText>
				<reportElement x="5" y="183" width="27" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Type:]]></text>
			</staticText>
			<staticText>
				<reportElement x="6" y="221" width="65" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Rite Aid Item:]]></text>
			</staticText>
			<staticText>
				<reportElement x="127" y="220" width="27" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[UPC#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="4" y="289" width="43" height="13"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[SSCC-18]]></text>
			</staticText>
			<textField isBlankWhenNull="true">
				<reportElement x="5" y="24" width="121" 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="5" y="34" width="120" 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="5" y="44" width="120" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_CITY}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="5" y="54" width="120" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_PIN}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="5" y="64" width="120" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_STATE_CODE}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="131" y="34" width="126" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SORDER_DLV_ADD1}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="131" y="44" width="127" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SORDER_DLV_ADD2}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="132" y="53" width="125" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SORDER_DLV_ADD3}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="149" y="91" width="99" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESPATCH_TRAN_CODE}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="171" y="114" width="86" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESPATCH_PRO_NO}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="171" y="127" width="86" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESPATCH_BOL_NO}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="36" y="148" width="150" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SORDER_CUST_PORD}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="37" y="166" width="221" height="17"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ITEM_DESCR}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="37" y="200" width="125" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$F{DESPATCH_NO_ART}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="7" y="239" width="117" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESPATCHDET_CUST_ITEM__REF}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="154" y="221" width="100" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ITEM_ITEM_CODE__UPC}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="4" y="314" width="255" height="73"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="Code 128AB Tall" size="32"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_3}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="125" y="236" width="135" height="51"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="Code 128AB" size="22"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_2}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="false">
				<reportElement x="3" y="103" width="140" height="41"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="Code 128AB" size="26"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_1}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="3" y="89" width="140" height="14"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_4}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="4" y="302" width="256" height="12"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="9"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_5}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="132" y="62" width="125" height="12"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_6}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="131" y="24" width="126" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CUST}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band splitType="Stretch"/>
	</summary>
</jasperReport>
