<?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="Cut Report" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="as_site_code" class="java.lang.String"/>
	<parameter name="frm_order_date" class="java.util.Date"/>
	<parameter name="to_order_date" class="java.util.Date"/>
	<queryString>
		<![CDATA[select sale_order,
line_no,
order_date,
due_date,
status_date,
cust_code,
cust_name,
sum(ord_qty) as ord_qty,
sum(ship_qty) as ship_qty,
sum(ord_qty - ship_qty) as cancel_qty,
item_code,
item_descr,
site_descr
from
(select sorder.sale_order,sorddet.line_no,sorder.order_date,sorder.due_date,sorder.status_date,sorder.cust_code,customer.cust_name,sorddet.quantity as ord_qty,
0 as ship_qty,sorddet.item_code,item.descr as item_descr,ddf_get_site_descr(sorder.site_code) as site_descr
from sorder,sorddet,customer,item
where sorder.order_date between $P{frm_order_date} AND $P{to_order_date}
and sorder.site_code =  '$P!{as_site_code}'
and sorder.confirmed = 'Y'
and sorder.status = 'C'
and sorddet.sale_order = sorder.sale_order
and customer.cust_code = sorder.cust_code
and item.item_code = sorddet.item_code
union all
select sorder.sale_order,sorditem.line_no,sorder.order_date,sorditem.due_date,sorder.status_date,sorder.cust_code,customer.cust_name,0 as ord_qty,
sum(sorditem.qty_desp) as ship_qty,sorditem.item_code,item.descr as item_descr,ddf_get_site_descr(sorder.site_code) as site_descr
from sorder,sorditem,customer,item
where sorder.order_date between $P{frm_order_date} AND $P{to_order_date}
and sorder.site_code =  '$P!{as_site_code}'
and sorder.confirmed = 'Y'
and sorder.status = 'C'
and sorditem.sale_order = sorder.sale_order
and customer.cust_code = sorder.cust_code
and item.item_code = sorditem.item_code
group by sorder.sale_order,sorditem.line_no,sorder.order_date,sorditem.due_date,sorder.status_date,sorder.cust_code,customer.cust_name,sorditem.item_code,item.descr,ddf_get_site_descr(sorder.site_code))
group by sale_order,line_no,order_date,due_date,status_date,cust_code,cust_name,item_code,item_descr,site_descr
having sum(ord_qty - ship_qty) > 0]]>
	</queryString>
	<field name="sale_order" class="java.lang.String"/>
	<field name="line_no" class="java.lang.Double"/>
	<field name="order_date" class="java.util.Date"/>
	<field name="due_date" class="java.util.Date"/>
	<field name="status_date" class="java.util.Date"/>
	<field name="cust_code" class="java.lang.String"/>
	<field name="cust_name" class="java.lang.String"/>
	<field name="ord_qty" class="java.lang.Double"/>
	<field name="ship_qty" class="java.lang.Double"/>
	<field name="cancel_qty" class="java.lang.Double"/>
	<field name="item_code" class="java.lang.String"/>
	<field name="item_descr" class="java.lang.String"/>
	<field name="site_descr" class="java.lang.String"/>
	<sortField name="cust_code"/>
	<variable name="variable1" class="java.util.Date" resetType="None">
		<variableExpression><![CDATA[new java.util.Date()]]></variableExpression>
	</variable>
	<variable name="ord_tot" class="java.lang.Double" resetType="Group" resetGroup="CUSTOMER" calculation="Sum">
		<variableExpression><![CDATA[$F{ord_qty}]]></variableExpression>
	</variable>
	<variable name="ship_tot" class="java.lang.Double" resetType="Group" resetGroup="CUSTOMER" calculation="Sum">
		<variableExpression><![CDATA[$F{ship_qty}]]></variableExpression>
	</variable>
	<variable name="pending_tot" class="java.lang.Double" resetType="Group" resetGroup="CUSTOMER" calculation="Sum">
		<variableExpression><![CDATA[$F{cancel_qty}]]></variableExpression>
	</variable>
	<variable name="ord_grand" class="java.lang.Double" calculation="Sum">
		<variableExpression><![CDATA[$F{ord_qty}]]></variableExpression>
	</variable>
	<variable name="ship_grand" class="java.lang.Double" calculation="Sum">
		<variableExpression><![CDATA[$F{ship_qty}]]></variableExpression>
	</variable>
	<variable name="pending_grand" class="java.lang.Double" calculation="Sum">
		<variableExpression><![CDATA[$F{cancel_qty}]]></variableExpression>
	</variable>
	<group name="CUSTOMER" isReprintHeaderOnEachPage="true">
		<groupExpression><![CDATA[$F{cust_code}]]></groupExpression>
		<groupHeader>
			<band height="18">
				<textField>
					<reportElement x="79" y="1" width="174" height="16"/>
					<textElement textAlignment="Left" verticalAlignment="Middle">
						<font fontName="Times New Roman" isBold="true"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{cust_name}]]></textFieldExpression>
				</textField>
				<line>
					<reportElement x="0" y="17" width="750" height="1"/>
				</line>
				<staticText>
					<reportElement x="3" y="0" width="76" height="18"/>
					<textElement textAlignment="Left" verticalAlignment="Middle">
						<font fontName="Times New Roman" isBold="true"/>
					</textElement>
					<text><![CDATA[Customer Name : ]]></text>
				</staticText>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="19">
				<textField pattern="###0.00">
					<reportElement x="561" y="0" width="84" height="18"/>
					<textElement textAlignment="Right" verticalAlignment="Middle">
						<font fontName="Times New Roman"/>
					</textElement>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{ship_tot}]]></textFieldExpression>
				</textField>
				<line>
					<reportElement x="0" y="0" width="750" height="1"/>
				</line>
				<staticText>
					<reportElement x="296" y="1" width="146" height="18"/>
					<textElement textAlignment="Left" verticalAlignment="Middle">
						<font fontName="Times New Roman" isBold="true"/>
					</textElement>
					<text><![CDATA[Customer Code Wise Total]]></text>
				</staticText>
				<textField pattern="###0.00">
					<reportElement x="647" y="0" width="99" height="18"/>
					<textElement textAlignment="Right" verticalAlignment="Middle">
						<font fontName="Times New Roman"/>
					</textElement>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{pending_tot}]]></textFieldExpression>
				</textField>
				<textField pattern="###0.00">
					<reportElement x="472" y="0" width="88" height="18"/>
					<textElement textAlignment="Right" verticalAlignment="Middle">
						<font fontName="Times New Roman"/>
					</textElement>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{ord_tot}]]></textFieldExpression>
				</textField>
				<line>
					<reportElement x="0" y="18" width="750" height="1"/>
				</line>
			</band>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<pageHeader>
		<band height="73" splitType="Stretch">
			<staticText>
				<reportElement x="326" y="50" width="146" height="21"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Item Description]]></text>
			</staticText>
			<textField evaluationTime="Report">
				<reportElement x="731" y="7" width="15" height="20"/>
				<textElement>
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="684" y="7" width="20" height="20"/>
				<textElement>
					<font fontName="Times New Roman" isBold="false"/>
				</textElement>
				<text><![CDATA[Page]]></text>
			</staticText>
			<staticText>
				<reportElement x="39" y="50" width="55" height="21"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Sale Order]]></text>
			</staticText>
			<staticText>
				<reportElement x="17" y="8" width="28" height="17"/>
				<textElement>
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Date:]]></text>
			</staticText>
			<staticText>
				<reportElement x="718" y="7" width="10" height="14"/>
				<textElement>
					<font fontName="Times New Roman" isBold="false"/>
				</textElement>
				<text><![CDATA[of]]></text>
			</staticText>
			<staticText>
				<reportElement x="265" y="49" width="60" height="22"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Item]]></text>
			</staticText>
			<staticText>
				<reportElement x="214" y="49" width="50" height="22"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Due Date]]></text>
			</staticText>
			<staticText>
				<reportElement x="3" y="50" width="36" height="21"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Sr No]]></text>
			</staticText>
			<textField pattern="MM/dd/yy">
				<reportElement x="49" y="8" width="133" height="17"/>
				<textElement>
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[$V{variable1}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="647" y="49" width="99" height="22"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Pending Qty]]></text>
			</staticText>
			<staticText>
				<reportElement x="100" y="50" width="53" height="21"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Order Date]]></text>
			</staticText>
			<line>
				<reportElement x="0" y="72" width="750" height="1"/>
			</line>
			<textField evaluationTime="Page">
				<reportElement x="706" y="7" width="13" height="20"/>
				<textElement>
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="561" y="49" width="84" height="22"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Ship Qty]]></text>
			</staticText>
			<staticText>
				<reportElement x="154" y="49" width="66" height="22"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Status Date]]></text>
			</staticText>
			<textField>
				<reportElement x="15" y="8" width="735" height="17"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="12" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{site_descr}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement x="0" y="47" width="750" height="1"/>
			</line>
			<staticText>
				<reportElement x="17" y="26" width="733" height="18"/>
				<textElement textAlignment="Center">
					<font fontName="Times New Roman" size="14" isBold="true"/>
				</textElement>
				<text><![CDATA[Cut Report]]></text>
			</staticText>
			<staticText>
				<reportElement x="473" y="49" width="87" height="22"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Order Qty]]></text>
			</staticText>
		</band>
	</pageHeader>
	<detail>
		<band height="19" splitType="Stretch">
			<textField>
				<reportElement x="264" y="0" width="57" height="18"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{item_code}]]></textFieldExpression>
			</textField>
			<textField pattern="MM/dd/yy">
				<reportElement x="100" y="0" width="53" height="18"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[$F{order_date}]]></textFieldExpression>
			</textField>
			<textField pattern="###0">
				<reportElement x="3" y="0" width="24" height="18"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{line_no}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="326" y="0" width="146" height="18"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{item_descr}]]></textFieldExpression>
			</textField>
			<textField pattern="MM/dd/yy">
				<reportElement x="214" y="0" width="50" height="18"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[$F{due_date}]]></textFieldExpression>
			</textField>
			<textField pattern="###0.00">
				<reportElement x="647" y="1" width="99" height="18"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{cancel_qty}]]></textFieldExpression>
			</textField>
			<textField pattern="MM/dd/yy">
				<reportElement x="154" y="0" width="65" height="18"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[$F{status_date}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="39" y="0" width="53" height="18"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{sale_order}]]></textFieldExpression>
			</textField>
			<textField pattern="###0.00">
				<reportElement x="473" y="0" width="87" height="18"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{ord_qty}]]></textFieldExpression>
			</textField>
			<textField pattern="###0.00">
				<reportElement x="561" y="0" width="84" height="18"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$F{ship_qty}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band height="19" splitType="Stretch">
			<staticText>
				<reportElement x="296" y="1" width="146" height="18"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font fontName="Times New Roman" isBold="true"/>
				</textElement>
				<text><![CDATA[Grand Total]]></text>
			</staticText>
			<textField pattern="###0.00">
				<reportElement x="561" y="1" width="84" height="18"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{ship_grand}]]></textFieldExpression>
			</textField>
			<textField pattern="###0.00">
				<reportElement x="473" y="1" width="87" height="18"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{ord_grand}]]></textFieldExpression>
			</textField>
			<textField pattern="###0.00">
				<reportElement x="647" y="1" width="99" height="18"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Times New Roman"/>
				</textElement>
				<textFieldExpression class="java.lang.Double"><![CDATA[$V{pending_grand}]]></textFieldExpression>
			</textField>
		</band>
	</summary>
</jasperReport>
