<?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="charts" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true">
	<property name="ireport.callouts" value="##Mon Feb 01 12:41:10 CET 2010\ncallouts.3.pins=237,396;\ncallouts.3.text=This crosstab is placed in the summary to use all the records of the report. If the crosstab must be places somewhere else, a custom datasource or a proper data definition must be used. To edit the crosstab data right click the crosstab and select the Crosstab Data menu item. \ncallouts.2.text=A crosstab can be edited using the corsstab designer (see the &quot;Crosstab 1&quot; button on the bottom of the designer)\ncallouts.1.text=Use the Sample Database (HSQLDB test) datasource to run this report.\nTo run the database, select Help &gt; Samples &gt; Run Sample Database.\ncallouts.3.bounds=9,427,210,136\ncallouts.2.bounds=469,268,150,102\ncallouts.1.bounds=544,12,235,90"/>
	<property name="ireport.zoom" value="0.9090909090909091"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<style name="style_for_list" isDefault="false" mode="Opaque" backcolor="#F0ECC9">
		<conditionalStyle>
			<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 ==0]]></conditionExpression>
			<style isDefault="false" style="style_for_list" backcolor="#CBCB91"/>
		</conditionalStyle>
	</style>
	<style name="Crosstab Data Text" isDefault="false" hAlign="Center"/>
	<subDataset name="dataset1">
		<parameter name="Country" class="java.lang.String"/>
		<queryString>
			<![CDATA[select distinct shipcity from orders where shipcountry=$P{Country}]]>
		</queryString>
		<field name="SHIPCITY" class="java.lang.String">
			<fieldDescription><![CDATA[]]></fieldDescription>
		</field>
	</subDataset>
	<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
		<defaultValueExpression><![CDATA["C:\\JasperSoft\\SVN\\ireport\\trunk\\iReport\\ireport-samples\\release\\samples\\Subreports\\"]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[select * from  orders]]>
	</queryString>
	<field name="ORDERID" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="CUSTOMERID" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="EMPLOYEEID" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="ORDERDATE" class="java.sql.Timestamp">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="REQUIREDDATE" class="java.sql.Timestamp">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPPEDDATE" class="java.sql.Timestamp">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPVIA" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="FREIGHT" class="java.math.BigDecimal">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPNAME" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPADDRESS" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPCITY" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPREGION" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPPOSTALCODE" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="SHIPCOUNTRY" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<variable name="return_value_orders" class="java.lang.Integer" calculation="System"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="198" splitType="Stretch">
			<staticText>
				<reportElement x="0" y="32" width="555" height="166"/>
				<textElement textAlignment="Justified" verticalAlignment="Top">
					<font size="14"/>
				</textElement>
				<text><![CDATA[A crosstab is an element that allows to print a table with a variable number of columns and rows depending by the data used to fill it. A crosstab can be populated using the main dataset or a sub-dataset (this allows to print several crosstabs in the same report).
Rows and columns can be grouped by means of expressions, and totals and subtotals are displayed at the intersection of each row/column.
In the following sample the subreport displays cities in the rows grouped by country. In the columns there are months, grouped by year. The cells show the number of orders for each city and each period. The coloured cells show totals and subtotals of orders.]]></text>
			</staticText>
			<staticText>
				<reportElement x="0" y="1" width="555" height="31"/>
				<textElement textAlignment="Center" verticalAlignment="Top">
					<font size="20" isBold="false"/>
				</textElement>
				<text><![CDATA[Crosstabs]]></text>
			</staticText>
		</band>
	</title>
	<pageHeader>
		<band splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band splitType="Stretch"/>
	</columnHeader>
	<detail>
		<band splitType="Stretch"/>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="37" splitType="Stretch">
			<textField>
				<reportElement x="427" y="14" width="80" height="20"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.String"><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
			</textField>
			<textField evaluationTime="Report">
				<reportElement x="507" y="14" width="40" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement x="0" y="1" width="555" height="1"/>
			</line>
		</band>
	</pageFooter>
	<summary>
		<band height="309" splitType="Stretch">
			<crosstab ignoreWidth="false">
				<reportElement x="0" y="0" width="555" height="309"/>
				<rowGroup name="SHIPCOUNTRY" width="70" totalPosition="End">
					<bucket>
						<bucketExpression class="java.lang.String"><![CDATA[$F{SHIPCOUNTRY}]]></bucketExpression>
					</bucket>
					<crosstabRowHeader>
						<cellContents backcolor="#BF6073" mode="Opaque">
							<textField>
								<reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="28" forecolor="#FFFFFF"/>
								<textElement/>
								<textFieldExpression class="java.lang.String"><![CDATA[$V{SHIPCOUNTRY}]]></textFieldExpression>
							</textField>
						</cellContents>
					</crosstabRowHeader>
					<crosstabTotalRowHeader>
						<cellContents backcolor="#BF6073" mode="Opaque">
							<box>
								<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
							</box>
							<staticText>
								<reportElement x="0" y="0" width="140" height="25" forecolor="#FFFFFF"/>
								<textElement textAlignment="Center" verticalAlignment="Middle"/>
								<text><![CDATA[Total SHIPCOUNTRY]]></text>
							</staticText>
						</cellContents>
					</crosstabTotalRowHeader>
				</rowGroup>
				<rowGroup name="SHIPCITY" width="70" totalPosition="End">
					<bucket>
						<bucketExpression class="java.lang.String"><![CDATA[$F{SHIPCITY}]]></bucketExpression>
					</bucket>
					<crosstabRowHeader>
						<cellContents backcolor="#FFBFCC" mode="Opaque">
							<box>
								<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
							</box>
							<textField>
								<reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="14"/>
								<textElement/>
								<textFieldExpression class="java.lang.String"><![CDATA[$V{SHIPCITY}]]></textFieldExpression>
							</textField>
						</cellContents>
					</crosstabRowHeader>
					<crosstabTotalRowHeader>
						<cellContents backcolor="#FFE6EB" mode="Opaque">
							<box>
								<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
							</box>
							<staticText>
								<reportElement x="0" y="0" width="70" height="14"/>
								<textElement textAlignment="Center" verticalAlignment="Middle"/>
								<text><![CDATA[Total SHIPCITY]]></text>
							</staticText>
						</cellContents>
					</crosstabTotalRowHeader>
				</rowGroup>
				<columnGroup name="ORDERDATE" height="30" totalPosition="End">
					<bucket>
						<bucketExpression class="java.lang.String"><![CDATA[(new SimpleDateFormat("yyyy")).format($F{ORDERDATE})]]></bucketExpression>
					</bucket>
					<crosstabColumnHeader>
						<cellContents backcolor="#FFBFCC" mode="Opaque">
							<box>
								<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
							</box>
							<textField>
								<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="30"/>
								<textElement/>
								<textFieldExpression class="java.lang.String"><![CDATA[$V{ORDERDATE}]]></textFieldExpression>
							</textField>
						</cellContents>
					</crosstabColumnHeader>
					<crosstabTotalColumnHeader>
						<cellContents backcolor="#BF6073" mode="Opaque">
							<box>
								<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
							</box>
							<staticText>
								<reportElement x="0" y="0" width="50" height="60" forecolor="#FFFFFF"/>
								<textElement textAlignment="Center" verticalAlignment="Middle"/>
								<text><![CDATA[Total ORDERDATE]]></text>
							</staticText>
						</cellContents>
					</crosstabTotalColumnHeader>
				</columnGroup>
				<columnGroup name="ORDERDATE1" height="30" totalPosition="End">
					<bucket>
						<bucketExpression class="java.lang.String"><![CDATA[(new SimpleDateFormat("yyyy-MM")).format($F{ORDERDATE})]]></bucketExpression>
					</bucket>
					<crosstabColumnHeader>
						<cellContents backcolor="#FFBFCC" mode="Opaque">
							<box>
								<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
							</box>
							<textField>
								<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="30"/>
								<textElement/>
								<textFieldExpression class="java.lang.String"><![CDATA[$V{ORDERDATE1}]]></textFieldExpression>
							</textField>
						</cellContents>
					</crosstabColumnHeader>
					<crosstabTotalColumnHeader>
						<cellContents backcolor="#FFE6EB" mode="Opaque">
							<box>
								<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
							</box>
							<staticText>
								<reportElement x="0" y="0" width="50" height="30"/>
								<textElement textAlignment="Center" verticalAlignment="Middle"/>
								<text><![CDATA[Total ORDERDATE1]]></text>
							</staticText>
						</cellContents>
					</crosstabTotalColumnHeader>
				</columnGroup>
				<measure name="ORDERIDMeasure" class="java.lang.Integer" calculation="Count">
					<measureExpression><![CDATA[$F{ORDERID}]]></measureExpression>
				</measure>
				<crosstabCell width="50" height="14">
					<cellContents>
						<box>
							<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
						</box>
						<textField>
							<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="14"/>
							<textElement/>
							<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
						</textField>
					</cellContents>
				</crosstabCell>
				<crosstabCell height="25" rowTotalGroup="SHIPCOUNTRY">
					<cellContents backcolor="#BF6073" mode="Opaque">
						<box>
							<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
						</box>
						<textField>
							<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
							<textElement/>
							<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
						</textField>
					</cellContents>
				</crosstabCell>
				<crosstabCell width="50" height="14" columnTotalGroup="ORDERDATE">
					<cellContents backcolor="#BF6073" mode="Opaque">
						<box>
							<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
						</box>
						<textField>
							<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="14" forecolor="#FFFFFF"/>
							<textElement/>
							<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
						</textField>
					</cellContents>
				</crosstabCell>
				<crosstabCell rowTotalGroup="SHIPCOUNTRY" columnTotalGroup="ORDERDATE">
					<cellContents backcolor="#BF6073" mode="Opaque">
						<box>
							<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
						</box>
						<textField>
							<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
							<textElement/>
							<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
						</textField>
					</cellContents>
				</crosstabCell>
				<crosstabCell width="50" height="14" columnTotalGroup="ORDERDATE1">
					<cellContents backcolor="#FFE6EB" mode="Opaque">
						<box>
							<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
						</box>
						<textField>
							<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="14"/>
							<textElement/>
							<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
						</textField>
					</cellContents>
				</crosstabCell>
				<crosstabCell rowTotalGroup="SHIPCOUNTRY" columnTotalGroup="ORDERDATE1">
					<cellContents backcolor="#BF6073" mode="Opaque">
						<box>
							<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
						</box>
						<textField>
							<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
							<textElement/>
							<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
						</textField>
					</cellContents>
				</crosstabCell>
				<crosstabCell height="14" rowTotalGroup="SHIPCITY">
					<cellContents backcolor="#FFE6EB" mode="Opaque">
						<box>
							<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
						</box>
						<textField>
							<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="14"/>
							<textElement/>
							<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
						</textField>
					</cellContents>
				</crosstabCell>
				<crosstabCell height="14" rowTotalGroup="SHIPCITY" columnTotalGroup="ORDERDATE">
					<cellContents backcolor="#BF6073" mode="Opaque">
						<box>
							<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
						</box>
						<textField>
							<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="14" forecolor="#FFFFFF"/>
							<textElement/>
							<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
						</textField>
					</cellContents>
				</crosstabCell>
				<crosstabCell height="14" rowTotalGroup="SHIPCITY" columnTotalGroup="ORDERDATE1">
					<cellContents backcolor="#FFE6EB" mode="Opaque">
						<box>
							<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
						</box>
						<textField>
							<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="14"/>
							<textElement/>
							<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ORDERIDMeasure}]]></textFieldExpression>
						</textField>
					</cellContents>
				</crosstabCell>
			</crosstab>
		</band>
	</summary>
</jasperReport>
