<?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="Ups_Ground_Shipping" pageWidth="283" pageHeight="425" columnWidth="243" leftMargin="20" rightMargin="20" 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="WaveID" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT
     DISTINCT
     CASE WHEN SORDER."CUST_PORD" IS NULL THEN ' ' ELSE SORDER."CUST_PORD" END AS SORDER_CUST_PORD,
     CASE WHEN SORDER."DLV_TO" IS NULL THEN ' ' ELSE SORDER."DLV_TO" END AS SORDER_DLV_TO,
     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."FRT_TERM" IS NULL THEN ' ' ELSE SORDER."FRT_TERM" END AS SORDER_FRT_TERM,
     CASE WHEN SITE."DESCR"IS NULL THEN ' ' ELSE SITE."DESCR" END AS SITE_DESCR,
     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."DESP_ID" IS NULL THEN ' ' ELSE DESPATCH."DESP_ID" END AS DESPATCH_TRAN_ID,
     CASE WHEN DESPATCH."TRAN_CODE" IS NULL THEN ' ' ELSE DESPATCH."TRAN_CODE" END AS DESPATCH_TRAN_CODE,
     CASE WHEN DESPATCH."SHIPMENT_ID" IS NULL THEN ' ' ELSE DESPATCH."SHIPMENT_ID" END AS DESPATCH_SHIPMENT_ID,
     CASE WHEN WAVE_TASK_DET.PTCN IS NULL THEN ' ' ELSE WAVE_TASK_DET.PTCN END AS WAVE_TASK_DET_PTCN,
	  CASE WHEN PACK_HDR."OUTER_CARTON_NO" IS NULL THEN ' ' ELSE PACK_HDR."OUTER_CARTON_NO" END AS PACK_HDR_OUTER_CARTON,
    (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",
     substr(DESPATCH.SHIPMENT_ID,4,7) as substr_shipment_id
FROM
     "SITE" SITE ,
     "DESPATCH" DESPATCH ,
        "SORDER" SORDER,
     "PACK_HDR" PACK_HDR,
           WAVE_TASK_DET
where
	 SORDER.SALE_ORDER =  DESPATCH.SORD_NO
	AND SITE.SITE_CODE = SORDER.SITE_CODE
   AND PACK_HDR.WAVE_ID = DESPATCH.WAVE_ID
  AND WAVE_TASK_DET.WAVE_ID = DESPATCH.WAVE_ID
    AND trim(DESPATCH.WAVE_ID) =trim('$P!{WaveID}')]]>
	</queryString>
	<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_FRT_TERM" 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_ID" class="java.lang.String"/>
	<field name="PACK_HDR_OUTER_CARTON" class="java.lang.String"/>
	<field name="Total no of carton" class="java.lang.String"/>
	<field name="SITE_DESCR" class="java.lang.String"/>
	<field name="DESPATCH_TRAN_CODE" class="java.lang.String"/>
	<field name="DESPATCH_SHIPMENT_ID" class="java.lang.String"/>
	<field name="WAVE_TASK_DET_PTCN" class="java.lang.String"/>
	<field name="SORDER_DLV_TO" class="java.lang.String"/>
	<field name="substr_shipment_id" class="java.lang.String"/>
	<variable name="compute_1" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String($F{SITE_CITY}+" "+$F{SITE_STATE_CODE}+" "+$F{SITE_PIN})]]></variableExpression>
	</variable>
	<variable name="compute_2" 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_6" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String($F{SITE_DESCR}.trim()+"         "+$F{SITE_PIN}.trim())]]></variableExpression>
	</variable>
	<variable name="compute_7" class="java.lang.String">
		<variableExpression><![CDATA[( ibase.webitm.reports.barcode.BaseGenBarcodeB4J.genBarcodeB4JCode128($F{DESPATCH_SHIPMENT_ID},"","",1.0f)).getAbsolutePath()]]></variableExpression>
	</variable>
	<variable name="compute_8" class="java.lang.String">
		<variableExpression><![CDATA[( ibase.webitm.reports.barcode.BaseGenBarcodeB4J.genBarcodeB4JPdf417($F{DESPATCH_SHIPMENT_ID},"","",1.0f,"")).getAbsolutePath()]]></variableExpression>
	</variable>
	<variable name="COMPUTE_9" class="java.lang.String">
		<variableExpression><![CDATA[new java.lang.String((ibase.webitm.reports.utility.BaseReportMethods.trim($F{substr_shipment_id})))]]></variableExpression>
	</variable>
	<group name="cartoon">
		<groupExpression><![CDATA[$F{Total no of carton}]]></groupExpression>
		<groupHeader>
			<band/>
		</groupHeader>
		<groupFooter>
			<band/>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band splitType="Stretch"/>
	</title>
	<pageHeader>
		<band splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band splitType="Stretch"/>
	</columnHeader>
	<detail>
		<band height="385" splitType="Stretch">
			<textField isBlankWhenNull="true">
				<reportElement x="3" y="36" width="69" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_ADD1}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="3" y="56" width="88" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_1}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement x="1" y="384" width="242" height="1"/>
			</line>
			<textField isBlankWhenNull="true">
				<reportElement x="132" y="57" width="109" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_2}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="149" y="16" width="92" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SORDER_DLV_TO}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="-116" y="72" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[TO:]]></text>
			</staticText>
			<staticText>
				<reportElement x="-112" y="266" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[LOCN:]]></text>
			</staticText>
			<staticText>
				<reportElement x="-112" y="246" width="36" height="11"/>
				<textElement>
					<font size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[SKU:]]></text>
			</staticText>
			<line>
				<reportElement x="1" y="270" width="242" height="1"/>
				<graphicElement>
					<pen lineWidth="2.0"/>
				</graphicElement>
			</line>
			<textField isBlankWhenNull="true">
				<reportElement x="132" y="26" width="109" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SORDER_DLV_ADD1}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="132" y="47" width="109" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SORDER_DLV_ADD3}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="132" y="36" width="109" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SORDER_DLV_ADD2}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement x="242" y="15" width="1" height="369"/>
			</line>
			<line>
				<reportElement x="1" y="14" width="242" height="1"/>
			</line>
			<textField isBlankWhenNull="true">
				<reportElement x="3" y="46" width="69" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_ADD2}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement x="1" y="14" width="1" height="370"/>
			</line>
			<staticText>
				<reportElement x="6" y="74" width="29" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[Order#]]></text>
			</staticText>
			<staticText>
				<reportElement x="218" y="306" width="14" height="13"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<text><![CDATA[OF]]></text>
			</staticText>
			<textField evaluationTime="Group" evaluationGroup="cartoon" isBlankWhenNull="true">
				<reportElement x="218" y="326" width="14" height="14"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{Total no of carton}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="155" y="354" width="21" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<text><![CDATA[Ctl#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="4" y="354" width="50" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<text><![CDATA[CARTON#:]]></text>
			</staticText>
			<staticText>
				<reportElement x="132" y="369" width="106" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="5" isBold="false"/>
				</textElement>
				<text><![CDATA[MAWN/V242/AS/ZTZ140XI12/SHLBLR3]]></text>
			</staticText>
			<textField isBlankWhenNull="true">
				<reportElement x="56" y="354" width="82" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{PACK_HDR_OUTER_CARTON}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="8" y="369" width="67" 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="176" y="354" width="66" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{WAVE_TASK_DET_PTCN}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="132" y="17" width="19" height="11"/>
				<textElement>
					<font fontName="Times New Roman" size="7" isBold="true"/>
				</textElement>
				<text><![CDATA[TO:]]></text>
			</staticText>
			<textField evaluationTime="Page" isBlankWhenNull="true">
				<reportElement x="218" y="286" width="14" height="14"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="3" y="26" width="69" height="10"/>
				<textElement>
					<font fontName="Times New Roman" size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_DESCR}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement x="92" y="16" width="1" height="55"/>
			</line>
			<line>
				<reportElement x="1" y="71" width="242" height="1"/>
				<graphicElement>
					<pen lineWidth="1.5"/>
				</graphicElement>
			</line>
			<line>
				<reportElement x="130" y="17" width="1" height="54"/>
			</line>
			<line>
				<reportElement x="92" y="16" width="38" height="1"/>
				<graphicElement>
					<pen lineWidth="4.0"/>
				</graphicElement>
			</line>
			<textField isBlankWhenNull="true">
				<reportElement x="24" y="83" width="218" height="12"/>
				<textElement>
					<font fontName="Times New Roman" size="10" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{compute_6}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement x="1" y="352" width="242" height="1"/>
			</line>
			<line>
				<reportElement x="2" y="365" width="241" height="1"/>
			</line>
			<staticText>
				<reportElement x="6" y="199" width="62" height="29"/>
				<textElement>
					<font fontName="Times New Roman" size="20" isBold="true"/>
				</textElement>
				<text><![CDATA[GND]]></text>
			</staticText>
			<staticText>
				<reportElement x="166" y="199" width="72" height="29"/>
				<textElement>
					<font fontName="Times New Roman" size="20" isBold="true"/>
				</textElement>
				<text><![CDATA[FedEx]]></text>
			</staticText>
			<staticText>
				<reportElement x="206" y="227" width="32" height="14"/>
				<textElement>
					<font fontName="Times New Roman" size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Ground]]></text>
			</staticText>
			<image hAlign="Center">
				<reportElement x="10" y="97" width="222" height="98"/>
				<imageExpression class="java.lang.String"><![CDATA[$V{compute_7}]]></imageExpression>
			</image>
			<image hAlign="Center">
				<reportElement x="11" y="276" width="186" height="73"/>
				<imageExpression class="java.lang.String"><![CDATA[$V{compute_8}]]></imageExpression>
			</image>
			<textField isBlankWhenNull="true">
				<reportElement x="8" y="230" width="101" height="37"/>
				<textElement>
					<font fontName="Times New Roman" size="20" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SORDER_FRT_TERM}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="86" y="199" width="63" height="29"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="20" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{COMPUTE_9}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band splitType="Stretch"/>
	</summary>
</jasperReport>
