<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Version: 1.0
  ~
  ~ The contents of this file are subject to the OpenVPMS License Version
  ~ 1.0 (the 'License'); you may not use this file except in compliance with
  ~ the License. You may obtain a copy of the License at
  ~ http://www.openvpms.org/license/
  ~
  ~ Software distributed under the License is distributed on an 'AS IS' basis,
  ~ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  ~ for the specific language governing rights and limitations under the
  ~ License.
  ~
  ~ Copyright 2014 (C) OpenVPMS Ltd. All Rights Reserved.
  -->

<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 A5" pageWidth="421" pageHeight="595" columnWidth="361" leftMargin="30" rightMargin="30"
              topMargin="11" 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="org.openvpms.component.business.domain.im.party.Party"/>
    <import value="net.sf.jasperreports.engine.*"/>
    <import value="java.util.*"/>
    <import value="org.openvpms.archetype.function.party.PartyFunctions"/>
    <import value="net.sf.jasperreports.engine.data.*"/>
    <parameter name="dataSource" class="org.openvpms.report.jasper.IMObjectCollectionDataSource"
               isForPrompting="false"/>
    <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>
    <field name="author.entity.name" class="java.lang.String"/>
    <field name="customer.entity.name" class="java.lang.String"/>
    <field name="customer.entity" class="org.openvpms.component.business.domain.im.party.Party"/>
    <field name="startTime" class="java.util.Date"/>
    <field name="uid" class="java.lang.Long"/>
    <field name="title" class="java.lang.String">
        <fieldDescription><![CDATA[Estimation Title]]></fieldDescription>
    </field>
    <field name="endTime" class="java.util.Date"/>
    <field name="[party:getBillingAddress(.)]" class="java.lang.String"/>
    <field name="description" class="java.lang.String"/>
    <field name="[party:getPartyFullName(.)]" class="java.lang.String"/>
    <field name="patient.entity.name" class="java.lang.String"/>
    <field name="taskType.entity.name" class="java.lang.String"/>
    <field name="reason" class="java.lang.String"/>
    <field name="clinician.entity.name" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="64" splitType="Stretch">
            <staticText>
                <reportElement x="5" y="10" width="351" height="24">
                    <printWhenExpression><![CDATA[$P{IsEmail}.equals(Boolean.TRUE)]]></printWhenExpression>
                </reportElement>
                <textElement/>
                <text><![CDATA[Email Letterhead. Replace this label with the practice logo and details.]]></text>
            </staticText>
            <staticText>
                <reportElement x="5" y="34" width="351" height="30">
                    <printWhenExpression><![CDATA[$P{IsEmail}.equals(Boolean.TRUE)]]></printWhenExpression>
                </reportElement>
                <textElement/>
                <text>
                    <![CDATA[This is automatically hidden when printing. See the "Print When Expression" property for more details.]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band height="45" splitType="Stretch">
            <staticText>
                <reportElement key="staticText-9" x="62" y="6" width="236" height="29"/>
                <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" pdfFontName="Helvetica-Bold"/>
                </textElement>
                <text><![CDATA[Task]]></text>
            </staticText>
        </band>
    </pageHeader>
    <columnHeader>
        <band splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="202" splitType="Stretch">
            <staticText>
                <reportElement key="staticText-11" x="0" y="42" width="73" 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>
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Patient]]></text>
            </staticText>
            <textField isBlankWhenNull="false">
                <reportElement key="textField-10" x="73" y="63" width="253" 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>
                    <font size="10"/>
                </textElement>
                <textFieldExpression class="java.lang.String">
                    <![CDATA[$F{[party:getPartyFullName(.)]}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false">
                <reportElement key="textField-11" x="73" y="84" width="251" height="46"/>
                <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="10"/>
                </textElement>
                <textFieldExpression class="java.lang.String">
                    <![CDATA[$F{[party:getBillingAddress(.)]}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement key="staticText-11" x="0" y="84" width="73" 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>
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Address]]></text>
            </staticText>
            <staticText>
                <reportElement key="staticText-11" x="0" y="0" width="73" 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>
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Task]]></text>
            </staticText>
            <textField pattern="EEE, d MMM yyyy hh:mm aaa" isBlankWhenNull="false">
                <reportElement key="textField-12" x="73" y="0" width="143" 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>
                    <font size="10"/>
                </textElement>
                <textFieldExpression class="java.util.Date"><![CDATA[$F{startTime}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="73" y="42" width="123" height="16"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{patient.entity.name}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement key="staticText-11" x="0" y="63" width="73" 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>
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Customer]]></text>
            </staticText>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="216" y="0" width="129" height="16"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{taskType.entity.name}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="73" y="21" width="120" height="16"/>
                <textElement/>
                <textFieldExpression class="java.lang.String">
                    <![CDATA[$F{clinician.entity.name}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement key="staticText-11" x="0" y="21" width="73" 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>
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Clinician]]></text>
            </staticText>
            <staticText>
                <reportElement key="staticText-11" x="0" y="130" width="73" 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>
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Notes]]></text>
            </staticText>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="73" y="130" width="272" height="56"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{description}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="40" splitType="Stretch"/>
    </summary>
</jasperReport>