dolibarr  19.0.0-dev
linkedobjectblock.tpl.php
1 <?php
2 /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
3  * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
4  * Copyright (C) 2014 Marcos GarcĂ­a <marcosgdf@gmail.com>
5  * Copyright (C) 2017 Charlene Benke <cf.benke@patas-monkey.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21 
22 print "<!-- BEGIN PHP TEMPLATE don/tpl/linkedobjectblock.tpl.php -->\n";
23 
24 global $user;
25 global $noMoreLinkedObjectBlockAfter;
26 
27 $langs = $GLOBALS['langs'];
28 $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
29 
30 $langs->load("donations");
31 
32 $total = 0;
33 $ilink = 0;
34 foreach ($linkedObjectBlock as $key => $objectlink) {
35  $ilink++;
36 
37  $trclass = 'oddeven';
38  if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
39  $trclass .= ' liste_sub_total';
40  }
41  print '<tr class="'.$trclass.'">';
42  print '<td>'.$langs->trans("Donation").'</td>';
43  print '<td>'.$objectlink->getNomUrl(1).'</td>';
44  print '<td class="center">'.$objectlink->ref_client.'</td>';
45  print '<td class="center">'.dol_print_date($objectlink->date, 'day').'</td>';
46  print '<td class="right">';
47  $total = $total + $objectlink->total_ht;
48  echo price($objectlink->total_ht);
49 }
50 print '</td>';
51 print '<td class="right">'.$objectlink->getLibStatut(3).'</td>';
52 print '</tr>';
53 
54 if (count($linkedObjectBlock) > 1) {
55  ?>
56  <tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
57  <td><?php echo $langs->trans("Total"); ?></td>
58  <td></td>
59  <td class="center"></td>
60  <td class="center"></td>
61  <td class="right"><?php echo price($total); ?></td>
62  <td class="right"></td>
63  <td class="right"></td>
64  </tr>
65  <?php
66 }
67 
68 print "<!-- END PHP TEMPLATE -->\n";
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.