<?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_resumen" language="groovy" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.4641000000000015"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="id_distribucion" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[SELECT distri."ID_DISTRIBUCION",
    distri."ID_LOTE",
    distri."ID_TIPO_CON",
    distri."ID_PERIODO",
    distri."ID_ANHOS",
    distri."ID_MINERAL",
    distri."ID_BN",
    distri."ID_CB",
    distri."FECHA_CREA",
    distri."CONCEPTO",
    distri."PRODUCCION",
    distri."PRECIO",
    distri."DISTRIBUCION",
    distri."ESTADO",
    distri."FECHA_ANU",
    distri."MOTIVO_ANU",
    distri."PORCENTAJE",
    distri."VALOR",
    distri."DISTRIBUIDO",
    distri."EN_USO",
    contra.cod_tipo_con,
    contra.descripcion AS descripcion_con,
    per.cod_periodo,
    per.descripcion AS dscripcion_per,
    mine.cod_mineral,
    mine.descripcion AS descripcion_mine,
    bn.codigo        AS codigo_bn,
    bn.descripcion   AS descripcion_bn,
    cb.numero_cuenta,
    tc.descripcion AS descripcion_tc

  FROM re_distribucion distri

  JOIN re_t_contraprestacion contra
  ON contra.id_tipo_con = distri.id_tipo_con

  JOIN re_periodo per
  ON per.id_periodo = distri.id_periodo

  JOIN re_mineral mine
  ON mine.id_mineral = distri.id_mineral

  JOIN ts_bn bn
  ON bn.id_bn = distri.id_bn

  JOIN ts_cb cb
  ON cb.id_cb = distri.id_cb

  LEFT JOIN ts_tc tc
  ON tc.id = cb.id_tc

where
distri.id_distribucion = $P{id_distribucion}

  ORDER BY
  distri.ID_DISTRIBUCION]]>
	</queryString>
	<field name="ID_DISTRIBUCION" class="java.math.BigDecimal"/>
	<field name="ID_LOTE" class="java.lang.String"/>
	<field name="ID_TIPO_CON" class="java.math.BigDecimal"/>
	<field name="ID_PERIODO" class="java.math.BigDecimal"/>
	<field name="ID_ANHOS" class="java.math.BigDecimal"/>
	<field name="ID_MINERAL" class="java.math.BigDecimal"/>
	<field name="ID_BN" class="java.math.BigDecimal"/>
	<field name="ID_CB" class="java.math.BigDecimal"/>
	<field name="FECHA_CREA" class="java.sql.Timestamp"/>
	<field name="CONCEPTO" class="java.lang.String"/>
	<field name="PRODUCCION" class="java.lang.String"/>
	<field name="PRECIO" class="java.lang.String"/>
	<field name="DISTRIBUCION" class="java.lang.String"/>
	<field name="ESTADO" class="java.math.BigDecimal"/>
	<field name="FECHA_ANU" class="java.sql.Timestamp"/>
	<field name="MOTIVO_ANU" class="java.lang.String"/>
	<field name="PORCENTAJE" class="java.lang.String"/>
	<field name="VALOR" class="java.math.BigDecimal"/>
	<field name="DISTRIBUIDO" class="java.math.BigDecimal"/>
	<field name="EN_USO" class="java.math.BigDecimal"/>
	<field name="COD_TIPO_CON" class="java.math.BigDecimal"/>
	<field name="DESCRIPCION_CON" class="java.lang.String"/>
	<field name="COD_PERIODO" class="java.lang.String"/>
	<field name="DSCRIPCION_PER" class="java.lang.String"/>
	<field name="COD_MINERAL" class="java.lang.String"/>
	<field name="DESCRIPCION_MINE" class="java.lang.String"/>
	<field name="CODIGO_BN" class="java.lang.String"/>
	<field name="DESCRIPCION_BN" class="java.lang.String"/>
	<field name="NUMERO_CUENTA" class="java.lang.String"/>
	<field name="DESCRIPCION_TC" class="java.lang.String"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<pageHeader>
		<band height="166" splitType="Stretch">
			<staticText>
				<reportElement mode="Transparent" x="0" y="77" width="100" height="12" forecolor="#000000" backcolor="#88C2F9"/>
				<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[Mineral :]]></text>
			</staticText>
			<textField>
				<reportElement x="100" y="77" width="652" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{COD_MINERAL} + " - " + $F{DESCRIPCION_MINE}]]></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
