ticket.tpl.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
  3. * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. // Protection to avoid direct call of template
  20. if (empty($langs) || !is_object($langs))
  21. {
  22. print "Error, template page can't be called as URL";
  23. exit;
  24. }
  25. include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
  26. // Load translation files required by the page
  27. $langs->loadLangs(array("main", "cashdesk"));
  28. top_httphead('text/html');
  29. $facid = GETPOST('facid', 'int');
  30. $object = new Facture($db);
  31. $object->fetch($facid);
  32. ?>
  33. <html>
  34. <head>
  35. <title><?php echo $langs->trans('PrintTicket') ?></title>
  36. <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT; ?>/cashdesk/css/ticket.css">
  37. </head>
  38. <body>
  39. <div class="entete">
  40. <div class="logo">
  41. <?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">'; ?>
  42. </div>
  43. <div class="infos">
  44. <p class="address"><?php echo $mysoc->name; ?><br>
  45. <?php print dol_nl2br(dol_format_address($mysoc)); ?><br>
  46. </p>
  47. <p class="date_heure"><?php
  48. // Recuperation et affichage de la date et de l'heure
  49. $now = dol_now();
  50. print dol_print_date($now, 'dayhourtext').'<br>';
  51. print $object->ref;
  52. ?></p>
  53. </div>
  54. </div>
  55. <br>
  56. <table class="liste_articles">
  57. <thead>
  58. <tr class="titres">
  59. <th><?php print $langs->trans("Code"); ?></th>
  60. <th><?php print $langs->trans("Label"); ?></th>
  61. <th><?php print $langs->trans("Qty"); ?></th>
  62. <th><?php print $langs->trans("Discount").' (%)'; ?></th>
  63. <th><?php print $langs->trans("TotalHT"); ?></th>
  64. </tr>
  65. </thead>
  66. <tbody>
  67. <?php
  68. $tab = array();
  69. $tab = $_SESSION['poscart'];
  70. $tab_size = count($tab);
  71. for ($i = 0; $i < $tab_size; $i++)
  72. {
  73. $remise = $tab[$i]['remise'];
  74. ?>
  75. <tr>
  76. <td><?php echo $tab[$i]['ref']; ?></td>
  77. <td><?php echo $tab[$i]['label']; ?></td>
  78. <td><?php echo $tab[$i]['qte']; ?></td>
  79. <td><?php echo $tab[$i]['remise_percent']; ?></td>
  80. <td class="total"><?php echo price(price2num($tab[$i]['total_ht'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td>
  81. </tr>
  82. <?php
  83. }
  84. ?>
  85. </tbody>
  86. </table>
  87. <table class="totaux">
  88. <tr>
  89. <th class="nowrap"><?php echo $langs->trans("TotalHT"); ?></th>
  90. <td class="nowrap"><?php echo price(price2num($obj_facturation->prixTotalHt(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
  91. </tr>
  92. <tr>
  93. <th class="nowrap"><?php echo $langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->montantTva(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
  94. </tr>
  95. <tr>
  96. <th class="nowrap"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->prixTotalTtc(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
  97. </tr>
  98. </table>
  99. <script type="text/javascript">
  100. window.print();
  101. </script>
  102. <a class="lien" href="#" onclick="javascript: window.close(); return(false);"><?php echo $langs->trans("Close"); ?></a>
  103. </body>
  104. </html>