1 | <?php |
---|
2 | /** |
---|
3 | * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana |
---|
4 | * @file proyecto_operativo_seguimiento.module |
---|
5 | * Drupal part Module to code proyectos operativos module |
---|
6 | * Copyright 2012 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 Uzcategui |
---|
23 | * @date 2013-02-07 // (anno-mes-dia) |
---|
24 | * Modificado |
---|
25 | * @author CENDITEL Merida - Msc. Juan Vizcarrondo |
---|
26 | * @date 2013-11-19 // (anno-mes-dia) |
---|
27 | * Correccion de meses y formato numerico |
---|
28 | * @version 0.1 |
---|
29 | * |
---|
30 | */ |
---|
31 | |
---|
32 | /** |
---|
33 | * Pagina que muestra los seguimientos de todos los meses de una ae (cuadro resumen de seguimientos) |
---|
34 | */ |
---|
35 | function seguimiento_proyecto_page($node) { |
---|
36 | |
---|
37 | drupal_set_title(t('Seguimiento y Control de Proyecto Operativo')); |
---|
38 | $mes_fase_seg = _obtener_mes_fase_seguimiento_proyecto($node); |
---|
39 | if (_proyecto_seguimiento_mes_mover_estado_access($node, $mes_fase_seg, $message = true)); |
---|
40 | |
---|
41 | $output = ''; |
---|
42 | $output .= '<br>'; |
---|
43 | |
---|
44 | $output .= _mostrar_datos_proyecto($node); |
---|
45 | $output .= _mostrar_indicadores_metafisica_seg_proyecto($node); |
---|
46 | $output .= _mostrar_indicadores_financieros_seg_proyecto($node); |
---|
47 | if (variable_get('proyectos_operativos_muestra_beneficiario', TRUE)) { |
---|
48 | $output .= _mostrar_beneficiarios_seg_proyecto($node); |
---|
49 | } |
---|
50 | $output .= _mostrarleyendazonacritica(); |
---|
51 | return $output; |
---|
52 | } |
---|
53 | |
---|
54 | /** |
---|
55 | * Pagina que carga los datos generales de una accion especifica (datos del proyecto y datos de la accion) |
---|
56 | */ |
---|
57 | function _mostrar_datos_proyecto($node) { |
---|
58 | $mes_fase_seg = _obtener_mes_fase_seguimiento_proyecto($node); |
---|
59 | $seguimiento_proyecto = _seguimiento_mesactual_proyecto_load($node, $mes_fase_seg); |
---|
60 | $state_name = t("Por ingresar"); |
---|
61 | if (workflow_get_state_name($seguimiento_proyecto['segmes']['estado'])) { |
---|
62 | $state_name = workflow_get_state_name($seguimiento_proyecto['segmes']['estado']); |
---|
63 | } |
---|
64 | //print_r($seguimiento_proyecto); |
---|
65 | |
---|
66 | |
---|
67 | $output = ''; |
---|
68 | $opciones = array(t('SI'), t('NO')); |
---|
69 | $node_type = content_types('proyectos_operativos'); |
---|
70 | $fields = $node_type['fields']; |
---|
71 | $output .= '<fieldset><legend>' . t('Datos del Proyecto Operativo') . '</legend>'; |
---|
72 | $output .= '<b>' . $fields['field_proyecto_codigo']['widget']['label'] . ':</b> '.$node->field_proyecto_codigo[0]['value'].'<br>'; |
---|
73 | $output .= '<b>' . t('Nombre del Proyecto') . ':</b> '.$node->titulo_asignado.'<br>'; |
---|
74 | $acumulativo = $opciones[$node->es_acumulativo] ? $opciones[$node->es_acumulativo] : 'N/D'; |
---|
75 | $output .= '<b>' . t('Es acumulativo: ') . '</b> '. $acumulativo . '<br>'; |
---|
76 | $output .= '<b>' . t('Estado del Seguimiento: ') . '</b>' . $state_name . '<br>'; |
---|
77 | $id_field1 = 'field_proyecto_fecha_i'; |
---|
78 | $fecha = explode(' ', $node->{$id_field1}[0]['value']); |
---|
79 | $fecha = explode('-', $fecha[0]); |
---|
80 | $output .= '<b>' . $fields[$id_field1]['widget']['label'] . ':</b> '.$fecha[2] . '/' . $fecha[1] . '/' . $fecha[0].'<br>'; |
---|
81 | $id_field1 = 'field_proyecto_fecha_f'; |
---|
82 | $fecha = explode(' ', $node->{$id_field1}[0]['value']); |
---|
83 | $fecha = explode('-', $fecha[0]); |
---|
84 | $output .= '<b>' . $fields[$id_field1]['widget']['label'] . ':</b> '.$fecha[2] . '/' . $fecha[1] . '/' . $fecha[0].'<br>'; |
---|
85 | if (variable_get('proyectos_operativos_muestra_mcti', TRUE)) { |
---|
86 | $term = taxonomy_get_term($node->field_proyecto_mcti[0]['value']); |
---|
87 | $output .= '<b>' . $fields['field_proyecto_mcti']['widget']['label'] . ':</b> '.$term->name.'<br>'; |
---|
88 | } |
---|
89 | if (variable_get('proyectos_operativos_muestra_pndes', TRUE)) { |
---|
90 | //$term = taxonomy_get_term($node->field_proyecto_pndes[0]['value']); |
---|
91 | $PP = array_reverse(taxonomy_get_parents_all($node->field_proyecto_pndes[0]['value'])); |
---|
92 | //$PP = explode('.', $term->name); |
---|
93 | if (isset($PP[0])) { |
---|
94 | $output .= '<b>' . t('Objetivo Histórico') . ':</b> '. $PP[0]->name . ' - ' . $PP[0]->description . '<br>'; |
---|
95 | } |
---|
96 | if (isset($PP[1])) { |
---|
97 | $output .= '<b>' . t('Objetivo Nacional') . ':</b> '. $PP[1]->name . ' - ' . $PP[1]->description . '<br>'; |
---|
98 | } |
---|
99 | if (isset($PP[2])) { |
---|
100 | $output .= '<b>' . t('Objetivo Estratégico') . ':</b> '. $PP[2]->name . ' - ' . $PP[2]->description . '<br>'; |
---|
101 | } |
---|
102 | if (isset($PP[3])) { |
---|
103 | $output .= '<b>' . t('Objetivo General') . ':</b> '. $PP[3]->name . ' - ' . $PP[3]->description . '<br>'; |
---|
104 | } |
---|
105 | } |
---|
106 | $output .= '</fieldset>'; |
---|
107 | |
---|
108 | return $output; |
---|
109 | } |
---|
110 | |
---|
111 | /** |
---|
112 | * Pagina que carga la tabla de indicadores de meta fÃsica del proyecto |
---|
113 | * revisado 13 marzo 2013 |
---|
114 | */ |
---|
115 | function _mostrar_indicadores_metafisica_seg_proyecto($node) { |
---|
116 | $output = ''; |
---|
117 | $years = variable_get('accion_especifica_de_proyecto_seguimiento_anho_seguimiento', 0); |
---|
118 | $mess = variable_get('accion_especifica_de_proyecto_seguimiento_mes_seguimiento', 0) - 1; |
---|
119 | $meses = json_decode(MESES); |
---|
120 | $format_number = array( |
---|
121 | 'decimals' => variable_get('proyectos_operativos_number_decimals', 0), |
---|
122 | 'dec_point' => variable_get('proyectos_operativos_number_dec_point', ','), |
---|
123 | 'thousands_sep' => variable_get('proyectos_operativos_number_thousands_sep', '.'), |
---|
124 | ); |
---|
125 | //tabla de indicadores financieros de la accion especific |
---|
126 | $seg_metafisica_todos = _seguimiento_metafisica_todosmes_proyecto_load($node); |
---|
127 | $tablas = array(); |
---|
128 | |
---|
129 | $header = array(); |
---|
130 | $header[] = array('data' => t('Mes')); |
---|
131 | $header[] = array('data' => t('Planificado')); |
---|
132 | $header[] = array('data' => t('Ejecutado')); |
---|
133 | $header[] = array('data' => t('% de Logro')); |
---|
134 | $header[] = array('data' => t('Estatus de Ejecución')); |
---|
135 | $header[] = array('data' => t('Información Complementaria')); |
---|
136 | $header[] = array('data' => t('Opciones Disponibles'),); |
---|
137 | |
---|
138 | $rows = array(); |
---|
139 | $acumulativo = TRUE; |
---|
140 | for($i=0; $i<12; $i++) { |
---|
141 | //calcular variacion por reformulacion |
---|
142 | $variacion_planificado_mes = _seguimiento_mesactual_metafisica_proyecto_reformulaciones_load($node, $i); |
---|
143 | $planificadoMes = $seg_metafisica_todos['seguimiento_metafisica_todosmes'][$i]['planificadoMes'] + $variacion_planificado_mes; |
---|
144 | $Ejecutado = $seg_metafisica_todos['seguimiento_metafisica_todosmes'][$i]['ejecutadoMes']; |
---|
145 | $infocomplementaria_metafisica = $seg_metafisica_todos['seguimiento_metafisica_todosmes'][$i]['infocomplementaria_metafisica']; |
---|
146 | $estatus_ejecucion = _calcularzonacritica($planificadoMes, $Ejecutado); |
---|
147 | $porczonacritica = $estatus_ejecucion['porczonacritica']; |
---|
148 | $textozona = $estatus_ejecucion['textozona']; |
---|
149 | $colorzona = $estatus_ejecucion['colorzona']; |
---|
150 | $colorfontzona = $estatus_ejecucion['colorfontzona']; |
---|
151 | |
---|
152 | $row = array(); |
---|
153 | $row[] = array('data' => $meses[$i],); |
---|
154 | //si el mes esta dentro del periodo de duracion de la accion especifica |
---|
155 | if(_mes_dentro_de_duracion_proyecto($node, $i)){ |
---|
156 | $row[] = array('data' => number_format($planificadoMes, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
157 | $row[] = array('data' => number_format($Ejecutado, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
158 | $row[] = array('data' => $porczonacritica,); |
---|
159 | $row[] = array('data' => $textozona, 'style' => 'font-weight: bold;background:' . $colorzona . '; color:' . $colorfontzona); |
---|
160 | $row[] = array('data' => $infocomplementaria_metafisica,); |
---|
161 | |
---|
162 | $seguimiento_proyecto = _seguimiento_mesactual_proyecto_load($node, $i); |
---|
163 | if (_proyecto_operativo_seguimiento_modificar_mes_access($node, $i)){ |
---|
164 | |
---|
165 | $title = ' ' . t('Agregar'); |
---|
166 | if ($seguimiento_proyecto['segmes']['estado']) { |
---|
167 | $title = ' ' . t('Modificar'); |
---|
168 | } |
---|
169 | |
---|
170 | $links = array(); |
---|
171 | $links[] = '<b>'.l( $title, 'proyectosop/' . $node->nid . '/seguimiento/proyecto/' . $i . '/edit/comentario_metafisica').'</b>'; |
---|
172 | $row[] = array('data' => theme('item_list', $links),); |
---|
173 | }else{ |
---|
174 | $row[] = array('data' => '',); |
---|
175 | } |
---|
176 | }else{ |
---|
177 | $row[] = array('data' => '-',);//planificado |
---|
178 | $row[] = array('data' => '-',);//ejecutado |
---|
179 | $row[] = array('data' => '-',);//porcentaje |
---|
180 | $row[] = array('data' => '-',);//estatus de ejecucion |
---|
181 | $row[] = array('data' => '-',);//info complementaria |
---|
182 | $row[] = array('data' => '-',); |
---|
183 | } |
---|
184 | $rows[] = $row; |
---|
185 | } |
---|
186 | $acumuladoPlanificado = $seg_metafisica_todos['acum']['acumuladoPlanificado']; |
---|
187 | $AcumuladoEjecutado = $seg_metafisica_todos['acum']['acumuladoEjecutado']; |
---|
188 | $row = array(); |
---|
189 | |
---|
190 | if (is_numeric($node->es_acumulativo) && !$node->es_acumulativo) { |
---|
191 | $row[] = array('data' => t('Acumulado'),); |
---|
192 | } |
---|
193 | |
---|
194 | $row[] = array('data' => number_format($acumuladoPlanificado, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
195 | |
---|
196 | if (is_numeric($node->es_acumulativo) && !$node->es_acumulativo) { |
---|
197 | $row[] = array('data' => number_format($AcumuladoEjecutado, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),);//total ejecutado |
---|
198 | } |
---|
199 | |
---|
200 | $row[] = array('data' => '', 'colspan' => 4); |
---|
201 | $rows[] = $row; |
---|
202 | $tablas[]= theme('table', $header, $rows); |
---|
203 | |
---|
204 | |
---|
205 | if (count($tablas)) { |
---|
206 | |
---|
207 | $output .= '<fieldset><legend>Indicadores de la Meta FÃsica del Proyecto</legend>'; |
---|
208 | |
---|
209 | $output .= '<b>Descripción del Bien y Servicio:</b> '.$node->field_proyecto_descripcion_bien[0]['value'].'<br>'; |
---|
210 | $term = taxonomy_get_term($node->field_proyecto_unidadm[0]['value']); |
---|
211 | $output .= '<b>Unidad de Medida:</b> '.$term->name.'<br><br>'; |
---|
212 | |
---|
213 | $output .= implode('', $tablas).'</fieldset>'; |
---|
214 | } |
---|
215 | |
---|
216 | return $output; |
---|
217 | } |
---|
218 | |
---|
219 | |
---|
220 | /** |
---|
221 | * Pagina que carga la tabla de indicadores de meta fÃsica de la accion especifica |
---|
222 | */ |
---|
223 | function _mostrar_indicadores_financieros_seg_proyecto($node) { |
---|
224 | $estado_aprobado = variable_get('proyectos_operativos_state_aprobado', NULL); |
---|
225 | $seguimiento_todos_meses_financiero = _seguimiento_financiero_todosmes_proyecto_load($node); |
---|
226 | $years = variable_get('accion_especifica_de_proyecto_seguimiento_anho_seguimiento', 0); |
---|
227 | $meses = array( |
---|
228 | 0 => t('January'), |
---|
229 | 1 => t('February'), |
---|
230 | 2 => t('March'), |
---|
231 | 3 => t('April'), |
---|
232 | 4 => t('May'), |
---|
233 | 5 => t('June'), |
---|
234 | 6 => t('July'), |
---|
235 | 7 => t('August'), |
---|
236 | 8 => t('September'), |
---|
237 | 9 => t('Octuber'), |
---|
238 | 10 => t('November'), |
---|
239 | 11 => t('December'), |
---|
240 | ); |
---|
241 | $format_number = array( |
---|
242 | 'decimals' => variable_get('proyectos_operativos_number_decimals', 0), |
---|
243 | 'dec_point' => variable_get('proyectos_operativos_number_dec_point', ','), |
---|
244 | 'thousands_sep' => variable_get('proyectos_operativos_number_thousands_sep', '.'), |
---|
245 | ); |
---|
246 | //tabla de indicadores financieros del proyecto |
---|
247 | $tablas = array(); |
---|
248 | |
---|
249 | $header = array(); |
---|
250 | $header[] = array('data' => t('Mes')); |
---|
251 | $header[] = array('data' => t('Asignado')); |
---|
252 | $header[] = array('data' => t('Comprometido')); |
---|
253 | $header[] = array('data' => t('Causado')); |
---|
254 | $header[] = array('data' => t('Pagado')); |
---|
255 | $header[] = array('data' => t('% de Inversión')); |
---|
256 | $header[] = array('data' => t('Estatus de la Inversión')); |
---|
257 | $header[] = array('data' => t('Información Complementaria')); |
---|
258 | $header[] = array('data' => t('Opciones Disponibles'),); |
---|
259 | |
---|
260 | |
---|
261 | $rows = array(); |
---|
262 | for($mes=0; $mes<12; $mes++){ |
---|
263 | |
---|
264 | //calcular variación por reformulación |
---|
265 | $variacion_total_ref_asignado = _seguimiento_mesactual_total_proyecto_reformulaciones_load($node, $mes); |
---|
266 | |
---|
267 | $asignadoMes = $seguimiento_todos_meses_financiero['seguimiento_financiero_todosmes'][$mes]['asignadoMes'] + $variacion_total_ref_asignado; |
---|
268 | $totalComprometido = $seguimiento_todos_meses_financiero['seguimiento_financiero_todosmes'][$mes]['comprometidoMes']; |
---|
269 | $totalCausado = $seguimiento_todos_meses_financiero['seguimiento_financiero_todosmes'][$mes]['causadoMes']; |
---|
270 | $totalPagado = $seguimiento_todos_meses_financiero['seguimiento_financiero_todosmes'][$mes]['pagadoMes']; |
---|
271 | $infocomplementaria_financiera = $seguimiento_todos_meses_financiero['seguimiento_financiero_todosmes'][$mes]['infocomplementaria_metafinanciera']; |
---|
272 | $estatus_inversion = _calcularzonacritica($asignadoMes, $totalCausado); |
---|
273 | $porczonacritica = $estatus_inversion['porczonacritica']; |
---|
274 | $textozona = $estatus_inversion['textozona']; |
---|
275 | $colorzona = $estatus_inversion['colorzona']; |
---|
276 | $colorfontzona = $estatus_inversion['colorfontzona']; |
---|
277 | |
---|
278 | $row = array(); |
---|
279 | $row[] = array('data' => $meses[$mes],); |
---|
280 | //si el mes esta dentro del periodo de duracion del proyecto |
---|
281 | if(_mes_dentro_de_duracion_proyecto($node, $mes)){ |
---|
282 | $row[] = array('data' => number_format($asignadoMes, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
283 | $row[] = array('data' => number_format($totalComprometido, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
284 | $row[] = array('data' => number_format($totalCausado, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
285 | $row[] = array('data' => number_format($totalPagado, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
286 | $row[] = array('data' => $porczonacritica,); |
---|
287 | $row[] = array('data' => $textozona, 'style' => 'font-weight: bold;background:' . $colorzona . '; color:' . $colorfontzona); |
---|
288 | $row[] = array('data' => $infocomplementaria_financiera,); |
---|
289 | $links = array(); |
---|
290 | if (_proyecto_operativo_seguimiento_modificar_mes_access($node, $mes)){ |
---|
291 | $title = ' ' . t('Modificar'); |
---|
292 | if (!_proyecto_seguimiento_mes_mover_estado_access($node, $mes)) { |
---|
293 | $transiciones = _obtener_transiciones_disponibles_proyecto($node, $mes); |
---|
294 | if (!count($transiciones['transic']) && $transiciones['estado_actual']<0){ |
---|
295 | $title = ' ' . t('Agregar'); |
---|
296 | $sn++; |
---|
297 | } |
---|
298 | } |
---|
299 | $links[] = '<b>'.l(t($title), 'proyectosop/' . $node->nid . '/seguimiento/proyecto/' . ($mes) . '/edit/comentario_informacionfinanciera').'</b>'; |
---|
300 | } |
---|
301 | $row[] = array('data' => theme('item_list', $links),); |
---|
302 | }else{ |
---|
303 | $row[] = array('data' => '-',); |
---|
304 | $row[] = array('data' => '-',); |
---|
305 | $row[] = array('data' => '-',); |
---|
306 | $row[] = array('data' => '-',); |
---|
307 | $row[] = array('data' => '-',); |
---|
308 | $row[] = array('data' => '-',); |
---|
309 | $row[] = array('data' => '-',); |
---|
310 | $row[] = array('data' => '-',); |
---|
311 | } |
---|
312 | $rows[] = $row; |
---|
313 | } |
---|
314 | |
---|
315 | $acumuladoAsignado = $seguimiento_todos_meses_financiero['acum']['acumuladoAsignado']; |
---|
316 | $AcumuladoTotalComprometido = $seguimiento_todos_meses_financiero['acum']['acumuladoComprometido']; |
---|
317 | $AcumuladoTotalCausado = $seguimiento_todos_meses_financiero['acum']['acumuladoCausado']; |
---|
318 | $AcumuladoTotalPagado = $seguimiento_todos_meses_financiero['acum']['acumuladoPagado']; |
---|
319 | $row = array(); |
---|
320 | $row[] = array('data' => t('Acumulado'),); |
---|
321 | $row[] = array('data' => number_format($acumuladoAsignado, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
322 | $row[] = array('data' => number_format($AcumuladoTotalComprometido, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),);//total comprometido |
---|
323 | $row[] = array('data' => number_format($AcumuladoTotalCausado, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),);//total causado |
---|
324 | $row[] = array('data' => number_format($AcumuladoTotalPagado, $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),);//total pagado |
---|
325 | $row[] = array('data' => '', 'colspan' => 4); |
---|
326 | |
---|
327 | $rows[] = $row; |
---|
328 | $tablas[]= theme('table', $header, $rows); |
---|
329 | |
---|
330 | if (count($tablas)) { |
---|
331 | $output .= '<fieldset><legend>Indicadores Financieros del Proyecto</legend>' . implode('', $tablas); |
---|
332 | $output .= '<br><b>Nota</b>: Los valores de \'Comprometido\', \'Causado\' y \'Pagado\', corresponden al total de los seguimiento de las acciones especÃficas. Si desea modificar estos valores para algun mes, debe modificar los seguimientos de las acciones especÃficas para ese mes.'; |
---|
333 | $output .= '</fieldset>'; |
---|
334 | } |
---|
335 | |
---|
336 | return $output; |
---|
337 | } |
---|
338 | |
---|
339 | |
---|
340 | /** |
---|
341 | * Pagina que carga la tabla de seguimiento de beneficiarios |
---|
342 | */ |
---|
343 | function _mostrar_beneficiarios_seg_proyecto($node) { |
---|
344 | |
---|
345 | $seguimiento_todos_meses_beneficiario = _seguimiento_beneficiario_todosmes_proyecto_load($node); |
---|
346 | $format_number = array( |
---|
347 | 'decimals' => variable_get('proyectos_operativos_number_decimals', 0), |
---|
348 | 'dec_point' => variable_get('proyectos_operativos_number_dec_point', ','), |
---|
349 | 'thousands_sep' => variable_get('proyectos_operativos_number_thousands_sep', '.'), |
---|
350 | ); |
---|
351 | //tabla de indicadores financieros del proyecto |
---|
352 | $tablas = array(); |
---|
353 | |
---|
354 | $header = array(); |
---|
355 | $header[] = array('data' => t('Beneficiario')); |
---|
356 | $header[] = array('data' => t('ENE')); |
---|
357 | $header[] = array('data' => t('FEB')); |
---|
358 | $header[] = array('data' => t('MAR')); |
---|
359 | $header[] = array('data' => t('ABR')); |
---|
360 | $header[] = array('data' => t('MAY')); |
---|
361 | $header[] = array('data' => t('JUN')); |
---|
362 | $header[] = array('data' => t('JUL')); |
---|
363 | $header[] = array('data' => t('AGO')); |
---|
364 | $header[] = array('data' => t('SEP')); |
---|
365 | $header[] = array('data' => t('OCT')); |
---|
366 | $header[] = array('data' => t('NOV')); |
---|
367 | $header[] = array('data' => t('DIC')); |
---|
368 | $header[] = array('data' => t('TOTAL'),); |
---|
369 | $rows = array(); |
---|
370 | foreach($seguimiento_todos_meses_beneficiario as $seg_benef){ |
---|
371 | $row = array(); |
---|
372 | $row[] = array('data' => $seg_benef['nombre'],); |
---|
373 | for($mes=0; $mes<12; $mes++){ |
---|
374 | if(_mes_dentro_de_duracion_proyecto($node, $mes)){ |
---|
375 | $row[] = array('data' => number_format($seg_benef['cant_meses'][$mes], $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
376 | }else{ |
---|
377 | $row[] = array('data' => '-',); |
---|
378 | } |
---|
379 | } |
---|
380 | $row[] = array('data' => number_format($seg_benef['total_benef'], $format_number['decimals'], $format_number['dec_point'], $format_number['thousands_sep']),); |
---|
381 | $rows[] = $row; |
---|
382 | } |
---|
383 | |
---|
384 | $tablas[]= theme('table', $header, $rows); |
---|
385 | |
---|
386 | if (count($tablas)) { |
---|
387 | $output .= '<fieldset><legend>' . t('Beneficiarios del Proyecto (Durante la Ejecución)') . '</legend>' . implode('', $tablas); |
---|
388 | $output .= '</fieldset>'; |
---|
389 | } |
---|
390 | |
---|
391 | return $output; |
---|
392 | } |
---|
393 | |
---|
394 | /** |
---|
395 | * Pagina que muestra la lsita de los seguimientos de las acciones especificas del proyecto |
---|
396 | */ |
---|
397 | function seguimiento_proyecto_y_aes_lista_page($node) { |
---|
398 | |
---|
399 | drupal_set_title(t('Seguimiento y Control del Proyecto y sus Acciones EspecÃficas')); |
---|
400 | /* |
---|
401 | $output = ''; |
---|
402 | $output .= '<br>'; |
---|
403 | |
---|
404 | //acciones especificas |
---|
405 | $output .= '<h4>' . t('Acciones EspecÃficas') . '</h4>'; |
---|
406 | $header = array(); |
---|
407 | $header[] = array('data' => t('Nombre de la Acción EspecÃfica')); |
---|
408 | $header[] = array('data' => t('Enlace')); |
---|
409 | |
---|
410 | $rows = array(); |
---|
411 | |
---|
412 | foreach($node->field_proyecto_accion_esp as $accionEspecifica) {//recorrido por todas las acciones especificas |
---|
413 | $accion_esp_load = node_load($accionEspecifica['nid']); |
---|
414 | if ($accion_esp_load && $accion_esp_load->type == 'accion_especifica') {//accion especifica cargada |
---|
415 | $row = array(); |
---|
416 | $links = array(); |
---|
417 | $row[] = array('data' => $accion_esp_load->titulo_asignado,); |
---|
418 | $links[] = '<b>'.l(t('Seguimiento de la AE'), 'proyectosop/' . $node->nid . '/seguimiento/ae/' . $accion_esp_load->nid . '/view') . '</b>'; |
---|
419 | $row[] = array('data' => theme('item_list', $links),); |
---|
420 | $rows[] = $row; |
---|
421 | } |
---|
422 | } |
---|
423 | |
---|
424 | $output .= theme('table', $header, $rows); |
---|
425 | |
---|
426 | //proyecto |
---|
427 | $output .= '<h4>' . t('Proyecto Operativo') . '</h4>'; |
---|
428 | $header = array(); |
---|
429 | $header[] = array('data' => t('Nombre del Proyecto')); |
---|
430 | $header[] = array('data' => t('Enlace')); |
---|
431 | |
---|
432 | $rows = array(); |
---|
433 | |
---|
434 | $row = array(); |
---|
435 | $links = array(); |
---|
436 | $row[] = array('data' => $node->titulo_asignado,); |
---|
437 | $links[] = '<b>'.l(t('Seguimiento del Proyecto'), 'proyectosop/' . $node->nid . '/seguimiento/proyecto').'</b>'; |
---|
438 | $row[] = array('data' => theme('item_list', $links),); |
---|
439 | $rows[] = $row; |
---|
440 | |
---|
441 | $output .= theme('table', $header, $rows); |
---|
442 | */ |
---|
443 | |
---|
444 | //$nodo_proyecto = node_load($proyecto->nid); |
---|
445 | if (_proyectooperativo_esta_aprobado($node)) { |
---|
446 | |
---|
447 | $output .= '<br>' . t('Estimado(a) Usuario(a), para ingresar el <b>Seguimiento del Proyecto Operativo</b> debe <i>ingresar primero</i> los <b>Seguimiento de las Acciones EspecÃficas</b> del mismo, los cuales se muestran a continuación.<br>'); |
---|
448 | |
---|
449 | $mes_fase_seg = _obtener_mes_fase_seguimiento_proyecto($node); |
---|
450 | $transiciones_dispo = _obtener_transiciones_disponibles($form['#node'], $form['#mes']); |
---|
451 | |
---|
452 | $seguimiento_proyecto = _seguimiento_mesactual_proyecto_load($node, $mes_fase_seg); |
---|
453 | $state_name = t("Por ingresar"); |
---|
454 | if (workflow_get_state_name($seguimiento_proyecto['segmes']['estado'])) { |
---|
455 | $state_name = workflow_get_state_name($seguimiento_proyecto['segmes']['estado']); |
---|
456 | } |
---|
457 | $output .= '<h4>' . t('Estado del Seguimiento: ') . $state_name . '</h4><hr>'; |
---|
458 | $meses = json_decode(MESES); |
---|
459 | $cnt = variable_get('seguimiento_proyectos_cantidad_meses_seguimiento', 0); |
---|
460 | $mes_seguimiento_proyecto_y_aes = variable_get('accion_especifica_de_proyecto_seguimiento_mes_seguimiento', 0); |
---|
461 | //proyectosop/%proyectosop/seguimiento/proyecto_aes |
---|
462 | if ($mes_seguimiento_proyecto_y_aes < ($mes_fase_seg+1)) { |
---|
463 | $output = t('No se puede realizar el seguimiento, Estara disponible a partir de @mes, fecha de inicio del proyecto.', array('@mes' => $meses[$mes_fase_seg])); |
---|
464 | $output .= '<br>'; |
---|
465 | return '<br><div class="messages warning">' . $output . '</div>'; |
---|
466 | } |
---|
467 | else { |
---|
468 | $output .= '<div style="background: #eee; padding: 10px; margin: -10px;"><h4><b>' . t('Acciones Especificas:', array('@mes' => $meses[$i])) . '</b>'; |
---|
469 | foreach($node->field_proyecto_accion_esp as $accion) { |
---|
470 | $k++; |
---|
471 | $accion_nid = (object) $accion; |
---|
472 | $accion = node_load($accion_nid->nid); |
---|
473 | $output .= "<h3> $k-) " . $accion->field_accion_titulo[0]['value'] . "</h3>"; |
---|
474 | $output .= "<ul>"; |
---|
475 | |
---|
476 | for ($i=$mes_fase_seg; $i<=$cnt; $i++) { |
---|
477 | if (_proyecto_operativo_seguimiento_modificar_mes_access($node, $i)) { |
---|
478 | $title = ' Modificar'; |
---|
479 | if (!_proyecto_seguimiento_mes_mover_estado_access($accion, $i)) { |
---|
480 | $transiciones = _obtener_transiciones_disponibles($accion, $i); |
---|
481 | if (!count($transiciones['transic']) && $transiciones['estado_actual']<0) { |
---|
482 | $title = ' Agregar'; |
---|
483 | $sn++; |
---|
484 | } |
---|
485 | } |
---|
486 | $enlace_fase_seg = '<b>' . l(t('Fase de Seguimiento del mes de @mes', array('@mes' => $meses[$i])), 'proyectosop/' . $node->nid. "/seguimiento/ae/$accion_nid->nid/$i/edit") . '</b>'; |
---|
487 | $output .= '<li>' . t("$title la ") . ' ' . $enlace_fase_seg . '</li>'; |
---|
488 | } |
---|
489 | |
---|
490 | } |
---|
491 | $output .= '</ul>'; |
---|
492 | if (!_proyecto_operativo_seguimiento_modificar_mes_access($node, $i)) { |
---|
493 | $enlace_fase_seg = '<b>'.l(t('Fase de Seguimiento'), 'proyectosop/' . $node->nid. "/seguimiento/ae/$accion_nid->nid/view") . '</b>'; |
---|
494 | $output .= t("Consultar el resumen de la ") . ' ' . $enlace_fase_seg; |
---|
495 | } |
---|
496 | } |
---|
497 | $output .= '<b>' . l(t('Consultar el Resumen General de las Acciones Especificas', array('@mes' => $meses[$i])), 'proyectosop/' . $node->nid. "/seguimiento/ae") . '</b></div>'; |
---|
498 | |
---|
499 | $output .= '<h4>' . t('Proyecto:') . '</h4>'; |
---|
500 | $output .= '<h3>' . $node->field_proyecto_titulo[0]['value'] . '</h3>'; |
---|
501 | $output .= t("Consultar ") . '<b>' . l(t('el resumen general del proyecto y reportar el seguimiento.'), 'proyectosop/' . $node->nid. "/seguimiento/proyecto") . '</b>'; |
---|
502 | if (_proyecto_seguimiento_mes_mover_estado_access($node, $mes_fase_seg, true)) { |
---|
503 | $output .= '<br><b>'.l(t('Enviar el Seguimiento'), 'proyectosop/' . $node->nid. "/seguimiento/workflow") . '.</b> (' . t("Haga Click Para reportar el seguimiento del proyecto") . ')<br>'; |
---|
504 | } |
---|
505 | $output .= '<ul>'; |
---|
506 | for ($i=$mes_fase_seg; $i<=$cnt; $i++) { |
---|
507 | if (_proyecto_operativo_seguimiento_modificar_mes_access($node, $i)) { |
---|
508 | if ($transiciones_dispo = _obtener_transiciones_disponibles_proyecto($node, $i)) { |
---|
509 | $title = t(' Modificar'); |
---|
510 | if (!count($transiciones_dispo['transic']) && $transiciones_dispo['estado_actual']<0) { |
---|
511 | $title = t(' Agregar'); |
---|
512 | } |
---|
513 | $output .= '<li>'. $title . '<b>' . l(t(" el Seguimiento y Control de Proyecto Operativo de @mes", array('@mes' => $meses[$i])), 'proyectosop/' . $node->nid. "/seguimiento/proyecto/$i/edit/full") . '</b></li>'; |
---|
514 | } |
---|
515 | } |
---|
516 | } |
---|
517 | $output .= '</ul>'; |
---|
518 | |
---|
519 | } |
---|
520 | } |
---|
521 | |
---|
522 | |
---|
523 | return $output; |
---|
524 | } |
---|