<?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="HorizontalReport" columnCount="3" printOrder="Horizontal" pageWidth="595" pageHeight="842" columnWidth="175" columnSpacing="5" leftMargin="30" rightMargin="30" topMargin="30" bottomMargin="30">
	<style name="Sans_Normal" isDefault="true" fontName="DejaVu Sans" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<style name="Sans_Bold" isDefault="false" fontName="DejaVu Sans" fontSize="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<style name="Sans_Italic" isDefault="false" fontName="DejaVu Sans" fontSize="8" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false"/>
	<style name="Serif_Normal" isDefault="false" fontName="DejaVu Serif" fontSize="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<style name="Serif_Bold" isDefault="false" fontName="DejaVu Serif" fontSize="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<parameter name="ReportTitle" class="java.lang.String"/>
	<parameter name="MaxOrderID" class="java.lang.Integer"/>
	<parameter name="SummaryImage" class="java.awt.Image"/>
	<queryString>
		<![CDATA[SELECT * FROM Orders WHERE OrderID <= $P{MaxOrderID} ORDER BY ShipCountry]]>
	</queryString>
	<field name="ShippedDate" class="java.sql.Timestamp"/>
	<field name="ShipCountry" class="java.lang.String"/>
	<field name="RequiredDate" class="java.sql.Timestamp"/>
	<field name="CustomerID" class="java.lang.String"/>
	<field name="OrderID" class="java.lang.Integer"/>
	<field name="ShipName" class="java.lang.String"/>
	<field name="ShipVia" class="java.lang.Integer"/>
	<field name="ShipPostalCode" class="java.lang.String"/>
	<field name="OrderDate" class="java.sql.Timestamp"/>
	<field name="ShipCity" class="java.lang.String"/>
	<field name="ShipAddress" class="java.lang.String"/>
	<field name="EmployeeID" class="java.lang.Integer"/>
	<field name="ShipRegion" class="java.lang.String"/>
	<field name="Freight" class="java.lang.Double"/>
	<variable name="FirstLetter" class="java.lang.String" resetType="None">
		<variableExpression><![CDATA[$F{ShipCountry}.substring(0, 1).toUpperCase()]]></variableExpression>
	</variable>
	<variable name="FreightSumFirstLetterGroup" class="java.lang.Double" resetType="Group" resetGroup="FirstLetterGroup" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="FreightSumCountryGroup" class="java.lang.Double" resetType="Group" resetGroup="CountryGroup" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="FreightSumColumn" class="java.lang.Double" resetType="Column" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="FreightSumPage" class="java.lang.Double" resetType="Page" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="FreightSumReport" class="java.lang.Double" calculation="Sum">
		<variableExpression><![CDATA[$F{Freight}]]></variableExpression>
	</variable>
	<variable name="DateHighestCountryGroup" class="java.sql.Timestamp" resetType="Group" resetGroup="CountryGroup" calculation="Highest">
		<variableExpression><![CDATA[$F{OrderDate}]]></variableExpression>
	</variable>
	<variable name="RegionCountCountryGroup" class="java.lang.Integer" resetType="Group" resetGroup="CountryGroup" calculation="Count">
		<variableExpression><![CDATA[$F{ShipRegion}]]></variableExpression>
	</variable>
	<group name="FirstLetterGroup" isStartNewColumn="true" isReprintHeaderOnEachPage="true" minHeightToStartNewPage="200">
		<groupExpression><![CDATA[$V{FirstLetter}]]></groupExpression>
		<groupHeader>
			<band height="25">
				<frame>
					<reportElement mode="Opaque" x="0" y="14" width="175" height="11" backcolor="#FFDDDD"/>
					<staticText>
						<reportElement style="Sans_Italic" x="0" y="0" width="130" height="11" forecolor="#FF0000"/>
						<textElement>
							<font isUnderline="true"/>
						</textElement>
						<text><![CDATA[Countries Starting With Letter :]]></text>
					</staticText>
					<textField>
						<reportElement style="Sans_Bold" x="130" y="0" width="45" height="11" forecolor="#FF0000"/>
						<textElement/>
						<textFieldExpression class="java.lang.String"><![CDATA[$V{FirstLetter}]]></textFieldExpression>
					</textField>
				</frame>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="15">
				<line>
					<reportElement x="0" y="0" width="175" height="1" forecolor="#FF0000"/>
				</line>
				<staticText>
					<reportElement style="Sans_Bold" x="0" y="1" width="45" height="11" forecolor="#FF0000"/>
					<textElement textAlignment="Right"/>
					<text><![CDATA[Count :]]></text>
				</staticText>
				<textField>
					<reportElement style="Sans_Bold" x="45" y="1" width="25" height="11" forecolor="#FF0000"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{FirstLetterGroup_COUNT}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Bold" x="70" y="1" width="50" height="11" forecolor="#FF0000"/>
					<textElement textAlignment="Right"/>
					<text><![CDATA[Total :]]></text>
				</staticText>
				<textField pattern="0.00">
					<reportElement style="Sans_Bold" x="120" y="1" width="55" height="11" forecolor="#FF0000"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{FreightSumFirstLetterGroup}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<group name="CountryGroup" isReprintHeaderOnEachPage="true">
		<groupExpression><![CDATA[$F{ShipCountry}]]></groupExpression>
		<groupHeader>
			<band height="30">
				<line>
					<reportElement x="0" y="24" width="175" height="1"/>
				</line>
				<textField>
					<reportElement style="Sans_Bold" x="10" y="12" width="90" height="11"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{ShipCountry}]]></textFieldExpression>
				</textField>
				<textField evaluationTime="Group" evaluationGroup="CountryGroup" pattern="EEE, MMM d, yyyy">
					<reportElement style="Sans_Bold" x="100" y="12" width="75" height="11"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.sql.Timestamp"><![CDATA[$V{DateHighestCountryGroup}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="15">
				<frame>
					<reportElement mode="Opaque" x="0" y="0" width="175" height="11" backcolor="#C0C0C0"/>
					<staticText>
						<reportElement style="Sans_Bold" x="0" y="0" width="45" height="11"/>
						<textElement textAlignment="Right"/>
						<text><![CDATA[Count :]]></text>
					</staticText>
					<textField>
						<reportElement style="Sans_Bold" x="45" y="0" width="25" height="11"/>
						<textElement textAlignment="Right"/>
						<textFieldExpression class="java.lang.Integer"><![CDATA[$V{CountryGroup_COUNT}]]></textFieldExpression>
					</textField>
					<staticText>
						<reportElement style="Sans_Bold" x="70" y="0" width="50" height="11"/>
						<textElement textAlignment="Right"/>
						<text><![CDATA[Total :]]></text>
					</staticText>
					<textField pattern="0.00">
						<reportElement style="Sans_Bold" x="120" y="0" width="55" height="11"/>
						<textElement textAlignment="Right"/>
						<textFieldExpression class="java.lang.Double"><![CDATA[$V{FreightSumCountryGroup}]]></textFieldExpression>
					</textField>
				</frame>
			</band>
		</groupFooter>
	</group>
	<title>
		<band height="100">
			<elementGroup>
				<line>
					<reportElement x="0" y="0" width="535" height="1"/>
				</line>
				<image scaleImage="Clip">
					<reportElement x="5" y="5" width="175" height="40"/>
					<imageExpression class="java.lang.String"><![CDATA["jasperreports.png"]]></imageExpression>
					<hyperlinkTooltipExpression><![CDATA["The JasperReports Logo"]]></hyperlinkTooltipExpression>
				</image>
			</elementGroup>
			<textField isBlankWhenNull="true">
				<reportElement style="Serif_Bold" x="180" y="5" width="355" height="35"/>
				<textElement textAlignment="Right">
					<font size="22"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{ReportTitle}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement style="Sans_Italic" x="180" y="40" width="355" height="15"/>
				<textElement textAlignment="Right">
					<font size="12"/>
				</textElement>
				<text><![CDATA[(c)2001-2009 by teodord]]></text>
			</staticText>
			<textField evaluationTime="Report">
				<reportElement x="235" y="55" width="100" height="40"/>
				<textElement textAlignment="Justified"/>
				<textFieldExpression class="java.lang.String"><![CDATA["There are " + String.valueOf($V{REPORT_COUNT}) + " orders on this report, with a total freight of " + new DecimalFormat("0.00").format($V{FreightSumReport}.doubleValue())]]></textFieldExpression>
			</textField>
		</band>
	</title>
	<pageHeader>
		<band height="45">
			<frame>
				<reportElement x="0" y="0" width="535" height="40"/>
				<box>
					<pen lineWidth="1.0"/>
				</box>
				<staticText>
					<reportElement x="0" y="0" width="535" height="25"/>
					<textElement textAlignment="Center">
						<font size="18"/>
					</textElement>
					<text><![CDATA[Northwind Order List]]></text>
				</staticText>
				<textField>
					<reportElement x="0" y="25" width="535" height="15"/>
					<textElement textAlignment="Center">
						<font size="10"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA["Max order ID is : " + String.valueOf($P{MaxOrderID})]]></textFieldExpression>
				</textField>
			</frame>
		</band>
	</pageHeader>
	<columnHeader>
		<band height="11">
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="0" y="0" width="175" height="11" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement/>
				<text><![CDATA[Orders]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="80">
			<frame>
				<reportElement x="0" y="0" width="175" height="75"/>
				<box>
					<pen lineWidth="0.5"/>
				</box>
				<staticText>
					<reportElement style="Sans_Bold" x="2" y="2" width="38" height="11"/>
					<textElement/>
					<text><![CDATA[Order]]></text>
				</staticText>
				<textField>
					<reportElement x="40" y="2" width="130" height="11">
						<printWhenExpression><![CDATA[new Boolean($F{OrderID}.intValue() % 10 != 0)]]></printWhenExpression>
					</reportElement>
					<textElement/>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$F{OrderID}]]></textFieldExpression>
				</textField>
				<textField>
					<reportElement style="Sans_Bold" x="40" y="2" width="130" height="11" forecolor="#FF0000">
						<printWhenExpression><![CDATA[new Boolean($F{OrderID}.intValue() % 10 == 0)]]></printWhenExpression>
					</reportElement>
					<textElement/>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$F{OrderID}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Bold" x="2" y="14" width="38" height="11"/>
					<textElement/>
					<text><![CDATA[Name]]></text>
				</staticText>
				<textField isStretchWithOverflow="true">
					<reportElement positionType="Float" x="40" y="14" width="130" height="11"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{ShipName}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Bold" x="2" y="26" width="38" height="11"/>
					<textElement/>
					<text><![CDATA[City]]></text>
				</staticText>
				<textField isStretchWithOverflow="true">
					<reportElement positionType="Float" x="40" y="26" width="130" height="11"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{ShipCity}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Bold" x="2" y="38" width="38" height="11"/>
					<textElement/>
					<text><![CDATA[Region]]></text>
				</staticText>
				<textField isBlankWhenNull="true">
					<reportElement x="40" y="38" width="130" height="11"/>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{ShipRegion}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Bold" x="2" y="50" width="38" height="11"/>
					<textElement/>
					<text><![CDATA[Date]]></text>
				</staticText>
				<textField pattern="dd/MM/yyyy">
					<reportElement x="40" y="50" width="130" height="11"/>
					<textElement/>
					<textFieldExpression class="java.sql.Timestamp"><![CDATA[$F{OrderDate}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Bold" x="2" y="62" width="38" height="11"/>
					<textElement/>
					<text><![CDATA[Freight]]></text>
				</staticText>
				<textField pattern="0.00">
					<reportElement x="40" y="62" width="130" height="11"/>
					<textElement/>
					<textFieldExpression class="java.lang.Double"><![CDATA[$F{Freight}]]></textFieldExpression>
				</textField>
			</frame>
		</band>
	</detail>
	<columnFooter>
		<band height="11">
			<frame>
				<reportElement mode="Opaque" x="0" y="0" width="175" height="11" backcolor="#333333"/>
				<staticText>
					<reportElement style="Sans_Bold" x="0" y="0" width="45" height="11" forecolor="#FFFFFF"/>
					<textElement textAlignment="Right"/>
					<text><![CDATA[Count :]]></text>
				</staticText>
				<textField>
					<reportElement style="Sans_Bold" x="45" y="0" width="25" height="11" forecolor="#FFFFFF"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement style="Sans_Bold" x="70" y="0" width="50" height="11" forecolor="#FFFFFF"/>
					<textElement textAlignment="Right"/>
					<text><![CDATA[Total :]]></text>
				</staticText>
				<textField pattern="0.00">
					<reportElement style="Sans_Bold" x="120" y="0" width="55" height="11" forecolor="#FFFFFF"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{FreightSumColumn}]]></textFieldExpression>
				</textField>
			</frame>
		</band>
	</columnFooter>
	<pageFooter>
		<band height="30">
			<frame>
				<reportElement x="0" y="5" width="535" height="25"/>
				<box>
					<pen lineWidth="1.0"/>
				</box>
				<staticText>
					<reportElement x="5" y="5" width="50" height="20"/>
					<textElement textAlignment="Right">
						<font size="14"/>
					</textElement>
					<text><![CDATA[Count :]]></text>
				</staticText>
				<textField>
					<reportElement x="55" y="5" width="45" height="20"/>
					<textElement textAlignment="Right">
						<font size="14"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_COUNT}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement x="410" y="5" width="50" height="20"/>
					<textElement textAlignment="Right">
						<font size="14"/>
					</textElement>
					<text><![CDATA[Total :]]></text>
				</staticText>
				<textField pattern="0.00">
					<reportElement x="460" y="5" width="70" height="20"/>
					<textElement textAlignment="Right">
						<font size="14"/>
					</textElement>
					<textFieldExpression class="java.lang.Double"><![CDATA[$V{FreightSumPage}]]></textFieldExpression>
				</textField>
				<textField>
					<reportElement x="190" y="5" width="75" height="20"/>
					<textElement textAlignment="Right">
						<font size="14"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement x="265" y="5" width="5" height="20"/>
					<textElement textAlignment="Center">
						<font size="14"/>
					</textElement>
					<text><![CDATA[/]]></text>
				</staticText>
				<textField evaluationTime="Report">
					<reportElement x="270" y="5" width="75" height="20"/>
					<textElement>
						<font size="14"/>
					</textElement>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
				</textField>
			</frame>
		</band>
	</pageFooter>
	<summary>
		<band height="65">
			<frame>
				<reportElement mode="Opaque" x="0" y="10" width="535" height="55" backcolor="#C0C0C0"/>
				<box>
					<pen lineWidth="1.0"/>
				</box>
				<image>
					<reportElement x="5" y="5" width="100" height="45"/>
					<imageExpression class="java.awt.Image"><![CDATA[$P{SummaryImage}]]></imageExpression>
				</image>
				<staticText>
					<reportElement x="180" y="5" width="200" height="45"/>
					<textElement textAlignment="Justified">
						<font size="12"/>
					</textElement>
					<text><![CDATA[That's All Folks! Hei_remind_me_to_put myself up for abduction. END!]]></text>
				</staticText>
			</frame>
		</band>
	</summary>
</jasperReport>
