<?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="com_program_comisiones_subreport1_2021" language="groovy" pageWidth="860" pageHeight="555" orientation="Landscape" columnWidth="860" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
	<property name="ireport.zoom" value="1.6105100000000019"/>
	<property name="ireport.x" value="25"/>
	<property name="ireport.y" value="0"/>
	<property name="ireport.jasperserver.reportUnit" value="/reports/control_comisiones/com_program_comisiones"/>
	<property name="ireport.jasperserver.url" value="http://localhost:18080/jasperserver/services/repository"/>
	<parameter name="vigencia" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="id_plan_comisiones" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="whereIdComisiones" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[SELECT
tab0.num_doc as num_doc, tab0.razsoc as razsoc, tab0.num_doc||' - '||tab0.razsoc as completo_ter,
tab0.tipter_ter as tipter_ter,
tab0.tipoter_text as tipoter_text, tab0.tipter_ter||' - '||tab0.tipoter_text as completo_tipter,
tab0.nitocc as nitocc,
tab0.id_plan_comisiones as id_plan_comisiones,
tab0.vigencia as vigencia, tab0.id_transporte as id_transporte, tab0.sueldo as sueldo, tab0.cargo as cargo,
tab0.fecha_salida as fecha_salida,
tab0.dias as dias, tab0.codreg as codreg, tab0.total_comision as total_comision, tab0.estado as estado,
tab0.fecha_regreso as fecha_regreso,
tab0.gastos_taxis as gastos_taxis,
tab0.dias_manu as dias_manu, tab0.tipter as tipter, tab0.codobj as codobj, tab0.valor as valor,
tab0.valor_gasto as valor_gasto, tab0.viaticos as viaticos, tab0.acumulado_gastos as acumulado_gastos,
tab0.taxis as taxis, tab0.tarifa as tarifa,
tab0.tarifa_tiquete,
tab0.cant_dia_reg,
tab0.cant_dia_sal,
tab1.descripcion as descripcion_trans,
tab2.desreg as desreg,
tab2.abreviatura as sede_abreviatura,
tab3.descripcion as tipo_comisionado,
tab0.id_comisiones,
tab0.tarifa_con_tr,
tab0.tarifa_sin_tr,
contratado,

tab0.tag_tarifa_separada,
tab0.dias_tarifa_a,
tab0.dias_tarifa_b,
tab0.porcentaje_dia,
tab0.vl_tarifa_a,
tab0.vl_tarifa_b

FROM (select
placom.nitocc as num_doc,
ter.razsoc,
ter.tipter as tipter_ter,
ter.descripcion as tipoter_text,

placom.nitocc,
placom.id_plan_comisiones,
placom.vigencia,
placom.id_transporte,
placom.sueldo,
placom.cargo,
placom.fecha_salida,
placom.dias,
placom.codreg,
placom.total_comision,
placom.estado,
placom.fecha_regreso,
placom.gastos_taxis,
placom.dias_manu,
placom.tipter,
placom.dias_tiempo,
placom.hora_salida,
placom.hora_regreso,
placom.hora_salida as hora_salida_sel,
placom.hora_regreso as hora_regreso_sel,
nvl(placom.liquidar_via,0) as liquidar_via,

obj.codobj,
nvl(obj.valor,0) as valor,
nvl(obj.valor_gasto,0) as valor_gasto,
nvl(obj.viaticos,0) as viaticos,
nvl(obj.acumulado_gastos,0) as acumulado_gastos,
nvl(obj.taxis,0) as taxis,
nvl(obj.tarifa,0) as tarifa,
nvl(tarifa_tiquete,0) as tarifa_tiquete,
nvl(cant_dia_sal,0) as cant_dia_sal,
nvl(cant_dia_reg,0) as cant_dia_reg,
obj.tarifa_sin_tr,
obj.tarifa_con_tr,
case when obj.contratado > 0 then '1' else '0' end as contratado,

prog.ID_COMISIONES,
prog.VIGENCIA_COMISIONES,

case when prog.ID_COMISIONES is null then 0 else 1 end as programado,

    case when placom.dias_tarifa_a != 0 or placom.dias_tarifa_b != 0 then 1 else 0 end as tag_tarifa_separada,
    placom.dias_tarifa_a,
    placom.dias_tarifa_b,
    placom.porcentaje_dia,
    nvl(obj.vl_tarifa_a,0) as vl_tarifa_a,
    nvl(obj.vl_tarifa_b,0) as vl_tarifa_b

from COM_PLAN_COMISIONADOS_PLACOM placom

left join terceros_v ter
on ter.nitocc = placom.nitocc

left join(

    select
    nitocc,
    id_plan_comisiones,
    vigencia,

    listagg(codobj, ',') within group (order by codobj) as codobj,

    sum(valor) as valor,
    sum(case when id_obj_gasto is not null and is_viatico = 1 then valor - viaticos when codobj = '06' then valor - viaticos else 0 end) as valor_gasto,
    sum(viaticos) as viaticos,
    sum(case when id_obj_gasto is not null and is_viatico = 1 then valor - viaticos when codobj != '06' then valor - viaticos else 0 end) as acumulado_gastos,
    sum(taxis) as taxis,
    max(tarifa) as tarifa,
    max(tarifa_tiquete) as tarifa_tiquete,
    max(cant_dia_sal) as cant_dia_sal,
    max(cant_dia_reg) as cant_dia_reg,
    case when contratado>0 then max(tarifa) else 0 end as tarifa_con_tr,
    case when contratado=0 then max(tarifa) else
    case when contratado>0 then max(tarifa_tiquete) else 0 end end as tarifa_sin_tr,
    contratado,
        max(vl_tarifa_a) as vl_tarifa_a,
        max(vl_tarifa_b) as vl_tarifa_b

    from (select tab1.* ,nvl(tab2.contratado,0) as contratado
from com_plan_comisionados_placom_v tab0
join com_plan_comisionados_objs_v tab1 on tab1.NUM_DOC=tab0.NUM_DOC and tab1.ID_PLAN_COMISIONES=tab0.ID_PLAN_COMISIONES and tab0.VIGENCIA = tab1.VIGENCIA
left join
(
                select nitocc,id_plan_comisiones,vigencia,1 as contratado
                from com_plan_tarifas_destino_v  where tarifa_transporte = 2
                group by nitocc,id_plan_comisiones,vigencia

                union

                select placom.nitocc,placom.id_plan_comisiones,placom.vigencia,1 as contratado
                from com_plan_comisionados_placom placom
                left join transportes tr on tr.id = placom.id_transporte
                where tr.tarifa_transporte = 2
                group by placom.nitocc,placom.id_plan_comisiones,placom.vigencia

)tab2 on tab1.NUM_DOC=tab2.nitocc and tab1.ID_PLAN_COMISIONES=tab2.ID_PLAN_COMISIONES and tab2.VIGENCIA = tab1.VIGENCIA)

    where
    estado = 1
    --and tarifa_tiquete>0 and tarifa_tiquete<>tarifa

    group by
    nitocc,
    id_plan_comisiones,
    vigencia,
    contratado

)obj
on obj.nitocc = placom.nitocc
and obj.id_plan_comisiones = placom.id_plan_comisiones
and obj.vigencia = placom.vigencia

left join (Select id_plan_comisiones,tab0.ID_COMISIONES,tab0.VIGENCIA_COMISIONES,tab0.VIGENCIA,NITOCC
from COM_PLAN_PROGRAM_COMIS_V tab0
left join
(select * from comisionados_planta
union
select * from comisionados_contrato
)tab1 on tab1.id_comision = tab0.id_comisiones and tab1.vigencia = tab0.vigencia_comisiones
where tab0.estado <> 0)prog
on prog.id_plan_comisiones = placom.id_plan_comisiones
and prog.vigencia = placom.vigencia and placom.nitocc = prog.nitocc) tab0

JOIN TRANSPORTES tab1 ON tab0.id_transporte = tab1.id

JOIN REGIONALES tab2 ON tab0.codreg = tab2.codreg

JOIN COM_TIPO_COMISIONADO tab3 ON tab0.tipter = tab3.tipter

WHERE
tab0.id_plan_comisiones = $P{id_plan_comisiones}
AND tab0.vigencia = $P{vigencia}
$P!{whereIdComisiones}
ORDER BY
tab0.vigencia ,
tab0.id_plan_comisiones ,
tab0.tipoter_text ,
tab0.nitocc]]>
	</queryString>
	<field name="NUM_DOC" class="java.math.BigDecimal"/>
	<field name="RAZSOC" class="java.lang.String"/>
	<field name="COMPLETO_TER" class="java.lang.String"/>
	<field name="TIPTER_TER" class="java.lang.String"/>
	<field name="TIPOTER_TEXT" class="java.lang.String"/>
	<field name="COMPLETO_TIPTER" class="java.lang.String"/>
	<field name="NITOCC" class="java.math.BigDecimal"/>
	<field name="ID_PLAN_COMISIONES" class="java.math.BigDecimal"/>
	<field name="VIGENCIA" class="java.math.BigDecimal"/>
	<field name="ID_TRANSPORTE" class="java.math.BigDecimal"/>
	<field name="SUELDO" class="java.math.BigDecimal"/>
	<field name="CARGO" class="java.math.BigDecimal"/>
	<field name="FECHA_SALIDA" class="java.sql.Timestamp"/>
	<field name="DIAS" class="java.math.BigDecimal"/>
	<field name="CODREG" class="java.lang.String"/>
	<field name="TOTAL_COMISION" class="java.math.BigDecimal"/>
	<field name="ESTADO" class="java.math.BigDecimal"/>
	<field name="FECHA_REGRESO" class="java.sql.Timestamp"/>
	<field name="GASTOS_TAXIS" class="java.math.BigDecimal"/>
	<field name="DIAS_MANU" class="java.math.BigDecimal"/>
	<field name="TIPTER" class="java.lang.String"/>
	<field name="CODOBJ" class="java.lang.String"/>
	<field name="VALOR" class="java.math.BigDecimal"/>
	<field name="VALOR_GASTO" class="java.math.BigDecimal"/>
	<field name="VIATICOS" class="java.math.BigDecimal"/>
	<field name="ACUMULADO_GASTOS" class="java.math.BigDecimal"/>
	<field name="TAXIS" class="java.math.BigDecimal"/>
	<field name="TARIFA" class="java.math.BigDecimal"/>
	<field name="TARIFA_TIQUETE" class="java.math.BigDecimal"/>
	<field name="CANT_DIA_REG" class="java.math.BigDecimal"/>
	<field name="CANT_DIA_SAL" class="java.math.BigDecimal"/>
	<field name="DESCRIPCION_TRANS" class="java.lang.String"/>
	<field name="DESREG" class="java.lang.String"/>
	<field name="SEDE_ABREVIATURA" class="java.lang.String"/>
	<field name="TIPO_COMISIONADO" class="java.lang.String"/>
	<field name="ID_COMISIONES" class="java.math.BigDecimal"/>
	<field name="TARIFA_CON_TR" class="java.math.BigDecimal"/>
	<field name="TARIFA_SIN_TR" class="java.math.BigDecimal"/>
	<field name="CONTRATADO" class="java.lang.String"/>
	<field name="TAG_TARIFA_SEPARADA" class="java.math.BigDecimal"/>
	<field name="DIAS_TARIFA_A" class="java.math.BigDecimal"/>
	<field name="DIAS_TARIFA_B" class="java.math.BigDecimal"/>
	<field name="PORCENTAJE_DIA" class="java.math.BigDecimal"/>
	<field name="VL_TARIFA_A" class="java.math.BigDecimal"/>
	<field name="VL_TARIFA_B" class="java.math.BigDecimal"/>
	<variable name="sum_dias" class="java.math.BigDecimal" resetType="Group" resetGroup="TIPTER" calculation="Sum">
		<variableExpression><![CDATA[$F{DIAS}]]></variableExpression>
	</variable>
	<variable name="sum_valor" class="java.math.BigDecimal" resetType="Group" resetGroup="TIPTER" calculation="Sum">
		<variableExpression><![CDATA[$F{VALOR}]]></variableExpression>
	</variable>
	<variable name="sum_dias_total" class="java.math.BigDecimal" calculation="Sum">
		<variableExpression><![CDATA[$F{DIAS}]]></variableExpression>
	</variable>
	<variable name="sum_valor_total" class="java.math.BigDecimal" calculation="Sum">
		<variableExpression><![CDATA[$F{VALOR}]]></variableExpression>
	</variable>
	<group name="TIPTER">
		<groupExpression><![CDATA[$F{TIPTER_TER}]]></groupExpression>
		<groupFooter>
			<band height="10">
				<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
					<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="0" y="0" width="345" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
					<box leftPadding="2" rightPadding="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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA["Suma total " + $V{TIPTER_COUNT} + " comisionados de " + $F{TIPOTER_TEXT}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
					<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="370" y="0" width="445" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
					<box leftPadding="2" rightPadding="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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[" "]]></textFieldExpression>
				</textField>
				<textField pattern="#,##0.00" isBlankWhenNull="true">
					<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="815" y="0" width="45" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
					<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" rotation="None" markup="none">
						<font fontName="SansSerif" size="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					</textElement>
					<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{sum_valor}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
					<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="345" y="0" width="25" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
					<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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					</textElement>
					<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{sum_dias}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<columnHeader>
		<band height="59" splitType="Stretch">
			<staticText>
				<reportElement mode="Opaque" x="450" y="34" width="125" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Transportes]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="815" y="34" width="45" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Total comisión]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="575" y="34" width="240" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Objetos de Gasto]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Transparent" x="0" y="9" width="860" height="20" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF"/>
				<box leftPadding="2">
					<topPen lineWidth="0.0"/>
					<leftPen lineWidth="0.0"/>
					<rightPen lineWidth="0.0"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Comisionados de Planta/Contrato]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="0" y="34" width="25" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Tipo Ter.]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="65" y="34" width="175" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Nombre]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="240" y="34" width="40" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Tarifa
