dolibarr 19.0.3
list_print_subtotal.tpl.php
1<?php
2
3// Move fields of totalizable into the common array pos and val
4if (!empty($subtotalarray['totalizable']) && is_array($subtotalarray['totalizable'])) {
5 foreach ($subtotalarray['totalizable'] as $keytotalizable => $valtotalizable) {
6 $totalarray['pos'][$valtotalizable['pos']] = $keytotalizable;
7 $subtotalarray['val'][$keytotalizable] = isset($valtotalizable['total']) ? $valtotalizable['total'] : 0;
8 }
9}
10// Show total line
11if (isset($totalarray['pos'])) {
12 print '<tr class="liste_total">';
13 $j = 0;
14 while ($j < $totalarray['nbfield']) {
15 $j++;
16 if (!empty($totalarray['pos'][$j])) {
17 switch ($totalarray['pos'][$j]) {
18 case 'duration':
19 print '<td class="right">';
20 print(!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? convertSecondToTime($subtotalarray['val'][$totalarray['pos'][$j]], 'allhourmin') : 0);
21 print '</td>';
22 break;
23 case 'string':
24 print '<td class="left">';
25 print(!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? $subtotalarray['val'][$totalarray['pos'][$j]] : '');
26 print '</td>';
27 break;
28 case 'stock':
29 print '<td class="right">';
30 print price2num(!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? $subtotalarray['val'][$totalarray['pos'][$j]] : 0, 'MS');
31 print '</td>';
32 break;
33 default:
34 print '<td class="right">';
35 print price(!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? $subtotalarray['val'][$totalarray['pos'][$j]] : 0);
36 print '</td>';
37 break;
38 }
39 $subtotalarray['val'][$totalarray['pos'][$j]] = 0;
40 } else {
41 if ($j == 1) {
42 print '<td>'.$langs->trans("SubTotal").'</td>';
43 } else {
44 print '<td></td>';
45 }
46 }
47 }
48 print '</tr>';
49}
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:243
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.