<?xml version="1.0" encoding="UTF-8"  ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
		 name="INDIVIDUAL_RESUMO_FATURA"
		 columnCount="1"
		 printOrder="Vertical"
		 orientation="Portrait"
		 pageWidth="595"
		 pageHeight="842"
		 columnWidth="535"
		 columnSpacing="0"
		 leftMargin="30"
		 rightMargin="30"
		 topMargin="20"
		 bottomMargin="20"
		 whenNoDataType="NoPages"
		 isTitleNewPage="false"
		 isSummaryNewPage="false">
	<property name="ireport.scriptlethandling" value="0" />
	<property name="ireport.encoding" value="UTF-8" />
	<import value="java.util.*" />
	<import value="net.sf.jasperreports.engine.*" />
	<import value="net.sf.jasperreports.engine.data.*" />

	<parameter name="LOGO" isForPrompting="false" class="java.lang.String"/>
	<parameter name="NOME_EMPRESA" isForPrompting="true" class="java.lang.String"/>
	<parameter name="CNPJ_NOME" isForPrompting="true" class="java.lang.String"/>
	<parameter name="INSCRICAO_ESTADUAL_NOME" isForPrompting="true" class="java.lang.String"/>
	<parameter name="DATA_INICIAL" isForPrompting="false" class="java.util.Date"/>
	<parameter name="DATA_FINAL" isForPrompting="false" class="java.util.Date"/>
	<parameter name="FECHO" isForPrompting="false" class="java.lang.String"/>
	<parameter name="LOGO_RELATORIO" isForPrompting="false" class="net.sf.jasperreports.engine.JRImageRenderer"/>
	<parameter name="SUBREPORT_DIR_IND" isForPrompting="true" class="java.lang.String"/>
	<queryString><![CDATA[SELECT
    c.cnpj, p.nome, ct.numero, ci.descricao, pes.nome as NOME_REMET, pess.nome AS NOME_DEST,
    ct.data_emissao, ct.vr_receber
FROM
    grupo_fatura_cte g
INNER JOIN
    fatura_cte f ON (f.id_grupo_fatura_cte = g.id_grupo_fatura_cte)
INNER JOIN
    pessoa p ON (p.id_pessoa = f.id_pessoa)
INNER JOIN
    complemento c ON (c.id_complemento = p.id_complemento)
INNER JOIN
    endereco e ON (e.id_endereco = p.id_endereco)
INNER JOIN
    cidade ci ON (ci.id_cidade = e.id_cidade)
INNER JOIN
    cte ct ON (ct.id_fatura_cte = f.id_fatura_cte)
INNER JOIN
    remetente_destinatario r ON (r.id_remetente_destinatario = ct.id_remetente_destinatario)
INNER JOIN
    unidade_fat_transporte u ON (u.id_unidade_fat_transporte = r.id_unidade_fat_transporte_remet)
INNER JOIN
    pessoa_transporte pe ON (pe.id_pessoa_transporte = u.id_pessoa_transporte)
INNER JOIN
    pessoa pes ON (pes.id_pessoa = pe.id_pessoa)
INNER JOIN
    unidade_fat_transporte un ON (un.id_unidade_fat_transporte = r.id_unidade_fat_transporte_dest)
INNER JOIN
    pessoa_transporte pt ON (pt.id_pessoa_transporte = un.id_pessoa_transporte)
INNER JOIN
    pessoa pess ON (pess.id_pessoa = pt.id_pessoa)
WHERE
    g.data_emissao BETWEEN $P{DATA_INICIAL} AND $P{DATA_FINAL}]]></queryString>

	<field name="dataInicial" class="java.util.Date">
		<fieldDescription><![CDATA[dataInicial]]></fieldDescription>
	</field>
	<field name="dataFinal" class="java.util.Date">
		<fieldDescription><![CDATA[dataFinal]]></fieldDescription>
	</field>
	<field name="faturaCte" class="java.util.List">
		<fieldDescription><![CDATA[faturaCte]]></fieldDescription>
	</field>

	<variable name="dataRel" class="java.util.Date" resetType="Page" calculation="Nothing">
		<initialValueExpression><![CDATA[new java.util.Date()]]></initialValueExpression>
	</variable>
	<variable name="SUM_vrReceber_1" class="java.lang.Double" resetType="Report" calculation="Sum">
	</variable>
		<background>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</background>
		<title>
			<band height="53"  isSplitAllowed="true" >
				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="155"
						y="9"
						width="279"
						height="17"
						key="textField-13"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement textAlignment="Center" verticalAlignment="Top">
						<font pdfFontName="Helvetica-Bold" size="10" isBold="true"/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$P{NOME_EMPRESA}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement
						x="434"
						y="16"
						width="35"
						height="14"
						key="staticText-15"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font pdfFontName="Helvetica-Bold" size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[Data :]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="434"
						y="32"
						width="35"
						height="14"
						key="staticText-16"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font pdfFontName="Helvetica-Bold" size="10" isBold="true"/>
					</textElement>
				<text><![CDATA[Hora :]]></text>
				</staticText>
				<textField isStretchWithOverflow="false" pattern="dd/MM/yyyy" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="468"
						y="16"
						width="67"
						height="14"
						key="textField-14"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement verticalAlignment="Middle">
						<font size="10"/>
					</textElement>
				<textFieldExpression   class="java.util.Date"><![CDATA[$V{dataRel}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" pattern="HH.mm.ss" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="468"
						y="32"
						width="67"
						height="14"
						key="textField-15"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement verticalAlignment="Middle">
						<font size="10"/>
					</textElement>
				<textFieldExpression   class="java.util.Date"><![CDATA[$V{dataRel}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement
						x="159"
						y="33"
						width="27"
						height="12"
						key="staticText-17"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font pdfFontName="Helvetica-BoldOblique" size="8" isBold="true" isItalic="true"/>
					</textElement>
				<text><![CDATA[CNPJ :]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="268"
						y="33"
						width="77"
						height="12"
						key="staticText-18"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement>
						<font pdfFontName="Helvetica-BoldOblique" size="8" isBold="true" isItalic="true"/>
					</textElement>
				<text><![CDATA[Inscrição Estadual :]]></text>
				</staticText>
				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="187"
						y="33"
						width="80"
						height="12"
						key="textField-16"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement verticalAlignment="Middle">
						<font size="8"/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$P{CNPJ_NOME}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="346"
						y="33"
						width="85"
						height="12"
						key="textField-17"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement verticalAlignment="Middle">
						<font size="8"/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$P{INSCRICAO_ESTADUAL_NOME}]]></textFieldExpression>
				</textField>
				<image  onErrorType="Blank" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="0"
						y="-1"
						width="154"
						height="52"
						key="image-1"/>
					<box></box>
					<graphicElement stretchType="NoStretch"/>
					<imageExpression class="net.sf.jasperreports.engine.JRRenderable"><![CDATA[$P{LOGO_RELATORIO}]]></imageExpression>
				</image>
			</band>
		</title>
		<pageHeader>
			<band height="25"  isSplitAllowed="true" >
				<staticText>
					<reportElement
						x="0"
						y="0"
						width="535"
						height="12"
						key="staticText-5"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement textAlignment="Center" verticalAlignment="Top">
						<font pdfFontName="Helvetica-Bold" size="8" isBold="true"/>
					</textElement>
				<text><![CDATA[Listagem Resumo da Fatura]]></text>
				</staticText>
				<line direction="TopDown">
					<reportElement
						x="0"
						y="0"
						width="535"
						height="1"
						key="line-1"/>
					<graphicElement stretchType="NoStretch">
					<pen lineWidth="0.25" lineStyle="Solid"/>
</graphicElement>
				</line>
				<textField isStretchWithOverflow="false" pattern="dd/MM/yyyy" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="46"
						y="12"
						width="43"
						height="11"
						key="textField"/>
					<box></box>
					<textElement>
						<font size="8"/>
					</textElement>
				<textFieldExpression   class="java.util.Date"><![CDATA[$F{dataInicial}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" pattern="dd/MM/yyyy" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="97"
						y="12"
						width="46"
						height="11"
						key="textField"/>
					<box></box>
					<textElement>
						<font size="8"/>
					</textElement>
				<textFieldExpression   class="java.util.Date"><![CDATA[$F{dataFinal}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement
						x="11"
						y="12"
						width="35"
						height="11"
						key="staticText-25"/>
					<box></box>
					<textElement>
						<font pdfFontName="Helvetica" size="8" isBold="false"/>
					</textElement>
				<text><![CDATA[Período - ]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="89"
						y="12"
						width="6"
						height="11"
						key="staticText-26"/>
					<box></box>
					<textElement textAlignment="Center">
						<font pdfFontName="Helvetica" size="8" isBold="false"/>
					</textElement>
				<text><![CDATA[a]]></text>
				</staticText>
				<line direction="TopDown">
					<reportElement
						x="0"
						y="23"
						width="535"
						height="1"
						key="line-4"/>
					<graphicElement stretchType="NoStretch">
					<pen lineWidth="0.25" lineStyle="Solid"/>
</graphicElement>
				</line>
			</band>
		</pageHeader>
		<columnHeader>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</columnHeader>
		<detail>
			<band height="2"  isSplitAllowed="true" >
				<subreport  isUsingCache="true">
					<reportElement
						x="0"
						y="0"
						width="535"
						height="2"
						key="subreport-1"/>
					<subreportParameter  name="SUBREPORT_DIR_IND">
						<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR_IND}]]></subreportParameterExpression>
					</subreportParameter>
					<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{faturaCte})]]></dataSourceExpression>
					<returnValue subreportVariable="SUM_vrReceber_1" toVariable="SUM_vrReceber_1" calculation="Sum"/>
					<subreportExpression  class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR_IND} + "SUB_IND_RESUMO_FATURA_FATURA.jasper"]]></subreportExpression>
				</subreport>
			</band>
		</detail>
		<columnFooter>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</columnFooter>
		<pageFooter>
			<band height="15"  isSplitAllowed="true" >
				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="494"
						y="0"
						width="16"
						height="15"
						key="textField-8"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font pdfFontName="Helvetica-Bold" size="9" isBold="true"/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Report" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="518"
						y="0"
						width="15"
						height="15"
						key="textField-9"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font pdfFontName="Helvetica-Bold" size="9" isBold="true"/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement
						x="510"
						y="0"
						width="8"
						height="15"
						key="staticText-8"/>
					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font pdfFontName="Helvetica-Bold" isBold="true"/>
					</textElement>
				<text><![CDATA[/]]></text>
				</staticText>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="RemotePage"  hyperlinkTarget="Self" >
					<reportElement
						x="363"
						y="0"
						width="131"
						height="14"
						forecolor="#0099FF"
						key="textField-18"/>
					<box></box>
					<textElement textAlignment="Center">
						<font pdfFontName="Helvetica-Oblique" size="9" isItalic="true" isUnderline="true"/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA["www.contatosistemas.com"]]></textFieldExpression>
						<hyperlinkReferenceExpression><![CDATA["HTTP://WWW.CONTATOSISTEMAS.COM"]]></hyperlinkReferenceExpression>
				</textField>
			</band>
		</pageFooter>
		<summary>
			<band height="36"  isSplitAllowed="true" >
				<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="0"
						y="13"
						width="535"
						height="23"
						key="textField-12"
						isRemoveLineWhenBlank="true"/>
					<box></box>
					<textElement textAlignment="Center" markup="html">
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$P{FECHO}]]></textFieldExpression>
				</textField>
				<line direction="TopDown">
					<reportElement
						x="344"
						y="1"
						width="191"
						height="1"
						key="line-3"/>
					<graphicElement stretchType="NoStretch">
					<pen lineWidth="0.25" lineStyle="Solid"/>
</graphicElement>
				</line>
				<staticText>
					<reportElement
						x="350"
						y="2"
						width="94"
						height="11"
						key="staticText-28"/>
					<box></box>
					<textElement>
						<font pdfFontName="Helvetica-Bold" size="8" isBold="true"/>
					</textElement>
				<text><![CDATA[Totalizadores Gerais.....]]></text>
				</staticText>
				<textField isStretchWithOverflow="false" pattern="#,##0.00" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="449"
						y="2"
						width="61"
						height="11"
						key="textField"/>
					<box></box>
					<textElement textAlignment="Right">
						<font pdfFontName="Helvetica-Bold" size="8" isBold="true"/>
					</textElement>
				<textFieldExpression   class="java.lang.Double"><![CDATA[$V{SUM_vrReceber_1}]]></textFieldExpression>
				</textField>
			</band>
		</summary>
</jasperReport>
