<?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="d_tracking_details_of_ptcn" pageWidth="841" pageHeight="595" orientation="Landscape" columnWidth="801" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="469"/>
	<property name="ireport.y" value="0"/>
	<parameter name="as_ptcn" class="java.lang.String"/>
	<parameter name="as_sordno" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT A.ptcn,A.tracking_no,A.CARTON_NO,sf_identity as menifest, c.sord_no,b.shipment_id,d.tran_name
From Carton_master a,Ship_docs b, Despatch c,Transporter d
Where a.ptcn        = b.ptcn
and   b.shipment_id = c.shipment_id
and   b.tran_code   = d.tran_code
and   (instr((select var_value from disparm where prd_code='999999' and var_name = 'TRACKING_DETAILS_REF_SER'),a.ref_ser ) > 0)
AND  (CASE WHEN nvl(TRIM('$P!{as_ptcn}'),'null') = 'null' AND nvl(TRIM('$P!{as_sordno}'),'null') = 'null' THEN '0' ELSE CASE WHEN nvl(TRIM('$P!{as_ptcn}'),'null') = 'null' THEN '1' ELSE a.PTCN END END)  
     = (CASE WHEN nvl(TRIM('$P!{as_ptcn}'),'null') = 'null' AND nvl(TRIM('$P!{as_sordno}'),'null') = 'null' THEN '1' ELSE CASE WHEN nvl(TRIM('$P!{as_ptcn}'),'null') = 'null' THEN '1' ELSE '$P!{as_ptcn}' END END)
AND  (CASE WHEN nvl(trim('$P!{as_sordno}'),'null') ='null'  THEN '1' ELSE c.sord_no END)  = (CASE WHEN nvl(trim('$P!{as_sordno}'),'null') ='null' THEN '1' ELSE '$P!{as_sordno}' END)
order by A.ptcn]]>
	</queryString>
	<field name="PTCN" class="java.lang.String"/>
	<field name="TRACKING_NO" class="java.lang.String"/>
	<field name="CARTON_NO" class="java.lang.String"/>
	<field name="MENIFEST" class="java.lang.String"/>
	<field name="SORD_NO" class="java.lang.String"/>
	<field name="SHIPMENT_ID" class="java.lang.String"/>
	<field name="TRAN_NAME" class="java.lang.String"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="30" splitType="Stretch">
			<staticText>
				<reportElement x="0" y="0" width="801" height="30"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="12" isBold="true"/>
				</textElement>
				<text><![CDATA[Tracking Details by PTCN]]></text>
			</staticText>
			<textField>
				<reportElement x="681" y="10" width="80" height="20"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.String"><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
			</textField>
			<textField evaluationTime="Report">
				<reportElement x="761" y="10" width="40" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<textField pattern="MM/dd/yyyy">
				<reportElement x="33" y="9" width="54" height="20"/>
				<textElement/>
				<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="0" y="9" width="30" height="20"/>
				<textElement textAlignment="Right"/>
				<text><![CDATA[Date :]]></text>
			</staticText>
		</band>
	</title>
	<pageHeader>
		<band splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="30" splitType="Stretch">
			<frame>
				<reportElement x="0" y="0" width="801" height="30"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<staticText>
					<reportElement x="1" y="0" width="65" height="20"/>
					<textElement textAlignment="Center">
						<font size="10" isBold="true"/>
					</textElement>
					<text><![CDATA[PTCN #]]></text>
				</staticText>
				<staticText>
					<reportElement x="69" y="0" width="65" height="20"/>
					<textElement textAlignment="Center">
						<font size="10" isBold="true"/>
					</textElement>
					<text><![CDATA[SO #]]></text>
				</staticText>
				<staticText>
					<reportElement x="203" y="0" width="147" height="20"/>
					<textElement textAlignment="Center">
						<font size="10" isBold="true"/>
					</textElement>
					<text><![CDATA[Transporter Name]]></text>
				</staticText>
				<staticText>
					<reportElement x="137" y="0" width="63" height="20"/>
					<textElement textAlignment="Center">
						<font size="10" isBold="true"/>
					</textElement>
					<text><![CDATA[Shipment #]]></text>
				</staticText>
				<staticText>
					<reportElement x="353" y="0" width="118" height="30"/>
					<textElement textAlignment="Center">
						<font size="10" isBold="true"/>
					</textElement>
					<text><![CDATA[Carton # (Master Carton / Parcel )]]></text>
				</staticText>
				<staticText>
					<reportElement x="473" y="0" width="112" height="20"/>
					<textElement textAlignment="Center">
						<font size="10" isBold="true"/>
					</textElement>
					<text><![CDATA[Tracking ID]]></text>
				</staticText>
				<staticText>
					<reportElement x="590" y="0" width="211" height="20"/>
					<textElement textAlignment="Center">
						<font size="10" isBold="true"/>
					</textElement>
					<text><![CDATA[Manifest #]]></text>
				</staticText>
				<line>
					<reportElement x="67" y="0" width="1" height="30"/>
				</line>
				<line>
					<reportElement x="135" y="0" width="1" height="30"/>
				</line>
				<line>
					<reportElement x="201" y="0" width="1" height="30"/>
				</line>
				<line>
					<reportElement x="350" y="0" width="1" height="30"/>
				</line>
				<line>
					<reportElement x="472" y="0" width="1" height="30"/>
				</line>
				<line>
					<reportElement x="586" y="0" width="1" height="30"/>
				</line>
			</frame>
		</band>
	</columnHeader>
	<detail>
		<band height="20" splitType="Stretch">
			<frame>
				<reportElement x="0" y="0" width="801" height="20"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textField isStretchWithOverflow="true" isBlankWhenNull="true">
					<reportElement isPrintRepeatedValues="false" x="1" y="0" width="65" height="20"/>
					<textElement textAlignment="Center"/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{PTCN}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true" isBlankWhenNull="true">
					<reportElement isPrintRepeatedValues="false" x="69" y="0" width="65" height="20"/>
					<textElement textAlignment="Center"/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{SORD_NO}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true" isBlankWhenNull="true">
					<reportElement isPrintRepeatedValues="false" x="203" y="0" width="147" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{TRAN_NAME}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true" isBlankWhenNull="true">
					<reportElement isPrintRepeatedValues="false" x="137" y="0" width="63" height="20"/>
					<textElement textAlignment="Center"/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{SHIPMENT_ID}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true" isBlankWhenNull="true">
					<reportElement x="351" y="0" width="120" height="20"/>
					<textElement textAlignment="Center"/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{CARTON_NO}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true" isBlankWhenNull="true">
					<reportElement x="473" y="0" width="112" height="20"/>
					<textElement textAlignment="Center"/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{TRACKING_NO}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true" isBlankWhenNull="true">
					<reportElement x="590" y="0" width="211" height="20"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{MENIFEST}]]></textFieldExpression>
				</textField>
				<line>
					<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="67" y="0" width="1" height="20"/>
				</line>
				<line>
					<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="135" y="0" width="1" height="20"/>
				</line>
				<line>
					<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="201" y="0" width="1" height="20"/>
				</line>
				<line>
					<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="350" y="0" width="1" height="20"/>
				</line>
				<line>
					<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="472" y="0" width="1" height="20"/>
				</line>
				<line>
					<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="586" y="0" width="1" height="20"/>
				</line>
			</frame>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
</jasperReport>
