<?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="manual_coordinacion" language="groovy" pageWidth="468" pageHeight="610" orientation="Landscape" columnWidth="468" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
	<property name="ireport.zoom" value="1.948717100000002"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="whereFuncionarioNumDoc" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<parameter name="whereFuncionarioTipoDoc" class="java.lang.String">
		<defaultValueExpression><![CDATA[" "]]></defaultValueExpression>
	</parameter>
	<parameter name="periodo" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="id_periodo" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="fecha_corte" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="numero_letras" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="destino" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="comando" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="sexo" class="java.lang.String"/>
	<parameter name="letra_a_sin" class="java.lang.String">
		<defaultValueExpression><![CDATA["a"]]></defaultValueExpression>
	</parameter>
	<parameter name="letra_a" class="java.lang.String">
		<defaultValueExpression><![CDATA["a"]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[select

LPAD(TO_CHAR(tab.fecha_ini,'dd'),2,'0') as DIA_ini,
trim(lower(TO_CHAR(tab.fecha_ini,'MONTH','nls_date_language=spanish'))) as MES_ini,
TO_CHAR(tab.fecha_ini,'yyyy') as anho_ini,

LPAD(TO_CHAR(tab.fecha_fin,'dd'),2,'0') as DIA_fin,
trim(lower(TO_CHAR(tab.fecha_fin,'MONTH','nls_date_language=spanish'))) as MES_fin,
TO_CHAR(tab.fecha_fin,'yyyy') as anho_fin,

initcap_sofhouse(initcap(tab.descripcion)) as grupo,
initcap_sofhouse(initcap(tab.norma)) as text_doc,

tab.*

from(

      select

      tab0.id_manual_func,
      tab0.id_manual_coordina,
      tab0.id_tipo_doc,
      tab0.num_doc,
      tab0.fecha_ini,
      tab0.fecha_fin,
      mancoor.id_area,
      mancoor.id_tipo_norma,
      mancoor.num_doc_sop,
      mancoor.fecha_doc_sop,
      detman.orden,
      detman.funcion,
      are.codigo,
      are.descripcion,
      tipnor.descripcion as norma

      from no_manual_func tab0

     left join no_manual_coordina mancoor
     on mancoor.id_manual_coordina = tab0.id_manual_coordina

     left join no_detalle_manual detman
     on mancoor.id_manual_coordina = detman.id_manual_coordina

     left join area are
     on mancoor.id_area = are.id_area

     left join tipo_de_norma tipnor
     on tipnor.id_tipo_norma = mancoor.id_tipo_norma

      where
      num_doc is not null
      $P!{whereFuncionarioNumDoc} $P!{whereFuncionarioTipoDoc}

)tab

order by
tab.num_doc,
tab.fecha_ini,
tab.fecha_doc_sop,
tab.orden]]>
	</queryString>
	<field name="DIA_INI" class="java.lang.String"/>
	<field name="MES_INI" class="java.lang.String"/>
	<field name="ANHO_INI" class="java.lang.String"/>
	<field name="DIA_FIN" class="java.lang.String"/>
	<field name="MES_FIN" class="java.lang.String"/>
	<field name="ANHO_FIN" class="java.lang.String"/>
	<field name="GRUPO" class="java.lang.String"/>
	<field name="TEXT_DOC" class="java.lang.String"/>
	<field name="ID_MANUAL_FUNC" class="java.math.BigDecimal"/>
	<field name="ID_MANUAL_COORDINA" class="java.math.BigDecimal"/>
	<field name="ID_TIPO_DOC" class="java.math.BigDecimal"/>
	<field name="NUM_DOC" class="java.lang.String"/>
	<field name="FECHA_INI" class="java.sql.Timestamp"/>
	<field name="FECHA_FIN" class="java.sql.Timestamp"/>
	<field name="ID_AREA" class="java.math.BigDecimal"/>
	<field name="ID_TIPO_NORMA" class="java.math.BigDecimal"/>
	<field name="NUM_DOC_SOP" class="java.lang.String"/>
	<field name="FECHA_DOC_SOP" class="java.sql.Timestamp"/>
	<field name="ORDEN" class="java.math.BigDecimal"/>
	<field name="FUNCION" class="java.lang.String"/>
	<field name="CODIGO" class="java.lang.String"/>
	<field name="DESCRIPCION" class="java.lang.String"/>
	<field name="NORMA" class="java.lang.String"/>
	<group name="manual">
		<groupExpression><![CDATA[$F{ID_MANUAL_COORDINA}]]></groupExpression>
		<groupHeader>
			<band height="40">
				<textField isStretchWithOverflow="true">
					<reportElement stretchType="RelativeToBandHeight" x="0" y="5" width="468" height="25" isRemoveLineWhenBlank="true"/>
					<box leftPadding="0">
						<pen lineWidth="0.75"/>
						<topPen lineWidth="0.0"/>
						<leftPen lineWidth="0.0"/>
						<bottomPen lineWidth="0.0"/>
						<rightPen lineWidth="0.0"/>
					</box>
					<textElement textAlignment="Justified" verticalAlignment="Top">
						<font size="11"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA["Como Coordinador" + $P{letra_a_sin} + " encargad" + $P{letra_a} + " del " + $F{GRUPO} + " del " + $F{DIA_INI} + " de " + $F{MES_INI} + " de " + $F{ANHO_INI} + " al " + $F{DIA_FIN} + " de " + $F{MES_FIN} + " de " + $F{ANHO_FIN} + " desempeñando las siguientes funciones establecidas en la " + $F{TEXT_DOC} + " " + $F{NUM_DOC_SOP} + " de " + $F{ANHO_FIN} + "."]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="4"/>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<detail>
		<band height="14" splitType="Stretch">
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="24" y="0" width="444" height="14"/>
				<box leftPadding="2"/>
				<textElement textAlignment="Justified" verticalAlignment="Top">
					<font size="11" isUnderline="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{FUNCION}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="24" height="14"/>
				<box leftPadding="2"/>
				<textElement>
					<font size="11" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{ORDEN} + ". "]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band splitType="Stretch"/>
	</summary>
	<noData>
		<band/>
	</noData>
</jasperReport>
