<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" 
	"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport name="MultiReport" pageWidth="565" pageHeight="842" columnWidth="545" 
	leftMargin="10" rightMargin="10" topMargin="30" bottomMargin="30">

	<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="12" 
		isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" 
		pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false" />
	<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="12" 
		isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" 
		pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false" />
	<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="12" 
		isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" 
		pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false" />
	<parameter name="customer_id" class="java.lang.Integer"></parameter>
	<parameter name="OrderHistory" class="net.sf.jasperreports.engine.JasperReport" />
	<parameter name="ReferralHistory" class="net.sf.jasperreports.engine.JasperReport" />

	<queryString>
		<![CDATA[SELECT first_name, last_name, city, state, email FROM 
			sample.CUSTOMER WHERE CUSTOMER_ID=$P{customer_id}]]>
	</queryString>
	<field name="first_name" class="java.lang.String"></field>
	<field name="last_name" class="java.lang.String"></field>
	<field name="city" class="java.lang.String"></field>
	<field name="state" class="java.lang.String"></field>
	<field name="email" class="java.lang.String"></field>

	<title>
		<band height="35">
			<textField isBlankWhenNull="true">
				<reportElement x="0" y="0" width="520" height="30" />
				<textElement textAlignment="Left">
					<font reportFont="Arial_Normal" size="22" />
				</textElement>
				<textFieldExpression class="java.lang.String">
					<![CDATA[$F{last_name} + ", " + $F{first_name} + " - Customer Report"]]>
				</textFieldExpression>
			</textField>
			<line>
				<reportElement x="0" y="30" width="520" height="1" />
				<graphicElement />
			</line>
		</band>
	</title>

	<pageHeader>
		<band></band>
	</pageHeader>
	<detail>
		<band height="30">
			<textField>
				<reportElement x="5" y="5" width="400" height="15" 
					isPrintWhenDetailOverflows="false" />
				<textElement>
					<font reportFont="Arial_Bold" />
				</textElement>
				<textFieldExpression class="java.lang.String">
					<![CDATA[$F{first_name} + " " + $F{last_name} + 
						" lives in " + $F{city} + ", " + $F{state} +"."]]>
				</textFieldExpression>
			</textField>
			<subreport>
				<reportElement positionType="Float" x="0" y="20" width="1" 
					height="1" isRemoveLineWhenBlank="true" backcolor="#99ccff" />
				<subreportParameter name="customer_id">
					<subreportParameterExpression>
						<![CDATA[$P{customer_id}]]>
					</subreportParameterExpression>
				</subreportParameter>
				<connectionExpression>
					<![CDATA[$P{REPORT_CONNECTION}]]>
				</connectionExpression>
				<subreportExpression class="net.sf.jasperreports.engine.JasperReport">
					<![CDATA[$P{OrderHistory}]]>
				</subreportExpression>
			</subreport>
			<subreport>
				<reportElement positionType="Float" x="0" y="22" width="1" height="1" 
					isRemoveLineWhenBlank="true" backcolor="#99ccff" />		
				<subreportParameter name="customer_id">
					<subreportParameterExpression>
						<![CDATA[$P{customer_id}]]>
					</subreportParameterExpression>
				</subreportParameter>
				<connectionExpression>
					<![CDATA[$P{REPORT_CONNECTION}]]>
				</connectionExpression>
				<subreportExpression class="net.sf.jasperreports.engine.JasperReport">
					<![CDATA[$P{ReferralHistory}]]>
				</subreportExpression>
			</subreport>
		</band>
	</detail>
	<pageFooter>
		<band height="40">
			<line>
				<reportElement x="0" y="10" width="515" height="1" />
				<graphicElement />
			</line>
			<textField>
				<reportElement x="200" y="20" width="80" height="15" />
				<textElement textAlignment="Right" />
				<textFieldExpression class="java.lang.String">
					<![CDATA["Page " + String.valueOf($V{PAGE_NUMBER})]]>
				</textFieldExpression>
			</textField>
			<textField evaluationTime="Report">
				<reportElement x="280" y="20" width="75" height="15" />
				<textElement />
				<textFieldExpression class="java.lang.String">
					<![CDATA[" of " + String.valueOf($V{PAGE_NUMBER})]]>
				</textFieldExpression>
			</textField>
		</band>
	</pageFooter>
</jasperReport>