<?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="Task Productivity Detail" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="792" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="EMP_CODE__FR" class="java.lang.String"/>
	<parameter name="EMP_CODE__TO" class="java.lang.String"/>
	<parameter name="DATE__FR" class="java.util.Date"/>
	<parameter name="DATE__TO" class="java.util.Date"/>
	<parameter name="AS_PICK_TYPE" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT
DDF_GET_EMP_NAME(PIH.EMP_CODE__APRV) AS EMP_NAME,
PIH.EMP_CODE__APRV AS EMP_CODE__APRV,
PID.PICK_ORDER AS PICK_ORDER,
COUNT(PID.PICK_ORDER) AS COUNT_PICK_ORDER,
PIH.PICK_TYPE,
(CASE WHEN PIH.PICK_TYPE = 'A' THEN SUM(PID.QUANTITY) ELSE SUM(PID.NO_ART) END) AS SUM_NO_ART,
COUNT(PID.LOC_CODE) AS COUNT_LOC_CODE
FROM PICK_ISS_HDR PIH, PICK_ISS_DET PID
WHERE
PIH.EMP_CODE__APRV >= '$P!{EMP_CODE__FR}' AND PIH.EMP_CODE__APRV <= '$P!{EMP_CODE__TO}' AND
PIH.TRAN_DATE >= $P{DATE__FR} AND PIH.TRAN_DATE <= $P{DATE__TO} AND
PIH.PICK_ORDER = PID.PICK_ORDER AND
(('$P!{AS_PICK_TYPE}' = PIH.PICK_TYPE OR '$P!{AS_PICK_TYPE}' = 'B') AND PIH.PICK_TYPE <> 'M')
GROUP BY PIH.EMP_CODE__APRV, PID.PICK_ORDER, PIH.PICK_TYPE]]>
	</queryString>
	<field name="EMP_NAME" class="java.lang.String"/>
	<field name="EMP_CODE__APRV" class="java.lang.String"/>
	<field name="PICK_ORDER" class="java.lang.String"/>
	<field name="COUNT_PICK_ORDER" class="java.lang.Integer"/>
	<field name="SUM_NO_ART" class="java.lang.Integer"/>
	<field name="COUNT_LOC_CODE" class="java.lang.Integer"/>
	<field name="PICK_TYPE" class="java.lang.String"/>
	<sortField name="EMP_CODE__APRV"/>
	<variable name="compute_1" class="java.lang.Integer" resetType="Group" resetGroup="EMP_CODE" calculation="Count">
		<variableExpression><![CDATA[new java.lang.Integer($F{COUNT_PICK_ORDER}.intValue())]]></variableExpression>
	</variable>
	<variable name="compute_2" class="java.lang.Integer" resetType="Group" resetGroup="EMP_CODE" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Integer(!$F{PICK_TYPE}.equals("A")?$F{SUM_NO_ART}.intValue():0)]]></variableExpression>
	</variable>
	<variable name="compute_3" class="java.lang.Integer" resetType="Group" resetGroup="EMP_CODE" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Integer($F{COUNT_LOC_CODE}.intValue())]]></variableExpression>
	</variable>
	<variable name="compute_4" class="java.lang.Integer" resetType="Group" resetGroup="Pick Order" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Integer($F{SUM_NO_ART}.intValue())]]></variableExpression>
	</variable>
	<variable name="compute_5" class="java.lang.Integer" resetType="Group" resetGroup="Pick Order" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Integer($F{COUNT_LOC_CODE}.intValue())]]></variableExpression>
	</variable>
	<variable name="compute_7" class="java.lang.Integer" resetType="Group" resetGroup="EMP_CODE" calculation="Sum">
		<variableExpression><![CDATA[new java.lang.Integer(!$F{PICK_TYPE}.equals("C")?$F{SUM_NO_ART}.intValue():0)]]></variableExpression>
	</variable>
	<group name="EMP_CODE">
		<groupExpression><![CDATA[$F{EMP_CODE__APRV}]]></groupExpression>
		<groupHeader>
			<band height="16">
				<staticText>
					<reportElement x="2" y="3" width="30" height="10"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<text><![CDATA[User :]]></text>
				</staticText>
				<textField isStretchWithOverflow="true" isBlankWhenNull="true">
					<reportElement x="112" y="3" width="281" height="10"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{EMP_NAME}]]></textFieldExpression>
				</textField>
				<line>
					<reportElement x="2" y="14" width="590" height="1"/>
					<graphicElement>
						<pen lineWidth="0.5" lineStyle="Dashed"/>
					</graphicElement>
				</line>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="19">
				<staticText>
					<reportElement x="56" y="3" width="59" height="10"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<text><![CDATA[Totals:]]></text>
				</staticText>
				<textField pattern="" isBlankWhenNull="true">
					<reportElement x="110" y="3" width="45" height="10"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{compute_1}]]></textFieldExpression>
				</textField>
				<textField pattern="0" isBlankWhenNull="true">
					<reportElement x="348" y="3" width="45" height="10"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{compute_3}]]></textFieldExpression>
				</textField>
				<textField evaluationTime="Group" evaluationGroup="EMP_CODE" pattern="0" isBlankWhenNull="true">
					<reportElement x="191" y="3" width="55" height="10"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{compute_2}]]></textFieldExpression>
				</textField>
				<line>
					<reportElement x="2" y="0" width="590" height="1"/>
					<graphicElement>
						<pen lineWidth="0.5" lineStyle="Dashed"/>
					</graphicElement>
				</line>
				<line>
					<reportElement x="2" y="15" width="590" height="1"/>
					<graphicElement>
						<pen lineWidth="0.5" lineStyle="Dashed"/>
					</graphicElement>
				</line>
				<textField evaluationTime="Group" evaluationGroup="EMP_CODE" pattern="0" isBlankWhenNull="true">
					<reportElement x="275" y="3" width="55" height="10"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{compute_7}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<group name="Pick Order">
		<groupExpression><![CDATA[$F{PICK_ORDER}]]></groupExpression>
		<groupHeader>
			<band/>
		</groupHeader>
		<groupFooter>
			<band height="10">
				<textField isBlankWhenNull="true">
					<reportElement x="112" y="0" width="59" height="10"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{PICK_ORDER}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement x="191" y="0" width="55" height="10">
						<printWhenExpression><![CDATA[new Boolean($F{PICK_TYPE}.equals("A")?false:true)]]></printWhenExpression>
					</reportElement>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{compute_4}]]></textFieldExpression>
				</textField>
				<textField pattern="0" isBlankWhenNull="true">
					<reportElement x="348" y="0" width="45" height="10"/>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{compute_5}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement x="275" y="0" width="55" height="10">
						<printWhenExpression><![CDATA[new Boolean($F{PICK_TYPE}.equals("C")?false:true)]]></printWhenExpression>
					</reportElement>
					<textElement textAlignment="Right">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{compute_4}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<detail>
		<band splitType="Stretch"/>
	</detail>
</jasperReport>
