receipt.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. * Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.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 <http://www.gnu.org/licenses/>.
  19. */
  20. require '../main.inc.php'; // Load $user and permissions
  21. include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
  22. $langs->loadLangs(array("main", "cashdesk"));
  23. /*
  24. * View
  25. */
  26. top_httphead('text/html');
  27. $facid=GETPOST('facid','int');
  28. $place=GETPOST('place','int');
  29. if ($place>0){
  30. $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
  31. $resql = $db->query($sql);
  32. $row = $db->fetch_array ($resql);
  33. $facid=$row[0];
  34. }
  35. $object=new Facture($db);
  36. $object->fetch($facid);
  37. // IMPORTANT: This file is sended to 'Takepos Printing' application. Keep basic file. No external files as css, js... If you need images use absolut path.
  38. ?>
  39. <html>
  40. <body>
  41. <center>
  42. <font size="4">
  43. <?php echo '<b>'.$mysoc->name.'</b>';?>
  44. </font>
  45. </center>
  46. <br>
  47. <p align="left">
  48. <?php
  49. $substitutionarray=getCommonSubstitutionArray($langs);
  50. if (! empty($conf->global->TAKEPOS_HEADER))
  51. {
  52. $newfreetext=make_substitutions($conf->global->TAKEPOS_HEADER,$substitutionarray);
  53. echo $newfreetext;
  54. }
  55. ?>
  56. </p>
  57. <p align="right">
  58. <?php
  59. print $langs->trans('Date')." ".dol_print_date($object->date, 'day').'<br>';
  60. if ($mysoc->country_code == 'ES') print "Factura simplificada ";
  61. print $object->ref;
  62. ?>
  63. </p>
  64. <br>
  65. <table width="100%" style="border-top-style: double;">
  66. <thead>
  67. <tr>
  68. <th align="center"><?php print $langs->trans("Label"); ?></th>
  69. <th align="right"><?php print $langs->trans("Qty"); ?></th>
  70. <th align="right"><?php print $langs->trans("Price"); ?></th>
  71. <th align="right"><?php print $langs->trans("TotalTTC"); ?></th>
  72. </tr>
  73. </thead>
  74. <tbody>
  75. <?php
  76. foreach ($object->lines as $line)
  77. {
  78. ?>
  79. <tr>
  80. <td><?php echo $line->product_label;?></td>
  81. <td align="right"><?php echo $line->qty;?></td>
  82. <td align="right"><?php echo $line->total_ttc/$line->qty;?></td>
  83. <td align="right"><?php echo price($line->total_ttc);?></td>
  84. </tr>
  85. <?php
  86. }
  87. ?>
  88. </tbody>
  89. </table>
  90. <br>
  91. <table align="right">
  92. <tr>
  93. <th align="right"><?php echo $langs->trans("TotalHT");?></th>
  94. <td align="right"><?php echo price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
  95. </tr>
  96. <tr>
  97. <th align="right"><?php echo $langs->trans("TotalVAT").'</th><td align="right">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
  98. </tr>
  99. <tr>
  100. <th align="right"><?php echo ''.$langs->trans("TotalTTC").'</th><td align="right">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
  101. </tr>
  102. </table>
  103. <div style="border-top-style: double;">
  104. <br>
  105. <br>
  106. <br>
  107. <?php
  108. $substitutionarray=getCommonSubstitutionArray($langs);
  109. if (! empty($conf->global->TAKEPOS_FOOTER))
  110. {
  111. $newfreetext=make_substitutions($conf->global->TAKEPOS_FOOTER,$substitutionarray);
  112. echo $newfreetext;
  113. }
  114. ?>
  115. <script type="text/javascript">
  116. window.print();
  117. </script>
  118. </body>
  119. </html>