<?xml version="1.0" encoding="UTF-8"?>
<jasperReport name="customer_by_country"
              pageWidth="595" pageHeight="842" columnWidth="515"
              leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50">

    <parameter name="country" class="java.lang.String">
        <defaultValueExpression><![CDATA["Germany"]]></defaultValueExpression>
    </parameter>

    <query language="SQL"><![CDATA[SELECT "CustomerID", "CompanyName", "ContactName", "City", "Country"
FROM "Customers"
WHERE "Country" = $P{country}
ORDER BY "CompanyName"]]></query>

    <field name="CustomerID" class="java.lang.String"/>
    <field name="CompanyName" class="java.lang.String"/>
    <field name="ContactName" class="java.lang.String"/>
    <field name="City" class="java.lang.String"/>
    <field name="Country" class="java.lang.String"/>

    <title height="55">
        <element kind="staticText" x="0" y="0" width="515" height="30" fontSize="16.0" bold="true" hTextAlign="Center" vTextAlign="Middle">
            <text><![CDATA[Customers by Country]]></text>
        </element>
        <element kind="textField" x="0" y="32" width="515" height="20" fontSize="11.0" italic="true" hTextAlign="Center">
            <expression><![CDATA["Country: " + $P{country}]]></expression>
        </element>
    </title>

    <columnHeader height="25">
        <element kind="staticText" x="0" y="0" width="80" height="25" mode="Opaque" backcolor="#E0E0E0" fontSize="9.0" bold="true" hTextAlign="Center" vTextAlign="Middle">
            <box><pen lineWidth="0.5"/></box>
            <text><![CDATA[Customer ID]]></text>
        </element>
        <element kind="staticText" x="80" y="0" width="170" height="25" mode="Opaque" backcolor="#E0E0E0" fontSize="9.0" bold="true" hTextAlign="Center" vTextAlign="Middle">
            <box><pen lineWidth="0.5"/></box>
            <text><![CDATA[Company Name]]></text>
        </element>
        <element kind="staticText" x="250" y="0" width="140" height="25" mode="Opaque" backcolor="#E0E0E0" fontSize="9.0" bold="true" hTextAlign="Center" vTextAlign="Middle">
            <box><pen lineWidth="0.5"/></box>
            <text><![CDATA[Contact Name]]></text>
        </element>
        <element kind="staticText" x="390" y="0" width="125" height="25" mode="Opaque" backcolor="#E0E0E0" fontSize="9.0" bold="true" hTextAlign="Center" vTextAlign="Middle">
            <box><pen lineWidth="0.5"/></box>
            <text><![CDATA[City]]></text>
        </element>
    </columnHeader>

    <detail>
        <band height="20">
            <element kind="textField" x="0" y="0" width="80" height="20" fontSize="8.0" hTextAlign="Center" vTextAlign="Middle">
                <box><pen lineWidth="0.25"/></box>
                <expression><![CDATA[$F{CustomerID}]]></expression>
            </element>
            <element kind="textField" x="80" y="0" width="170" height="20" fontSize="8.0" vTextAlign="Middle">
                <box leftPadding="4"><pen lineWidth="0.25"/></box>
                <expression><![CDATA[$F{CompanyName}]]></expression>
            </element>
            <element kind="textField" x="250" y="0" width="140" height="20" fontSize="8.0" vTextAlign="Middle">
                <box leftPadding="4"><pen lineWidth="0.25"/></box>
                <expression><![CDATA[$F{ContactName}]]></expression>
            </element>
            <element kind="textField" x="390" y="0" width="125" height="20" fontSize="8.0" vTextAlign="Middle">
                <box leftPadding="4"><pen lineWidth="0.25"/></box>
                <expression><![CDATA[$F{City}]]></expression>
            </element>
        </band>
    </detail>

    <summary height="30">
        <element kind="textField" x="0" y="10" width="515" height="20" fontSize="9.0" italic="true" hTextAlign="Right">
            <expression><![CDATA["Total customers: " + $V{REPORT_COUNT}]]></expression>
        </element>
    </summary>

</jasperReport>
