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 de matriz de procesos |
---|
30 | * Implementado por: Ing. Diego Uzcátegui, |
---|
31 | * Inicio de codificación: 25-04-13 |
---|
32 | */ |
---|
33 | |
---|
34 | function matriz_de_procesos_reporte_mensual_page(){ |
---|
35 | |
---|
36 | drupal_set_title(t('Matriz de procesos - Mensual')); |
---|
37 | |
---|
38 | $output = '<br>'; |
---|
39 | |
---|
40 | $output .= drupal_get_form('consulta_matriz_de_procesos_reporte_mensual_form'); |
---|
41 | |
---|
42 | $output .= '<br><br>'; |
---|
43 | |
---|
44 | //**************************************************************************** |
---|
45 | |
---|
46 | $mes_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_mp_mensual']['mes']) ? $_SESSION['datos_para_generar_reporte_mp_mensual']['mes'] : date('M') -1; |
---|
47 | $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'),); |
---|
48 | |
---|
49 | $mes_selecc = isset($meses_disponibles[$mes_seleccionado_para_reporte])? $meses_disponibles[$mes_seleccionado_para_reporte]: 'Todos'; |
---|
50 | |
---|
51 | $ente_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_mp_mensual']) && isset($_SESSION['datos_para_generar_reporte_mp_mensual']['ente']) ? $_SESSION['datos_para_generar_reporte_mp_mensual']['ente'] : 0; |
---|
52 | if($ente_seleccionado_para_reporte > 0){ |
---|
53 | $nodo_ente = node_load($ente_seleccionado_para_reporte); |
---|
54 | $ente_selecc = l($nodo_ente->title, 'node/' . $nodo_ente->nid); |
---|
55 | }else{ |
---|
56 | $ente_selecc = 'Todos'; |
---|
57 | } |
---|
58 | |
---|
59 | $anno_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_mp_mensual']) && isset($_SESSION['datos_para_generar_reporte_mp_mensual']['anho']) ? $_SESSION['datos_para_generar_reporte_mp_mensual']['anho'] : date('Y'); |
---|
60 | if($anno_seleccionado_para_reporte > 0){ |
---|
61 | $anho_selecc = $anno_seleccionado_para_reporte; |
---|
62 | }else{ |
---|
63 | $anho_selecc = 'Todos'; |
---|
64 | } |
---|
65 | |
---|
66 | $header = array(); |
---|
67 | |
---|
68 | $rows1 = array(); |
---|
69 | |
---|
70 | $row1 = array(); |
---|
71 | $row1[] = array('data' => 'Año', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
72 | $row1[] = array('data' => $anho_selecc, 'bgcolor' => 'FCFCFC',); |
---|
73 | $rows1[] = $row1; |
---|
74 | |
---|
75 | $row1 = array(); |
---|
76 | $row1[] = array('data' => 'Mes(es)', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
77 | $row1[] = array('data' => $mes_selecc, 'bgcolor' => 'FCFCFC',); |
---|
78 | $rows1[] = $row1; |
---|
79 | |
---|
80 | $row1 = array(); |
---|
81 | $row1[] = array('data' => 'Ente Planificador', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
82 | $row1[] = array('data' => $ente_selecc, 'bgcolor' => 'FCFCFC',); |
---|
83 | $rows1[] = $row1; |
---|
84 | |
---|
85 | $output .= theme('table', $header, $rows1); |
---|
86 | $output .= '<br><br>'; |
---|
87 | |
---|
88 | |
---|
89 | //**************************************************************************** |
---|
90 | $inputs = array(); |
---|
91 | $sql = ''; |
---|
92 | |
---|
93 | $header = array(); |
---|
94 | $row_header = array(); |
---|
95 | $header[] = array('data' => t('Año')); |
---|
96 | $row_header[] = array('data' => '', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
97 | $header[] = array('data' => t('Ente.')); |
---|
98 | $row_header[] = array('data' => '', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
99 | $cab = 2; |
---|
100 | |
---|
101 | $header[] = array('data' => t('Datos del Proyecto'), 'colspan' => 3, ); |
---|
102 | $row_header[] = array('data' => 'Nombre', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
103 | $row_header[] = array('data' => 'Código', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
104 | $row_header[] = array('data' => 'DirectrÃz PNDES', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
105 | $cab += 3; |
---|
106 | |
---|
107 | $row_header[] = array('data' => 'Unidad de Medida', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
108 | $cab += 1; |
---|
109 | |
---|
110 | //colocar cabceras correspondientes avance fisico y financiero para el proyecto en el mes actual |
---|
111 | if($mes_seleccionado_para_reporte == 12){//todos los meses |
---|
112 | |
---|
113 | $header[] = array('data' => t('Meta FÃsica hasta ahora'), 'colspan' => 2,); |
---|
114 | $row_header[] = array('data' => t('Cantidad'), 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
115 | $header[] = array('data' => t('Presupuesto del año') ); |
---|
116 | $row_header[] = array('data' => '', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
117 | $header[] = array('data' => t('Beneficiarios hasta ahora') ); |
---|
118 | $row_header[] = array('data' => '', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
119 | $cab = $cab + 3; |
---|
120 | |
---|
121 | foreach($meses_disponibles as $mes_i){ |
---|
122 | $header[] = array('data' => $mes_i, 'colspan' => 2, ); |
---|
123 | $row_header[] = array('data' => '% Avance FÃsico', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
124 | $row_header[] = array('data' => '% Ejecución Financiera', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
125 | $cab = $cab + 2; |
---|
126 | } |
---|
127 | }else{ |
---|
128 | |
---|
129 | //solo un mes |
---|
130 | $header[] = array('data' => t('Meta FÃsica en el mes') , 'colspan' => 2,); |
---|
131 | $row_header[] = array('data' => t('Cantidad'), 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
132 | $header[] = array('data' => t('Presupuesto del año').'<br>' ); |
---|
133 | $row_header[] = array('data' => '', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
134 | $header[] = array('data' => t('Beneficiarios en el mes') ); |
---|
135 | $row_header[] = array('data' => '', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
136 | $cab = $cab + 3; |
---|
137 | |
---|
138 | //calcular mes actual |
---|
139 | $header[] = array('data' => $meses_disponibles[$mes_seleccionado_para_reporte], 'colspan' => 2, ); |
---|
140 | $row_header[] = array('data' => '% Avance FÃsico', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
141 | $row_header[] = array('data' => '% Ejecución Financiera', 'bgcolor' => 'E6E6E6', 'style' => 'font-weight: bold;'); |
---|
142 | $cab = $cab + 2; |
---|
143 | } |
---|
144 | |
---|
145 | //proyectos operativos con estado aprobado |
---|
146 | $sql1 = "SELECT n.nid, n.title, po.year, po.ente, wn.sid FROM {proyectos_operativos} po, {node} n, {workflow_node} AS wn WHERE po.nid = n.nid AND wn.nid = n.nid AND wn.sid = %d "; |
---|
147 | $inputs[] = variable_get('proyectos_operativos_state_aprobado', NULL); |
---|
148 | |
---|
149 | //verificar filtro de ente planificador |
---|
150 | $ente_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_mp_mensual']) && isset($_SESSION['datos_para_generar_reporte_mp_mensual']['ente']) ? $_SESSION['datos_para_generar_reporte_mp_mensual']['ente'] : 0; |
---|
151 | if($ente_seleccionado_para_reporte > 0){ |
---|
152 | $sql1 .= "AND po.ente = %d "; |
---|
153 | $inputs[] = $ente_seleccionado_para_reporte; |
---|
154 | } |
---|
155 | |
---|
156 | //verificar filtro de anho |
---|
157 | $anno_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_mp_mensual']) && isset($_SESSION['datos_para_generar_reporte_mp_mensual']['anho']) ? $_SESSION['datos_para_generar_reporte_mp_mensual']['anho'] : date('Y'); |
---|
158 | if($anno_seleccionado_para_reporte > 0){ |
---|
159 | $sql1 .= "AND po.year = %d "; |
---|
160 | $inputs[] = $anno_seleccionado_para_reporte; |
---|
161 | } |
---|
162 | |
---|
163 | $queryResult1 = db_query ( $sql1, $inputs); |
---|
164 | $rows = array(); |
---|
165 | $rows[] = $row_header; |
---|
166 | while ($proyectos = db_fetch_array ( $queryResult1 ) ){ |
---|
167 | $row = array(); |
---|
168 | $row[] = array('data' => $proyectos['year'],); |
---|
169 | |
---|
170 | //cargar nodo para mostrar otros datos |
---|
171 | $ente_planificador = node_load($proyectos['ente']); |
---|
172 | $row[] = array('data' => l($ente_planificador->title, 'node/' . $proyectos['ente']),); |
---|
173 | |
---|
174 | $row[] = array('data' => l($proyectos['title'], 'proyectosop/' . $proyectos['nid']),); |
---|
175 | |
---|
176 | //cargar nodo para mostrar otros datos |
---|
177 | $nodo_proyecto = node_load($proyectos['nid']); |
---|
178 | $row[] = array('data' => $nodo_proyecto->field_proyecto_codigo[0]['value'] ); |
---|
179 | $term = taxonomy_get_term($nodo_proyecto->field_proyecto_pndes[0]['value']); |
---|
180 | $row[] = array('data' => $term->name ); |
---|
181 | $term = taxonomy_get_term($nodo_proyecto->field_proyecto_unidadm[0]['value']); |
---|
182 | $row[] = array('data' => $term->name ); |
---|
183 | |
---|
184 | //calcular avance fisico y financiero para el proyecto en el mes actual |
---|
185 | if($mes_seleccionado_para_reporte == 12){ |
---|
186 | |
---|
187 | //calcular cantidad de meta fisica y de beneficiarios |
---|
188 | $datos_mf_benef_monto = _calcular_cantmf_beneficiarios_montoref_total($nodo_proyecto); |
---|
189 | $row[] = array('data' => $datos_mf_benef_monto['cant_ejecut_metafisica'] ); |
---|
190 | $row[] = array('data' => $datos_mf_benef_monto['monto_total_proyecto'] ); |
---|
191 | $row[] = array('data' => $datos_mf_benef_monto['cant_beneficiarios_mes'] ); |
---|
192 | |
---|
193 | //calcular todos los meses |
---|
194 | foreach($meses_disponibles as $id => $mes_i){ |
---|
195 | $porcentajes_avance = _calcular_porcentaje_avance_para_mes($nodo_proyecto, $id); |
---|
196 | $porczonacritica_mf = $porcentajes_avance['avance_fisico'] != 'N/A' ? number_format($porcentajes_avance['avance_fisico'], 2, '.', ',').'%' : 'N/A'; |
---|
197 | $row[] = array('data' => $porczonacritica_mf ); |
---|
198 | $porczonacritica_financiera = $porcentajes_avance['ejecucion_financiera'] != 'N/A' ? number_format($porcentajes_avance['ejecucion_financiera'], 2, '.', ',').'%' : 'N/A'; |
---|
199 | $row[] = array('data' => $porczonacritica_financiera ); |
---|
200 | } |
---|
201 | }else{ |
---|
202 | |
---|
203 | //calcular mes actual |
---|
204 | $porcentajes_avance = _calcular_porcentaje_avance_para_mes($nodo_proyecto, $mes_seleccionado_para_reporte); |
---|
205 | $mf_ejecutado_mes = $porcentajes_avance['valores_particulares']['mf_ejecutado_mes']; |
---|
206 | $row[] = array('data' => $mf_ejecutado_mes ); |
---|
207 | |
---|
208 | //calcular cantidad de meta fisica y de beneficiarios |
---|
209 | $datos_mf_benef_monto = _calcular_cantmf_beneficiarios_montoref_para_mes($nodo_proyecto, $mes_seleccionado_para_reporte); |
---|
210 | $row[] = array('data' => $datos_mf_benef_monto['monto_total_proyecto'] ); |
---|
211 | $row[] = array('data' => $datos_mf_benef_monto['cant_beneficiarios_mes'] ); |
---|
212 | |
---|
213 | $porczonacritica_mf = $porcentajes_avance['avance_fisico'] != 'N/A' ? number_format($porcentajes_avance['avance_fisico'], 2, '.', ',').'%' : 'N/A'; |
---|
214 | $row[] = array('data' => $porczonacritica_mf ); |
---|
215 | $porczonacritica_financiera = $porcentajes_avance['ejecucion_financiera'] != 'N/A' ? number_format($porcentajes_avance['ejecucion_financiera'], 2, '.', ',').'%' : 'N/A'; |
---|
216 | $row[] = array('data' => $porczonacritica_financiera ); |
---|
217 | } |
---|
218 | |
---|
219 | $rows[] = $row; |
---|
220 | } |
---|
221 | |
---|
222 | if (!(count($rows)>1)) { |
---|
223 | $row[] = array('data' => t('No hay resultados para la consulta actual'), 'colspan' => $cab); |
---|
224 | $rows[] = $row; |
---|
225 | } |
---|
226 | |
---|
227 | $output .= theme('table', $header, $rows); |
---|
228 | |
---|
229 | return $output; |
---|
230 | |
---|
231 | } |
---|
232 | |
---|
233 | /** |
---|
234 | * Implementation of consulta_matriz_de_procesos_reporte_form(). |
---|
235 | * Formulario de busqueda de proyecto. |
---|
236 | */ |
---|
237 | function consulta_matriz_de_procesos_reporte_mensual_form($form_state) { |
---|
238 | $form = array(); |
---|
239 | |
---|
240 | //entes planificadores |
---|
241 | $entes = array(); |
---|
242 | $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 '); |
---|
243 | while($ente = db_fetch_object($result)) { |
---|
244 | $entes[$ente->nid] = $ente->title; |
---|
245 | } |
---|
246 | $entes[0] = 'Todos'; |
---|
247 | $ente_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_mp_mensual']) && isset($_SESSION['datos_para_generar_reporte_mp_mensual']['ente']) ? $_SESSION['datos_para_generar_reporte_mp_mensual']['ente'] : 0; |
---|
248 | $form['ente_seleccionado_para_reporte'] = array( |
---|
249 | '#title' => t('Ente Planificador'), |
---|
250 | '#type' => 'select', |
---|
251 | '#default_value' => $ente_seleccionado_para_reporte, |
---|
252 | '#options' => $entes, |
---|
253 | ); |
---|
254 | |
---|
255 | //años disponibles |
---|
256 | $anno_actual = date("Y"); |
---|
257 | for($i = $anno_actual - 10; $i <= $anno_actual; $i++) { |
---|
258 | $annos[$i] = $i; |
---|
259 | } |
---|
260 | $annos[0] = 'Todos'; |
---|
261 | $anno_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_mp_mensual']) && isset($_SESSION['datos_para_generar_reporte_mp_mensual']['anho']) ? $_SESSION['datos_para_generar_reporte_mp_mensual']['anho'] : date('Y'); |
---|
262 | $form['anno_seleccionado_para_reporte'] = array( |
---|
263 | '#title' => t('Consultar para el año'), |
---|
264 | '#type' => 'select', |
---|
265 | '#default_value' => $anno_seleccionado_para_reporte, |
---|
266 | '#options' => $annos, |
---|
267 | ); |
---|
268 | |
---|
269 | //tipo de periodo |
---|
270 | $tipo_periodo = t('Mensual'); |
---|
271 | //subopciones de periodo |
---|
272 | $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'),); |
---|
273 | $mes_seleccionado_para_reporte = isset($_SESSION['datos_para_generar_reporte_mp_mensual']) && isset($_SESSION['datos_para_generar_reporte_mp_mensual']['mes']) ? $_SESSION['datos_para_generar_reporte_mp_mensual']['mes'] : date('M') -1; |
---|
274 | $form['mes_seleccionado_para_reporte'] = array( |
---|
275 | '#title' => t('Mes(es)'), |
---|
276 | '#type' => 'select', |
---|
277 | '#default_value' => $mes_seleccionado_para_reporte, |
---|
278 | '#options' => $sub_opciones, |
---|
279 | ); |
---|
280 | |
---|
281 | //boton de enviar consulta |
---|
282 | $form['buttons'] = array( |
---|
283 | '#prefix' => '<div class="container-inline">', |
---|
284 | '#suffix' => '</div>', |
---|
285 | ); |
---|
286 | $form['buttons']['submit'] = array( |
---|
287 | '#type' => 'submit', |
---|
288 | '#value' => t('Consultar'), |
---|
289 | ); |
---|
290 | return $form; |
---|
291 | } |
---|
292 | |
---|
293 | /** |
---|
294 | * Implementation of consulta_matriz_de_procesos_reporte_form_submit(). |
---|
295 | * cambia el filtro de busqueda de proyectos. |
---|
296 | */ |
---|
297 | function consulta_matriz_de_procesos_reporte_mensual_form_submit($form, &$form_state) { |
---|
298 | $_SESSION['datos_para_generar_reporte_mp_mensual'] = array(); |
---|
299 | |
---|
300 | $_SESSION['datos_para_generar_reporte_mp_mensual']['ente'] = $form_state['values']['ente_seleccionado_para_reporte']; |
---|
301 | $_SESSION['datos_para_generar_reporte_mp_mensual']['anho'] = $form_state['values']['anno_seleccionado_para_reporte']; |
---|
302 | $_SESSION['datos_para_generar_reporte_mp_mensual']['mes'] = $form_state['values']['mes_seleccionado_para_reporte']; |
---|
303 | } |
---|
304 | |
---|
305 | /** |
---|
306 | * Implementation of _calcular_porcentaje_avance_para_mes(). |
---|
307 | * calcula el porcentaje de avance fisico y financiero para un mes particular |
---|
308 | */ |
---|
309 | function _calcular_porcentaje_avance_para_mes($node, $mes){ |
---|
310 | |
---|
311 | //avance fÃsico |
---|
312 | $seg_metafisica_todos = _seguimiento_metafisica_todosmes_proyecto_load_solo_datos_aprobados($node); |
---|
313 | $variacion_planificado_mes = _seguimiento_mesactual_metafisica_proyecto_reformulaciones_load($node, $mes);//calcular variacion por reformulacion |
---|
314 | |
---|
315 | $planificadoMes = $seg_metafisica_todos['seguimiento_metafisica_todosmes'][$mes]['planificadoMes'] + $variacion_planificado_mes; |
---|
316 | $Ejecutado = $seg_metafisica_todos['seguimiento_metafisica_todosmes'][$mes]['ejecutadoMes']; |
---|
317 | $porc_avance_fisico = $planificadoMes ? (($Ejecutado/$planificadoMes) *100) . '%' : 'N/A'; |
---|
318 | |
---|
319 | //ejecución financiera |
---|
320 | $seguimiento_todos_meses_financiero = _seguimiento_financiero_todosmes_proyecto_load_solo_datos_aprobados($node); |
---|
321 | $variacion_total_ref_asignado = _seguimiento_mesactual_total_proyecto_reformulaciones_load($node, $mes);//calcular variación por reformulación |
---|
322 | |
---|
323 | $asignadoMes = $seguimiento_todos_meses_financiero['seguimiento_financiero_todosmes'][$mes]['asignadoMes'] + $variacion_total_ref_asignado; |
---|
324 | $totalCausado = $seguimiento_todos_meses_financiero['seguimiento_financiero_todosmes'][$mes]['causadoMes']; |
---|
325 | $porc_ejecucion_financiera = $asignadoMes ? (($totalCausado/$asignadoMes) *100) . '%' : 'N/A'; |
---|
326 | |
---|
327 | $valores_particulares = array( |
---|
328 | 'mf_planificado_mes' => $planificadoMes,//meta fisica planificada con reformulaciones aprobadas |
---|
329 | 'mf_ejecutado_mes' => $Ejecutado,//meta fisica ejecutada |
---|
330 | 'financiera_asignado_mes' => $asignadoMes,//asignado financiero con reformulaciones aprobadas |
---|
331 | 'financiera_comprometido_mes' => $seguimiento_todos_meses_financiero['seguimiento_financiero_todosmes'][$mes]['comprometidoMes'],//comprometido financiero |
---|
332 | 'financiera_causado_mes' => $totalCausado,//causado financiero |
---|
333 | 'financiera_pagado_mes' => $seguimiento_todos_meses_financiero['seguimiento_financiero_todosmes'][$mes]['pagadoMes'],//pagado financiero |
---|
334 | ); |
---|
335 | |
---|
336 | $porcentajes_avance = array( |
---|
337 | 'avance_fisico' => $porc_avance_fisico, |
---|
338 | 'ejecucion_financiera' => $porc_ejecucion_financiera, |
---|
339 | 'valores_particulares' => $valores_particulares, |
---|
340 | ); |
---|
341 | |
---|
342 | return $porcentajes_avance; |
---|
343 | } |
---|
344 | |
---|
345 | /** |
---|
346 | * Implementation of _calcular_cantmf_beneficiarios_montoref_para_mes(). |
---|
347 | * calcula el porcentaje de avance fisico y financiero para un mes particular (cant ejecutado y beneficiarios) |
---|
348 | */ |
---|
349 | function _calcular_cantmf_beneficiarios_montoref_para_mes($node, $mes){ |
---|
350 | |
---|
351 | //beneficiarios |
---|
352 | $seguimiento_todos_meses_beneficiario = _seguimiento_beneficiario_todosmes_proyecto_load_solo_datos_aprobados($node); |
---|
353 | $cant_beneficiarios_mes = 0; |
---|
354 | |
---|
355 | foreach($seguimiento_todos_meses_beneficiario as $seg_benef){ |
---|
356 | if(_mes_dentro_de_duracion_proyecto($node, $mes)){ |
---|
357 | $cant_beneficiarios_mes += $seg_benef['cant_meses'][$mes]; |
---|
358 | }else{ |
---|
359 | $cant_ejecut_metafisica = 'N/A'; |
---|
360 | $cant_beneficiarios_mes = 'N/A'; |
---|
361 | break; |
---|
362 | } |
---|
363 | } |
---|
364 | |
---|
365 | //monto total del año con reformulaciones aprobadas |
---|
366 | $monto_total_inicial = $node->field_proyecto_monto_anual[0]['value']; |
---|
367 | $variacion_total_aprobada = _variacion_monto_total_por_reformulaciones_proyecto_load($node); |
---|
368 | $monto_total_proyecto = number_format($monto_total_inicial + $variacion_total_aprobada, 0, '.', ' ').' Bs'; |
---|
369 | |
---|
370 | $datos_mf_benef_monto = array( |
---|
371 | 'cant_beneficiarios_mes' => $cant_beneficiarios_mes, |
---|
372 | 'monto_total_proyecto' => $monto_total_proyecto, |
---|
373 | ); |
---|
374 | |
---|
375 | return $datos_mf_benef_monto; |
---|
376 | } |
---|
377 | |
---|
378 | /** |
---|
379 | * Implementation of _calcular_cantmf_beneficiarios_montoref_para_mes(). |
---|
380 | * calcula el porcentaje de avance fisico y financiero total (todos los meses que tenga registrado seguimiento) |
---|
381 | */ |
---|
382 | function _calcular_cantmf_beneficiarios_montoref_total($node){ |
---|
383 | |
---|
384 | //ejecutado meta fÃsica |
---|
385 | $seg_metafisica_todos = _seguimiento_metafisica_todosmes_proyecto_load_solo_datos_aprobados($node); |
---|
386 | $cant_ejecut_metafisica = 0; |
---|
387 | for($i=0; $i<12; $i++){ |
---|
388 | $cant_ejecut_metafisica += $seg_metafisica_todos['seguimiento_metafisica_todosmes'][$i]['ejecutadoMes']; |
---|
389 | } |
---|
390 | |
---|
391 | //beneficiarios |
---|
392 | $seguimiento_todos_meses_beneficiario = _seguimiento_beneficiario_todosmes_proyecto_load_solo_datos_aprobados($node); |
---|
393 | $cant_beneficiarios_mes = 0; |
---|
394 | foreach($seguimiento_todos_meses_beneficiario as $seg_benef){ |
---|
395 | $cant_beneficiarios_mes += $seg_benef['total_benef']; |
---|
396 | } |
---|
397 | |
---|
398 | //monto total del año |
---|
399 | $monto_total_inicial = $node->field_proyecto_monto_anual[0]['value']; |
---|
400 | $variacion_total_aprobada = _variacion_monto_total_por_reformulaciones_proyecto_load($node); |
---|
401 | $monto_total_proyecto = number_format($monto_total_inicial + $variacion_total_aprobada, 0, '.', ' ').' Bs'; |
---|
402 | |
---|
403 | $datos_mf_benef_monto = array( |
---|
404 | 'cant_ejecut_metafisica' => $cant_ejecut_metafisica, |
---|
405 | 'cant_beneficiarios_mes' => $cant_beneficiarios_mes, |
---|
406 | 'monto_total_proyecto' => $monto_total_proyecto, |
---|
407 | ); |
---|
408 | |
---|
409 | return $datos_mf_benef_monto; |
---|
410 | } |
---|