[a0b4327] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * Sistema Integral de Planificación y Presupuesto (SIPP) |
---|
| 4 | * @file reportes_sipp.module |
---|
| 5 | * Drupal part Module to Sistema Integral de Planificación y Presupuesto (SIPP) |
---|
| 6 | * Copyright 2013 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL) |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or modify |
---|
| 9 | * it under the terms of the GNU General Public License as published by |
---|
| 10 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | * (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 21 | * |
---|
| 22 | * @author Cenditel Merida - Ing. Diego Uzcátegui (diego.uzc [at] gmail [dot] com) |
---|
| 23 | * @date 2013-05-01 // (año-mes-dia) |
---|
| 24 | * @version 0.1 // (0.1) |
---|
| 25 | * |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | /* |
---|
| 29 | * Pagina que muestra el reporte unidad ejecutora |
---|
| 30 | * Implementado por: Ing. Diego Uzcátegui, |
---|
| 31 | * Inicio de codificación: 06-05-13 |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | function resultados_por_unidad_ejecutora_reporte_mensual_page(){ |
---|
| 35 | |
---|
| 36 | module_load_include('inc', 'reportes_sipp' , 'includes/matriz_de_procesos_reporte_mensual.pages'); |
---|
| 37 | |
---|
| 38 | drupal_set_title(t('Resultado por Unidad Ejecutora')); |
---|
| 39 | |
---|
| 40 | $output = '<br>'; |
---|
| 41 | |
---|
| 42 | $output .= drupal_get_form('consulta_resultados_por_unidad_ejecutora_reporte_mensual_form'); |
---|
| 43 | |
---|
| 44 | $output .= '<br><br>'; |
---|
| 45 | |
---|
| 46 | //mostrar datos de la consulta |
---|
| 47 | $mes_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_rpue_mensual']['mes']) ? $_SESSION['datos_para_generar_reporte_rpue_mensual']['mes'] : date('M') -1; |
---|
| 48 | $meses_disponibles = array(t('Enero'), t('Febrero'), t('Marzo'), t('Abril'), t('Mayo'), t('Junio'), t('Julio'), t('Agosto'), t('Septiembre'), t('Octubre'), t('Noviembre'), t('Diciembre'), t('Todos (Total Anual)'),); |
---|
| 49 | |
---|
| 50 | $anno_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_rpue_mensual']) && isset($_SESSION['datos_para_generar_reporte_rpue_mensual']['anho']) ? $_SESSION['datos_para_generar_reporte_rpue_mensual']['anho'] : date('Y'); |
---|
| 51 | if($anno_seleccionado_para_reporte > 0){ |
---|
| 52 | $anho_selecc = $anno_seleccionado_para_reporte; |
---|
| 53 | }else{ |
---|
| 54 | $anho_selecc = 'Por seleccionar'; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | $ente_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_rpue_mensual']) && isset($_SESSION['datos_para_generar_reporte_rpue_mensual']['ente']) ? $_SESSION['datos_para_generar_reporte_rpue_mensual']['ente'] : 0; |
---|
| 58 | if($ente_seleccionado_para_reporte > 0){ |
---|
| 59 | $nodo_ente = node_load($ente_seleccionado_para_reporte); |
---|
| 60 | $ente_selecc = l($nodo_ente->title, 'node/' . $nodo_ente->nid); |
---|
| 61 | }else{ |
---|
| 62 | $ente_selecc = 'Por seleccionar'; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | if(($anho_selecc != 'Por seleccionar')&&($ente_selecc != 'Por seleccionar')){ |
---|
| 66 | $estado_aprobado_proyecto = variable_get('proyectos_operativos_state_aprobado', NULL); |
---|
| 67 | $consulta_sql0 = "SELECT count(po.nid) as total from {proyectos_operativos} as po, {workflow_node} as w WHERE po.nid=w.nid AND po.year=%d AND po.ente=%d AND w.sid=%d "; |
---|
| 68 | $consulta_sql1 = "SELECT po.nid as nid from {proyectos_operativos} as po, {workflow_node} as w WHERE po.nid=w.nid AND po.year=%d AND po.ente=%d AND w.sid=%d "; |
---|
| 69 | $Resultado_consulta0 = db_query ($consulta_sql0, $anno_seleccionado_para_reporte, $ente_seleccionado_para_reporte, $estado_aprobado_proyecto); |
---|
| 70 | $Resultado_consulta1 = db_query ($consulta_sql1, $anno_seleccionado_para_reporte, $ente_seleccionado_para_reporte, $estado_aprobado_proyecto); |
---|
| 71 | $proyectos_aprobados = db_fetch_array ( $Resultado_consulta0 ); |
---|
| 72 | $cant_proyectos_del_ente_para_anho_actual = $proyectos_aprobados['total']; |
---|
| 73 | }else{ |
---|
| 74 | $cant_proyectos_del_ente_para_anho_actual = 0; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | $header = array(); |
---|
| 78 | |
---|
| 79 | $rows = array(); |
---|
| 80 | |
---|
| 81 | $row = array(); |
---|
| 82 | $row[] = array('data' => 'Año', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 83 | $row[] = array('data' => $anho_selecc, 'bgcolor' => 'FCFCFC',); |
---|
| 84 | $rows[] = $row; |
---|
| 85 | |
---|
| 86 | $row = array(); |
---|
| 87 | $row[] = array('data' => 'Mes(es)', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 88 | $row[] = array('data' => $meses_disponibles[$mes_seleccionado_para_reporte], 'bgcolor' => 'FCFCFC',); |
---|
| 89 | $rows[] = $row; |
---|
| 90 | |
---|
| 91 | $row = array(); |
---|
| 92 | $row[] = array('data' => 'Unidad Ejecutora', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 93 | $row[] = array('data' => $ente_selecc, 'bgcolor' => 'FCFCFC',); |
---|
| 94 | $rows[] = $row; |
---|
| 95 | |
---|
| 96 | $row = array(); |
---|
| 97 | $row[] = array('data' => 'Cantidad de Proyectos Aprobados', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 98 | $row[] = array('data' => $cant_proyectos_del_ente_para_anho_actual, 'bgcolor' => 'FCFCFC',); |
---|
| 99 | $rows[] = $row; |
---|
| 100 | |
---|
| 101 | $output .= theme('table', $header, $rows); |
---|
| 102 | $output .= '<br><br>'; |
---|
| 103 | |
---|
| 104 | //**************************************************************************** |
---|
| 105 | $inputs = array(); |
---|
| 106 | $sql = ''; |
---|
| 107 | |
---|
| 108 | $header = array(); |
---|
| 109 | $header[] = array('data' => t('Proyecto')); |
---|
| 110 | $header[] = array('data' => t('Indicador de Resultado'), 'colspan' => 3); |
---|
| 111 | $header[] = array('data' => t('Beneficiarios')); |
---|
| 112 | $header[] = array('data' => t('Indicador Financiero'), 'colspan' => 2); |
---|
| 113 | $cab = 7; |
---|
| 114 | |
---|
| 115 | $rows = array(); |
---|
| 116 | |
---|
| 117 | //continuacion de cabecera |
---|
| 118 | $row = array(); |
---|
| 119 | $row[] = array('data' => 'Nombre del Proyecto', 'rowspan' => 4, 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 120 | $row[] = array('data' => 'Unidad de Medida', 'rowspan' => 4, 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 121 | $row[] = array('data' => 'Planificado', 'rowspan' => 2, 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 122 | $row[] = array('data' => '% de Logro', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 123 | $row[] = array('data' => 'Directos e Indirectos', 'rowspan' => 4, 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 124 | $row[] = array('data' => 'Asignado', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 125 | $row[] = array('data' => '% de Inversión', 'rowspan' => 1, 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 126 | $rows[] = $row; |
---|
| 127 | $row = array(); |
---|
| 128 | $row[] = array('data' => 'Estatus de Ejecución', 'rowspan' => 3, 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 129 | $row[] = array('data' => 'Comprometido', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 130 | $row[] = array('data' => 'Estatus de Inversión', 'rowspan' => 3, 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 131 | $rows[] = $row; |
---|
| 132 | $row = array(); |
---|
| 133 | $row[] = array('data' => 'Ejecutado', 'rowspan' => 2, 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 134 | $row[] = array('data' => 'Causado', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 135 | $rows[] = $row; |
---|
| 136 | $row = array(); |
---|
| 137 | $row[] = array('data' => 'Pagado', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
| 138 | $rows[] = $row; |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | //cargar datos |
---|
| 142 | $sombreado = TRUE; |
---|
| 143 | while($proyectos_aprobados = db_fetch_array ( $Resultado_consulta1 ) ){ |
---|
| 144 | $color_celdas_fila = $sombreado ? 'F4F4F4': 'FCFCFC'; |
---|
| 145 | $nodo_proyecto = node_load($proyectos_aprobados['nid']); |
---|
| 146 | |
---|
| 147 | if($mes_seleccionado_para_reporte == 12){ |
---|
| 148 | |
---|
| 149 | //calcular cantidad de meta fisica y de beneficiarios |
---|
| 150 | $datos_mf_benef_monto = _calcular_cantmf_beneficiarios_montoref_total($nodo_proyecto); |
---|
| 151 | $cant_benef_mes = $datos_mf_benef_monto['cant_beneficiarios_mes']; |
---|
| 152 | |
---|
| 153 | $total_mf_planificado_mes = 0; |
---|
| 154 | $total_mf_ejecutado_mes = 0; |
---|
| 155 | $total_financiera_asignado_mes = 0; |
---|
| 156 | $total_financiera_comprometido_mes = 0; |
---|
| 157 | $total_financiera_causado_mes = 0; |
---|
| 158 | $total_financiera_pagado_mes = 0; |
---|
| 159 | |
---|
| 160 | //calcular todos los meses |
---|
| 161 | for($id = 0; $id < 12; $id++){ |
---|
| 162 | |
---|
| 163 | $porcentajes_avance = _calcular_porcentaje_avance_para_mes($nodo_proyecto, $id); |
---|
| 164 | |
---|
| 165 | $mf_planificado_mes = isset($porcentajes_avance['valores_particulares']['mf_planificado_mes'])? $porcentajes_avance['valores_particulares']['mf_planificado_mes'] : 0; |
---|
| 166 | $mf_ejecutado_mes = isset($porcentajes_avance['valores_particulares']['mf_ejecutado_mes'])? $porcentajes_avance['valores_particulares']['mf_ejecutado_mes'] : 0; |
---|
| 167 | $financiera_asignado_mes = isset($porcentajes_avance['valores_particulares']['financiera_asignado_mes'])? $porcentajes_avance['valores_particulares']['financiera_asignado_mes'] : 0; |
---|
| 168 | $financiera_comprometido_mes = isset($porcentajes_avance['valores_particulares']['financiera_comprometido_mes'])? $porcentajes_avance['valores_particulares']['financiera_comprometido_mes'] : 0; |
---|
| 169 | $financiera_causado_mes = isset($porcentajes_avance['valores_particulares']['financiera_causado_mes'])? $porcentajes_avance['valores_particulares']['financiera_causado_mes'] : 0; |
---|
| 170 | $financiera_pagado_mes = isset($porcentajes_avance['valores_particulares']['financiera_pagado_mes'])? $porcentajes_avance['valores_particulares']['financiera_pagado_mes'] : 0; |
---|
| 171 | |
---|
| 172 | $total_mf_planificado_mes += $mf_planificado_mes; |
---|
| 173 | $total_mf_ejecutado_mes += $mf_ejecutado_mes; |
---|
| 174 | $total_financiera_asignado_mes += $financiera_asignado_mes; |
---|
| 175 | $total_financiera_comprometido_mes += $financiera_comprometido_mes; |
---|
| 176 | $total_financiera_causado_mes += $financiera_causado_mes; |
---|
| 177 | $total_financiera_pagado_mes += $financiera_pagado_mes; |
---|
| 178 | } |
---|
| 179 | |
---|
| 180 | $mf_planificado_mes = $total_mf_planificado_mes; |
---|
| 181 | $mf_ejecutado_mes = $total_mf_ejecutado_mes; |
---|
| 182 | $financiera_asignado_mes = $total_financiera_asignado_mes; |
---|
| 183 | $financiera_comprometido_mes = $total_financiera_comprometido_mes; |
---|
| 184 | $financiera_causado_mes = $total_financiera_causado_mes; |
---|
| 185 | $financiera_pagado_mes = $total_financiera_pagado_mes; |
---|
| 186 | |
---|
| 187 | $estatus_ejecucion_mf = _calcularzonacritica($total_mf_planificado_mes, $total_mf_ejecutado_mes); |
---|
| 188 | $porczonacritica_mf = $estatus_ejecucion_mf['porczonacritica']; |
---|
| 189 | $textozona_mf = $estatus_ejecucion_mf['textozona']; |
---|
| 190 | $colorzona_mf = $estatus_ejecucion_mf['colorzona']; |
---|
| 191 | $colorfontzona_mf = $estatus_ejecucion_mf['colorfontzona']; |
---|
| 192 | |
---|
| 193 | $estatus_inversion_financ = _calcularzonacritica($total_financiera_asignado_mes, $total_financiera_causado_mes); |
---|
| 194 | $porczonacritica_financ = $estatus_inversion_financ['porczonacritica']; |
---|
| 195 | $textozona_financ = $estatus_inversion_financ['textozona']; |
---|
| 196 | $colorzona_financ = $estatus_inversion_financ['colorzona']; |
---|
| 197 | $colorfontzona_financ = $estatus_inversion_financ['colorfontzona']; |
---|
| 198 | |
---|
| 199 | }else{ |
---|
| 200 | |
---|
| 201 | //calcular cantidad de meta fisica y de beneficiarios |
---|
| 202 | $datos_mf_benef_monto = _calcular_cantmf_beneficiarios_montoref_para_mes($nodo_proyecto, $mes_seleccionado_para_reporte); |
---|
| 203 | $cant_benef_mes = $datos_mf_benef_monto['cant_beneficiarios_mes']; |
---|
| 204 | |
---|
| 205 | //calcular mes actual |
---|
| 206 | $porcentajes_avance = _calcular_porcentaje_avance_para_mes($nodo_proyecto, $mes_seleccionado_para_reporte); |
---|
| 207 | $avance_fisico = $porcentajes_avance['avance_fisico']; |
---|
| 208 | $avance_financiero = $porcentajes_avance['ejecucion_financiera']; |
---|
| 209 | |
---|
| 210 | $mf_planificado_mes = isset($porcentajes_avance['valores_particulares']['mf_planificado_mes'])? $porcentajes_avance['valores_particulares']['mf_planificado_mes'] : 0; |
---|
| 211 | $mf_ejecutado_mes = isset($porcentajes_avance['valores_particulares']['mf_ejecutado_mes'])? $porcentajes_avance['valores_particulares']['mf_ejecutado_mes'] : 0; |
---|
| 212 | $financiera_asignado_mes = isset($porcentajes_avance['valores_particulares']['financiera_asignado_mes'])? $porcentajes_avance['valores_particulares']['financiera_asignado_mes'] : 0; |
---|
| 213 | $financiera_comprometido_mes = isset($porcentajes_avance['valores_particulares']['financiera_comprometido_mes'])? $porcentajes_avance['valores_particulares']['financiera_comprometido_mes'] : 0; |
---|
| 214 | $financiera_causado_mes = isset($porcentajes_avance['valores_particulares']['financiera_causado_mes'])? $porcentajes_avance['valores_particulares']['financiera_causado_mes'] : 0; |
---|
| 215 | $financiera_pagado_mes = isset($porcentajes_avance['valores_particulares']['financiera_pagado_mes'])? $porcentajes_avance['valores_particulares']['financiera_pagado_mes'] : 0; |
---|
| 216 | |
---|
| 217 | $estatus_ejecucion_mf = _calcularzonacritica($mf_planificado_mes, $mf_ejecutado_mes); |
---|
| 218 | $porczonacritica_mf = $estatus_ejecucion_mf['porczonacritica']; |
---|
| 219 | $textozona_mf = $estatus_ejecucion_mf['textozona']; |
---|
| 220 | $colorzona_mf = $estatus_ejecucion_mf['colorzona']; |
---|
| 221 | $colorfontzona_mf = $estatus_ejecucion_mf['colorfontzona']; |
---|
| 222 | |
---|
| 223 | $estatus_inversion_financ = _calcularzonacritica($financiera_asignado_mes, $financiera_causado_mes); |
---|
| 224 | $porczonacritica_financ = $estatus_inversion_financ['porczonacritica']; |
---|
| 225 | $textozona_financ = $estatus_inversion_financ['textozona']; |
---|
| 226 | $colorzona_financ = $estatus_inversion_financ['colorzona']; |
---|
| 227 | $colorfontzona_financ = $estatus_inversion_financ['colorfontzona']; |
---|
| 228 | |
---|
| 229 | } |
---|
| 230 | $avance_fisico = $porczonacritica_mf.'%'; |
---|
| 231 | $avance_financiero= $porczonacritica_financ.'%'; |
---|
| 232 | |
---|
| 233 | //imprimir columna |
---|
| 234 | $row = array(); |
---|
| 235 | $row[] = array('data' => l($nodo_proyecto->title, 'proyectosop/' . $nodo_proyecto->nid), 'rowspan' => 4, 'bgcolor' => $color_celdas_fila); |
---|
| 236 | $term = taxonomy_get_term($nodo_proyecto->field_proyecto_unidadm[0]['value']); |
---|
| 237 | $row[] = array('data' => $term->name, 'rowspan' => 4, 'bgcolor' => $color_celdas_fila);//'Unidad de Medida' |
---|
| 238 | $row[] = array('data' => $mf_planificado_mes, 'rowspan' => 2, 'bgcolor' => $color_celdas_fila); |
---|
| 239 | $row[] = array('data' => $avance_fisico, 'bgcolor' => $color_celdas_fila);//'% de Logro' |
---|
| 240 | $row[] = array('data' => $cant_benef_mes, 'rowspan' => 4, 'bgcolor' => $color_celdas_fila);//'Directos e Indirectos' |
---|
| 241 | $row[] = array('data' => $financiera_asignado_mes, 'bgcolor' => $color_celdas_fila); |
---|
| 242 | $row[] = array('data' => $avance_financiero, 'rowspan' => 1, 'bgcolor' => $color_celdas_fila);//'% de Inversión' |
---|
| 243 | $rows[] = $row; |
---|
| 244 | $row = array(); |
---|
| 245 | $row[] = array('data' => $textozona_mf, 'rowspan' => 3, 'style' => 'font-weight: bold;background:' . $colorzona_mf . '; color:' . $colorfontzona_mf);//Estatus de Ejecución |
---|
| 246 | $row[] = array('data' => $financiera_comprometido_mes, 'bgcolor' => $color_celdas_fila); |
---|
| 247 | $row[] = array('data' => $textozona_financ, 'rowspan' => 3, 'style' => 'font-weight: bold;background:' . $colorzona_financ . '; color:' . $colorfontzona_financ); |
---|
| 248 | $rows[] = $row; |
---|
| 249 | $row = array(); |
---|
| 250 | $row[] = array('data' => $mf_ejecutado_mes, 'rowspan' => 2, 'bgcolor' => $color_celdas_fila);//'Ejecutado' |
---|
| 251 | $row[] = array('data' => $financiera_causado_mes, 'bgcolor' => $color_celdas_fila); |
---|
| 252 | $rows[] = $row; |
---|
| 253 | $row = array(); |
---|
| 254 | $row[] = array('data' => $financiera_pagado_mes, 'bgcolor' => $color_celdas_fila); |
---|
| 255 | $rows[] = $row; |
---|
| 256 | |
---|
| 257 | $sombreado = !$sombreado; |
---|
| 258 | } |
---|
| 259 | |
---|
| 260 | |
---|
| 261 | if (!(count($rows)>4)) { |
---|
| 262 | $row = array(); |
---|
| 263 | $row[] = array('data' => t('No hay resultados para la consulta actual'), 'colspan' => $cab); |
---|
| 264 | $rows[] = $row; |
---|
| 265 | } |
---|
| 266 | |
---|
| 267 | $output .= theme('table', $header, $rows); |
---|
| 268 | |
---|
| 269 | $output .= _mostrarleyendazonacritica(); |
---|
| 270 | $output .= '<br>'; |
---|
| 271 | |
---|
| 272 | return $output; |
---|
| 273 | |
---|
| 274 | } |
---|
| 275 | |
---|
| 276 | /** |
---|
| 277 | * Implementation of consulta_matriz_de_procesos_reporte_form(). |
---|
| 278 | * Formulario de busqueda de proyecto. |
---|
| 279 | */ |
---|
| 280 | function consulta_resultados_por_unidad_ejecutora_reporte_mensual_form($form_state) { |
---|
| 281 | $form = array(); |
---|
| 282 | |
---|
| 283 | //entes planificadores |
---|
| 284 | $entes = array(); |
---|
| 285 | $result = db_query('SELECT e.nid, n.title FROM {ente_planificador} AS e INNER JOIN {node} AS n ON n.nid = e.nid WHERE n.status = 1 AND e.tipo = 2 '); |
---|
| 286 | while($ente = db_fetch_object($result)) { |
---|
| 287 | $entes[$ente->nid] = $ente->title; |
---|
| 288 | } |
---|
| 289 | $ente_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_rpue_mensual']) && isset($_SESSION['datos_para_generar_reporte_rpue_mensual']['ente']) ? $_SESSION['datos_para_generar_reporte_rpue_mensual']['ente'] : 0; |
---|
| 290 | $form['ente_seleccionado_para_reporte'] = array( |
---|
| 291 | '#title' => t('Ente Planificador'), |
---|
| 292 | '#type' => 'select', |
---|
| 293 | '#default_value' => $ente_seleccionado_para_reporte, |
---|
| 294 | '#options' => $entes, |
---|
| 295 | ); |
---|
| 296 | |
---|
| 297 | |
---|
| 298 | //años disponibles |
---|
| 299 | $anno_actual = date("Y"); |
---|
| 300 | for($i = $anno_actual - 10; $i <= $anno_actual; $i++) { |
---|
| 301 | $annos[$i] = $i; |
---|
| 302 | } |
---|
| 303 | $anno_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_rpue_mensual']) && isset($_SESSION['datos_para_generar_reporte_rpue_mensual']['anho']) ? $_SESSION['datos_para_generar_reporte_rpue_mensual']['anho'] : date('Y'); |
---|
| 304 | $form['anno_seleccionado_para_reporte'] = array( |
---|
| 305 | '#title' => t('Consultar para el año'), |
---|
| 306 | '#type' => 'select', |
---|
| 307 | '#default_value' => $anno_seleccionado_para_reporte, |
---|
| 308 | '#options' => $annos, |
---|
| 309 | ); |
---|
| 310 | |
---|
| 311 | //tipo de periodo |
---|
| 312 | $tipo_periodo = t('Mensual'); |
---|
| 313 | //subopciones de periodo |
---|
| 314 | $sub_opciones = array(t('Enero'), t('Febrero'), t('Marzo'), t('Abril'), t('Mayo'), t('Junio'), t('Julio'), t('Agosto'), t('Septiembre'), t('Octubre'), t('Noviembre'), t('Diciembre'), t('Todos (Total Anual)'),); |
---|
| 315 | $mes_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_rpue_mensual']) && isset($_SESSION['datos_para_generar_reporte_rpue_mensual']['mes']) ? $_SESSION['datos_para_generar_reporte_rpue_mensual']['mes'] : date('M') -1; |
---|
| 316 | $form['mes_seleccionado_para_reporte'] = array( |
---|
| 317 | '#title' => t('Mes(es)'), |
---|
| 318 | '#type' => 'select', |
---|
| 319 | '#default_value' => $mes_seleccionado_para_reporte, |
---|
| 320 | '#options' => $sub_opciones, |
---|
| 321 | ); |
---|
| 322 | |
---|
| 323 | |
---|
| 324 | //boton de enviar consulta |
---|
| 325 | $form['buttons'] = array( |
---|
| 326 | '#prefix' => '<div class="container-inline">', |
---|
| 327 | '#suffix' => '</div>', |
---|
| 328 | ); |
---|
| 329 | $form['buttons']['submit'] = array( |
---|
| 330 | '#type' => 'submit', |
---|
| 331 | '#value' => t('Consultar'), |
---|
| 332 | ); |
---|
| 333 | return $form; |
---|
| 334 | } |
---|
| 335 | |
---|
| 336 | /** |
---|
| 337 | * Implementation of consulta_matriz_de_procesos_reporte_form_submit(). |
---|
| 338 | * cambia el filtro de busqueda de proyectos. |
---|
| 339 | */ |
---|
| 340 | function consulta_resultados_por_unidad_ejecutora_reporte_mensual_form_submit($form, &$form_state) { |
---|
| 341 | $_SESSION['datos_para_generar_reporte_rpue_mensual'] = array(); |
---|
| 342 | |
---|
| 343 | $_SESSION['datos_para_generar_reporte_rpue_mensual']['ente'] = $form_state['values']['ente_seleccionado_para_reporte']; |
---|
| 344 | $_SESSION['datos_para_generar_reporte_rpue_mensual']['anho'] = $form_state['values']['anno_seleccionado_para_reporte']; |
---|
| 345 | $_SESSION['datos_para_generar_reporte_rpue_mensual']['mes'] = $form_state['values']['mes_seleccionado_para_reporte']; |
---|
| 346 | } |
---|