<?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_control_presup" language="groovy" pageWidth="612" pageHeight="792" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.7715610000000148"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="id_anhos" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereEstado" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereCajaMenor" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<parameter name="whereArea" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<parameter name="whereRubro" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<parameter name="whereObjetoGasto" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[SELECT tab0.* FROM(

    SELECT

    tab0.id_detalle_presup as id_detalle_presup, tab0.id_rubro as id_rubro,
    tab0.id_proyecto as id_proyecto, tab0.id_obj_gasto as id_obj_gasto,
    tab0.valor_asignado as valor_asignado, tab0.id_anhos as id_anhos,
    tab1.rubro as rubro, tab1.descripcion as descripcion_rubro,
    tab2.descripcion as descripcion_cm, tab2.codigo as codigo_cm,
    tab2.estado as estado, tab2.codigo||' - '||tab2.descripcion as completo_cm,
    tab3.codigo as codigo_obj, tab3.descripcion as descripcion_obj,
    tab3.codigo||' - '||tab3.descripcion as completo_obj,
    tab4.codigo as codigo_area, tab4.descripcion as descripcion_area,
    tab4.codigo||' - '||tab4.descripcion as completo_area

    FROM COM_DETALLE_PRESUP tab0

    JOIN PR_RUBRO_PRESUP_V tab1 ON tab0.id_rubro = tab1.id_rubro
    JOIN PROYECTOS tab2 ON tab0.id_proyecto = tab2.id
    JOIN OBJETOS_GASTO tab3 ON tab0.id_obj_gasto = tab3.id
    JOIN AREA tab4 ON tab2.id_area_lider = tab4.id_area

)tab0

WHERE
tab0.id_anhos = $P{id_anhos}
$P!{whereCajaMenor} $P!{whereArea}
$P!{whereRubro} $P!{whereObjetoGasto}
$P!{whereEstado}

ORDER BY
tab0.id_anhos,
tab0.codigo_cm,
tab0.rubro,
tab0.codigo_obj]]>
	</queryString>
	<field name="ID_DETALLE_PRESUP" class="java.math.BigDecimal"/>
	<field name="ID_RUBRO" class="java.math.BigDecimal"/>
	<field name="ID_PROYECTO" class="java.math.BigDecimal"/>
	<field name="ID_OBJ_GASTO" class="java.math.BigDecimal"/>
	<field name="VALOR_ASIGNADO" class="java.math.BigDecimal"/>
	<field name="ID_ANHOS" class="java.math.BigDecimal"/>
	<field name="RUBRO" class="java.lang.String"/>
	<field name="DESCRIPCION_RUBRO" class="java.lang.String"/>
	<field name="DESCRIPCION_CM" class="java.lang.String"/>
	<field name="CODIGO_CM" class="java.lang.String"/>
	<field name="ESTADO" class="java.math.BigDecimal"/>
	<field name="COMPLETO_CM" class="java.lang.String"/>
	<field name="CODIGO_OBJ" class="java.lang.String"/>
	<field name="DESCRIPCION_OBJ" class="java.lang.String"/>
	<field name="COMPLETO_OBJ" class="java.lang.String"/>
	<field name="CODIGO_AREA" class="java.lang.String"/>
	<field name="DESCRIPCION_AREA" class="java.lang.String"/>
	<field name="COMPLETO_AREA" class="java.lang.String"/>
	<variable name="sum_valor" class="java.math.BigDecimal" resetType="Group" resetGroup="caja menor" calculation="Sum">
		<variableExpression><![CDATA[$F{VALOR_ASIGNADO}]]></variableExpression>
	</variable>
	<variable name="total_valor" class="java.math.BigDecimal" calculation="Sum">
		<variableExpression><![CDATA[$F{VALOR_ASIGNADO}]]></variableExpression>
	</variable>
	<group name="caja menor">
		<groupExpression><![CDATA[$F{ID_PROYECTO}]]></groupExpression>
		<groupHeader>
			<band height="49">
				<staticText>
					<reportElement x="0" y="0" width="572" height="11"/>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font isBold="true"/>
					</textElement>
					<text><![CDATA[]]></text>
				</staticText>
				<staticText>
					<reportElement mode="Opaque" x="60" y="37" width="100" height="12" forecolor="#000000" backcolor="#BDDFFE"/>
					<box>
						<pen lineWidth="0.75"/>
						<topPen lineWidth="0.75"/>
						<leftPen lineWidth="0.75"/>
						<bottomPen lineWidth="0.75"/>
						<rightPen lineWidth="0.75"/>
					</box>
					<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
						<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					</textElement>
					<text><![CDATA[Cod. Rubro]]></text>
				</staticText>
				<staticText>
					<reportElement mode="Opaque" x="160" y="37" width="167" height="12" forecolor="#000000" backcolor="#BDDFFE"/>
					<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[Rubro Presupuestal]]></text>
				</staticText>
				<staticText>
					<reportElement mode="Opaque" x="327" y="37" width="155" height="12" forecolor="#000000" backcolor="#BDDFFE"/>
					<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[Objeto de Gasto]]></text>
				</staticText>
				<staticText>
					<reportElement mode="Opaque" x="482" y="37" width="90" height="12" forecolor="#000000" backcolor="#BDDFFE"/>
					<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 Asignado]]></text>
				</staticText>
				<staticText>
					<reportElement mode="Opaque" x="327" y="11" width="155" height="12" forecolor="#000000" backcolor="#8CC6FC"/>
					<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[Área]]></text>
				</staticText>
				<textField>
					<reportElement x="327" y="23" width="155" 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{COMPLETO_AREA}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement mode="Opaque" x="482" y="11" width="90" height="12" forecolor="#000000" backcolor="#8CC6FC"/>
					<box>
						<pen lineWidth="0.75"/>
						<topPen lineWidth="0.75"/>
						<leftPen lineWidth="0.75"/>
						<bottomPen lineWidth="0.75"/>
						<rightPen lineWidth="0.75"/>
					</box>
					<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
						<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
					</textElement>
					<text><![CDATA[Estado CM]]></text>
				</staticText>
				<textField>
					<reportElement x="482" y="23" 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.lang.String"><![CDATA[( $F{ESTADO} == 1
    ? "Activo"
    : "Anulado"
)]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement mode="Opaque" x="0" y="37" width="60" height="12" forecolor="#000000" backcolor="#BDDFFE"/>
					<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[Vigencia]]></text>
				</staticText>
				<staticText>
					<reportElement mode="Opaque" x="0" y="11" width="60" height="12" forecolor="#000000" backcolor="#8CC6FC"/>
					<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[Código CM]]></text>
				</staticText>
				<textField>
					<reportElement x="0" y="23" width="60" 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_CM}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement mode="Opaque" x="60" y="11" width="267" height="12" forecolor="#000000" backcolor="#8CC6FC"/>
					<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[Caja Menor]]></text>
				</staticText>
				<textField>
					<reportElement x="60" y="23" width="267" 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_CM}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="10">
				<textField>
					<reportElement mode="Opaque" x="0" y="0" width="482" height="10" backcolor="#C8C8C8"/>
					<box leftPadding="2" rightPadding="0">
						<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="none">
						<font size="7" isBold="true"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA["Total CM - " + $F{CODIGO_CM}]]></textFieldExpression>
				</textField>
				<textField pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="true">
					<reportElement mode="Opaque" x="482" y="0" width="90" height="10" forecolor="#000000" backcolor="#C8C8C8"/>
					<box rightPadding="3">
						<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>
			</band>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="60" splitType="Stretch">
			<staticText>
				<reportElement x="140" y="0" width="312" height="60"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font fontName="SansSerif" size="12" isBold="true"/>
				</textElement>
				<text><![CDATA[Sistema General de Control de Comisiones
Informe de Control Presupuestal]]></text>
			</staticText>
			<image>
				<reportElement x="0" y="10" width="140" height="40"/>
				<imageExpression class="java.lang.String"><![CDATA["repo:LogoEmpresa003.jpg"]]></imageExpression>
			</image>
			<staticText>
				<reportElement mode="Transparent" x="452" y="26" 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="38" 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>
		</band>
	</title>
	<pageHeader>
		<band height="12" splitType="Stretch"/>
	</pageHeader>
	<detail>
		<band height="10" splitType="Stretch">
			<textField>
				<reportElement x="60" y="0" width="100" 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.lang.String"><![CDATA[$F{RUBRO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="160" y="0" width="167" 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_RUBRO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="327" y="0" width="155" 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{COMPLETO_OBJ}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00">
				<reportElement x="482" y="0" width="90" 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_ASIGNADO}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="0" y="0" width="60" 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{ID_ANHOS}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band height="24" splitType="Stretch">
			<textField>
				<reportElement mode="Opaque" x="210" 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="300" 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="210" y="0" width="150" height="12" forecolor="#575757"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="6"/>
				</textElement>
				<text><![CDATA[Websafi - Control de Comisiones]]></text>
			</staticText>
		</band>
	</pageFooter>
	<summary>
		<band height="18" splitType="Stretch">
			<staticText>
				<reportElement mode="Opaque" x="0" y="8" width="482" height="10" backcolor="#B1B1B1"/>
				<box leftPadding="3">
					<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" isBold="true"/>
				</textElement>
				<text><![CDATA[Total]]></text>
			</staticText>
			<textField pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="true">
				<reportElement mode="Opaque" x="482" y="8" width="90" height="10" forecolor="#000000" backcolor="#B1B1B1"/>
				<box rightPadding="3">
					<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{total_valor}]]></textFieldExpression>
			</textField>
		</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>
