<?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="inf_provisiones_res" language="groovy" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.610510000000002"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="whereClasePlanta" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="id_periodo_filtro" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="whereFuncionarioTipoDoc" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereFuncionarioNumDoc" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="comando" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="whereAgrupConcepto" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[select
tab0.agrupacion,
count(tab0.num_doc) as cant,
tab0.codigo as codigo,
tab0.descripcion as descripcion,
sum(tab0.valor_liquidado) as valor_liquidado,
tab0.id_clase_planta,
tab0.codigo_cla,
tab0.descripcion_cla,
tab0.periodo as periodo,
tab0.id_agrup_concepto as id_agrup_concepto

from (

SELECT

agrup.CODIGO || ' - ' || agrup.DESCRIPCION as agrupacion,
tab0.id_agrup_concepto,
tab0.id_liquida_provision as id_liquida_provision, tab0.id_tipo_doc as id_tipo_doc, tab0.num_doc as num_doc,
tab0.id_concep_nomina as id_concep_nomina, tab0.id_periodo as id_periodo, tab0.id_clase_planta as id_clase_planta,
tab0.valor_liquidado as valor_liquidado, tab1.tipo_documento as tipo_documento, tab1.primer_nombre as primer_nombre,
tab1.segundo_nombre as segundo_nombre, tab1.primer_nombre||' '||tab1.segundo_nombre as nombre,
tab1.primer_apellido as primer_apellido, tab1.segundo_apellido as segundo_apellido,
tab1.nombre_completo as nombre_completo, tab1.nombre_apellido as nombre_apellido,
to_char(tab1.fecha_nace, 'YYYY-MM-DD') as fecha_nace, tab1.email as email, tab1.tel as telefono,
tab1.direccion as direccion, tab1.pais_nace as pais_nace, tab1.depto_nace as depto_nace, tab1.muni_nace as muni_nace,
tab1.genero as genero, tab1.estado_civil as estado_civil, tab1.tipo_sangre as tipo_sangre, tab2.codigo as codigo,
tab2.descripcion as descripcion, tab2.codigo||' - '||tab2.descripcion as completo,
tab2.id_tipo_concepto as id_tipo_concepto, tab2.abreviatura as abreviatura, tab2.operador as operador,
tab2.operadoropcional as operadoropcional, tab2.cod2 as cod2, tab2.cod3 as cod3,
tab2.id_concep_ajuste as id_concep_ajuste, tab2.id_concep_rein as id_concep_rein,
tab2.id_acreedor as id_acreedor, tab2.id_rubro as id_rubro, tab2.id_cpo as id_cpo,
tab2.estado as estado, tab2.aplica_descuento as aplica_descuento, tab2.id_clase_fondo as id_clase_fondo,
tab2.usa_dias_calen as usa_dias_calen, tab3.id_anhos as id_anhos, tab3.id_meses as id_meses,
to_char(tab3.fecha_ini, 'YYYY-MM-DD') as fecha_ini, to_char(tab3.fecha_fin, 'YYYY-MM-DD') as fecha_fin,
tab3.id_tipo_periodo as id_tipo_periodo, tab3.estado as estado_per, tab3.activo as activo,
to_char(tab3.fecha_cierre, 'YYYY-MM-DD') as fecha_cierre,
to_char(tab3.fecha_cierre_nov, 'YYYY-MM-DD') as fecha_cierre_nov,
tab3.periodo as periodo, tab4.descripcion as descripcion_mes, tab5.codigo as codigo_cla,
tab5.descripcion as descripcion_cla, tab5.codigo||' - '||tab5.descripcion as completo_cla

FROM NO_LIQUIDA_PROVISION tab0
JOIN NO_DATOS_FUNCIONARIO_V tab1 ON tab0.id_tipo_doc = tab1.id_tipo_doc AND tab0.num_doc = tab1.num_doc
JOIN NO_CONCEPTOS_V tab2 ON tab0.id_concep_nomina = tab2.id_concep_nomina
JOIN NO_PERIODO_V tab3 ON tab0.id_periodo = tab3.id_periodo
JOIN MESES tab4 ON tab3.id_meses = tab4.id_meses
JOIN NO_CLASE_PLANTA tab5 ON tab0.id_clase_planta = tab5.id_clase_planta

left join no_agrup_concepto agrup
on agrup.ID_AGRUP_CONCEPTO = tab0.ID_AGRUP_CONCEPTO

WHERE
tab0.id_liquida_provision != '-1'
AND tab0.id_periodo = $P{id_periodo_filtro}
$P!{whereFuncionarioNumDoc} $P!{whereFuncionarioTipoDoc}


)tab0

where
1 = 1
$P!{whereClasePlanta} $P!{whereAgrupConcepto}

group by
tab0.agrupacion,
tab0.codigo,
tab0.descripcion,
tab0.id_clase_planta,
tab0.codigo_cla,
tab0.descripcion_cla,
tab0.periodo,
tab0.id_agrup_concepto

ORDER BY
tab0.id_clase_planta,  tab0.codigo]]>
	</queryString>
	<field name="AGRUPACION" class="java.lang.String"/>
	<field name="CANT" class="java.math.BigDecimal"/>
	<field name="CODIGO" class="java.lang.String"/>
	<field name="DESCRIPCION" class="java.lang.String"/>
	<field name="VALOR_LIQUIDADO" class="java.math.BigDecimal"/>
	<field name="ID_CLASE_PLANTA" class="java.math.BigDecimal"/>
	<field name="CODIGO_CLA" class="java.lang.String"/>
	<field name="DESCRIPCION_CLA" class="java.lang.String"/>
	<field name="PERIODO" class="java.lang.String"/>
	<field name="ID_AGRUP_CONCEPTO" class="java.math.BigDecimal"/>
	<variable name="sum_valor_liq" class="java.math.BigDecimal" resetType="Group" resetGroup="claseplanta" calculation="Sum">
		<variableExpression><![CDATA[$F{VALOR_LIQUIDADO}]]></variableExpression>
	</variable>
	<variable name="total_valor_liq" class="java.math.BigDecimal" calculation="Sum">
		<variableExpression><![CDATA[$F{VALOR_LIQUIDADO}]]></variableExpression>
	</variable>
	<group name="claseplanta">
		<groupExpression><![CDATA[$F{ID_CLASE_PLANTA}]]></groupExpression>
		<groupHeader>
			<band height="32">
				<staticText>
					<reportElement mode="Opaque" x="0" y="20" 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[Codigo]]></text>
				</staticText>
				<staticText>
					<reportElement mode="Opaque" x="70" y="20" width="292" 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[Concepto]]></text>
				</staticText>
				<staticText>
					<reportElement mode="Opaque" x="452" y="20" width="120" 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[Valor]]></text>
				</staticText>
				<staticText>
					<reportElement mode="Opaque" x="362" y="20" width="90" 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[Cantidad]]></text>
				</staticText>
				<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[Clase Planta]]></text>
				</staticText>
				<textField>
					<reportElement x="70" y="0" width="502" height="12"/>
					<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="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$F{CODIGO_CLA} + " - " + $F{DESCRIPCION_CLA}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="24">
				<staticText>
					<reportElement mode="Opaque" x="0" y="0" width="452" height="12" forecolor="#000000" backcolor="#C9C9C9"/>
					<box>
						<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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					</textElement>
					<text><![CDATA[]]></text>
				</staticText>
				<textField pattern="#,##0.00;-#,##0.00">
					<reportElement mode="Opaque" x="452" y="0" width="120" height="12" forecolor="#000000" backcolor="#C9C9C9"/>
					<box leftPadding="0" 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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					</textElement>
					<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{sum_valor_liq}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="95" splitType="Stretch">
			<staticText>
				<reportElement x="140" y="0" width="312" height="60"/>
				<textElement textAlignment="Center" verticalAlignment="Bottom" markup="none">
					<font fontName="SansSerif" size="12" isBold="true"/>
				</textElement>
				<text><![CDATA[Sistema General de Nómina
OBLIGACIONES DE PRESTACIONES SOCIALES Y SALARIALES DE CORTO PLAZO]]></text>
			</staticText>
			<image>
				<reportElement x="0" y="20" width="140" height="40"/>
				<imageExpression class="java.lang.String"><![CDATA["repo:LogoEmpresa003.jpg"]]></imageExpression>
			</image>
			<staticText>
				<reportElement mode="Opaque" x="452" y="36" width="120" 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-MMM-yyyy   hh:mm aaa">
				<reportElement x="452" y="48" width="120" 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>
			<textField>
				<reportElement x="140" y="60" width="312" height="20"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="12" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Periodo: " + $F{PERIODO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="140" y="80" width="312" height="15"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="10" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Agrupación: " + $F{AGRUPACION}]]></textFieldExpression>
			</textField>
		</band>
	</title>
	<pageHeader>
		<band height="7" splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="8" splitType="Stretch"/>
	</columnHeader>
	<detail>
		<band height="10" splitType="Stretch">
			<textField>
				<reportElement x="0" y="0" width="70" 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="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CODIGO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="70" y="0" width="292" 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="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESCRIPCION}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00">
				<reportElement x="452" y="0" width="120" 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="7"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{VALOR_LIQUIDADO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="362" y="0" width="90" 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="7"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{CANT}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band height="8" splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="24" splitType="Stretch">
			<textField>
				<reportElement mode="Opaque" x="212" 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="302" 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="212" y="0" width="150" height="12" forecolor="#575757"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="6"/>
				</textElement>
				<text><![CDATA[Websafi - Nómina]]></text>
			</staticText>
		</band>
	</pageFooter>
	<summary>
		<band height="92" splitType="Stretch">
			<subreport>
				<reportElement stretchType="RelativeToBandHeight" x="169" y="30" width="250" height="62"/>
				<subreportParameter name="comando">
					<subreportParameterExpression><![CDATA[$P{comando}]]></subreportParameterExpression>
				</subreportParameter>
				<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
				<subreportExpression class="java.lang.String"><![CDATA["repo:firma"]]></subreportExpression>
			</subreport>
			<textField pattern="#,##0.00;-#,##0.00">
				<reportElement mode="Opaque" x="452" y="0" width="120" height="12" forecolor="#000000" backcolor="#BCBABA"/>
				<box leftPadding="0" 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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{total_valor_liq}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement mode="Opaque" x="0" y="0" width="452" height="12" 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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Total]]></text>
			</staticText>
		</band>
	</summary>
	<noData>
		<band height="20">
			<staticText>
				<reportElement x="0" y="0" width="572" height="20"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font isBold="true"/>
				</textElement>
				<text><![CDATA[No hay objetos a mostrar.]]></text>
			</staticText>
		</band>
	</noData>
</jasperReport>
