<?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="qcad_tip_com_fec" language="groovy" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="id_cia" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="id_cen_op" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="id_vigencia" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA["1"]]></defaultValueExpression>
	</parameter>
	<parameter name="nom_periodo" class="java.lang.String">
		<defaultValueExpression><![CDATA["Enero"]]></defaultValueExpression>
	</parameter>
	<parameter name="nom_cen_op" class="java.lang.String">
		<defaultValueExpression><![CDATA["INGEOMINAS - AMAGA"]]></defaultValueExpression>
	</parameter>
	<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
		<defaultValueExpression><![CDATA["/home/acontreras/php-dev/iReports/"]]></defaultValueExpression>
	</parameter>
	<parameter name="di_ini" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="di_fin" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="id_periodo_contable" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="whereTipComp" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereCenOp" class="java.lang.String">
		<defaultValueExpression><![CDATA[' ']]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[SELECT
tab0.id_tipo_comprobante as id_tipo_comprobante,
to_char(tab0.fecha_cad, 'DD/MM/YYYY') as fecha_cad,
tab1.nom_tipo_comprobante
as nom_tipo_comprobante, tab1.nom_corto||' - '||tab1.nom_tipo_comprobante
as completo, tab2.tot_debito
as tot_debito, tab2.tot_credito
as tot_credito, tab2.tot_debito-tab2.tot_credito
as diferencia

FROM CN_TIP_COM_FECHA tab0

JOIN CN_TIPO_COMPROBANTE tab1
ON tab0.id_tipo_comprobante = tab1.id_tipo_comprobante
AND tab0.id_cia = tab1.id_cia

LEFT JOIN CN_TIPO_COMPROBANTE_TOT tab2
ON tab0.FECHA_CAD = tab2.FECHA_CAD
AND tab0.ID_TIPO_COMPROBANTE = tab2.ID_TIPO_COMPROBANTE
AND tab0.ID_CEN_OP = tab2.ID_CEN_OP
AND tab0.id_cia = tab2.id_cia

WHERE
tab0.id_cia = $P{id_cia}
AND tab0.fecha_cad BETWEEN to_date($P{di_ini}, 'DD/MM/YYYY') AND to_date($P{di_fin}, 'DD/MM/YYYY')
$P!{whereTipComp}
$P!{whereCenOp}]]>
	</queryString>
	<field name="ID_TIPO_COMPROBANTE" class="java.math.BigDecimal">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="FECHA_CAD" class="java.lang.String"/>
	<field name="NOM_TIPO_COMPROBANTE" class="java.lang.String"/>
	<field name="COMPLETO" class="java.lang.String"/>
	<field name="TOT_DEBITO" class="java.math.BigDecimal"/>
	<field name="TOT_CREDITO" class="java.math.BigDecimal"/>
	<field name="DIFERENCIA" class="java.math.BigDecimal"/>
	<variable name="sum_debito" class="java.math.BigDecimal" calculation="Sum">
		<variableExpression><![CDATA[$F{TOT_DEBITO}]]></variableExpression>
	</variable>
	<variable name="sum_credito" class="java.math.BigDecimal" calculation="Sum">
		<variableExpression><![CDATA[$F{TOT_CREDITO}]]></variableExpression>
	</variable>
	<variable name="tot_diferencia" class="java.math.BigDecimal" calculation="Sum">
		<variableExpression><![CDATA[$F{TOT_DEBITO} - $F{TOT_CREDITO}]]></variableExpression>
	</variable>
	<group name="Group 1">
		<groupExpression><![CDATA[]]></groupExpression>
	</group>
	<group name="Group 2">
		<groupExpression><![CDATA[]]></groupExpression>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="60" splitType="Stretch">
			<staticText>
				<reportElement mode="Opaque" x="601" y="10" width="151" height="12" forecolor="#000000" backcolor="#FFFFFF"/>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Fecha de Impresión:]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="601" y="34" width="150" height="12" forecolor="#000000" backcolor="#FFFFFF"/>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Centro de operación:]]></text>
			</staticText>
			<textField pattern="dd-MMM-yyyy   hh:mm aaa">
				<reportElement mode="Opaque" x="601" y="22" width="150" height="12" forecolor="#000000" backcolor="#FFFFFF"/>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="141" y="0" width="460" height="40"/>
				<textElement textAlignment="Center" verticalAlignment="Bottom" markup="none">
					<font fontName="SansSerif" size="12" isBold="true"/>
				</textElement>
				<text><![CDATA[Sistema de Contabilidad
Resumen de documentos por tipo de comprobante]]></text>
			</staticText>
			<textField>
				<reportElement x="141" y="40" width="460" height="20"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="12" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Periodo: "+$P{nom_periodo}+" de "+$P{id_vigencia}]]></textFieldExpression>
			</textField>
			<image>
				<reportElement x="0" y="10" width="140" height="40"/>
				<imageExpression class="java.lang.String"><![CDATA["repo:LogoEmpresa003.jpg"]]></imageExpression>
			</image>
			<textField pattern="dd-MMM-yyyy   hh:mm aaa">
				<reportElement mode="Opaque" x="602" y="46" width="150" height="12" forecolor="#000000" backcolor="#FFFFFF"/>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{nom_cen_op}]]></textFieldExpression>
			</textField>
		</band>
	</title>
	<pageHeader>
		<band height="25" splitType="Stretch"/>
	</pageHeader>
	<detail>
		<band height="51" splitType="Stretch">
			<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
				<reportElement mode="Transparent" x="371" y="12" width="88" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<box rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{FECHA_CAD}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="0" y="12" width="371" height="10"/>
				<box leftPadding="2" rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement>
					<font size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{COMPLETO}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00;(-#,##0.00)" isBlankWhenNull="true">
				<reportElement mode="Transparent" x="459" y="12" width="110" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<box rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{TOT_DEBITO}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00;(-#,##0.00)" isBlankWhenNull="true">
				<reportElement mode="Transparent" x="569" y="12" width="110" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<box rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{TOT_CREDITO}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="true">
				<reportElement mode="Transparent" x="679" y="12" width="73" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<box rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{DIFERENCIA}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement mode="Opaque" x="0" y="0" width="371" height="12" forecolor="#000000" backcolor="#64B0F7"/>
				<box leftPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Tipo de comprobante]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="371" y="0" width="88" height="12" forecolor="#000000" backcolor="#64B0F7"/>
				<box leftPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Fecha CAD]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="459" y="0" width="110" height="12" forecolor="#000000" backcolor="#64B0F7"/>
				<box leftPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Total Débito]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="569" y="0" width="110" height="12" forecolor="#000000" backcolor="#64B0F7"/>
				<box leftPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Total Crédito]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="679" y="0" width="73" height="12" forecolor="#000000" backcolor="#64B0F7"/>
				<box leftPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Diferencia]]></text>
			</staticText>
			<subreport>
				<reportElement x="0" y="29" width="751" height="16"/>
				<subreportParameter name="fecha_cad">
					<subreportParameterExpression><![CDATA[$F{FECHA_CAD}]]></subreportParameterExpression>
				</subreportParameter>
				<subreportParameter name="id_vigencia">
					<subreportParameterExpression><![CDATA[$P{id_vigencia}]]></subreportParameterExpression>
				</subreportParameter>
				<subreportParameter name="id_cia">
					<subreportParameterExpression><![CDATA[$P{id_cia}]]></subreportParameterExpression>
				</subreportParameter>
				<subreportParameter name="whereCenOp">
					<subreportParameterExpression><![CDATA[$P{whereCenOp}]]></subreportParameterExpression>
				</subreportParameter>
				<subreportParameter name="id_tipo_comprobante">
					<subreportParameterExpression><![CDATA[$F{ID_TIPO_COMPROBANTE}]]></subreportParameterExpression>
				</subreportParameter>
				<subreportParameter name="id_cen_op">
					<subreportParameterExpression><![CDATA[$P{id_cen_op}]]></subreportParameterExpression>
				</subreportParameter>
				<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
				<subreportExpression class="java.lang.String"><![CDATA["repo:res_doc_tip_comp_det"]]></subreportExpression>
			</subreport>
		</band>
	</detail>
	<pageFooter>
		<band height="25" splitType="Stretch">
			<textField>
				<reportElement mode="Opaque" x="297" y="12" width="89" height="12" forecolor="#575757" backcolor="#FFFFFF"/>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Página "+$V{PAGE_NUMBER}+" de "]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement mode="Opaque" x="297" y="0" width="150" height="12" forecolor="#575757"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="6"/>
				</textElement>
				<text><![CDATA[Websafi - Contabilidad]]></text>
			</staticText>
			<textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
				<reportElement mode="Opaque" x="387" y="12" width="60" height="12" forecolor="#575757" backcolor="#FFFFFF"/>
				<textElement verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
	<summary>
		<band height="13">
			<staticText>
				<reportElement mode="Opaque" x="0" y="3" width="459" height="10" forecolor="#000000" backcolor="#BCBABA"/>
				<box leftPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[TOTAL]]></text>
			</staticText>
			<textField pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="false">
				<reportElement mode="Opaque" x="459" y="3" width="110" height="10" forecolor="#000000" backcolor="#BCBABA"/>
				<box rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{sum_debito}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="false">
				<reportElement mode="Opaque" x="569" y="3" width="110" height="10" forecolor="#000000" backcolor="#BCBABA"/>
				<box rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{sum_credito}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="false">
				<reportElement mode="Opaque" x="679" y="3" width="73" height="10" forecolor="#000000" backcolor="#BCBABA"/>
				<box rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{tot_diferencia}]]></textFieldExpression>
			</textField>
		</band>
	</summary>
	<noData>
		<band height="21">
			<staticText>
				<reportElement x="0" y="0" width="752" height="20"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font isBold="true"/>
				</textElement>
				<text><![CDATA[No hay objetos a mostrar.]]></text>
			</staticText>
		</band>
	</noData>
</jasperReport>
