affContenu.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
  3. * Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
  4. * Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.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 <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/cashdesk/affContenu.php
  21. * \ingroup cashdesk
  22. * \brief Include to show main page for cashdesk module
  23. */
  24. require_once 'class/Facturation.class.php';
  25. // Si nouvelle vente, reinitialisation des donnees (destruction de l'objet et vidage de la table contenant la liste des articles)
  26. if ( $_GET['id'] == 'NOUV' )
  27. {
  28. unset($_SESSION['serObjFacturation']);
  29. unset($_SESSION['poscart']);
  30. }
  31. // Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ...
  32. if (isset($_SESSION['serObjFacturation']))
  33. {
  34. $obj_facturation = unserialize($_SESSION['serObjFacturation']);
  35. unset($_SESSION['serObjFacturation']);
  36. }
  37. else
  38. {
  39. // ... sinon, c'est une nouvelle vente
  40. $obj_facturation = new Facturation();
  41. }
  42. // $obj_facturation contains data for all invoice total + selection of current product
  43. $obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart']
  44. $total_ttc = $obj_facturation->prixTotalTtc();
  45. /*var_dump($obj_facturation);
  46. var_dump($_SESSION['poscart']);
  47. var_dump($total_ttc);
  48. exit;*/
  49. // Left area with selected articles (area for article, amount and payments)
  50. print '<div class="inline-block" style="vertical-align: top">';
  51. print '<div class="principal">';
  52. $page=GETPOST('menutpl','alpha');
  53. if (empty($page)) $page='facturation';
  54. if (in_array(
  55. $page,
  56. array(
  57. 'deconnexion',
  58. 'index','index_verif','facturation','facturation_verif','facturation_dhtml',
  59. 'validation','validation_ok','validation_ticket','validation_verif',
  60. )
  61. ))
  62. {
  63. include $page.'.php';
  64. }
  65. else
  66. {
  67. dol_print_error('','menu param '.$page.' is not inside allowed list');
  68. }
  69. print '</div>';
  70. print '</div>';
  71. // Right area with selected articles (shopping cart)
  72. print '<div class="inline-block" style="vertical-align: top">';
  73. print '<div class="liste_articles">';
  74. require 'tpl/liste_articles.tpl.php';
  75. print '</div>';
  76. print '</div>';
  77. $_SESSION['serObjFacturation'] = serialize($obj_facturation);