<?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="walmat_ship_label" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="203"/>
	<parameter name="WaveID" 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."PRO_NO" IS NULL THEN ' ' ELSE DESPATCH."PRO_NO" END AS DESPATCH_PRO_NO,
     CASE WHEN SORDER."CUST_PORD" IS NULL THEN ' ' ELSE SORDER."CUST_PORD" END AS SORDER_CUST_PORD,
     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 SORDER."CUST_CODE" IS NULL THEN ' ' ELSE SORDER."CUST_CODE" END AS SORDER_CUST_CODE,
     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 DESPATCH."TRAN_CODE" IS NULL THEN ' ' ELSE DESPATCH."TRAN_CODE" END 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 DESPATCHDET."QUANTITY" IS NULL THEN 0 ELSE DESPATCHDET."QUANTITY" END AS DESPATCHDET_QUANTITY,
	  CASE WHEN DESPATCHDET."LOC_CODE" IS NULL THEN ' ' ELSE DESPATCHDET."LOC_CODE" END AS DESPATCHDET_LOC_CODE,
     CASE WHEN DESPATCHDET."SSCC_18" IS NULL THEN ' ' ELSE DESPATCHDET."SSCC_18" END AS DESPATCHDET_SSCC_18,
     CASE WHEN DESPATCHDET."CUST_ITEM__REF" IS NULL THEN ' ' ELSE DESPATCHDET."CUST_ITEM__REF" END AS DESPATCHDET_CUST_ITEM__REF,
     CASE WHEN PICK_ORD_HDR."PICK_ORDER" IS NULL THEN ' ' ELSE PICK_ORD_HDR."PICK_ORDER" END AS PICK_ORD_HDR_PICK_ORDER,
     (select
        count(pack_det.carton_no) from pack_hdr,pack_det
       where pack_hdr.tran_id = pack_det.tran_id
     )as "Total no of carton"
FROM
     "LCK"."SITE" SITE ,
     "LCK"."DESPATCH" DESPATCH ,
     "LCK"."DESPATCHDET" DESPATCHDET ,
     "LCK"."SORDER" SORDER,
     "LCK"."PICK_ORD_HDR" PICK_ORD_HDR,
     "LCK"."PACK_HDR" PACK_HDR,
     "LCK"."PACK_DET" PACK_DET

 where
     SORDER.SALE_ORDER =  DESPATCH.SORD_NO
   AND SITE.SITE_CODE = SORDER.SITE_CODE
   AND DESPATCHDET.DESP_ID = DESPATCH.DESP_ID
   AND PACK_HDR.WAVE_ID = DESPATCH.WAVE_ID
   AND PICK_ORD_HDR.WAVE_ID = DESPATCH.WAVE_ID
   AND trim(DESPATCH.WAVE_ID) = trim($P{WaveID})]]>
	</queryString>
	<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="SORDER_CUST_CODE" 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="DESPATCH_TRAN_CODE" class="java.lang.String"/>
	<field name="DESPATCH_TRAN_ID" class="java.lang.String"/>
	<field name="DESPATCH_NO_ART" class="java.lang.String"/>
	<field name="DESPATCHDET_QUANTITY" class="java.lang.String"/>
	<field name="DESPATCHDET_LOC_CODE" class="java.lang.String"/>
	<field name="DESPATCHDET_SSCC_18" class="java.lang.String"/>
	<field name="DESPATCHDET_CUST_ITEM__REF" class="java.lang.String"/>
	<field name="PICK_ORD_HDR_PICK_ORDER" class="java.lang.String"/>
	<field name="Total no of carton" 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="617" splitType="Stretch">
			<line>
				<reportElement x="286" y="-1" width="1" height="431"/>
			</line>
			<line>
				<reportElement x="0" y="430" width="286" height="1"/>
			</line>
			<staticText>
				<reportElement x="5" y="2" width="76" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[FROM:]]></text>
			</staticText>
			<line>
				<reportElement x="1" y="219" width="286" height="1"/>
			</line>
			<line>
				<reportElement x="1" y="-1" width="286" height="1"/>
			</line>
			<line>
				<reportElement x="0" y="290" width="286" height="1"/>
			</line>
			<line>
				<reportElement x="138" y="144" width="1" height="75"/>
			</line>
			<line>
				<reportElement x="1" y="144" width="286" height="1"/>
			</line>
			<line>
				<reportElement x="0" y="74" width="286" height="1"/>
			</line>
			<line>
				<reportElement x="0" y="-1" width="1" height="432"/>
			</line>
			<staticText>
				<reportElement x="8" y="146" width="100" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[SHIP TO POSTAL CODE:]]></text>
			</staticText>
			<line>
				<reportElement x="120" y="0" width="1" height="75"/>
			</line>
			<staticText>
				<reportElement x="126" y="3" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[Carr:]]></text>
			</staticText>
			<staticText>
				<reportElement x="124" y="33" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[Pro#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="125" y="53" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[BOL#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="144" y="192" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[Ctl#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="141" y="147" width="38" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[PO#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="142" y="168" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[DEPT#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="5" y="76" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[TO:]]></text>
			</staticText>
			<staticText>
				<reportElement x="1" y="291" width="178" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[(00) SERIAL SHIPPING CONTAINER]]></text>
			</staticText>
			<staticText>
				<reportElement x="9" y="270" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[LOCN:]]></text>
			</staticText>
			<staticText>
				<reportElement x="9" y="250" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[SKU:]]></text>
			</staticText>
			<staticText>
				<reportElement x="160" y="270" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[QTY:]]></text>
			</staticText>
			<textField>
				<reportElement x="7" y="15" width="101" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SITE_ADD1}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="7" y="35" width="101" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SITE_CITY}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="7" y="45" width="101" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SITE_PIN}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="7" y="25" width="101" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SITE_ADD2}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="7" y="55" width="101" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SITE_STATE_CODE}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="8" y="129" width="105" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SORDER_DLV_PIN}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="7" y="98" width="105" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SORDER_DLV_ADD2}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="8" y="109" width="105" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SORDER_DLV_ADD3}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="8" y="119" width="105" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SORDER_STATE_CODE__DLV}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="7" y="88" width="105" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SORDER_DLV_ADD1}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="172" y="4" width="69" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{DESPATCH_TRAN_CODE}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="166" y="52" width="84" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{DESPATCH_BOL_NO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="165" y="34" width="85" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{DESPATCH_PRO_NO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="181" y="148" width="80" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SORDER_CUST_PORD}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="181" y="192" width="90" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{PICK_ORD_HDR_PICK_ORDER}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="57" y="251" width="69" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SORDER_CUST_CODE}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="57" y="271" width="69" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{DESPATCHDET_LOC_CODE}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="202" y="271" width="69" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{DESPATCHDET_QUANTITY}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="163" y="226" width="14" height="11"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{Total no of carton}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="139" y="226" width="12" height="10"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="151" y="226" width="11" height="11"/>
				<textElement>
					<font size="7"/>
				</textElement>
				<text><![CDATA[OF]]></text>
			</staticText>
			<textField>
				<reportElement x="51" y="318" width="180" height="42"/>
				<textElement>
					<font fontName="Code 128AB" size="24"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{DESPATCHDET_SSCC_18}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="9" y="168" width="111" height="24"/>
				<textElement>
					<font fontName="Code 128AB" size="14"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{SORDER_DLV_PIN}.substring(0,4)]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band splitType="Stretch"/>
	</summary>
</jasperReport>
