<?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="informe_titulares_por_titulo" language="groovy" pageWidth="1000" pageHeight="612" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="960" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.6105100000000023"/>
	<property name="ireport.x" value="454"/>
	<property name="ireport.y" value="0"/>
	<property name="ireport.jasperserver.reportUnit" value="/reports/canon/informe_titulares"/>
	<property name="ireport.jasperserver.url" value="http://soporte6.sofhouse.net:8090/jasperserver/services/repository"/>
	<parameter name="id_titulo" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[0]]></defaultValueExpression>
	</parameter>
	<parameter name="whereModalidad" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereNormaCanon" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereFechaContrato" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereFechaRMN" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereTitulo" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<parameter name="whereNumDoc" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[select
tab0.*
from(

    SELECT DISTINCT
    tab0.id_titulo as id_titulo,
    tab0.cod_titulo as cod_titulo,
    tab0.fecha_contrato as fecha_contrato,
    tab0.fecha_inscripcion_rmn as fecha_inscripcion_rmn,
    tab0.estado,
    tab1.id_titulo_modalidad as id_titulo_modalidad,
    tab1.id_modalidad as id_modalidad,
    tab3.id_titulo_persona as id_titulo_persona,
    tab3.id_titular as id_titular,
    tab4.nombre as nombre,
    tab4.primer_apellido as primer_apellido,
    tab4.segundo_apellido as segundo_apellido,
    tab4.telefono as telefono,
    tab4.celular as celular,
    tab4.correo as correo,
    tab4.correo_alt as correo_alt,
    tab4.raz_soc as raz_soc,
    tab4.num_doc as num_doc,
    tab4.nombre||' '||tab4.primer_apellido||' '||tab4.segundo_apellido||' '||tab4.raz_soc as completo,
    tab5.nombre as nombre_rol,
    tab6.id_titulo_norma as id_titulo_norma,
    tab6.id_norma as id_norma
    FROM RMN_TITULO tab0
    JOIN RMN_TITULO_MODALIDAD tab1 ON tab0.id_titulo = tab1.id_titulo AND TAB1.ACTUAL = 1
    JOIN RMN_TITULO_PERSONA tab3 ON tab0.id_titulo = tab3.id_titulo AND TAB3.ACTUAL = 1
    JOIN RMN_PERSONA tab4 ON tab3.id_titular = tab4.id_persona
    LEFT JOIN RMN_TIPO_ROL_PERSONA tab5 ON tab3.id_rol_titulo = tab5.id_tipo_rol_persona
    JOIN CA_TITULO_NORMA tab6 ON tab0.id_titulo = tab6.id_titulo AND tab6.actual = '1'
)tab0


WHERE
1 = 1
$P!{whereTitulo}
$P!{whereNumDoc}
$P!{whereModalidad}
$P!{whereNormaCanon}
$P!{whereFechaContrato}
$P!{whereFechaRMN}

ORDER BY
case when LENGTH(TRIM(TRANSLATE(tab0.cod_titulo, '0123456789',' '))) is null then 0 else 1 end,
tab0.cod_titulo,
tab0.num_doc]]>
	</queryString>
	<field name="ID_TITULO" class="java.math.BigDecimal"/>
	<field name="COD_TITULO" class="java.lang.String"/>
	<field name="FECHA_CONTRATO" class="java.sql.Timestamp"/>
	<field name="FECHA_INSCRIPCION_RMN" class="java.sql.Timestamp"/>
	<field name="ESTADO" class="java.math.BigDecimal"/>
	<field name="ID_TITULO_MODALIDAD" class="java.math.BigDecimal"/>
	<field name="ID_MODALIDAD" class="java.math.BigDecimal"/>
	<field name="ID_TITULO_PERSONA" class="java.math.BigDecimal"/>
	<field name="ID_TITULAR" class="java.math.BigDecimal"/>
	<field name="NOMBRE" class="java.lang.String"/>
	<field name="PRIMER_APELLIDO" class="java.lang.String"/>
	<field name="SEGUNDO_APELLIDO" class="java.lang.String"/>
	<field name="TELEFONO" class="java.lang.String"/>
	<field name="CELULAR" class="java.lang.String"/>
	<field name="CORREO" class="java.lang.String"/>
	<field name="CORREO_ALT" class="java.lang.String"/>
	<field name="RAZ_SOC" class="java.lang.String"/>
	<field name="NUM_DOC" class="java.lang.String"/>
	<field name="COMPLETO" class="java.lang.String"/>
	<field name="NOMBRE_ROL" class="java.lang.String"/>
	<field name="ID_TITULO_NORMA" class="java.math.BigDecimal"/>
	<field name="ID_NORMA" class="java.math.BigDecimal"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="60" splitType="Stretch">
			<staticText>
				<reportElement x="180" y="0" width="602" height="60"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="16" isBold="true"/>
				</textElement>
				<text><![CDATA[Sistema General de Canon Superficiario
Informe de Titulares por Título]]></text>
			</staticText>
			<image>
				<reportElement x="0" y="10" width="140" height="40"/>
				<imageExpression class="java.lang.String"><![CDATA["repo:logo_entidad_2.png"]]></imageExpression>
			</image>
			<staticText>
				<reportElement mode="Opaque" x="782" y="26" width="178" 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>
			<textField pattern="dd MMMMM yyyy hh:mm aaa">
				<reportElement x="782" y="38" width="178" height="12"/>
				<box rightPadding="3"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
		</band>
	</title>
	<pageHeader>
		<band height="20" splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="12">
			<staticText>
				<reportElement mode="Opaque" x="0" y="0" width="80" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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[Cod. Título]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="80" y="0" width="100" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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[Fecha Inscripción]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="180" y="0" width="60" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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[Estado]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="320" y="0" width="196" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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 / Razon Social]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="516" y="0" width="81" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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[Telefono]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="597" y="0" width="77" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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[Celular]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="674" y="0" width="108" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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[E - Mail]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="240" y="0" width="80" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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. Documento]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="782" y="0" width="108" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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[E - Mail Alternativo]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="890" y="0" width="70" height="12" forecolor="#000000" backcolor="#5C999C"/>
				<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[Rol]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="10" splitType="Stretch">
			<textField isBlankWhenNull="true">
				<reportElement x="674" y="0" width="108" 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{CORREO}]]></textFieldExpression>
			</textField>
			<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
				<reportElement x="516" y="0" width="81" 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{TELEFONO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="320" y="0" width="196" 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}]]></textFieldExpression>
			</textField>
			<textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
				<reportElement x="597" y="0" width="77" 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{CELULAR}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="782" y="0" width="108" 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{CORREO_ALT}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="240" 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_DOC}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="890" y="0" width="70" 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{NOMBRE_ROL}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="0" y="0" width="80" height="10"/>
				<box rightPadding="0">
					<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{COD_TITULO}]]></textFieldExpression>
			</textField>
			<textField pattern="dd/MM/yyyy">
				<reportElement x="80" y="0" width="100" height="10"/>
				<box rightPadding="0">
					<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.util.Date"><![CDATA[$F{FECHA_INSCRIPCION_RMN}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="180" y="0" width="60" height="10"/>
				<box rightPadding="0">
					<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{ESTADO} == 1
    ? "Activo"
    : "Inactivo"
)]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="25" splitType="Stretch">
			<textField>
				<reportElement mode="Opaque" x="397" 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="487" y="12" width="60" height="12" forecolor="#575757" backcolor="#FFFFFF"/>
				<box leftPadding="2"/>
				<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="397" y="0" width="150" height="12" forecolor="#575757"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="6"/>
				</textElement>
				<text><![CDATA[Websafi - Canon Superficiario]]></text>
			</staticText>
		</band>
	</pageFooter>
	<noData>
		<band height="20">
			<staticText>
				<reportElement x="0" y="0" width="960" height="20"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font isBold="true"/>
				</textElement>
				<text><![CDATA[No hay objetos a mostrar.]]></text>
			</staticText>
		</band>
	</noData>
</jasperReport>
