<?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="EmployeeAccounts" pageWidth="595" pageHeight="842" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50">
	<property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
	<property name="net.sf.jasperreports.export.pdf.tag.language" value="EN-US"/>
	<style name="Sans_Normal" isDefault="true" fontName="SansSerif" fontSize="12" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
	<style name="Sans_Bold" isDefault="false" fontName="SansSerif" fontSize="12" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
	<style name="Sans_Italic" isDefault="false" fontName="SansSerif" fontSize="12" isItalic="true" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
	<style name="PageHeader" isDefault="false" style="Sans_Bold" forecolor="#FFFFFF"/>
	<style name="detail" isDefault="false">
		<conditionalStyle>
			<conditionExpression><![CDATA[new Boolean($V{CityGroup_COUNT}.intValue() % 2 == 0)]]></conditionExpression>
			<style isDefault="false" style="detail" mode="Opaque" backcolor="#E0E0E0"/>
		</conditionalStyle>
	</style>
	<parameter name="EmployeeID" class="java.lang.String"/>
	<queryString>
		<![CDATA[SELECT name, phone_office, billing_address_city, billing_address_street, billing_address_country 
		FROM accounts
		WHERE assigned_user_id = $P{EmployeeID} 
		ORDER BY billing_address_country, billing_address_city]]>
	</queryString>
	<field name="name" class="java.lang.String"/>
	<field name="phone_office" class="java.lang.String"/>
	<field name="billing_address_city" class="java.lang.String"/>
	<field name="billing_address_street" class="java.lang.String"/>
	<field name="billing_address_country" class="java.lang.String"/>
	<variable name="CityyNumber" class="java.lang.Integer" resetType="Group" resetGroup="CityGroup" calculation="System">
		<initialValueExpression><![CDATA[($V{CityyNumber} != null)?(new Integer($V{CityyNumber}.intValue() + 1)):(new Integer(1))]]></initialValueExpression>
	</variable>
	<group name="CityGroup" minHeightToStartNewPage="60">
		<groupExpression><![CDATA[$F{billing_address_city}]]></groupExpression>
		<groupHeader>
			<band height="30" splitType="Stretch">
				<frame>
					<reportElement mode="Opaque" x="0" y="14" width="515" height="16" backcolor="#C0C0C0">
						<property name="net.sf.jasperreports.export.pdf.tag.tr" value="full"/>
						<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
						<property name="net.sf.jasperreports.export.pdf.tag.colspan" value="4"/>
					</reportElement>
					<box>
						<bottomPen lineWidth="1.0" lineStyle="Solid"/>
					</box>
					<textField isStretchWithOverflow="true">
						<reportElement style="Sans_Bold" x="0" y="0" width="515" height="16"/>
						<textElement textAlignment="Left"/>
						<textFieldExpression class="java.lang.String"><![CDATA["  " + String.valueOf($V{CityyNumber}) + ". " + $F{billing_address_city}+ ", " + $F{billing_address_country}]]></textFieldExpression>
					</textField>
				</frame>
			</band>
		</groupHeader>
	</group>
	<title>
		<band height="50" splitType="Stretch">
			<line>
				<reportElement x="0" y="1" width="515" height="1" forecolor="#000000"/>
			</line>
			<textField isBlankWhenNull="true">
				<reportElement style="Sans_Normal" x="0" y="10" width="515" height="30"/>
				<textElement textAlignment="Center" lineSpacing="Single">
					<font size="22"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Accounts"]]></textFieldExpression>
			</textField>
		</band>
	</title>
	<pageHeader>
		<band height="20" splitType="Stretch">
			<frame>
				<reportElement mode="Opaque" x="0" y="4" width="515" height="16" backcolor="#333333">
					<property name="net.sf.jasperreports.export.pdf.tag.table" value="start"/>
					<property name="net.sf.jasperreports.export.pdf.tag.tr" value="full"/>
				</reportElement>
				<staticText>
					<reportElement style="PageHeader" x="30" y="0" width="240" height="16">
						<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
						<property name="net.sf.jasperreports.export.pdf.tag.colspan" value="2"/>
					</reportElement>
					<textElement/>
					<text><![CDATA[Name]]></text>
				</staticText>
				<staticText>
					<reportElement style="PageHeader" x="280" y="0" width="80" height="16">
						<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
					</reportElement>
					<textElement/>
					<text><![CDATA[Phone]]></text>
				</staticText>
				<staticText>
					<reportElement style="PageHeader" x="370" y="0" width="145" height="16">
						<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
					</reportElement>
					<textElement/>
					<text><![CDATA[Address]]></text>
				</staticText>
			</frame>
		</band>
	</pageHeader>
	<detail>
		<band height="20" splitType="Prevent">
			<frame>
				<reportElement style="detail" x="0" y="0" width="515" height="20">
					<property name="net.sf.jasperreports.export.pdf.tag.tr" value="full"/>
				</reportElement>
				<box>
					<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#808080"/>
				</box>
				<textField isStretchWithOverflow="true">
					<reportElement x="0" y="4" width="20" height="16">
						<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
					</reportElement>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.String"><![CDATA[$V{CityGroup_COUNT} + "."]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true">
					<reportElement x="30" y="4" width="240" height="16">
						<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
					</reportElement>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true">
					<reportElement x="280" y="4" width="80" height="16">
						<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
					</reportElement>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{phone_office}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true">
					<reportElement x="370" y="4" width="145" height="16">
						<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
					</reportElement>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{billing_address_street}]]></textFieldExpression>
				</textField>
			</frame>
		</band>
	</detail>
	<pageFooter>
		<band height="40" splitType="Stretch">
			<line>
				<reportElement x="0" y="10" width="515" height="1">
					<property name="net.sf.jasperreports.export.pdf.tag.table" value="end"/>
				</reportElement>
			</line>
			<textField isStretchWithOverflow="true">
				<reportElement x="200" y="20" width="80" height="16"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" evaluationTime="Report">
				<reportElement x="280" y="20" width="75" height="16"/>
				<textElement textAlignment="Left"/>
				<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
</jasperReport>