Resumen de Distribución]]></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="637" y="40" width="35" height="12" forecolor="#000000" backcolor="#FFFFFF"/>
				<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[Fecha:]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="637" y="28" width="35" height="12" forecolor="#000000" backcolor="#FFFFFF"/>
				<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[No. GRD]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Transparent" x="0" y="89" width="100" height="12" forecolor="#000000" backcolor="#88C2F9"/>
				<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[Contraprestación :]]></text>
			</staticText>
			<textField>
				<reportElement x="100" y="89" width="652" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{COD_TIPO_CON} + " - " + $F{DESCRIPCION_CON}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="672" y="30" width="60" height="10"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{ID_DISTRIBUCION}]]></textFieldExpression>
			</textField>
			<textField pattern="dd/MM/yyyy">
				<reportElement x="672" y="40" width="60" height="10"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.sql.Timestamp"><![CDATA[$F{FECHA_CREA}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="0" y="101" width="100" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Periodo :]]></text>
			</staticText>
			<textField>
				<reportElement x="100" y="101" width="652" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{COD_PERIODO} + " " + $F{DSCRIPCION_PER} + " - " + $F{ID_ANHOS}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="0" y="113" width="100" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Cuenta Recaudadora :]]></text>
			</staticText>
			<textField>
				<reportElement x="100" y="113" width="305" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CODIGO_BN} + " - " + $F{DESCRIPCION_BN}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="405" y="113" width="100" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Cuenta :]]></text>
			</staticText>
			<textField>
				<reportElement x="505" y="113" width="247" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{NUMERO_CUENTA} + "   " + $F{DESCRIPCION_TC}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="0" y="125" width="100" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Total a Distribuir :]]></text>
			</staticText>
			<textField pattern="#,##0.00;(#,##0.00)">
				<reportElement x="100" y="125" width="100" height="12"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{VALOR}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" x="0" y="137" width="100" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Concepto :]]></text>
			</staticText>
			<textField isStretchWithOverflow="true">
				<reportElement x="100" y="137" width="652" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CONCEPTO}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement x="0" y="157" width="751" height="1"/>
				<graphicElement>
					<pen lineStyle="Dotted"/>
				</graphicElement>
			</line>
		</band>
	</pageHeader>
	<detail>
		<band height="26" splitType="Stretch">
			<subreport>
				<reportElement x="0" y="0" width="752" height="12"/>
				<subreportParameter name="id_distribucion">
					<subreportParameterExpression><![CDATA[$P{id_distribucion}]]></subreportParameterExpression>
				</subreportParameter>
				<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
				<subreportExpression class="java.lang.String"><![CDATA["repo:distribucion_resumen_tipobene.jasper"]]></subreportExpression>
			</subreport>
		</band>
		<band height="25">
			<subreport>
				<reportElement x="0" y="13" width="752" height="12"/>
				<subreportParameter name="id_distribucion">
					<subreportParameterExpression><![CDATA[$P{id_distribucion}]]></subreportParameterExpression>
				</subreportParameter>
				<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
				<subreportExpression class="java.lang.String"><![CDATA["repo:distribucion_resumen_ordengiro.jasper"]]></subreportExpression>
			</subreport>
			<line>
				<reportElement x="0" y="0" width="751" height="1"/>
				<graphicElement>
					<pen lineStyle="Dotted"/>
				</graphicElement>
			</line>
		</band>
		<band height="156">
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" x="1" y="36" width="60" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Preparado :]]></text>
			</staticText>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" x="1" y="82" width="60" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Aprobado :]]></text>
			</staticText>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" x="1" y="126" width="60" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Ordeno :]]></text>
			</staticText>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" x="61" y="36" width="200" height="12"/>
				<box>
					<pen lineStyle="Dotted"/>
					<topPen lineStyle="Dotted"/>
					<leftPen lineStyle="Dotted"/>
					<bottomPen lineWidth="0.75" lineStyle="Dotted"/>
					<rightPen lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[]]></text>
			</staticText>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" x="61" y="82" width="200" height="12"/>
				<box>
					<pen lineStyle="Dotted"/>
					<topPen lineStyle="Dotted"/>
					<leftPen lineStyle="Dotted"/>
					<bottomPen lineWidth="0.75" lineStyle="Dotted"/>
					<rightPen lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[]]></text>
			</staticText>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" x="61" y="126" width="200" height="12"/>
				<box>
					<pen lineStyle="Dotted"/>
					<topPen lineStyle="Dotted"/>
					<leftPen lineStyle="Dotted"/>
					<bottomPen lineWidth="0.75" lineStyle="Dotted"/>
					<rightPen lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[]]></text>
			</staticText>
		</band>
	</detail>
	<pageFooter>
		<band height="12" splitType="Stretch">
			<textField>
				<reportElement mode="Opaque" x="627" y="0" 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="717" y="0" width="34" 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>
			<staticText>
				<reportElement mode="Opaque" x="0" y="0" width="100" height="12" forecolor="#575757" backcolor="#FFFFFF"/>
				<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>
				<text><![CDATA[Fecha de Impresion:]]></text>
			</staticText>
			<textField pattern="dd-MM-yyyy   hh:mm aaa">
				<reportElement mode="Opaque" x="100" y="0" width="150" 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.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
	<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>
