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

<jasperReport name="ReferralHistory" 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>
	<queryString>
		<![CDATA[SELECT first_name, last_name, city, state, email FROM
			sample.CUSTOMER as a inner join sample.CUSTOMER_REFERRAL as b on
			(a.customer_id=b.referred_customer_id) where b.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="50">
			<line>
				<reportElement x="0" y="10" width="520" height="1" />
				<graphicElement />
			</line>
			<staticText>
				<reportElement x="0" y="12" width="345" height="30" />
				<textElement>
					<font reportFont="Arial_Normal" size="22" />
				</textElement>
				<text>
					<![CDATA[Customer Referral History]]>
				</text>
			</staticText>
		</band>
	</title>

	<pageHeader>
		<band></band>
	</pageHeader>
	<columnHeader>
		<band height="20">
			<staticText>
				<reportElement mode="Opaque" x="0" y="2" width="130"
					height="15" backcolor="#bbbbbb" />
				<textElement>
					<font reportFont="Arial_Bold" />
				</textElement>
				<text>
					<![CDATA[Name]]>
				</text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="130" y="2" width="130"
					height="15" backcolor="#bbbbbb" />
				<textElement>
					<font reportFont="Arial_Bold" />
				</textElement>
				<text>
					<![CDATA[Location]]>
				</text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="260" y="2" width="260"
					height="15" backcolor="#bbbbbb" />
				<textElement>
					<font reportFont="Arial_Bold" />
				</textElement>
				<text>
					<![CDATA[Email]]>
				</text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="20">
			<textField>
				<reportElement x="0" y="2" width="130" height="15" />
				<textElement textAlignment="Left" />
				<textFieldExpression class="java.lang.String">
					<![CDATA[$F{last_name} + ", " + $F{first_name}]]>
				</textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="130" y="2"
					width="130" height="15" />
				<textElement />
				<textFieldExpression class="java.lang.String">
					<![CDATA[$F{city} + ", " + $F{state}]]>
				</textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="260" y="2"
					width="260" height="15" />
				<textElement />
				<textFieldExpression class="java.lang.String">
					<![CDATA[$F{email}]]>
				</textFieldExpression>
			</textField>
			<line>
				<reportElement positionType="Float" x="0" y="19"
					width="520" height="1" forecolor="#808080" />
				<graphicElement />
			</line>
		</band>
	</detail>
	<columnFooter>
		<band></band>
	</columnFooter>
	<pageFooter>
		<band></band>
	</pageFooter>
	<summary>
		<band height="35">
			<textField isStretchWithOverflow="true">
				<reportElement x="175" y="10" width="165" height="15" />
				<textElement textAlignment="Center">
					<font reportFont="Arial_Italic" />
				</textElement>
				<textFieldExpression class="java.lang.String">
					<![CDATA["This customer has referred " +
					String.valueOf($V{REPORT_COUNT}) +
					"  customers."]]>
				</textFieldExpression>
			</textField>
		</band>
	</summary>
</jasperReport>