<?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="pr_legalizacion_sop_dig" language="groovy" pageWidth="800" pageHeight="792" whenNoDataType="NoDataSection" columnWidth="712" leftMargin="68" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<property name="ireport.jasperserver.reportUnit" value="/reports/presupuesto/pr_legalizacion_sop_dig"/>
	<property name="ireport.jasperserver.url" value="http://192.168.2.43:8090/jasperserver/services/repository"/>
	<parameter name="vigencia" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="id_rp" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[select

(SELECT case when abreviatura like '%SGC%' then 1 else 0 end as is_sgc FROM datos_compania) as is_sgc,

pag.nro_orden_pago,

tab0.*,

nvl((

    select initcap(tab.nombre) || ' ' || initcap(tab.apellido) as usuario from(

        select distinct
        tab.*,
        initcap(usu.nombre) as nombre,
        initcap(usu.apellido) as apellido
        from(

            select
            sop.id_rp_comis,
            sop.vigencia,
            sop.id_vigencia,
            sopdig.observaciones,
            sopdig.fecha_sys,
            sopdig.usuario,
            ROW_NUMBER() OVER (
              partition by sop.id_rp_comis
              ORDER BY sopdig.fecha_sys desc, sopdig.usuario desc
            ) AS rn
            from pr_legalizacion_sop_dig_nov sopdig
            join pr_legalizacion_soporte_dig sop
            on sopdig.id_legalizacion_soporte_dig = sop.id_legalizacion_soporte_dig

        )tab

        left join usuario usu
        on username = tab.usuario

    )tab

    where
    tab.id_rp_comis = tab0.id_rp_comis
    and tab.vigencia = tab0.vigencia
    and tab.id_vigencia = tab0.id_vigencia
    and tab.rn = 1

), (
    SELECT
    initcap(usu.nombre) || ' ' || initcap(usu.apellido) as usuario

    FROM pr_cierre_comision prcierr

    join usuario usu
    on usu.num_doc = prcierr.usuario

    where
    prcierr.id_tipo_nov_comis = 29
    and prcierr.id_rp_comis = tab0.id_rp_comis
    and prcierr.vigencia = tab0.vigencia
    and prcierr.id_vigencia = tab0.id_vigencia
) ) as usuario_reviso,
(
    SELECT
    initcap(usu.nombre) || ' ' || initcap(usu.apellido) as usuario

    FROM pr_cierre_comision prcierr

    join usuario usu
    on usu.num_doc = prcierr.usuario

    where
    prcierr.id_tipo_nov_comis = 29
    and prcierr.id_rp_comis = 229818
    and prcierr.vigencia = 2018
    and prcierr.id_vigencia = 1
) as usuario_cerro,

nvl(
(
    select
    --comobj.*
    sum(nvl(comobj.valor,0)) as v_aprobado

    from comisionados_objs comobj

    left join pr_rp_comis rp
    on rp.id_comision = comobj.id_comision
    and rp.vigencia = comobj.vigencia
    and rp.id_tercero = comobj.nitocc

    where
    rp.id = tab0.id_rp_comis
    and rp.vigencia = tab0.vigencia
    and rp.id_vigencia = tab0.id_vigencia
)
,0 ) as v_aprobado,

nvl(
  (select
  --rpcom.*
  sum(nvl(leg.v_bruto,0)) + sum(nvl(leg.v_iva,0)) as v_legalizado
  from (
        SELECT
        aut.*,
        ROW_NUMBER() OVER (
            partition by aut.id_rp, aut.vigencia, aut.id_obj_gasto
            ORDER BY aut.id_rp, aut.vigencia, aut.id_obj_gasto, aut.id
        ) AS rn
        from pr_rp_compromiso aut
    )rpcom

  join objetos_gasto obj
  on obj.id = rpcom.id_obj_gasto

  join pr_elementos_gasto ele
  on ele.id_objeto_gasto = obj.id

  join pr_legalizacion_comis leg
  on leg.id_rp_comis = rpcom.id_rp
  and leg.id_vigencia = rpcom.id_vigencia
  and leg.vigencia = rpcom.vigencia
  and case when leg.id_elementos_gasto = 82 then 32 else leg.id_elementos_gasto end = ele.id_elementos_gasto

  where
  rpcom.id_rp = tab0.id_rp_comis
  and rpcom.id_vigencia = tab0.id_vigencia
  and rpcom.vigencia = tab0.vigencia
  and rpcom.id_obj_gasto = obj.id
  and rpcom.rn = 1
), 0) as v_legalizado,

nvl(
(
select
/*
rpcom.*,
nvl(nov.cant,0) as cant,
nvl(nov7.cant7,0) as cant7,
nvl(hist.valor_hist,0) as valor_hist,
nvl(nov7.debito,0) as debito,
nvl(nov7.credito,0) as credito,*/
nvl(sum(case when nvl(nov.cant,0) = 0 then rpcom.valor
     when nvl(nov.cant,0) = 1 and nvl(nov7.cant7,0) = 1 then rpcom.valor
     when nvl(nov.cant,0) = 1 and nvl(nov7.cant7,0) != 1 then nvl(hist.valor_hist,0)
     when nvl(nov.cant,0) != 1 then nvl(hist.valor_hist,0) - nvl(nov7.credito,0)
     else 0 end),0) as v_reintegro_comp

from pr_rp_compromiso rpcom

left join(
  select
  nov.id_rp,
  nov.id_vigencia,
  nov.vigencia,
  novval.id_obj_gasto,
  count(nov.id_novedad_rp) as cant
  /*
  nov.*,
  novval.debito,
  novval.credito*/
  from pr_novedad_rp nov
  join pr_novedad_rp_val novval
  on novval.id_novedad_rp = nov.id_novedad_rp
  group by
  nov.id_rp,
  nov.id_vigencia,
  nov.vigencia,
  novval.id_obj_gasto
)nov
on nov.id_rp = rpcom.id_rp
and nov.id_vigencia = rpcom.id_vigencia
and nov.vigencia = rpcom.vigencia
and nov.id_obj_gasto = rpcom.id_obj_gasto

left join(
  select
  nov.id_rp,
  nov.id_vigencia,
  nov.vigencia,
  novval.id_obj_gasto,
  count(nov.id_novedad_rp) as cant7,
  sum(novval.debito) as debito,
  sum(novval.credito) as credito
  /*
  nov.*,
  novval.debito,
  novval.credito*/
  from pr_novedad_rp nov
  join pr_novedad_rp_val novval
  on novval.id_novedad_rp = nov.id_novedad_rp
  where
  nov.id_tipo_novedad = 7
  group by
  nov.id_rp,
  nov.id_vigencia,
  nov.vigencia,
  novval.id_obj_gasto
)nov7
on nov7.id_rp = rpcom.id_rp
and nov7.id_vigencia = rpcom.id_vigencia
and nov7.vigencia = rpcom.vigencia
and nov7.id_obj_gasto = rpcom.id_obj_gasto

left join(
  select
  hist.id_rp,
  hist.id_vigencia,
  hist.vigencia,
  hist.id_obj_gasto,
  sum(nvl(hist.valor,0)) as valor_hist
  from pr_historial_rp hist
  group by
  hist.id_rp,
  hist.id_vigencia,
  hist.vigencia,
  hist.id_obj_gasto
)hist
on hist.id_rp = rpcom.id_rp
and hist.id_vigencia = rpcom.id_vigencia
and hist.vigencia = rpcom.vigencia
and hist.id_obj_gasto = rpcom.id_obj_gasto

where
rpcom.id_rp = tab0.id_rp_comis
and rpcom.id_vigencia = tab0.id_vigencia
and rpcom.vigencia = tab0.vigencia) ,0) as v_reintegro_comp,


nvl(
(select
--rpcom.*
sum(nvl(leg.v_bruto,0)) + sum(nvl(leg.v_iva,0)) as v_retencion

from (
        SELECT
        aut.*,
        ROW_NUMBER() OVER (
            partition by aut.id_rp, aut.vigencia, aut.id_obj_gasto
            ORDER BY aut.id_rp, aut.vigencia, aut.id_obj_gasto, aut.id
        ) AS rn
        from pr_rp_compromiso aut
    )rpcom

join objetos_gasto obj
on obj.id = rpcom.id_obj_gasto

join pr_elementos_gasto ele
on ele.id_objeto_gasto = obj.id

join pr_legalizacion_comis leg
on leg.id_rp_comis = rpcom.id_rp
and leg.id_vigencia = rpcom.id_vigencia
and leg.vigencia = rpcom.vigencia
and case when leg.id_elementos_gasto = 82 then 32 else leg.id_elementos_gasto end = ele.id_elementos_gasto

where
rpcom.id_rp = tab0.id_rp_comis
and rpcom.id_vigencia = tab0.id_vigencia
and rpcom.vigencia = tab0.vigencia
and rpcom.rn = 1) ,0) as v_reintegro_leg,

nvl(
(select
--rpcom.*
sum(nvl(leg.v_retencion,0)) as v_retencion
from pr_rp_compromiso rpcom

join objetos_gasto obj
on obj.id = rpcom.id_obj_gasto

join pr_elementos_gasto ele
on ele.id_objeto_gasto = obj.id

join pr_legalizacion_comis leg
on leg.id_rp_comis = rpcom.id_rp
and leg.id_vigencia = rpcom.id_vigencia
and leg.vigencia = rpcom.vigencia
and leg.id_elementos_gasto = ele.id_elementos_gasto

where
rpcom.id_rp = tab0.id_rp_comis
and rpcom.id_vigencia = tab0.id_vigencia
and rpcom.vigencia = tab0.vigencia) ,0) as v_retencion

from (

    select distinct
    1 as tag,
    null as adjunto_est,
    null as id_legalizacion_soporte_dig,
    sop.id_rp_comis,
    sop.id_vigencia,
    sop.vigencia,
    null as fecha_proceso,
    null as id_objetos_soporte_digital,
    null as adjunto,
    null as descripcion,
    null as bloqueado,
    null as observaciones,
    null as cerrado,
    null as fecha_sys,
    null as usuario,
    null as fecha_cerrado,
    null as usuario_cerrado,
    null as bloqueado_text,
    null as cerrado_text,
    objleg.id_objetos_legal_soporte as id_objetos_legal_soporte,
    objleg.codigo as codigo,
    objleg.descripcion as descripcion_objsop,
    null as completo,
    null as abreviatura,
    null as estado,
    case when objsop.estado = 1 then 'Activo' else 'Inactivo' end as estado_text,
    objleg.codigo as codigo_leg,
    objleg.descripcion as descripcion_leg,
    objleg.codigo || '-' || objleg.descripcion as completo_leg,
    objleg.abreviatura as abreviatura_leg,
    objleg.estado as estado_leg,
    case when objleg.estado = 1 then 'Activo' else 'Inactivo' end as estado_text_leg,

    rp.id_tercero,
    ter.razon_soc,

    res.resolucion,
    comis.fecha_salida as fecha_comis,
    lpad(to_char(comis.fecha_salida,'dd'),2,'0') as dia_comis,
    trim(initcap(to_char(comis.fecha_salida,'MONTH','nls_date_language=spanish'))) as mes_comis,
    to_char(comis.fecha_salida,'yyyy') as anho_comis,
    comis.dias,
    to_number(avan.dias_comi) as dias_comi,

    null as fecha_adjunto

    from pr_legalizacion_soporte_dig sop

    join pr_rp_comis rp
    on rp.id = sop.id_rp_comis
    and rp.vigencia = sop.vigencia
    and rp.id_vigencia = sop.id_vigencia

    left join pr_resol_comis res
    on res.id = rp.no_acto_admin
    and res.id_vigencia = rp.id_vigencia
    and res.vigencia = rp.vigencia

    left join(
        select
        1 as tip,
        comisionados_planta.*
        from comisionados_planta
        union
        select
        0 as tip,
        comisionados_contrato.*
        from comisionados_contrato
    )comis
    on comis.nitocc = rp.id_tercero
    and comis.id_comision = rp.id_comision
    and comis.vigencia = rp.vigencia

    left join pr_avances_comisiones avan
    on avan.id_rp_comis = rp.id
    and avan.id_vigencia = rp.id_vigencia
    and avan.vigencia = rp.vigencia

    join interceros_v ter
    on ter.num_doc = to_char(rp.id_tercero)

    join objetos_soporte_digital objsop
    on sop.id_objetos_soporte_digital = objsop.id_objetos_soporte_digital

    join objetos_legal_soporte objleg
    on objsop.id_objetos_legal_soporte = objleg.id_objetos_legal_soporte

    where
    sop.id_rp_comis = $P{id_rp}
    and sop.vigencia = $P{vigencia}
    and sop.id_vigencia = 1

    union

    select
    2 as tag,
    case when sop.adjunto is not null then 'Si - ' || nvl( to_char(tab5.fecha_sys,'dd/mm/yyyy'), to_char(sop.fecha_sys,'dd/mm/yyyy') )
    else 'No' end as adjunto_est,
    sop.ID_LEGALIZACION_SOPORTE_DIG,
    sop.ID_RP_COMIS,
    sop.ID_VIGENCIA,
    sop.VIGENCIA,
    sop.FECHA_PROCESO,
    sop.ID_OBJETOS_SOPORTE_DIGITAL,
    sop.ADJUNTO,
    sop.DESCRIPCION,
    sop.BLOQUEADO,
    sop.OBSERVACIONES,
    sop.CERRADO,
    sop.FECHA_SYS,
    sop.USUARIO,
    sop.FECHA_CERRADO,
    sop.USUARIO_CERRADO,
    case when sop.bloqueado = 1 then 'Bloqueado' else 'Desbloqueado' end as bloqueado_text,
    case when sop.cerrado = 1 then 'Cerrado' else 'Abierto' end as cerrado_text,
    objsop.id_objetos_legal_soporte,
    objsop.codigo,
    objsop.descripcion as descripcion_objsop,
    objsop.codigo || '-' || objsop.descripcion as completo,
    objsop.abreviatura,
    objsop.estado,
    case when objsop.estado = 1 then 'Activo' else 'Inactivo' end as estado_text,
    objleg.codigo as codigo_leg,
    objleg.descripcion as descripcion_leg,
    objleg.codigo || '-' || objleg.descripcion as completo_leg,
    objleg.abreviatura as abreviatura_leg,
    objleg.estado as estado_leg,
    case when objleg.estado = 1 then 'Activo' else 'Inactivo' end as estado_text_leg,

    rp.id_tercero,
    ter.razon_soc,

    res.resolucion,
    comis.fecha_salida as fecha_comis,
    lpad(to_char(comis.fecha_salida,'dd'),2,'0') as dia_comis,
    trim(initcap(to_char(comis.fecha_salida,'MONTH','nls_date_language=spanish'))) as mes_comis,
    to_char(comis.fecha_salida,'yyyy') as anho_comis,
    comis.dias,
    to_number(avan.dias_comi) as dias_comi,

    case when sop.adjunto is not null
    then nvl( to_char(tab5.fecha_sys,'dd/mm/yyyy'), to_char(sop.fecha_sys,'dd/mm/yyyy') )
    else null end as fecha_adjunto

    from pr_legalizacion_soporte_dig sop

    left join (
      SELECT
       aut.*,
       ROW_NUMBER() OVER (
        partition by aut.id_legalizacion_soporte_dig
        ORDER BY aut.fecha_sys desc
       ) AS rn
      from pr_legalizacion_sop_dig_nov aut
      where
      aut.bloqueado = 1
    )tab5
    on sop.id_legalizacion_soporte_dig = tab5.id_legalizacion_soporte_dig
    and tab5.rn = 1

    join pr_rp_comis rp
    on rp.id = sop.id_rp_comis
    and rp.vigencia = sop.vigencia
    and rp.id_vigencia = sop.id_vigencia

    left join pr_resol_comis res
    on res.id = rp.no_acto_admin
    and res.id_vigencia = rp.id_vigencia
    and res.vigencia = rp.vigencia

    left join(
        select
        1 as tip,
        comisionados_planta.*
        from comisionados_planta
        union
        select
        0 as tip,
        comisionados_contrato.*
        from comisionados_contrato
    )comis
    on comis.nitocc = rp.id_tercero
    and comis.id_comision = rp.id_comision
    and comis.vigencia = rp.vigencia

    left join pr_avances_comisiones avan
    on avan.id_rp_comis = rp.id
    and avan.id_vigencia = rp.id_vigencia
    and avan.vigencia = rp.vigencia

    join interceros_v ter
    on ter.num_doc = to_char(rp.id_tercero)

    join objetos_soporte_digital objsop
    on sop.id_objetos_soporte_digital = objsop.id_objetos_soporte_digital

    join objetos_legal_soporte objleg
    on objsop.id_objetos_legal_soporte = objleg.id_objetos_legal_soporte

    where
    sop.id_rp_comis = $P{id_rp}
    and sop.vigencia = $P{vigencia}
    and sop.id_vigencia = 1


    union

    select distinct
    3 as tag,
    null as adjunto_est,
    null as id_legalizacion_soporte_dig,
    sop.id_rp_comis,
    sop.id_vigencia,sop.vigencia,
    null as fecha_proceso,
    null as id_objetos_soporte_digital,
    null as adjunto,
    null as descripcion,
    null as bloqueado,
    null as observaciones,
    null as cerrado,
    null as fecha_sys,
    null as usuario,
    null as fecha_cerrado,
    null as usuario_cerrado,
    null as bloqueado_text,
    null as cerrado_text,
    999 as id_objetos_legal_soporte,
    null as codigo,
    'Registro Gastos Legalización' as descripcion_objsop,
    null as completo,
    null as abreviatura,
    null as estado,
    null as estado_text,
    '999' as codigo_leg,
    'Registro Gastos Legalización' as descripcion_leg,
    '999' || '-' || 'Registro Gastos Legalización' as completo_leg,
    null as abreviatura_leg,
    null as estado_leg,
    null as estado_text_leg,

    rp.id_tercero,
    ter.razon_soc,

    res.resolucion,
    comis.fecha_salida as fecha_comis,
    lpad(to_char(comis.fecha_salida,'dd'),2,'0') as dia_comis,
    trim(initcap(to_char(comis.fecha_salida,'MONTH','nls_date_language=spanish'))) as mes_comis,
    to_char(comis.fecha_salida,'yyyy') as anho_comis,
    comis.dias,
    to_number(avan.dias_comi) as dias_comi,

    null as fecha_adjunto

    from pr_legalizacion_gasto_sopdig sop

    join pr_rp_comis rp
    on rp.id = sop.id_rp_comis
    and rp.vigencia = sop.vigencia
    and rp.id_vigencia = sop.id_vigencia

    left join pr_resol_comis res
    on res.id = rp.no_acto_admin
    and res.id_vigencia = rp.id_vigencia
    and res.vigencia = rp.vigencia

    left join(
        select
        1 as tip,
        comisionados_planta.*
        from comisionados_planta
        union
        select
        0 as tip,
        comisionados_contrato.*
        from comisionados_contrato
    )comis
    on comis.nitocc = rp.id_tercero
    and comis.id_comision = rp.id_comision
    and comis.vigencia = rp.vigencia

    left join pr_avances_comisiones avan
    on avan.id_rp_comis = rp.id
    and avan.id_vigencia = rp.id_vigencia
    and avan.vigencia = rp.vigencia

    join interceros_v ter
    on ter.num_doc = to_char(rp.id_tercero)

    left join(

        SELECT
        leg.id_rp_comis,
        leg.id_vigencia,
        leg.vigencia,
        leg.documento,

        to_char(wm_concat( distinct gas.codigo_obj)) as codigo_obj,
        to_char(wm_concat( distinct gas.descripcion_obj)) as descripcion_obj,

        1 as estado

        FROM pr_legalizacion_comis leg

        left join pr_elementos_gasto_v gas
        on leg.id_elementos_gasto = gas.id_elementos_gasto

        where
        leg.id_vigencia = 1
        and leg.vigencia = $P{vigencia}
        and leg.id_rp_comis = $P{id_rp}
        and gas.viatico = 0

        group by
        leg.id_rp_comis,
        leg.id_vigencia,
        leg.vigencia,
        leg.documento

    )objleg
    on objleg.id_rp_comis = sop.id_rp_comis
    and objleg.id_vigencia = sop.id_vigencia
    and objleg.vigencia = sop.vigencia
    and objleg.documento = sop.documento

    where
    sop.id_rp_comis = $P{id_rp}
    and sop.vigencia = $P{vigencia}
    and sop.id_vigencia = 1

    union

    select
    4 as tag,
    case when sop.adjunto is not null then 'Si - ' || nvl( to_char(tab5.fecha_sys,'dd/mm/yyyy'), to_char(sop.fecha_sys,'dd/mm/yyyy') )
    else 'No' end as adjunto_est,
    sop.ID_LEGALIZACION_GASTO_SOPDIG,
    sop.ID_RP_COMIS,
    sop.ID_VIGENCIA,
    sop.VIGENCIA,
    sop.FECHA_PROCESO,
    to_number(sop.ID_LEGALIZACION_GASTO_SOPDIG || '0' || sop.VIGENCIA) as id_objetos_soporte_digital,
    sop.ADJUNTO,
    sop.DESCRIPCION,
    sop.BLOQUEADO,
    sop.OBSERVACIONES,
    sop.CERRADO,
    sop.FECHA_SYS,
    sop.USUARIO,
    sop.FECHA_CERRADO,
    sop.USUARIO_CERRADO,
    case when sop.bloqueado = 1 then 'Bloqueado' else 'Desbloqueado' end as bloqueado_text,
    case when sop.cerrado = 1 then 'Cerrado' else 'Abierto' end as cerrado_text,
    999 as id_objetos_legal_soporte,
    sop.documento as codigo,
    'Doc.(' || sop.documento || ') - ' || objleg.descripcion_obj as descripcion_objsop,
    objleg.codigo_obj || '-' || objleg.descripcion_obj as completo,
    null as abreviatura,
    objleg.estado,
    case when objleg.estado = 1 then 'Activo' else 'Inactivo' end as estado_text,
    objleg.codigo_obj as codigo_leg,
    objleg.descripcion_obj as descripcion_leg,
    objleg.codigo_obj || '-' || objleg.descripcion_obj as completo_leg,
    null as abreviatura_leg,
    objleg.estado as estado_leg,
    case when objleg.estado = 1 then 'Activo' else 'Inactivo' end as estado_text_leg,

    rp.id_tercero,
    ter.razon_soc,

    res.resolucion,
    comis.fecha_salida as fecha_comis,
    lpad(to_char(comis.fecha_salida,'dd'),2,'0') as dia_comis,
    trim(initcap(to_char(comis.fecha_salida,'MONTH','nls_date_language=spanish'))) as mes_comis,
    to_char(comis.fecha_salida,'yyyy') as anho_comis,
    comis.dias,
    to_number(avan.dias_comi) as dias_comi,

    case when sop.adjunto is not null
    then nvl( to_char(tab5.fecha_sys,'dd/mm/yyyy'), to_char(sop.fecha_sys,'dd/mm/yyyy') )
    else null end as fecha_adjunto

    from pr_legalizacion_gasto_sopdig sop

    left join (
      SELECT
       aut.*,
       ROW_NUMBER() OVER (
        partition by aut.id_legalizacion_gasto_sopdig
        ORDER BY aut.fecha_sys desc
       ) AS rn
      from pr_legalizacion_gasto_sd_nov aut
      where
      aut.bloqueado = 1
    )tab5
    on sop.id_legalizacion_gasto_sopdig = tab5.id_legalizacion_gasto_sopdig
    and tab5.rn = 1

    join pr_rp_comis rp
    on rp.id = sop.id_rp_comis
    and rp.vigencia = sop.vigencia
    and rp.id_vigencia = sop.id_vigencia

    left join pr_resol_comis res
    on res.id = rp.no_acto_admin
    and res.id_vigencia = rp.id_vigencia
    and res.vigencia = rp.vigencia

    left join(
        select
        1 as tip,
        comisionados_planta.*
        from comisionados_planta
        union
        select
        0 as tip,
        comisionados_contrato.*
        from comisionados_contrato
    )comis
    on comis.nitocc = rp.id_tercero
    and comis.id_comision = rp.id_comision
    and comis.vigencia = rp.vigencia

    left join pr_avances_comisiones avan
    on avan.id_rp_comis = rp.id
    and avan.id_vigencia = rp.id_vigencia
    and avan.vigencia = rp.vigencia

    join interceros_v ter
    on ter.num_doc = to_char(rp.id_tercero)

    left join(

        SELECT
        leg.id_rp_comis,
        leg.id_vigencia,
        leg.vigencia,
        leg.documento,

        to_char(wm_concat( distinct gas.codigo_obj)) as codigo_obj,
        to_char(wm_concat( distinct gas.descripcion_obj)) as descripcion_obj,

        1 as estado

        FROM pr_legalizacion_comis leg

        left join pr_elementos_gasto_v gas
        on leg.id_elementos_gasto = gas.id_elementos_gasto

        where
        leg.id_vigencia = 1
        and leg.vigencia = $P{vigencia}
        and leg.id_rp_comis = $P{id_rp}
        and gas.viatico = 0

        group by
        leg.id_rp_comis,
        leg.id_vigencia,
        leg.vigencia,
        leg.documento

    )objleg
    on objleg.id_rp_comis = sop.id_rp_comis
    and objleg.id_vigencia = sop.id_vigencia
    and objleg.vigencia = sop.vigencia
    and objleg.documento = sop.documento

    where
    sop.id_rp_comis = $P{id_rp}
    and sop.vigencia = $P{vigencia}
    and sop.id_vigencia = 1

)tab0

left join (
  SELECT
   aut.*,
   ROW_NUMBER() OVER (
    partition by  aut.vigencia, aut.id_vigencia, aut.id_rp
    ORDER BY aut.vigencia, aut.id_vigencia, aut.id_rp, aut.secuencia, aut.estado DESC
   ) AS rn
  from ts_pago_obl aut
)pag
on pag.vigencia = tab0.vigencia
and pag.id_vigencia = tab0.id_vigencia
and pag.id_rp = tab0.id_rp_comis
and pag.rn = 1

order by
tab0.id_objetos_legal_soporte,
tab0.tag,
tab0.codigo,
tab0.estado desc]]>
	</queryString>
	<field name="IS_SGC" class="java.math.BigDecimal"/>
	<field name="NRO_ORDEN_PAGO" class="java.math.BigDecimal"/>
	<field name="TAG" class="java.math.BigDecimal"/>
	<field name="ADJUNTO_EST" class="java.lang.String"/>
	<field name="ID_LEGALIZACION_SOPORTE_DIG" class="java.math.BigDecimal"/>
	<field name="ID_RP_COMIS" class="java.math.BigDecimal"/>
	<field name="ID_VIGENCIA" class="java.math.BigDecimal"/>
	<field name="VIGENCIA" class="java.lang.String"/>
	<field name="FECHA_PROCESO" class="java.sql.Timestamp"/>
	<field name="ID_OBJETOS_SOPORTE_DIGITAL" class="java.math.BigDecimal"/>
	<field name="ADJUNTO" class="java.lang.String"/>
	<field name="DESCRIPCION" class="java.lang.String"/>
	<field name="BLOQUEADO" class="java.math.BigDecimal"/>
	<field name="OBSERVACIONES" class="java.lang.String"/>
	<field name="CERRADO" class="java.math.BigDecimal"/>
	<field name="FECHA_SYS" class="java.sql.Timestamp"/>
	<field name="USUARIO" class="java.lang.String"/>
	<field name="FECHA_CERRADO" class="java.sql.Timestamp"/>
	<field name="USUARIO_CERRADO" class="java.lang.String"/>
	<field name="BLOQUEADO_TEXT" class="java.lang.String"/>
	<field name="CERRADO_TEXT" class="java.lang.String"/>
	<field name="ID_OBJETOS_LEGAL_SOPORTE" class="java.math.BigDecimal"/>
	<field name="CODIGO" class="java.lang.String"/>
	<field name="DESCRIPCION_OBJSOP" class="java.lang.String"/>
	<field name="COMPLETO" class="java.lang.String"/>
	<field name="ABREVIATURA" class="java.lang.String"/>
	<field name="ESTADO" class="java.math.BigDecimal"/>
	<field name="ESTADO_TEXT" class="java.lang.String"/>
	<field name="CODIGO_LEG" class="java.lang.String"/>
	<field name="DESCRIPCION_LEG" class="java.lang.String"/>
	<field name="COMPLETO_LEG" class="java.lang.String"/>
	<field name="ABREVIATURA_LEG" class="java.lang.String"/>
	<field name="ESTADO_LEG" class="java.math.BigDecimal"/>
	<field name="ESTADO_TEXT_LEG" class="java.lang.String"/>
	<field name="ID_TERCERO" class="java.math.BigDecimal"/>
	<field name="RAZON_SOC" class="java.lang.String"/>
	<field name="RESOLUCION" class="java.lang.String"/>
	<field name="FECHA_COMIS" class="java.sql.Timestamp"/>
	<field name="DIA_COMIS" class="java.lang.String"/>
	<field name="MES_COMIS" class="java.lang.String"/>
	<field name="ANHO_COMIS" class="java.lang.String"/>
	<field name="DIAS" class="java.math.BigDecimal"/>
	<field name="DIAS_COMI" class="java.math.BigDecimal"/>
	<field name="FECHA_ADJUNTO" class="java.lang.String"/>
	<field name="USUARIO_REVISO" class="java.lang.String"/>
	<field name="USUARIO_CERRO" class="java.lang.String"/>
	<field name="V_APROBADO" class="java.math.BigDecimal"/>
	<field name="V_LEGALIZADO" class="java.math.BigDecimal"/>
	<field name="V_REINTEGRO_COMP" class="java.math.BigDecimal"/>
	<field name="V_REINTEGRO_LEG" class="java.math.BigDecimal"/>
	<field name="V_RETENCION" class="java.math.BigDecimal"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="60" splitType="Stretch">
			<staticText>
				<reportElement x="160" y="0" width="482" height="50"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="10" isBold="true"/>
				</textElement>
				<text><![CDATA[LEGALIZACION DE COMISION DOCUMENTOS DIGITALIZADOS]]></text>
			</staticText>
			<image>
				<reportElement x="0" y="10" width="140" height="40"/>
				<imageExpression class="java.lang.String"><![CDATA["repo:LogoEmpresa003.jpg"]]></imageExpression>
			</image>
		</band>
	</title>
	<pageHeader>
		<band height="8" splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="91" splitType="Stretch">
			<textField isBlankWhenNull="true">
				<reportElement mode="Opaque" x="70" y="0" width="291" height="20" forecolor="#000000"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{RAZON_SOC}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement mode="Opaque" x="0" y="0" width="70" height="20" forecolor="#000000"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Dotted"/>
					<topPen lineWidth="0.0" lineStyle="Dotted"/>
					<leftPen lineWidth="0.0" lineStyle="Dotted"/>
					<bottomPen lineWidth="0.0" lineStyle="Dotted"/>
					<rightPen lineWidth="0.0" lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Nombre Comisionado:"]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement mode="Opaque" x="431" y="0" width="100" height="20" forecolor="#000000"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ID_TERCERO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement mode="Opaque" x="361" y="0" width="70" height="20" forecolor="#000000"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Dotted"/>
					<topPen lineWidth="0.0" lineStyle="Dotted"/>
					<leftPen lineWidth="0.0" lineStyle="Dotted"/>
					<bottomPen lineWidth="0.0" lineStyle="Dotted"/>
					<rightPen lineWidth="0.0" lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Documento:"]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement mode="Opaque" x="261" y="20" width="100" height="20" forecolor="#000000"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ID_RP_COMIS}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement mode="Opaque" x="180" y="20" width="80" height="20" forecolor="#000000"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Dotted"/>
					<topPen lineWidth="0.0" lineStyle="Dotted"/>
					<leftPen lineWidth="0.0" lineStyle="Dotted"/>
					<bottomPen lineWidth="0.0" lineStyle="Dotted"/>
					<rightPen lineWidth="0.0" lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[( $F{IS_SGC} == 0
    ? "No. RP/Egreso:"
    : "No. RP:"
)    ]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement mode="Opaque" x="0" y="71" width="160" height="20" forecolor="#000000" backcolor="#A4CFF6"/>
				<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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Soporte Legalización]]></text>
			</staticText>
			<textField isBlankWhenNull="true">
				<reportElement mode="Opaque" x="431" y="20" width="100" height="20" forecolor="#000000"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{VIGENCIA}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement mode="Opaque" x="361" y="20" width="70" height="20" forecolor="#000000"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Dotted"/>
					<topPen lineWidth="0.0" lineStyle="Dotted"/>
					<leftPen lineWidth="0.0" lineStyle="Dotted"/>
					<bottomPen lineWidth="0.0" lineStyle="Dotted"/>
					<rightPen lineWidth="0.0" lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Vigencia:"]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement mode="Opaque" x="230" y="71" width="160" height="20" forecolor="#000000" backcolor="#A4CFF6"/>
				<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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Descripción]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="642" y="71" width="70" height="20" forecolor="#000000" backcolor="#A4CFF6"/>
				<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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Cerrado/Abierto]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="460" y="71" width="182" height="20" forecolor="#000000" backcolor="#A4CFF6"/>
				<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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Observaciones Grupo Presupuesto]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="390" y="71" width="70" height="20" forecolor="#000000" backcolor="#A4CFF6"/>
				<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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Estado]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="160" y="71" width="70" height="20" forecolor="#000000" backcolor="#A4CFF6"/>
				<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="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Adjunto - Fecha Adj.]]></text>
			</staticText>
			<textField evaluationTime="Report" pattern="" isBlankWhenNull="true">
				<reportElement isPrintRepeatedValues="false" x="0" y="60" width="712" height="11"/>
				<box leftPadding="2" rightPadding="0">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.0"/>
					<leftPen lineWidth="0.0"/>
					<bottomPen lineWidth="0.0"/>
					<rightPen lineWidth="0.0"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="6" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement mode="Opaque" x="80" y="20" width="100" height="20" forecolor="#000000"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{RESOLUCION}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement mode="Opaque" x="0" y="20" width="80" height="20" forecolor="#000000"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Dotted"/>
					<topPen lineWidth="0.0" lineStyle="Dotted"/>
					<leftPen lineWidth="0.0" lineStyle="Dotted"/>
					<bottomPen lineWidth="0.0" lineStyle="Dotted"/>
					<rightPen lineWidth="0.0" lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["No. Resolución:"]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement mode="Opaque" x="361" y="40" width="70" height="20" forecolor="#000000"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Dotted"/>
					<topPen lineWidth="0.0" lineStyle="Dotted"/>
					<leftPen lineWidth="0.0" lineStyle="Dotted"/>
					<bottomPen lineWidth="0.0" lineStyle="Dotted"/>
					<rightPen lineWidth="0.0" lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Días legalizados:"]]></textFieldExpression>
			</textField>
			<textField pattern="" isBlankWhenNull="true">
				<reportElement mode="Opaque" x="80" y="40" width="100" height="20" forecolor="#000000"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DIA_COMIS} + " " + $F{MES_COMIS} + " " + $F{ANHO_COMIS}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement mode="Opaque" x="431" y="40" width="100" height="20" forecolor="#000000"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DIAS_COMI}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement mode="Opaque" x="0" y="40" width="80" height="20" forecolor="#000000"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Dotted"/>
					<topPen lineWidth="0.0" lineStyle="Dotted"/>
					<leftPen lineWidth="0.0" lineStyle="Dotted"/>
					<bottomPen lineWidth="0.0" lineStyle="Dotted"/>
					<rightPen lineWidth="0.0" lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Fecha de salida de la comisión:"]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement mode="Opaque" x="261" y="40" width="100" height="20" forecolor="#000000"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DIAS}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement mode="Opaque" x="180" y="40" width="80" height="20" forecolor="#000000"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Dotted"/>
					<topPen lineWidth="0.0" lineStyle="Dotted"/>
					<leftPen lineWidth="0.0" lineStyle="Dotted"/>
					<bottomPen lineWidth="0.0" lineStyle="Dotted"/>
					<rightPen lineWidth="0.0" lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Días aprobados:"]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement mode="Opaque" x="601" y="40" width="100" height="20" forecolor="#000000"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{NRO_ORDEN_PAGO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement mode="Opaque" x="531" y="40" width="70" height="20" forecolor="#000000"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Dotted"/>
					<topPen lineWidth="0.0" lineStyle="Dotted"/>
					<leftPen lineWidth="0.0" lineStyle="Dotted"/>
					<bottomPen lineWidth="0.0" lineStyle="Dotted"/>
					<rightPen lineWidth="0.0" lineStyle="Dotted"/>
				</box>
				<textElement verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Orden de Pago:"]]></textFieldExpression>
			</textField>
		</band>
	</columnHeader>
	<detail>
		<band height="12" splitType="Stretch">
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="160" 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" markup="styled">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[( $F{TAG} == 1
    ? "<style isBold=\"true\">"+$F{DESCRIPCION_OBJSOP}+"</style>"
    : ( $F{TAG} == 3
        ? "<style isBold=\"true\">"+$F{DESCRIPCION_OBJSOP}+"</style>"
        : $F{DESCRIPCION_OBJSOP}
       )
)]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="230" y="0" width="160" 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="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESCRIPCION}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="460" y="0" width="182" 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="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{OBSERVACIONES}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="642" y="0" width="70" height="12"/>
				<box leftPadding="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="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CERRADO_TEXT}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="390" y="0" width="70" height="12"/>
				<box leftPadding="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="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{BLOQUEADO_TEXT}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="160" y="0" width="70" height="12"/>
				<box leftPadding="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="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ADJUNTO_EST}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band height="12" splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="33" splitType="Stretch">
			<staticText>
				<reportElement mode="Opaque" x="0" y="21" width="70" height="12" forecolor="#575757"/>
				<textElement verticalAlignment="Middle">
					<font fontName="SansSerif" size="6"/>
				</textElement>
				<text><![CDATA[Fecha de Impresion:]]></text>
			</staticText>
			<textField pattern="dd-MMM-yyyy   hh:mm aaa">
				<reportElement mode="Opaque" x="70" y="21" width="150" 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.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement mode="Opaque" x="421" y="12" width="151" 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>
				<text><![CDATA[]]></text>
			</staticText>
			<textField isStretchWithOverflow="true">
				<reportElement mode="Opaque" x="0" y="0" width="712" height="12" forecolor="#000000">
					<printWhenExpression><![CDATA[$F{USUARIO_CERRO} != null]]></printWhenExpression>
				</reportElement>
				<textElement verticalAlignment="Middle" markup="styled">
					<font fontName="SansSerif" size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["<style isBold=\"true\">Persona quien revisa:</style> " + $F{USUARIO_CERRO} + "."]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
	<summary>
		<band height="84" splitType="Stretch">
			<textField isStretchWithOverflow="true">
				<reportElement mode="Opaque" x="0" y="11" width="712" height="12" forecolor="#000000"/>
				<textElement verticalAlignment="Middle" markup="styled">
					<font fontName="SansSerif" size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["<style isBold=\"true\">Nota:</style> El comisionado garantiza  que todos los documentos aquí almacenados digitalmente son fiel copia del original, Sr. Comisionado conserve los documentos originales en caso de que los entes de control lo requiera."]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="160" y="36" width="100" height="12"/>
				<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">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{V_APROBADO}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="0" y="36" width="160" height="12" backcolor="#C9C9C9"/>
				<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" markup="styled">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Valor Pagado]]></text>
			</staticText>
			<textField isStretchWithOverflow="true" pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="160" y="48" width="100" height="12"/>
				<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">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{V_LEGALIZADO}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="0" y="48" width="160" height="12" backcolor="#C9C9C9"/>
				<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" markup="styled">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Valor Legalizado]]></text>
			</staticText>
			<textField isStretchWithOverflow="true" pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="160" y="60" width="100" height="12"/>
				<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">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{V_REINTEGRO_COMP} - $F{V_REINTEGRO_LEG}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="0" y="60" width="160" height="12" backcolor="#C9C9C9"/>
				<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" markup="styled">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Valor Reintegro]]></text>
			</staticText>
			<textField isStretchWithOverflow="true" pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="160" y="72" width="100" height="12"/>
				<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">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{V_RETENCION}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="0" y="72" width="160" height="12" backcolor="#C9C9C9"/>
				<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" markup="styled">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Valor Retención]]></text>
			</staticText>
		</band>
	</summary>
	<noData>
		<band height="20">
			<staticText>
				<reportElement x="0" y="0" width="712" height="20"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="SansSerif" isBold="true"/>
				</textElement>
				<text><![CDATA[No hay objetos a mostrar.]]></text>
			</staticText>
		</band>
	</noData>
</jasperReport>
