<jasperReport name="AddressesReport" language="java" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" uuid="f050e3db-0847-4912-9c16-d6b157484813">
	<property name="com.jaspersoft.studio.data.defaultdataadapter" value="hibernate/data/HibernateDataAdapter.jrdax"/>
	<import>net.sf.jasperreports.engine.data.JRBeanCollectionDataSource</import>
	<style name="Sans_Normal" default="true" fontName="DejaVu Sans" fontSize="12.0"/>
	<style name="Sans_Normal_Small" fontName="DejaVu Sans" fontSize="9.0"/>
	<style name="Sans_Bold" fontName="DejaVu Sans" fontSize="12.0" bold="true"/>
	<style name="Sans_Italic" fontName="DejaVu Sans" fontSize="12.0" italic="true"/>
	<parameter name="ReportTitle" class="java.lang.String">
		<defaultValueExpression><![CDATA["Address Report"]]></defaultValueExpression>
	</parameter>
	<parameter name="CityFilter" class="java.util.List">
		<defaultValueExpression><![CDATA[Arrays.asList("Boston","Chicago","Oslo")]]></defaultValueExpression>
	</parameter>
	<query language="hql"><![CDATA[select address as address, document.id as documentId, document.total as documentTotal
			from Address as address join address.documents as document
			where city not in ($P{CityFilter})
			order by address.city, address.lastName, address.firstName, address.id]]></query>
	<field name="id" class="java.lang.Long">
		<property name="net.sf.jasperreports.javabean.field.property" value="address.id"/>
	</field>
	<field name="firstName" class="java.lang.String">
		<property name="net.sf.jasperreports.javabean.field.property" value="address.firstName"/>
	</field>
	<field name="lastName" class="java.lang.String">
		<property name="net.sf.jasperreports.javabean.field.property" value="address.lastName"/>
	</field>
	<field name="street" class="java.lang.String">
		<property name="net.sf.jasperreports.javabean.field.property" value="address.street"/>
	</field>
	<field name="city" class="java.lang.String">
		<property name="net.sf.jasperreports.javabean.field.property" value="address.city"/>
	</field>
	<field name="documentId" class="java.lang.Long"/>
	<field name="documentTotal" class="java.lang.Double"/>
	<variable name="addressTotal" resetType="Group" calculation="Sum" resetGroup="AddressGroup" class="java.lang.Double">
		<expression><![CDATA[$F{documentTotal}]]></expression>
	</variable>
	<group name="AddressGroup">
		<expression><![CDATA[$F{id}]]></expression>
		<groupHeader>
			<band height="25">
				<element kind="frame" uuid="a143642b-fbed-4962-bfbf-c9d9ecc24879" mode="Opaque" x="0" y="0" width="375" height="21" backcolor="#E0E0E0">
					<element kind="textField" uuid="fdadafcd-6622-4d05-89f8-31eeb46e68f9" x="5" y="3" width="160" height="15" textAdjust="StretchHeight">
						<expression><![CDATA[$F{firstName} + " " + $F{lastName} + " (ID: " + $F{id} + ")"]]></expression>
					</element>
					<element kind="textField" uuid="8e21ca6a-7eb9-4deb-8b36-9df9db27314c" x="210" y="3" width="160" height="15" textAdjust="StretchHeight" hTextAlign="Right">
						<expression><![CDATA[$F{street} + "," + $F{city}]]></expression>
					</element>
				</element>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="25">
				<element kind="line" uuid="89aa8875-ef41-4ade-8143-b12e79955216" x="20" y="0" width="475" height="1" forecolor="#808080">
					<pen lineWidth="0.5"/>
				</element>
				<element kind="staticText" uuid="d248a006-9289-4a01-909d-81608bbdd09b" x="20" y="2" width="70" height="15" style="Sans_Normal_Small">
					<text><![CDATA[Total]]></text>
				</element>
				<element kind="textField" uuid="c4c43f7e-2ce3-4070-818b-e64bb6c27977" x="100" y="2" width="50" height="15" hTextAlign="Right" style="Sans_Normal_Small">
					<expression><![CDATA[$V{AddressGroup_COUNT}]]></expression>
				</element>
				<element kind="textField" uuid="026b8161-7824-41f8-a86f-38d8c1321003" x="255" y="2" width="100" height="15" textAdjust="StretchHeight" pattern="#.00" hTextAlign="Right" style="Sans_Normal_Small">
					<expression><![CDATA[$V{addressTotal}]]></expression>
				</element>
			</band>
		</groupFooter>
	</group>
	<title height="50">
		<element kind="line" uuid="6a96d2fc-8ad1-4022-91e6-fcc11f3380f5" x="0" y="0" width="515" height="1" forecolor="#000000"/>
		<element kind="textField" uuid="876bd00a-1cd0-485e-8e71-20c402f03048" x="0" y="10" width="515" height="30" fontSize="22.0" blankWhenNull="true" hTextAlign="Center" style="Sans_Normal">
			<paragraph lineSpacing="Single" style="Sans_Normal"/>
			<expression><![CDATA[$P{ReportTitle}]]></expression>
		</element>
	</title>
	<detail>
		<band height="13">
			<element kind="staticText" uuid="8d08fcca-f5d3-4c5b-baa0-e5ab70628047" x="20" y="0" width="70" height="12" printWhenGroupChanges="AddressGroup" printRepeatedValues="false" printInFirstWholeBand="true" style="Sans_Normal_Small">
				<text><![CDATA[Document ID]]></text>
			</element>
			<element kind="textField" uuid="f31a81f4-a0c8-4883-9d4c-285e66739478" x="100" y="0" width="50" height="12" hTextAlign="Right" style="Sans_Normal_Small">
				<expression><![CDATA[$F{documentId}]]></expression>
			</element>
			<element kind="staticText" uuid="c5e1138c-175d-44cf-81ea-aa736ce885f2" x="180" y="0" width="70" height="12" printWhenGroupChanges="AddressGroup" printRepeatedValues="false" printInFirstWholeBand="true" style="Sans_Normal_Small">
				<text><![CDATA[Document Total]]></text>
			</element>
			<element kind="textField" uuid="cf13a747-c535-4a39-b13b-3ba60926e317" x="255" y="0" width="100" height="12" textAdjust="StretchHeight" pattern="#.00" hTextAlign="Right" style="Sans_Normal_Small">
				<expression><![CDATA[$F{documentTotal}]]></expression>
			</element>
		</band>
	</detail>
	<pageFooter height="40">
		<printWhenExpression><![CDATA[!$P{IS_IGNORE_PAGINATION}]]></printWhenExpression>
		<element kind="line" uuid="7c3195dc-606d-4287-a159-acf9af1e1063" x="0" y="10" width="515" height="1"/>
		<element kind="textField" uuid="dba281f2-0790-48c4-a5d8-0a71cfc4c842" x="200" y="20" width="80" height="15" hTextAlign="Right">
			<expression><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></expression>
		</element>
		<element kind="textField" uuid="e6b4b6f0-e454-4c46-ad41-765e42ea01e8" x="280" y="20" width="75" height="15" evaluationTime="Report" hTextAlign="Left">
			<expression><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></expression>
		</element>
	</pageFooter>
</jasperReport>
