dolibarr 18.0.6
list_print_total.tpl.php
1<?php
2// Move fields of totalizable into the common array pos and val
3if (!empty($totalarray['totalizable']) && is_array($totalarray['totalizable'])) {
4 foreach ($totalarray['totalizable'] as $keytotalizable => $valtotalizable) {
5 $totalarray['pos'][$valtotalizable['pos']] = $keytotalizable;
6 $totalarray['val'][$keytotalizable] = isset($valtotalizable['total']) ? $valtotalizable['total'] : 0;
7 }
8}
9// Show total line
10if (isset($totalarray['pos'])) {
11 print '<tr class="liste_total">';
12 $i = 0;
13 while ($i < $totalarray['nbfield']) {
14 $i++;
15 if (!empty($totalarray['pos'][$i])) {
16 switch ($totalarray['pos'][$i]) {
17 case 'duration';
18 print '<td class="right">';
19 print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0);
20 print '</td>';
21 break;
22 case 'string';
23 print '<td class="left">';
24 print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : '');
25 print '</td>';
26 break;
27 case 'stock';
28 print '<td class="right">';
29 print price2num(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0, 'MS');
30 print '</td>';
31 break;
32 default;
33 print '<td class="right">';
34 print price(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0);
35 print '</td>';
36 break;
37 }
38 } else {
39 if ($i == 1) {
40 if (is_null($limit) || $num < $limit) {
41 print '<td>'.$langs->trans("Total").'</td>';
42 } else {
43 print '<td>';
44 if (is_object($form)) {
45 print $form->textwithpicto($langs->trans("Total"), $langs->transnoentitiesnoconv("Totalforthispage"));
46 } else {
47 print $langs->trans("Totalforthispage");
48 }
49 print '</td>';
50 }
51 } else {
52 print '<td></td>';
53 }
54 }
55 }
56 print '</tr>';
57}
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
Definition date.lib.php:240
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.