source: sipes/0.3-modules/sipp_reports2/theme/views-view-table--matriz-procesos--page-3.tpl.php

stableversion-3.0
Last change on this file was 303fae2, checked in by José Gregorio Puentes <jpuentes@…>, 9 años ago

se agregaron los modulos

  • Propiedad mode establecida a 100755
File size: 14.6 KB
Línea 
1<?php
2// $Id: views-view-table.tpl.php,v 1.8 2009/01/28 00:43:43 merlinofchaos Exp $
3/**
4 * @file views-view-table.tpl.php
5 * Template to display a view as a table.
6 *
7 * - $title : The title of this group of rows.  May be empty.
8 * - $header: An array of header labels keyed by field id.
9 * - $fields: An array of CSS IDs to use for each field id.
10 * - $class: A class or classes to apply to the table, based on settings.
11 * - $row_classes: An array of classes to apply to each row, indexed by row
12 *   number. This matches the index in $rows.
13 * - $rows: An array of row items. Each row is an array of content.
14 *   $rows are keyed by row number, fields within rows are keyed by field ID.
15 * @ingroup views_templates
16 */
17//print_r($result);
18$row2 =array(
19  'nothing' =>1,
20  'nothing_2' =>1,
21
22);
23$row2_t =array(
24  'total' =>1,
25  'nothing' =>1,
26  'nothing_1' => 1,
27  'nothing_2' =>1,
28  'nothing_3' =>1,
29);
30$total_datos = count($result);
31$total_seg_partidas = array();
32$total_seg = 0;
33$total_plan_partidas = array();
34$total_plan = 0;
35
36
37$suma_plan_meta = 0;
38$suma_porc_meta = 0;
39$suma_plan_financ = 0;
40$suma_porc_financ = 0;
41$suma_eje_meta = 0;
42$suma_eje_financ = 0;
43$partidas_labels = array();
44$cuenta_partidas = count($_POST['partidas']);
45if (isset($_POST['partidas']) && $cuenta_partidas) {
46  foreach($_POST['partidas'] as $campo){
47    $partidas_labels[$campo] = isset($_POST['partida_label_' . $campo])? $_POST['partida_label_' . $campo] : FALSE;
48  }
49}
50$cuenta_financiamiento = count($_POST['financiamiento']);
51$arreglo_label = array();
52$cuenta_f = 0;
53if (isset($_POST['financiamiento']) && count($_POST['financiamiento'])) {
54  foreach($_POST['financiamiento'] as $campo){
55    $father = isset($_POST['finaciamiento_father_' . $campo])? $_POST['finaciamiento_father_' . $campo] : FALSE;
56    if ($father && !isset($arreglo_label[$father])) {
57      $arreglo_label[$father] = array();
58    }
59    if ($father && $_POST['finaciamiento_label_' . $campo]) {
60      $cuenta_f ++;
61      $arreglo_label[$father][$campo] = $_POST['finaciamiento_label_' . $campo];
62    }
63  }
64}
65$sumarow = 0;
66$cuenta_P = count($arreglo_label);
67$rowspan = 1;
68$rowspan1 = $cuenta_partidas? 2 : 1;
69if ($cuenta_P || $cuenta_partidas) {
70  $rowspan = 4;
71  $rowspan1 = 2;
72}
73if (!$cuenta_partidas && $cuenta_f) {
74  $rowspan = 4;
75  $rowspan1 = 1;
76  $sumarow = 2;
77
78}
79
80$planificado = t('Planificado');
81$ejecutado = t('Ejecutado');
82$total_fuentes_by = 0;
83$total_fuentes_by = array();
84$ver_planificado = FALSE;
85$ver_ejecutado = FALSE;
86if (isset($_POST['mostrar']) && count($_POST['mostrar'])) {
87  foreach($_POST['mostrar'] as $mostrar){
88    if ($mostrar == 'planificado') {
89      $ver_planificado = TRUE;
90    }
91    elseif($mostrar == 'ejecutado') {
92      $ver_ejecutado = TRUE;
93    }
94  }
95}
96if (!$ver_planificado) {
97  $cuenta_f = 0;
98  $arreglo_label = array();
99  $adicional_rows = ' rowspan="2"';
100  $rowspan1 = 1;
101}
102if(!$ver_ejecutado) {
103  $adicional_rows = ' rowspan="2"';
104  $rowspan1 = 1;
105}
106//print_r($partidas_labels);
107?>
108<table class="<?php print $class; ?>">
109  <?php if (!empty($title)) : ?>
110    <caption><?php print $title; ?></caption>
111  <?php endif; ?>
112  <thead>
113    <tr>
114      <?php foreach ($header as $field => $label): ?>
115        <th class="views-field views-field-<?php print $fields[$field]; ?>" align="center" rowspan="<?php print $rowspan ; ?>">
116          <?php print $label; ?>
117        </th>
118      <?php endforeach; ?>
119      <?php if ($cuenta_partidas): ?>
120        <?php ?>
121        <th class="views-field views-field-partidas" align="center" colspan="<?php print $cuenta_partidas; ?>">
122          <?php print t('Partidas'); ?>
123        </th>
124      <?php endif; ?>
125      <?php if ($cuenta_f): ?>
126        <th class="views-field views-field-financiamiento" align="center" colspan="<?php print $cuenta_f; ?>">
127          <?php print t('Fuentes de Financiamiento'); ?>
128        </th>
129      <?php endif; ?>
130    </tr>
131    <tr>
132      <?php if ($cuenta_partidas): ?>
133        <?php foreach ($partidas_labels as $field => $label): ?>
134          <th class="views-field views-field-<?php print $fields; ?>" align="center">
135            <?php print $label; ?>
136          </th>
137        <?php endforeach; ?>
138      <?php endif; ?>
139      <?php if ($cuenta_P): ?>
140        <?php foreach ($arreglo_label as $field => $label): ?>
141          <th class="views-field views-field-<?php print $fields; ?>" align="center" colspan="<?php print count($label); ?>">
142            <?php print $field; ?>
143          </th>
144        <?php endforeach; ?>
145      <?php endif; ?>
146    </tr>
147    <tr>
148      <?php if ($cuenta_partidas): ?>
149        <?php foreach ($partidas_labels as $field => $label): ?>
150          <th class="views-field views-field-planificado" align="center" <?php print $adicional_rows; ?>>
151            <?php 
152              if ($ver_planificado){
153                print $planificado; 
154              }
155              else {
156                print $ejecutado;
157              }
158            ?>
159          </th>
160        <?php endforeach; ?>
161      <?php endif; ?>
162      <?php if ($cuenta_P): ?>
163        <?php foreach ($arreglo_label as $field => $label): ?>
164          <?php foreach ($label as $field1 => $label1): ?>
165            <th class="views-field views-field-<?php print $field1; ?>" align="center">
166              <?php print $label1; ?>
167            </th>
168          <?php endforeach; ?>
169        <?php endforeach; ?>
170      <?php endif; ?>
171    </tr>
172    <tr>
173      <?php if ($ver_planificado && $ver_ejecutado && $cuenta_partidas): ?>
174        <?php foreach ($partidas_labels as $field => $label): ?>
175          <th class="views-field views-field-planificado" align="center">
176            <?php print $ejecutado; ?>
177          </th>
178        <?php endforeach; ?>
179      <?php endif; ?>
180      <?php if ($cuenta_P): ?>
181        <?php foreach ($arreglo_label as $field => $label): ?>
182          <?php foreach ($label as $field1 => $label1): ?>
183            <th class="views-field views-field-<?php print $field1; ?>" align="center">
184              <?php print $planificado; ?>
185            </th>
186          <?php endforeach; ?>
187        <?php endforeach; ?>
188      <?php endif; ?>
189    </tr>
190  </thead>
191  <tbody>
192    <?php foreach ($rows as $count => $row): ?>
193      <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
194        <?php foreach ($row as $field => $content): ?>
195          <td class="views-field views-field-<?php print $fields[$field]; ?>" rowspan="<?php print $rowspan1; ?>">
196            <?php print $content; ?>
197          </td>
198        <?php endforeach; ?>
199      <?php if ($cuenta_partidas): ?>
200        <?php foreach ($partidas_labels as $field => $label): ?>
201          <td class="views-field views-field-planificado" align="center" >
202            <?php
203              if ($ver_planificado){ 
204                $valor = isset($result[$count]->suma_partidas[$field])? $result[$count]->suma_partidas[$field] : 0;
205                if (!isset($total_plan_partidas[$field])) {
206                  $total_plan_partidas[$field] = 0;
207                }
208                $total_plan_partidas[$field] += $valor;
209                $total_plan += $valor;
210                print number_format($valor, 2, '.', ',');
211              }
212              else {
213                $ejecutadoP = isset($result[$count]->seg_partidas[$field])? $result[$count]->seg_partidas[$field] : 0;
214                if (!isset($total_seg_partidas[$field])) {
215                  $total_seg_partidas[$field] = 0;
216                }
217                $total_seg_partidas[$field] += $ejecutadoP;
218                $total_seg += $ejecutadoP;
219                print number_format($ejecutadoP, 2, '.', ',');
220              }
221            ?>
222          </td>
223        <?php endforeach; ?>
224      <?php endif; ?>
225      <?php if ($cuenta_P): ?>
226        <?php foreach ($arreglo_label as $field => $label): ?>
227          <?php foreach ($label as $field1 => $label1): ?>
228            <td class="views-field views-field-<?php print $field1; ?>" align="center" rowspan="<?php print $rowspan1; ?>">
229              <?php 
230                $fuente = isset($result[$count]->financiamiento[$field1])? $result[$count]->financiamiento[$field1] : 0;
231                if (!isset($total_fuentes_by[$field1])) {
232                  $total_fuentes_by[$field1] = 0;
233                }
234                $total_fuentes_by[$field1] += $fuente;
235                $total_fuentes += $fuente;
236                print number_format($fuente, 2, '.', ','); 
237              ?>
238            </td>
239          <?php endforeach; ?>
240        <?php endforeach; ?>
241      <?php endif; ?>
242      </tr>
243
244
245
246      <?php if ($ver_planificado  && $ver_ejecutado && $cuenta_partidas): ?>
247      <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
248        <?php foreach ($partidas_labels as $field => $label): ?>
249          <td class="views-field views-field-planificado" align="center">
250            <?php 
251              $ejecutadoP = isset($result[$count]->seg_partidas[$field])? $result[$count]->seg_partidas[$field] : 0;
252              if (!isset($total_seg_partidas[$field])) {
253                $total_seg_partidas[$field] = 0;
254              }
255              $total_seg_partidas[$field] += $ejecutadoP;
256              $total_seg += $ejecutadoP;
257              print number_format($ejecutadoP, 2, '.', ',');
258            ?>
259          </td>
260        <?php endforeach; ?>
261      </tr>
262      <?php endif; ?>
263
264   <?php endforeach; ?>
265   <?php if ($ver_planificado && $cuenta_partidas): ?>
266     <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
267       <td class="views-field views-field-planificado" align="center" colspan="2"  <?php print $adicional_rows; ?>>
268         <b><?php print t('Subtotal Partidas (P)'); ?></b>
269      </td>
270      <?php if ($cuenta_partidas): ?>
271        <?php foreach ($partidas_labels as $field => $label): ?>
272          <td class="views-field views-field-planificado" align="center"  <?php print $adicional_rows; ?>>
273            <?php print number_format($total_plan_partidas[$field], 2, '.', ','); ?>
274          </td>
275        <?php endforeach; ?>
276      <?php endif; ?>
277      <?php if ($cuenta_f): ?>
278        <td class="views-field views-field-<?php print $field1; ?>" align="center" colspan="<?php print $cuenta_f; ?>">
279          <b><?php print t('Sub-Total Fuente de Financiamiento'); ?></b>
280        </td>
281      <?php endif; ?>
282     </tr>
283   <?php endif; ?>
284      <?php if (!$ver_ejecutado && $cuenta_partidas): ?>
285     <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
286        <?php foreach ($arreglo_label as $field => $label): ?>
287          <?php foreach ($label as $field1 => $label1): ?>
288            <td class="views-field views-field-<?php print $field1; ?>" align="center">
289             <?php print number_format($total_fuentes_by[$field1], 2, '.', ','); ?>
290            </td>
291          <?php endforeach; ?>
292        <?php endforeach; ?>
293     </tr>
294      <?php endif; ?>
295
296
297
298   <?php if ($ver_planificado && ($cuenta_partidas || $cuenta_P)): ?>
299     <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
300      <?php if ($cuenta_partidas): ?>
301        <td class="views-field views-field-planificado" align="center" colspan="2"   <?php print $adicional_rows; ?>>
302          <b><?php print t('Subtotal Partidas (P)'); ?></b>
303       </td>
304        <td class="views-field views-field-<?php print $field1; ?>" align="center" colspan="<?php print $cuenta_partidas; ?>"   <?php print $adicional_rows; ?>>
305          <?php print number_format($total_plan, 2, '.', ','); ?>
306        </td>
307      <?php endif; ?>
308      <?php if (!$cuenta_partidas && $cuenta_P): ?>
309       <td class="views-field views-field-planificado" align="center" colspan="2">
310         <b><?php print t('Sub-Total Fuente de Financiamiento'); ?></b>
311      </td>
312      <?php endif; ?>
313      <?php if ($ver_ejecutado && $cuenta_P): ?>
314        <?php foreach ($arreglo_label as $field => $label): ?>
315          <?php foreach ($label as $field1 => $label1): ?>
316            <td class="views-field views-field-<?php print $field1; ?>" align="center">
317              <?php print number_format($total_fuentes_by[$field1], 2, '.', ','); ?>
318            </td>
319          <?php endforeach; ?>
320        <?php endforeach; ?>
321      <?php endif; ?>
322
323      <?php if (!$ver_ejecutado && $cuenta_partidas && $cuenta_f): ?>
324        <td class="views-field views-field-<?php print $field1; ?>" align="center" colspan="<?php print $cuenta_f; ?>">
325          <b><?php print t('Total Fuente de Financiamiento'); ?></b>
326        </td>
327      <?php endif; ?>
328
329      <?php if (!$ver_ejecutado && !$cuenta_partidas && $cuenta_f): ?>
330        <?php foreach ($arreglo_label as $field => $label): ?>
331          <?php foreach ($label as $field1 => $label1): ?>
332            <td class="views-field views-field-<?php print $field1; ?>" align="center">
333              <?php print number_format($total_fuentes_by[$field1], 2, '.', ','); ?>
334            </td>
335          <?php endforeach; ?>
336        <?php endforeach; ?>
337      <?php endif; ?>
338     </tr>
339   <?php endif; ?>
340
341
342   <?php if ($ver_ejecutado && $cuenta_partidas): ?>
343     <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
344       <td class="views-field views-field-planificado" align="center" colspan="2">
345         <b><?php print t('Total Partidas (E)'); ?></b>
346      </td>
347      <?php if ($cuenta_partidas): ?>
348        <?php foreach ($partidas_labels as $field => $label): ?>
349          <td class="views-field views-field-planificado" align="center">
350            <?php print number_format($total_seg_partidas[$field], 2, '.', ','); ?>
351          </td>
352        <?php endforeach; ?>
353      <?php endif; ?>
354      <?php if ($cuenta_f): ?>
355        <td class="views-field views-field-<?php print $field1; ?>" align="center" colspan="<?php print $cuenta_f; ?>">
356          <b><?php print t('Total Fuente de Financiamiento'); ?></b>
357        </td>
358      <?php endif; ?>
359     </tr>
360   <?php endif; ?>
361   <?php if ($cuenta_partidas|| $cuenta_P): ?>
362     <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
363      <?php if ($ver_ejecutado && $cuenta_partidas): ?>
364         <td class="views-field views-field-planificado" align="center" colspan="2">
365           <b><?php print t('Total Partidas (E)'); ?></b>
366        </td>
367        <td class="views-field views-field-<?php print $field1; ?>" align="center" colspan="<?php print $cuenta_partidas; ?>">
368          <?php print number_format($total_seg, 2, '.', ','); ?>
369        </td>
370      <?php endif; ?>
371      <?php if (!$cuenta_partidas && $cuenta_f): ?>
372         <td class="views-field views-field-planificado" align="center" colspan="2">
373           <b><?php print t('Total Fuente de Financiamiento'); ?></b>
374        </td>
375      <?php endif; ?>
376      <?php if ($cuenta_f): ?>
377        <td class="views-field views-field-<?php print $field1; ?>" align="center" colspan="<?php print $cuenta_f; ?>">
378          <?php print number_format($total_fuentes, 2, '.', ','); ?>
379        </td>
380      <?php endif; ?>
381 
382     </tr>
383   <?php endif; ?>
384
385  </tbody>
386</table>
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.