Viaticos]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="280" y="34" width="25" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Sede]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="345" y="34" width="25" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Días
viáticos]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="305" y="34" width="40" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Fecha Salida]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="370" y="34" width="40" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Fecha Regreso]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="25" y="34" width="40" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[No. Documento]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="410" y="34" width="40" height="25" 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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Total
Viaticos]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="10" splitType="Stretch">
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="65" y="0" width="175" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<box leftPadding="2" rightPadding="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="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{RAZSOC}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="0" y="0" width="25" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{TIPTER_TER}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="240" y="0" width="40" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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" 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.math.BigDecimal"><![CDATA[$F{TARIFA}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="280" y="0" width="25" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SEDE_ABREVIATURA}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="dd/MM/yyyy" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="305" y="0" width="40" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[$F{FECHA_SALIDA}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="450" y="0" width="125" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<box leftPadding="2" rightPadding="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="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESCRIPCION_TRANS}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="dd/MM/yyyy" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="370" y="0" width="40" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[$F{FECHA_REGRESO}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="815" y="0" width="45" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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" 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.math.BigDecimal"><![CDATA[$F{VALOR}]]></textFieldExpression>
			</textField>
			<subreport>
				<reportElement stretchType="RelativeToBandHeight" x="575" y="0" width="240" height="10"/>
				<subreportParameter name="num_doc">
					<subreportParameterExpression><![CDATA[$F{NUM_DOC}]]></subreportParameterExpression>
				</subreportParameter>
				<subreportParameter name="vigencia">
					<subreportParameterExpression><![CDATA[$F{VIGENCIA}]]></subreportParameterExpression>
				</subreportParameter>
				<subreportParameter name="id_plan_comisiones">
					<subreportParameterExpression><![CDATA[$F{ID_PLAN_COMISIONES}]]></subreportParameterExpression>
				</subreportParameter>
				<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
				<subreportExpression class="java.lang.String"><![CDATA["repo:com_program_comisiones_subreport1_1"]]></subreportExpression>
			</subreport>
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="25" y="0" width="40" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{NUM_DOC}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="345" y="0" width="25" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{DIAS}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="410" y="0" width="40" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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" 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.math.BigDecimal"><![CDATA[$F{PORCENTAJE_DIA}!="0" && $F{PORCENTAJE_DIA}!="100"
? $F{VIATICOS}
:  $F{PORCENTAJE_DIA}.toString()=="0"
    ? $F{VIATICOS}
    : $F{TAG_TARIFA_SEPARADA}.toString()=="1"
        ? ($F{DIAS_TARIFA_A} * $F{VL_TARIFA_A}) + ($F{DIAS_TARIFA_B} * $F{VL_TARIFA_B})
        : ($F{TARIFA}*($F{DIAS}-($F{CANT_DIA_REG}+$F{CANT_DIA_SAL})))+($F{TARIFA_TIQUETE}*($F{CANT_DIA_REG}+$F{CANT_DIA_SAL}))]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<summary>
		<band height="19" splitType="Stretch">
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="0" y="0" width="345" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<box leftPadding="2" rightPadding="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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["TOTAL " + $V{COLUMN_COUNT} + " COMISIONADOS"]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="370" y="0" width="445" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<box leftPadding="2" rightPadding="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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[" "]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="815" y="0" width="45" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{sum_valor_total}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="345" y="0" width="25" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<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="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$V{sum_dias_total}]]></textFieldExpression>
			</textField>
		</band>
	</summary>
</jasperReport>
