<?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 Summary" 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,
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="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="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>
		<groupFooter>
			<band height="21">
				<line>
					<reportElement x="1" y="18" width="590" height="1"/>
					<graphicElement>
						<pen lineWidth="0.5" lineStyle="Dashed"/>
					</graphicElement>
				</line>
				<line>
					<reportElement x="1" y="3" width="590" height="1"/>
					<graphicElement>
						<pen lineWidth="0.5" lineStyle="Dashed"/>
					</graphicElement>
				</line>
				<staticText>
					<reportElement x="45" y="8" width="59" height="10"/>
					<textElement>
						<font fontName="Courier New" size="7"/>
					</textElement>
					<text><![CDATA[Totals:]]></text>
				</staticText>
				<textField pattern="" isBlankWhenNull="true">
					<reportElement x="94" y="8" width="59" 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="193" y="8" 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>
				<textField pattern="0" isBlankWhenNull="true">
					<reportElement x="340" y="8" 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 pattern="0" isBlankWhenNull="true">
					<reportElement x="459" y="8" width="131" height="10"/>
					<textElement textAlignment="Left">
						<font fontName="Courier New" size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{EMP_NAME}]]></textFieldExpression>
				</textField>
				<textField pattern="0" isBlankWhenNull="true">
					<reportElement x="269" y="8" width="55" height="10"/>
					<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>
