<?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="distribucion_list" language="groovy" pageWidth="792" pageHeight="612" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.7715610000000022"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="whereMinero" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<parameter name="whereBanco" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<parameter name="whereAplicaRegalias" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<parameter name="whereConfAch" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[select tab0.* from (

    SELECT

    tab0.id_reg_ach_distri as id_reg_ach_distri, tab0.id_reg_ach as id_reg_ach, tab0.id_bn as id_bn,
    tab0.codigo_ach as codigo_ach, tab0.num_cuenta as num_cuenta,
    tab0.tipo_cuenta as tipo_cuenta, CASE WHEN tab0.tipo_cuenta = 7 THEN 'Cuenta Corriente' ELSE 'Cuenta de Ahorros' end as NOM_tipo_cuenta,
    tab0.nombre_cuenta as nombre_cuenta, tab0.doc_num as doc_num, tab0.id_tipo_identificacion as id_tipo_identificacion,
    tab0.conf_ach as conf_ach, tab0.adjunto as adjunto, tab0.secuencia as secuencia, tab0.id_tercero as id_tercero,
    tab0.observaciones as observaciones, tab1.codigo||' - '||tab1.descripcion as completo_bn, tab1.codigo as codigo_bn,
    tab1.descripcion as descripcion_bn, tab2.num_doc as num_doc, tab2.razon_soc as razon_soc,
    tab2.num_doc||' - '||tab2.razon_soc as completo_tercero, tab3.descripcion as descripcion,
    tab3.abreviacion as abreviacion, tab4.aplica_regalias as aplica_regalias,
    tab2.id_mae_ter

    FROM TS_REG_ACH_DISTRI tab0  JOIN TS_BN tab1 ON tab0.id_bn = tab1.id_bn

    JOIN TIPO_DOCUMENTO tab3 ON tab0.id_tipo_identificacion = tab3.id_tipo_doc
    LEFT JOIN INTERCEROS tab2 ON tab0.id_tercero = tab2.id_mae_ter
    JOIN TS_REG_ACH tab4 ON tab0.id_reg_ach = tab4.id_reg_ach

)tab0

where
1 = 1
$P!{whereMinero} $P!{whereBanco}
$P!{whereAplicaRegalias} $P!{whereConfAch}

ORDER BY
tab0.num_doc,
tab0.id_reg_ach_distri]]>
	</queryString>
	<field name="ID_REG_ACH_DISTRI" class="java.math.BigDecimal"/>
	<field name="ID_REG_ACH" class="java.math.BigDecimal"/>
	<field name="ID_BN" class="java.math.BigDecimal"/>
	<field name="CODIGO_ACH" class="java.lang.String"/>
	<field name="NUM_CUENTA" class="java.lang.String"/>
	<field name="TIPO_CUENTA" class="java.lang.String"/>
	<field name="NOM_TIPO_CUENTA" class="java.lang.String"/>
	<field name="NOMBRE_CUENTA" class="java.lang.String"/>
	<field name="DOC_NUM" class="java.lang.String"/>
	<field name="ID_TIPO_IDENTIFICACION" class="java.math.BigDecimal"/>
	<field name="CONF_ACH" class="java.lang.String"/>
	<field name="ADJUNTO" class="java.lang.String"/>
	<field name="SECUENCIA" class="java.math.BigDecimal"/>
	<field name="ID_TERCERO" class="java.math.BigDecimal"/>
	<field name="OBSERVACIONES" class="java.lang.String"/>
	<field name="COMPLETO_BN" class="java.lang.String"/>
	<field name="CODIGO_BN" class="java.lang.String"/>
	<field name="DESCRIPCION_BN" class="java.lang.String"/>
	<field name="NUM_DOC" class="java.lang.String"/>
	<field name="RAZON_SOC" class="java.lang.String"/>
	<field name="COMPLETO_TERCERO" class="java.lang.String"/>
	<field name="DESCRIPCION" class="java.lang.String"/>
	<field name="ABREVIACION" class="java.lang.String"/>
	<field name="APLICA_REGALIAS" class="java.math.BigDecimal"/>
	<field name="ID_MAE_TER" class="java.math.BigDecimal"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="60" splitType="Stretch">
			<textField pattern="dd-MM-yyyy   hh:mm aaa">
				<reportElement mode="Opaque" x="632" y="38" width="120" 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="50"/>
				<textElement textAlignment="Center" verticalAlignment="Bottom" markup="none">
					<font fontName="SansSerif" size="12" isBold="true"/>
				</textElement>
				<text><![CDATA[Sistema de Distribución de Regalías
Informe de Beneficiarios Regalías]]></text>
			</staticText>
			<image>
				<reportElement x="0" y="10" width="140" height="40"/>
				<imageExpression class="java.lang.String"><![CDATA["repo:LogoEmpresa003.jpg"]]></imageExpression>
			</image>
			<staticText>
				<reportElement mode="Opaque" x="632" y="26" width="121" 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>
		</band>
	</title>
	<pageHeader>
		<band height="20" splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="12" splitType="Stretch">
			<staticText>
				<reportElement mode="Opaque" x="0" y="0" width="70" height="12" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<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[Nit / Cc]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="70" y="0" width="201" height="12" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<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[Nombre Beneficiario]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="271" y="0" width="100" height="12" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<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[Tipo Cuenta]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="451" y="0" width="180" height="12" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<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[Banco]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="371" y="0" width="80" height="12" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<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[No. Cuenta]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="631" y="0" width="60" height="12" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<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[Confirmada]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="691" y="0" width="60" height="12" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<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[Autorizada]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="10" splitType="Stretch">
			<textField>
				<reportElement x="0" y="0" width="70" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{NUM_DOC}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="70" y="0" width="201" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{RAZON_SOC}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="271" y="0" width="100" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{NOM_TIPO_CUENTA}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="371" y="0" width="80" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{NUM_CUENTA}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="451" y="0" width="180" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{COMPLETO_BN}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="631" y="0" width="60" height="10"/>
				<box>
					<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[( $F{CONF_ACH} == '1'
    ? "Si"
    : "No"
)]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="691" y="0" width="60" height="10"/>
				<box>
					<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[( $F{APLICA_REGALIAS} == 1
    ? "Si"
    : "No"
)]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band height="24" splitType="Stretch">
			<textField>
				<reportElement mode="Opaque" x="299" 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>
			<textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
				<reportElement mode="Opaque" x="389" 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>
			<staticText>
				<reportElement mode="Opaque" x="299" y="0" width="150" height="12" forecolor="#575757"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="6"/>
				</textElement>
				<text><![CDATA[Websafi - Regalias]]></text>
			</staticText>
		</band>
	</pageFooter>
	<summary>
		<band height="25" splitType="Stretch"/>
	</summary>
	<noData>
		<band height="20">
			<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>
