1 | <?php |
---|
2 | $field_form = array(); |
---|
3 | $total_accion = 0; |
---|
4 | $headers = array(); |
---|
5 | $header = array(); |
---|
6 | $header[] = array('data' => t('Partidas'), 'colspan' => '2'); |
---|
7 | foreach($ftypes as $texto) { |
---|
8 | $header[] = array('data' => $texto); |
---|
9 | } |
---|
10 | $header[] = array('data' => t('Total')); |
---|
11 | foreach ($campos as $id) { |
---|
12 | if (count($accion->{$id})) { |
---|
13 | $field_load = content_fields($id, 'accion_centralizada'); |
---|
14 | $fields_title[$id] = $field_load['widget']['label']; |
---|
15 | $rows = array(); |
---|
16 | foreach($accion->{$id} as $partida) { |
---|
17 | if(!empty($partida['tid'])) { |
---|
18 | $term = taxonomy_get_term($partida['tid']); |
---|
19 | $partida['term'] = $term; |
---|
20 | $field_form[$id][] = $partida; |
---|
21 | $row = array(); |
---|
22 | $row1 = array(); |
---|
23 | $row[] = array('data' => $partida['term']->name, 'rowspan' => '2'); |
---|
24 | $row[] = array('data' => t('planificado'),); |
---|
25 | $row1[] = array('data' => t('variación'),); |
---|
26 | $total = 0; |
---|
27 | $total1 = 0; |
---|
28 | $i = 1; |
---|
29 | foreach($ftypes as $id_field => $texto) { |
---|
30 | $varia = isset($variaciones[$id][$partida['tid']][$id_field]) ? $variaciones[$id][$partida['tid']][$id_field] : 0; |
---|
31 | $min = $partida[$id_field] + $varia; |
---|
32 | $total += $min; |
---|
33 | $total_accion += $min; |
---|
34 | $valor = isset($reformula[$id][$partida['tid']][$id_field])? $reformula[$id][$partida['tid']][$id_field] : 0; |
---|
35 | $total1 += $valor; |
---|
36 | $row[] = array('data' => number_format($min, 2, '.', ','),); |
---|
37 | if ($show_variacion) { |
---|
38 | $row1[] = array('data' => number_format($valor, 2, '.', ','),); |
---|
39 | } |
---|
40 | $i++; |
---|
41 | } |
---|
42 | $row[] = array('data' => number_format($total, 2, '.', ','),); |
---|
43 | $rows[] = $row; |
---|
44 | if ($show_variacion) { |
---|
45 | $row1[] = array('data' => number_format($total1, 2, '.', ','),); |
---|
46 | $rows[] = $row1; |
---|
47 | } |
---|
48 | } |
---|
49 | } |
---|
50 | if (!isset($outputs[$grupos_fields[$id]])) { |
---|
51 | $outputs[$grupos_fields[$id]] = array(); |
---|
52 | } |
---|
53 | if(count($rows)) { |
---|
54 | $outputs[$grupos_fields[$id]][] = '<h2>' . $fields_title[$id] . '</h2>' . theme('table', $header, $rows); |
---|
55 | } |
---|
56 | } |
---|
57 | } |
---|
58 | foreach($grupos as $id => $grupo) { |
---|
59 | if (isset($outputs[$id]) && count($outputs[$id])) { |
---|
60 | print '<h1>' . $grupo['label'] . '</h1>' . implode('', $outputs[$id]); |
---|
61 | } |
---|
62 | } |
---|
63 | if (count($historys)) { |
---|
64 | $header = array(); |
---|
65 | $header[] = array('data' => t('Fecha'),); |
---|
66 | $header[] = array('data' => t('Estado'),); |
---|
67 | $header[] = array('data' => t('Estado anterior'),); |
---|
68 | $header[] = array('data' => t('Comentario'),); |
---|
69 | $header[] = array('data' => t('Usuario'),); |
---|
70 | $rows = array(); |
---|
71 | foreach($historys as $history) { |
---|
72 | $row = array(); |
---|
73 | $row[] = array('data' => format_date($history->date),); |
---|
74 | $row[] = array('data' => $states['states'][$history->estado],); |
---|
75 | $row[] = array('data' => $states['states'][$history->estado_ant],); |
---|
76 | $row[] = array('data' => $history->comentario,); |
---|
77 | $row[] = array('data' => $history->name,); |
---|
78 | $rows[] = $row; |
---|
79 | } |
---|
80 | if (count($rows)) { |
---|
81 | print '<h3>' . t('Historial') . ':</h3>' . theme('table', $header, $rows) . '</div>'; |
---|
82 | } |
---|
83 | else { |
---|
84 | print '<h3>' . t('Historial') . ':</h3><p>' . t('No existe historial para esta reformulación') . '</p>'; |
---|
85 | } |
---|
86 | } |
---|
87 | ?> |
---|