<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="no_ana_demo_pla_perso_cargo_sexo" language="groovy" pageWidth="572" pageHeight="1200" columnWidth="572" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
	<property name="ireport.zoom" value="1.3310000000000013"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<property name="ireport.jasperserver.reportUnit" value="/reports/nomina/no_ana_demo_pla_perso"/>
	<property name="ireport.jasperserver.url" value="http://192.168.2.43:8090/jasperserver/services/repository"/>
	<parameter name="id_periodo" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[SELECT tab.*, (tab.total_componente/tab.total)*100 as porcentaje   FROM (

SELECT
count(tab1.id_com_esc) AS total_componente,
tab2.codigo || '-' || tab2.grado || '-' ||tab2.denominacion as descripcion,
(SELECT
count(tab1.id_com_esc) AS total
FROM no_estado_func tab0
LEFT JOIN NO_DP_V tab1 ON tab0.id_dp=tab1.id_dp
LEFT JOIN RH_PN_COMPONENTE_ESCALA tab2 ON tab1.id_com_esc=tab2.id_com_esc
WHERE 1=1 and tab0.periodo=$P{id_periodo} ) as total


FROM no_estado_func tab0
LEFT JOIN NO_DP_V tab1 ON tab0.id_dp=tab1.id_dp
LEFT JOIN RH_PN_COMPONENTE_ESCALA tab2 ON tab1.id_com_esc=tab2.id_com_esc
LEFT JOIN NO_DATOS_FUNCIONARIO_V tab3 ON tab3.num_doc=tab0.num_doc and tab0.id_tipo_doc=tab3.id_tipo_doc
WHERE 1=1 and tab0.periodo=$P{id_periodo}
GROUP BY tab1.id_com_esc,tab2.denominacion,tab2.codigo,tab2.grado



)tab

ORDER BY tab.total_componente]]>
	</queryString>
	<field name="TOTAL_COMPONENTE" class="java.math.BigDecimal"/>
	<field name="DESCRIPCION" class="java.lang.String"/>
	<field name="TOTAL" class="java.math.BigDecimal"/>
	<field name="PORCENTAJE" class="java.math.BigDecimal"/>
	<columnHeader>
		<band height="38" splitType="Stretch">
			<staticText>
				<reportElement x="0" y="0" width="572" height="20"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[DISTRIBUCIÓN POR  CARGO]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="236" y="26" width="100" height="12" forecolor="#000000" backcolor="#AED6FB"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Cantidad]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="136" y="26" width="100" height="12" forecolor="#000000" backcolor="#AED6FB"/>
				<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[CARGO]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="336" y="26" width="100" height="12" forecolor="#000000" backcolor="#AED6FB"/>
				<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[Porcentaje]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="10" splitType="Stretch">
			<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToBandHeight" x="236" y="0" width="100" 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">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{TOTAL_COMPONENTE}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToBandHeight" x="136" y="0" width="100" 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>
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[( $F{DESCRIPCION}!=null
    ? $F{DESCRIPCION}
    : ""
)]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToBandHeight" x="336" y="0" width="100" 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">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{PORCENTAJE}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band height="13" splitType="Stretch"/>
	</columnFooter>
	<summary>
		<band height="400" splitType="Stretch">
			<stackedBar3DChart>
				<chart>
					<reportElement x="0" y="41" width="572" height="268"/>
					<chartTitle position="Top"/>
					<chartSubtitle/>
					<chartLegend/>
				</chart>
				<categoryDataset>
					<categorySeries>
						<seriesExpression><![CDATA[( $F{DESCRIPCION}!=null
    ? $F{DESCRIPCION}
    : ""
)]]></seriesExpression>
						<categoryExpression><![CDATA[( $F{DESCRIPCION}!=null
    ? $F{DESCRIPCION}
    : ""
)]]></categoryExpression>
						<valueExpression><![CDATA[$F{TOTAL_COMPONENTE}]]></valueExpression>
						<labelExpression><![CDATA[( $F{DESCRIPCION}!=null
    ? $F{DESCRIPCION}.substring( 0, 1 )
    : ""
)]]></labelExpression>
					</categorySeries>
				</categoryDataset>
				<bar3DPlot>
					<plot/>
					<itemLabel color="#000000" backgroundColor="#FFFFFF"/>
					<categoryAxisFormat>
						<axisFormat>
							<labelFont/>
							<tickLabelFont/>
						</axisFormat>
					</categoryAxisFormat>
					<valueAxisFormat>
						<axisFormat>
							<labelFont/>
							<tickLabelFont/>
						</axisFormat>
					</valueAxisFormat>
				</bar3DPlot>
			</stackedBar3DChart>
			<staticText>
				<reportElement mode="Opaque" x="136" y="0" width="100" height="13" forecolor="#000000" backcolor="#AED6FB"/>
				<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[Total]]></text>
			</staticText>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement mode="Opaque" x="236" y="0" width="100" height="13" backcolor="#CFCFCF"/>
				<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">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{TOTAL}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement mode="Opaque" x="336" y="0" width="100" height="13" backcolor="#CFCFCF"/>
				<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">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[100]]></textFieldExpression>
			</textField>
		</band>
	</summary>
</jasperReport>
