<?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="stock reorder report" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20">
	<property name="ireport.scriptlethandling" value="0"/>
	<property name="ireport.encoding" value="UTF-8"/>
	<property name="ireport.zoom" value="1.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<import value="net.sf.jasperreports.engine.*"/>
	<import value="java.util.*"/>
	<import value="net.sf.jasperreports.engine.data.*"/>
	<parameter name="Stock Location" class="java.lang.String">
		<defaultValueExpression><![CDATA["%"]]></defaultValueExpression>
	</parameter>
	<parameter name="Supplier" class="java.lang.String">
		<defaultValueExpression><![CDATA["%"]]></defaultValueExpression>
	</parameter>
	<parameter name="Product" class="java.lang.String">
		<defaultValueExpression><![CDATA["%"]]></defaultValueExpression>
	</parameter>
	<parameter name="Classification" class="java.lang.String">
		<defaultValueExpression><![CDATA["%"]]></defaultValueExpression>
	</parameter>
	<parameter name="IsEmail" class="java.lang.Boolean" isForPrompting="false">
		<parameterDescription><![CDATA[If true, indicates the report is being emailed, to enable different formatting]]></parameterDescription>
		<defaultValueExpression><![CDATA[Boolean.FALSE]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[select
  stockLocation,
  supplier,
  product,
  reorderCode,
  reorderDesc,
  nettPrice,
  max(current) as current,
  max(ideal) as ideal,
  max(critical) as critical,
  packsize,
  max(orderSize) as orderPackSize,
  sum(if((orderedQty-receivedQty-cancelledQty) < 0, 0,(orderedQty-receivedQty-cancelledQty))*if(orderSize is not null, orderSize,packsize)) as onorder,
  ceil((max(ideal) - (max(current) + sum(if((orderedQty-receivedQty-cancelledQty) < 0, 0,(orderedQty-receivedQty-cancelledQty))*if(orderSize is not null, orderSize,packsize))))/packsize) as toorder
from
(
select
  stockLocation.entity_id as stockLocationId,
	stockLocation.name as stockLocation,
  supplier.entity_id as supplierId,
	supplier.name as supplier,
  product.entity_id as productId,
	product.name as product,
  currentqty.value as current,
  idealqty.value as ideal,
  criticalqty.value as critical,
  packageSize.value as packsize,
  preferred.value as prefSupplier,
  reorderCode.value as reorderCode,
  reorderDesc.value as reorderDesc,
  nettprice.value as nettPrice,
  orderDetail.quantity as orderedQty,
  receivedqty.value as receivedQty,
  cancelledqty.value as cancelledQty,
  orderpacksize.value as orderSize
from entities product
    join entity_relationships productStock on product.entity_id = productStock.source_id and productStock.arch_short_name = "entityRelationship.productStockLocation"
    left outer join entity_relationship_details currentqty on currentqty.entity_relationship_id = productStock.entity_relationship_id  and currentqty.name = "quantity"
    left outer join entity_relationship_details idealqty on idealqty.entity_relationship_id = productStock.entity_relationship_id  and idealqty.name = "idealQty"
    left outer join entity_relationship_details criticalqty on criticalqty.entity_relationship_id = productStock.entity_relationship_id  and criticalqty.name = "criticalQty"
    left outer join entities stockLocation on stockLocation.entity_id = productStock.target_id
    left outer join entity_classifications productgroup on productgroup.entity_id = product.entity_id
    left outer join lookups grouplookup on grouplookup.lookup_id = productgroup.lookup_id
join entity_relationships productSupplier on product.entity_id = productSupplier.source_id
	and productSupplier.arch_short_name = "entityRelationship.productSupplier"
	and (productSupplier.active_start_time is null or productSupplier.active_start_time < now())
	and (productSupplier.active_end_time is null or productSupplier.active_end_time > now())
    left outer join entity_relationship_details packageSize on packageSize.entity_relationship_id = productSupplier.entity_relationship_id  and packageSize.name = "packageSize"
    left outer join entity_relationship_details preferred on preferred.entity_relationship_id = productSupplier.entity_relationship_id  and preferred.name = "preferred"
    left outer join entity_relationship_details reorderCode on reorderCode.entity_relationship_id = productSupplier.entity_relationship_id  and reorderCode.name = "reorderCode"
    left outer join entity_relationship_details reorderDesc on reorderDesc.entity_relationship_id = productSupplier.entity_relationship_id  and reorderDesc.name = "reorderDescription"
    left outer join entity_relationship_details nettprice on nettprice.entity_relationship_id = productSupplier.entity_relationship_id  and nettprice.name = "nettPrice"
    join entities supplier on supplier.entity_id = productSupplier.target_id
    left outer join participations productParticipation on productParticipation.entity_id = product.entity_id
    left outer join acts orderLine on orderLine.act_id = productParticipation.act_id and orderLine.arch_short_name = "act.supplierOrderItem"
    left outer join financial_acts orderDetail on orderDetail.financial_act_id = orderLine.act_id
    left outer join act_details receivedqty on receivedqty.act_id = orderLine.act_id and receivedqty.name ="receivedQuantity"
    left outer join act_details cancelledqty on cancelledqty.act_id = orderLine.act_id and cancelledqty.name ="cancelledQuantity"
    left outer join act_details orderpacksize on orderpacksize.act_id = orderLine.act_id and orderpacksize.name ="packageSize"
    left outer join act_relationships orderLink on orderLink.target_id = orderLine.act_id and orderLink.arch_short_name = "actRelationship.supplierOrderItem"
    left outer join acts orders on orders.act_id = orderLink.source_id
    left outer join act_details deliveryStatus on deliveryStatus.act_id = orders.act_id and deliveryStatus.name ="deliveryStatus"
    left outer join participations stockParticipation on stockParticipation.act_id = orders.act_id and stockParticipation.arch_short_name = "participation.stockLocation"
where
  product.name like $P{Product} and
  product.active = 1 and
  stockLocation.name like $P{Stock Location} and
  supplier.name like $P{Supplier} and
  supplier.active = 1 and
  if($P{Classification} = "%",(grouplookup.name like $P{Classification} or grouplookup.lookup_id is null),grouplookup.name like $P{Classification}) and
  preferred.value = "true" and
  idealqty.value <> "0.00" and
  (productParticipation.act_arch_short_name = "act.supplierOrderItem") and
  (orders.status = "POSTED" or orders.status = "ACCEPTED" or orders.status is null) and
  (deliveryStatus.value <> "FULL" or deliveryStatus.value is null) and
  stockParticipation.entity_id = stockLocation.entity_id
union
select
  stockLocation.entity_id as stockLocationId,
	stockLocation.name as stockLocation,
  supplier.entity_id as supplierId,
	supplier.name as supplier,
  product.entity_id as productId,
	product.name as product,
  currentqty.value as current,
  idealqty.value as ideal,
  criticalqty.value as critical,
  packageSize.value as packsize,
  preferred.value as prefSupplier,
  reorderCode.value as reorderCode,
  reorderDesc.value as reorderDesc,
  nettprice.value as nettPrice,
  0 as orderedQty,
  0 as receivedQty,
  0 as cancelledQty,
  packageSize.value as orderSize
from entities product
    join entity_relationships productStock on product.entity_id = productStock.source_id and productStock.arch_short_name = "entityRelationship.productStockLocation"
    left outer join entity_relationship_details currentqty on currentqty.entity_relationship_id = productStock.entity_relationship_id  and currentqty.name = "quantity"
    left outer join entity_relationship_details idealqty on idealqty.entity_relationship_id = productStock.entity_relationship_id  and idealqty.name = "idealQty"
    left outer join entity_relationship_details criticalqty on criticalqty.entity_relationship_id = productStock.entity_relationship_id  and criticalqty.name = "criticalQty"
    join entities stockLocation on stockLocation.entity_id = productStock.target_id
    left outer join entity_classifications productgroup on productgroup.entity_id = product.entity_id
    left outer join lookups grouplookup on grouplookup.lookup_id = productgroup.lookup_id
    join entity_relationships productSupplier on product.entity_id = productSupplier.source_id and productSupplier.arch_short_name = "entityRelationship.productSupplier"
	and productSupplier.arch_short_name = "entityRelationship.productSupplier"
	and (productSupplier.active_start_time is null or productSupplier.active_start_time < now())
	and (productSupplier.active_end_time is null or productSupplier.active_end_time > now())
    left outer join entity_relationship_details packageSize on packageSize.entity_relationship_id = productSupplier.entity_relationship_id  and packageSize.name = "packageSize"
    left outer join entity_relationship_details preferred on preferred.entity_relationship_id = productSupplier.entity_relationship_id  and preferred.name = "preferred"
    left outer join entity_relationship_details reorderCode on reorderCode.entity_relationship_id = productSupplier.entity_relationship_id  and reorderCode.name = "reorderCode"
    left outer join entity_relationship_details reorderDesc on reorderDesc.entity_relationship_id = productSupplier.entity_relationship_id  and reorderDesc.name = "reorderDescription"
    left outer join entity_relationship_details nettprice on nettprice.entity_relationship_id = productSupplier.entity_relationship_id  and nettprice.name = "nettPrice"
    join entities supplier on supplier.entity_id = productSupplier.target_id
where
  product.name like $P{Product} and
  product.active = 1 and
  stockLocation.name like $P{Stock Location} and
  supplier.name like $P{Supplier} and
  if($P{Classification} = "%",(grouplookup.name like $P{Classification} or grouplookup.lookup_id is null),grouplookup.name like $P{Classification}) and
  preferred.value = "true" and
  idealqty.value <> "0.00"
) as tmp
group by stockLocationId, supplierId, productId
having (current + onorder) <= critical and toorder > 0]]>
	</queryString>
	<field name="stockLocation" class="java.lang.String"/>
	<field name="supplier" class="java.lang.String"/>
	<field name="product" class="java.lang.String"/>
	<field name="reorderCode" class="java.lang.String"/>
	<field name="reorderDesc" class="java.lang.String"/>
	<field name="nettPrice" class="java.math.BigDecimal"/>
	<field name="current" class="java.math.BigDecimal"/>
	<field name="ideal" class="java.math.BigDecimal"/>
	<field name="critical" class="java.math.BigDecimal"/>
	<field name="packsize" class="java.lang.String"/>
	<field name="orderPackSize" class="java.lang.String"/>
	<field name="onorder" class="java.math.BigDecimal"/>
	<field name="toorder" class="java.math.BigDecimal"/>
	<sortField name="stockLocation"/>
	<sortField name="supplier"/>
	<sortField name="product"/>
	<variable name="SUPPLIER_TOTAL" class="java.math.BigDecimal" resetType="Group" resetGroup="supplier" calculation="Sum">
		<variableExpression><![CDATA[$F{nettPrice}.multiply($F{toorder})]]></variableExpression>
		<initialValueExpression><![CDATA[new BigDecimal("0.00")]]></initialValueExpression>
	</variable>
	<variable name="STOCKLOCATION_TOTAL" class="java.math.BigDecimal" resetType="Group" resetGroup="stockLocation" calculation="Sum">
		<variableExpression><![CDATA[$F{nettPrice}.multiply($F{toorder} )]]></variableExpression>
		<initialValueExpression><![CDATA[new BigDecimal("0.00")]]></initialValueExpression>
	</variable>
	<variable name="TOTAL_ORDER" class="java.math.BigDecimal" calculation="Sum">
		<variableExpression><![CDATA[$F{nettPrice}.multiply($F{toorder})]]></variableExpression>
		<initialValueExpression><![CDATA[new BigDecimal("0.00")]]></initialValueExpression>
	</variable>
	<group name="stockLocation" isStartNewPage="true" isReprintHeaderOnEachPage="true">
		<groupExpression><![CDATA[$F{stockLocation}]]></groupExpression>
		<groupHeader>
			<band height="26" splitType="Stretch">
				<textField isBlankWhenNull="false">
					<reportElement key="textField" x="5" y="5" width="212" height="18"/>
					<textElement>
						<font size="14" isBold="true" pdfFontName="Helvetica-Bold"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{stockLocation}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="20" splitType="Stretch">
				<textField pattern="##0.00" isBlankWhenNull="false">
					<reportElement key="textField-6" x="471" y="0" width="50" height="16"/>
					<box>
						<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
						<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
						<bottomPen lineWidth="0.0" lineColor="#000000"/>
						<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					</box>
					<textElement textAlignment="Right">
						<font size="12" isBold="true" isUnderline="true" pdfFontName="Helvetica-Bold"/>
					</textElement>
					<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{STOCKLOCATION_TOTAL}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement key="staticText-39" x="386" y="0" width="81" height="17"/>
					<box>
						<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
						<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
						<bottomPen lineWidth="0.0" lineColor="#000000"/>
						<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					</box>
					<textElement>
						<font size="12" isBold="true" isUnderline="true" pdfFontName="Helvetica-Bold"/>
					</textElement>
					<text><![CDATA[Total :]]></text>
				</staticText>
			</band>
		</groupFooter>
	</group>
	<group name="supplier" isReprintHeaderOnEachPage="true">
		<groupExpression><![CDATA[$F{supplier}]]></groupExpression>
		<groupHeader>
			<band height="21" splitType="Stretch">
				<textField isBlankWhenNull="false">
					<reportElement key="textField" x="19" y="3" width="156" height="18"/>
					<textElement>
						<font size="12" isBold="true" isUnderline="true" pdfFontName="Helvetica-Bold"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{supplier}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="20" splitType="Stretch">
				<textField pattern="##0.00" isBlankWhenNull="false">
					<reportElement key="textField-5" x="470" y="0" width="50" height="16"/>
					<box>
						<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
						<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
						<bottomPen lineWidth="0.0" lineColor="#000000"/>
						<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					</box>
					<textElement textAlignment="Right">
						<font size="12" isBold="true" pdfFontName="Helvetica-Bold"/>
					</textElement>
					<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{SUPPLIER_TOTAL}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement key="staticText-38" x="386" y="0" width="81" height="17"/>
					<box>
						<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
						<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
						<bottomPen lineWidth="0.0" lineColor="#000000"/>
						<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					</box>
					<textElement>
						<font size="12" isBold="true" pdfFontName="Helvetica-Bold"/>
					</textElement>
					<text><![CDATA[Total :]]></text>
				</staticText>
			</band>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band splitType="Stretch"/>
	</title>
	<pageHeader>
		<band height="74" splitType="Stretch">
			<staticText>
				<reportElement key="staticText-1" x="120" y="0" width="290" height="24"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Center">
					<font size="18" isBold="true" isUnderline="true" pdfFontName="Helvetica-Bold"/>
				</textElement>
				<text><![CDATA[Stock Reorder Report]]></text>
			</staticText>
			<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
				<reportElement key="textField" x="86" y="35" width="100" height="18"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{Supplier}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement key="staticText-9" x="5" y="36" width="81" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement/>
				<text><![CDATA[Supplier :]]></text>
			</staticText>
			<textField isBlankWhenNull="false">
				<reportElement key="textField-1" x="358" y="36" width="100" height="18"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>
			</textField>
			<textField evaluationTime="Report" isBlankWhenNull="false">
				<reportElement key="textField-2" x="462" y="36" width="73" height="18"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER} + ""]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement key="staticText-31" x="6" y="53" width="80" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement/>
				<text><![CDATA[Stock Location :]]></text>
			</staticText>
			<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
				<reportElement key="textField-3" x="87" y="52" width="100" height="18"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{Stock Location}]]></textFieldExpression>
			</textField>
			<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
				<reportElement key="textField-4" x="269" y="51" width="100" height="18"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{Product}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement key="staticText-32" x="188" y="52" width="81" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement/>
				<text><![CDATA[Products :]]></text>
			</staticText>
		</band>
	</pageHeader>
	<columnHeader>
		<band height="30" splitType="Stretch">
			<line>
				<reportElement key="line-4" x="5" y="27" width="514" height="1"/>
			</line>
			<staticText>
				<reportElement key="staticText-33" x="22" y="6" width="56" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement/>
				<text><![CDATA[Code]]></text>
			</staticText>
			<staticText>
				<reportElement key="staticText-34" x="78" y="6" width="207" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement/>
				<text><![CDATA[Description]]></text>
			</staticText>
			<staticText>
				<reportElement key="staticText-35" x="377" y="6" width="50" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Right"/>
				<text><![CDATA[Order Qty]]></text>
			</staticText>
			<staticText>
				<reportElement key="staticText-36" x="427" y="6" width="42" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Right"/>
				<text><![CDATA[Cost(Ex)]]></text>
			</staticText>
			<staticText>
				<reportElement key="staticText-37" x="469" y="6" width="50" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Right"/>
				<text><![CDATA[Total(Ex)]]></text>
			</staticText>
			<staticText>
				<reportElement key="staticText-40" x="285" y="6" width="44" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Center"/>
				<text><![CDATA[Ideal]]></text>
			</staticText>
			<staticText>
				<reportElement key="staticText-41" x="329" y="6" width="50" height="17"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Center"/>
				<text><![CDATA[Current]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="24" splitType="Stretch">
			<textField pattern="##0.00" isBlankWhenNull="false">
				<reportElement key="textField" x="469" y="2" width="50" height="16"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{nettPrice}.multiply($F{toorder})]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement key="textField" x="22" y="3" width="53" height="16"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{reorderCode}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="false">
				<reportElement key="textField" x="77" y="2" width="208" height="16"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[($F{reorderDesc} == null) ? $F{product}: $F{reorderDesc}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement key="textField" x="377" y="2" width="50" height="16"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{toorder}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement key="textField" x="427" y="2" width="42" height="16"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{nettPrice}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement key="textField-8" x="285" y="2" width="44" height="16"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{ideal}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement key="textField-9" x="329" y="2" width="50" height="16"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{current}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band height="17" splitType="Stretch">
			<line>
				<reportElement key="line-2" x="5" y="9" width="514" height="1"/>
			</line>
		</band>
	</columnFooter>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
	<lastPageFooter>
		<band height="100" splitType="Stretch">
			<staticText>
				<reportElement key="staticText-29" x="30" y="11" width="480" height="24"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font size="18" isBold="true" isUnderline="true" pdfFontName="Helvetica-Bold"/>
				</textElement>
				<text><![CDATA[Stock Reorder Report - Summary]]></text>
			</staticText>
			<staticText>
				<reportElement key="staticText-30" x="33" y="50" width="130" height="20"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font isBold="true" pdfFontName="Helvetica-Bold"/>
				</textElement>
				<text><![CDATA[Total Order (Ex Tax)]]></text>
			</staticText>
			<textField pattern="##0.00" isBlankWhenNull="false">
				<reportElement key="textField-7" x="163" y="50" width="50" height="20"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Right">
					<font isBold="true" pdfFontName="Helvetica-Bold"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{TOTAL_ORDER}]]></textFieldExpression>
			</textField>
		</band>
	</lastPageFooter>
	<summary>
		<band splitType="Stretch"/>
	</summary>
</jasperReport>