1 | <?php |
---|
2 | |
---|
3 | ?> |
---|
4 | <?php if ($accion->field_acciones_ente[0]['nid']): ?> |
---|
5 | <h1><?php print t('Datos de la Acción Centralizada'); ?></h1> |
---|
6 | <p> |
---|
7 | <b><?php print t('Ente'); ?>:</b> <?php print $ente_planificador->title;?> |
---|
8 | </p> |
---|
9 | <p> |
---|
10 | <b><?php print t('Año'); ?> :</b> <?php print $accion->anhoaccion_centralizada; ?> |
---|
11 | </p> |
---|
12 | <p> |
---|
13 | <b><?php print t('Autor'); ?>:</b> <?php print $accion->name; ?> |
---|
14 | </p> |
---|
15 | <p> |
---|
16 | <b><?php print t('Fecha de creación'); ?>:</b> <?php print format_date($node->created); ?> |
---|
17 | </p> |
---|
18 | <p> |
---|
19 | <b><?php print t('Fecha de la última actualización'); ?>:</b> <?php print format_date($accion->changed); ?> |
---|
20 | </p> |
---|
21 | <?php endif ?> |
---|
22 | <h1><?php print t('Acciones Centralizadas'); ?></h1> |
---|
23 | <?php |
---|
24 | $field_form = array(); |
---|
25 | $total_accion = 0; |
---|
26 | $headers = array(); |
---|
27 | $header = array(); |
---|
28 | $header[] = array('data' => t('Partidas'), 'colspan' => '2', 'align' => 'center'); |
---|
29 | foreach($ftypes as $texto) { |
---|
30 | $header[] = array('data' => $texto, 'align' => 'center'); |
---|
31 | } |
---|
32 | $header[] = array('data' => t('Total'), 'align' => 'center'); |
---|
33 | foreach ($campos as $id) { |
---|
34 | if (count($accion->{$id})) { |
---|
35 | $rows = array(); |
---|
36 | $sumas = array(); |
---|
37 | $sumaT = 0; |
---|
38 | foreach($accion->{$id} as $partida) { |
---|
39 | if(!empty($partida['tid'])) { |
---|
40 | $field_form[$id][] = $partida; |
---|
41 | $row = array(); |
---|
42 | $row1 = array(); |
---|
43 | $row[] = array('data' => $partida_nombre[$partida['tid']], 'rowspan' => '2'); |
---|
44 | $row[] = array('data' => t('planificado'),); |
---|
45 | $row1[] = array('data' => t('variación'),); |
---|
46 | $total = 0; |
---|
47 | $total1 = 0; |
---|
48 | $i = 1; |
---|
49 | foreach($ftypes as $id_field => $texto) { |
---|
50 | $varia = isset($variaciones[$id][$partida['tid']][$id_field]) ? $variaciones[$id][$partida['tid']][$id_field] : 0; |
---|
51 | $min = $partida[$id_field] + $varia; |
---|
52 | $total += $min; |
---|
53 | $total_accion += $min; |
---|
54 | $valor = isset($reformula[$id][$partida['tid']][$id_field])? $reformula[$id][$partida['tid']][$id_field] : 0; |
---|
55 | $total1 += $valor; |
---|
56 | if (!isset($sumas[$id_field])) { |
---|
57 | $sumas[$id_field] = 0; |
---|
58 | } |
---|
59 | $sumas[$id_field] += $min + $valor; |
---|
60 | $sumaT += $min + $valor; |
---|
61 | $row[] = array('data' => number_format($min, 2, '.', ','), 'align' => 'center',); |
---|
62 | $row1[] = array('data' => number_format($valor, 2, '.', ','), 'align' => 'center',); |
---|
63 | $i++; |
---|
64 | } |
---|
65 | $row[] = array('data' => number_format($total, 2, '.', ','), 'align' => 'center',); |
---|
66 | $rows[] = $row; |
---|
67 | $row1[] = array('data' => number_format($total1, 2, '.', ','), 'align' => 'center',); |
---|
68 | $rows[] = $row1; |
---|
69 | } |
---|
70 | } |
---|
71 | if (!isset($outputs[$grupos_fields[$id]])) { |
---|
72 | $outputs[$grupos_fields[$id]] = array(); |
---|
73 | } |
---|
74 | if(count($rows)) { |
---|
75 | $row = array(); |
---|
76 | $row[] = array('data' => '<b>' . t('TOTAl') . '</b>', 'colspan' => '2', 'align' => 'right'); |
---|
77 | foreach($ftypes as $id_field => $texto) { |
---|
78 | if (!isset($sumas[$id_field])) { |
---|
79 | $sumas[$id_field] = 0; |
---|
80 | } |
---|
81 | $row[] = array('data' => number_format($sumas[$id_field], 2, '.', ','), 'align' => 'center',); |
---|
82 | } |
---|
83 | $row[] = array('data' => number_format($sumaT, 2, '.', ','), 'align' => 'center',); |
---|
84 | $rows[] = $row; |
---|
85 | $outputs[$grupos_fields[$id]][] = '<h2>' . $fields_title[$id] . '</h2>' . theme('table', $header, $rows, array('border' => '1')); |
---|
86 | } |
---|
87 | } |
---|
88 | } |
---|
89 | foreach($grupos as $id => $grupo) { |
---|
90 | if (isset($outputs[$id]) && count($outputs[$id])) { |
---|
91 | print '<h1>' . $grupo['label'] . '</h1>' . implode('', $outputs[$id]); |
---|
92 | } |
---|
93 | } |
---|
94 | if (count($historys)) { |
---|
95 | $header = array(); |
---|
96 | $header[] = array('data' => t('Fecha'), 'align' => 'center',); |
---|
97 | $header[] = array('data' => t('Estado'), 'align' => 'center',); |
---|
98 | $header[] = array('data' => t('Estado anterior'), 'align' => 'center',); |
---|
99 | $header[] = array('data' => t('Comentario'), 'align' => 'center',); |
---|
100 | $header[] = array('data' => t('Usuario'), 'align' => 'center',); |
---|
101 | $rows = array(); |
---|
102 | foreach($historys as $history) { |
---|
103 | $row = array(); |
---|
104 | $row[] = array('data' => format_date($history->date),); |
---|
105 | $row[] = array('data' => $states['states'][$history->estado], 'align' => 'center',); |
---|
106 | $row[] = array('data' => $states['states'][$history->estado_ant], 'align' => 'center',); |
---|
107 | $row[] = array('data' => $history->comentario,); |
---|
108 | $row[] = array('data' => $history->name, 'align' => 'center',); |
---|
109 | $rows[] = $row; |
---|
110 | } |
---|
111 | if (count($rows)) { |
---|
112 | print '<h1>' . t('Historial') . ':</h1>' . theme('table', $header, $rows, array('border' => '1')); |
---|
113 | } |
---|
114 | else { |
---|
115 | print '<h1>' . t('Historial') . ':</h1><p>' . t('No existe historial para esta reformulación') . '</p>'; |
---|
116 | } |
---|
117 | } |
---|
118 | ?> |
---|