linkedobjectblock.tpl.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
  4. * Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
  5. * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
  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. // Protection to avoid direct call of template
  21. if (empty($conf) || !is_object($conf)) {
  22. print "Error, template page can't be called as URL";
  23. exit;
  24. }
  25. print "<!-- BEGIN PHP TEMPLATE fourn/facture/tpl/linkedobjectblock.tpl.php -->\n";
  26. global $user;
  27. global $noMoreLinkedObjectBlockAfter;
  28. $langs = $GLOBALS['langs'];
  29. $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
  30. $langs->load("bills");
  31. $total = 0; $ilink = 0;
  32. foreach ($linkedObjectBlock as $key => $objectlink) {
  33. $ilink++;
  34. $trclass = 'oddeven';
  35. if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
  36. $trclass .= ' liste_sub_total';
  37. }
  38. ?>
  39. <tr class="<?php echo $trclass; ?>">
  40. <td><?php echo $langs->trans("SupplierInvoice"); ?></td>
  41. <td><a href="<?php echo DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowBill"), "bill").' '.$objectlink->ref; ?></a></td>
  42. <td class="left"><?php echo $objectlink->ref_supplier; ?></td>
  43. <td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
  44. <td class="right"><?php
  45. if ($user->rights->fournisseur->facture->lire) {
  46. $sign = 1;
  47. if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
  48. $sign = -1;
  49. }
  50. if ($objectlink->statut != 3) {
  51. // If not abandonned
  52. $total = $total + $sign * $objectlink->total_ht;
  53. echo price($objectlink->total_ht);
  54. } else {
  55. echo '<strike>'.price($objectlink->total_ht).'</strike>';
  56. }
  57. } ?></td>
  58. <td class="right"><?php
  59. if (method_exists($objectlink, 'getSommePaiement')) {
  60. echo $objectlink->getLibStatut(3, $objectlink->getSommePaiement());
  61. } else {
  62. echo $objectlink->getLibStatut(3);
  63. }
  64. ?></td>
  65. <td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.urlencode($object->id).'&action=dellink&token='.newToken().'&dellinkid='.urlencode($key); ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
  66. </tr>
  67. <?php
  68. }
  69. if (count($linkedObjectBlock) > 1) {
  70. ?>
  71. <tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
  72. <td><?php echo $langs->trans("Total"); ?></td>
  73. <td></td>
  74. <td class="center"></td>
  75. <td class="center"></td>
  76. <td class="right"><?php echo price($total); ?></td>
  77. <td class="right"></td>
  78. <td class="right"></td>
  79. </tr>
  80. <?php
  81. }
  82. print "<!-- END PHP TEMPLATE -->\n";