source: sipp/0.3-stable-modules/reportes_sipp/includes/aem/aem_consulta_interactiva.pages.inc @ a0b4327

0.3-stable
Last change on this file since a0b4327 was a0b4327, checked in by José Gregorio Puentes <jpuentes@…>, 9 años ago

Se agregaron los nuevos cambios a los modulos

  • Propiedad mode establecida a 100644
File size: 7.0 KB
Línea 
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&#241;o-mes-dia)
24  * @version 0.1 // (0.1)
25  *
26  */
27
28/*
29 * Pagina que muestra el reporte áreas estratégicas del ministerio
30 * Implementado por: Ing. Diego Uzcátegui,
31 * Inicio de codificación: 06-05-13
32 */
33 
34module_load_include('inc', 'reportes_sipp' , 'includes/aem/funciones_tablas_graficas.pages');
35
36function areas_estrategicas_del_ministerio_reporte_page(){
37
38  module_load_include('inc', 'reportes_sipp' , 'includes/matriz_de_procesos_reporte_trimestral.pages');
39
40  drupal_set_title(t('Áreas Estratégicas del Ministerio'));
41 
42  $output = '<br>';
43  $output .= drupal_get_form('consulta_areas_estrategicas_del_ministerio_reporte_mensual_form');
44  $output .= '<br><br>';
45 
46  $anno_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_aem']['anho']) ? $_SESSION['datos_para_generar_reporte_aem']['anho'] : date('Y');
47  if($anno_seleccionado_para_reporte > 0){
48    $anho_selecc = $anno_seleccionado_para_reporte;
49  }
50 
51  $area_seleccionada_para_reporte = isset($_SESSION['datos_para_generar_reporte_aem']) && isset($_SESSION['datos_para_generar_reporte_aem']['area']) ? $_SESSION['datos_para_generar_reporte_aem']['area'] : 0;
52  if($area_seleccionada_para_reporte > 0){
53    $term = taxonomy_get_term($area_seleccionada_para_reporte);
54    $area_selecc = $term->name;
55  }else{
56    $area_selecc = 'Todas';
57  }
58 
59  $sub_opciones_tipografico = array(t('Columnas'), t('Lineas'),);
60  $tipografico_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_aem']) && isset($_SESSION['datos_para_generar_reporte_aem']['tipografico']) ? $_SESSION['datos_para_generar_reporte_aem']['tipografico'] : 0;
61  $tipografico_selec = $sub_opciones_tipografico[$tipografico_seleccionado_para_reporte];
62 
63  $header = array();
64 
65  $rows = array();
66 
67  $row = array();
68  $row[] = array('data' => 'Año', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;');
69  $row[] = array('data' => $anho_selecc, 'bgcolor' => 'FCFCFC',);
70  $rows[] = $row;
71 
72  $row = array();
73  $row[] = array('data' => 'Área Estratégica del Ministerio', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;');
74  $row[] = array('data' => $area_selecc, 'bgcolor' => 'FCFCFC',);
75  $rows[] = $row;
76 
77  $row = array();
78  $row[] = array('data' => 'Tipo de Gráfico', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;');
79  $row[] = array('data' => $tipografico_selec, 'bgcolor' => 'FCFCFC',);
80  $rows[] = $row;
81
82  $output .= theme('table', $header, $rows);
83  $output .= '<br><br>';
84 
85  //****************************************************************************
86 
87  $datos_cargados = calcular_datos_para_aem_reporte_page($anno_seleccionado_para_reporte, $area_seleccionada_para_reporte, $tipografico_selec);
88 
89  $output .= generar_grafica_producciontrimestres($datos_cargados['datos_anho_actual'], $datos_cargados['param']);
90  $output .= '<br><br>';
91  $output .= generar_tabla_produccion_trimestres($datos_cargados['datos_anho_actual'], $datos_cargados['param']);
92  $output .= '<br><br>';
93  $output .= generar_grafica_historicos($datos_cargados);
94 
95  return $output;
96 
97}
98
99/**
100 * Implementation of consulta_areas_estrategicas_del_ministerio_reporte_mensual_form().
101 */
102function consulta_areas_estrategicas_del_ministerio_reporte_mensual_form($form_state) {
103  $form = array();
104 
105  //años disponibles
106  $anno_actual = date("Y");
107  for($i = $anno_actual - 10; $i <= $anno_actual; $i++) {
108    $annos[$i] = $i;
109  }
110  $anno_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_aem']) && isset($_SESSION['datos_para_generar_reporte_aem']['anho']) ? $_SESSION['datos_para_generar_reporte_aem']['anho'] : date('Y');
111  $form['anno_seleccionado_para_reporte'] = array(
112    '#title' => t('Consultar para el año'),
113    '#type' => 'select',
114    '#default_value' => $anno_seleccionado_para_reporte,
115    '#options' => $annos,
116  );
117
118  //areas estratégicas del ministerio
119  $areas = array();
120  $result = db_query("SELECT td.tid AS tid, td.name AS name FROM {vocabulary} AS v, {term_data} AS td WHERE v.name = 'MPPCTI' AND v.vid = td.vid ");
121  while($area = db_fetch_object($result)) {
122    $areas[$area->tid] = $area->name;
123  }
124  $areas[0] = 'Todas';
125  $area_seleccionada_para_reporte = isset($_SESSION['datos_para_generar_reporte_aem']) && isset($_SESSION['datos_para_generar_reporte_aem']['area']) ? $_SESSION['datos_para_generar_reporte_aem']['area'] : 0;
126  $form['area_seleccionada_para_reporte'] = array(
127    '#title' => t('Área Estratégica del Ministerio'),
128    '#type' => 'select',
129    '#default_value' => $area_seleccionada_para_reporte,
130    '#options' => $areas,
131  );
132 
133  $sub_opciones_tipografico = array(t('Columnas'), t('Lineas'),);
134  $tipografico_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_aem']) && isset($_SESSION['datos_para_generar_reporte_aem']['tipografico']) ? $_SESSION['datos_para_generar_reporte_aem']['tipografico'] : 0;
135  $form['tipografico_seleccionado_para_reporte'] = array(
136    '#title' => t('Tipo de Gráfico'),
137    '#type' => 'select',
138    '#default_value' => $tipografico_seleccionado_para_reporte,
139    '#options' => $sub_opciones_tipografico,
140  );
141   
142  //boton de enviar consulta
143  $form['buttons'] = array(
144    '#prefix' => '<div class="container-inline">',
145    '#suffix' => '</div>',
146  );
147  $form['buttons']['submit'] = array(
148    '#type' => 'submit',
149    '#value' => t('Consultar'),
150  );
151  return $form;
152}
153
154/**
155 * Implementation of consulta_areas_estrategicas_del_ministerio_reporte_mensual_form_submit().
156 */
157function consulta_areas_estrategicas_del_ministerio_reporte_mensual_form_submit($form, &$form_state) {
158  $_SESSION['datos_para_generar_reporte_aem'] = array();
159 
160  $_SESSION['datos_para_generar_reporte_aem']['anho'] = $form_state['values']['anno_seleccionado_para_reporte'];
161  $_SESSION['datos_para_generar_reporte_aem']['area'] = $form_state['values']['area_seleccionada_para_reporte'];
162  $_SESSION['datos_para_generar_reporte_aem']['tipografico'] = $form_state['values']['tipografico_seleccionado_para_reporte'];
163}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.