<?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="no_conceptos" language="groovy" pageWidth="400" pageHeight="59" orientation="Landscape" columnWidth="400" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
	<property name="ireport.zoom" value="1.3310000000000004"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="id_periodo_filtro" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="num_doc" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="id_novedad_vac" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[select
rownum,
tab.* ,
   ROW_NUMBER() OVER (
    --partition by tab.num_doc
    ORDER BY tab.codigo asc
   ) AS rn
from
(

    select
    tab2.descripcion,
    tab3.valor_liquidado,
    tab0.num_dias_vac,
    tab2.id_concep_nomina,
    tab2.codigo,
    case when tab2.id_concep_nomina = (select id_concep_vacac from no_param_concep where id_param_concep = 1) then to_char(tab0.num_dias_vac) || ' días' else ' ' end as dias

    from no_novedad_vac tab0
    left join no_concep_vac tab1 ON tab1.id_tipo_nov_vac = tab0.id_tipo_nov_vac
    left join no_concep_nomina tab2 ON tab2.id_concep_nomina = tab1.id_concep_nomina

    left join no_liquida_nomina tab3 ON
    tab3.id_concep_nomina = tab1.id_concep_nomina and tab3.id_periodo = tab0.id_periodo and tab3.num_doc = tab0.num_doc
    and tab3.fecha_desde = tab0.fecha_ini
    and tab3.fecha_hasta = tab0.fecha_fin

    where tab0.num_doc =  $P{num_doc}
    and tab0.id_periodo = $P{id_periodo_filtro} and tab3.id_liquida_nomina IS NOT NULL
    and tab0.id_novedad_vac = $P{id_novedad_vac}

)tab

order by
tab.codigo]]>
	</queryString>
	<field name="ROWNUM" class="java.math.BigDecimal"/>
	<field name="DESCRIPCION" class="java.lang.String"/>
	<field name="VALOR_LIQUIDADO" class="java.math.BigDecimal"/>
	<field name="NUM_DIAS_VAC" class="java.math.BigDecimal"/>
	<field name="ID_CONCEP_NOMINA" class="java.math.BigDecimal"/>
	<field name="CODIGO" class="java.lang.String"/>
	<field name="DIAS" class="java.lang.String"/>
	<field name="RN" class="java.math.BigDecimal"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<detail>
		<band height="20" splitType="Stretch">
			<textField>
				<reportElement x="31" y="0" width="269" height="20"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Serif"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESCRIPCION} + " " + $F{DIAS}]]></textFieldExpression>
			</textField>
			<textField pattern="$ #,##0">
				<reportElement x="300" y="0" width="100" height="20"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font fontName="Serif"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{VALOR_LIQUIDADO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="0" y="0" width="31" height="20"/>
				<textElement verticalAlignment="Middle">
					<font fontName="Serif"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{RN}+")"]]></textFieldExpression>
			</textField>
		</band>
	</detail>
</jasperReport>
