No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

134 líneas
4.2KB

  1. <?php
  2. use domain\Order\Order\OrderModule;
  3. use domain\Producer\Producer\Producer;
  4. use domain\Product\Product\ProductModule;
  5. $orderModule = OrderModule::getInstance();
  6. $html = '';
  7. foreach ($pointsSaleArray as $keyPointSale => $pointSale) {
  8. if (isset($ordersArray[$pointSale->id]) && count($ordersArray[$pointSale->id]) > 0) {
  9. $html .= '<h1>' . $pointSale->name . '</h1>';
  10. foreach ($ordersArray[$pointSale->id] as $indexPage => $orders) {
  11. $html .= '<table class="">'
  12. . '<thead>'
  13. . '<tr>'
  14. . '<th></th>';
  15. foreach ($orders as $order) {
  16. $html .= '<th class="th-user" text-rotate="90">'
  17. . '<div class="user">' . $orderModule->getOrderUsername($order) . '</div>'
  18. //.'<div class="amount">'.number_format($order->amount_with_tax, 2) .' € </div>'
  19. . '</th>';
  20. }
  21. $html .= '</tr>'
  22. . '<thead>'
  23. . '<tbody>';
  24. foreach ($categoriesArray as $category) {
  25. if ($category) {
  26. $html .= '<tr><td class="category-name">' . $category->name . '</td><td colspan="' . (count($orders)) . '"></td></tr>';
  27. }
  28. foreach ($productsArray as $product) {
  29. if (($category && $product->id_product_category == $category->id) || (!$category && !$product->id_product_category)) {
  30. $html .= line_product($product, $orders);
  31. }
  32. }
  33. }
  34. $html .= '</tbody>'
  35. . '</table>';
  36. $html .= '<pagebreak>';
  37. $html .= '<table class="">'
  38. . '<thead>'
  39. . '<tr>'
  40. . '<th>Client</th>'
  41. . '<th>Contact</th>'
  42. . '<th>Commentaire</th>'
  43. . '<th>Montant</th>'
  44. . '</thead>'
  45. . '<tbody>';
  46. foreach ($orders as $order) {
  47. $html .= '<tr>';
  48. $strUser = $orderModule->getOrderUsername($order);
  49. if ($producer->option_order_reference_type == Producer::ORDER_REFERENCE_TYPE_YEARLY && $order->reference && strlen($order->reference) > 0) {
  50. $strUser .= '<br />' . $order->reference;
  51. }
  52. $html .= '<td>' . $strUser . '</td>';
  53. $contactUser = '';
  54. if ($order->user) {
  55. $contactUser .= $order->user->phone . '<br />' . $order->user->email;
  56. }
  57. $html .= '<td>' . $contactUser . '</td>';
  58. $html .= '<td>' . nl2br($order->comment) . '</td>';
  59. $html .= '<td>' . number_format($order->amount_with_tax, 2) . ' € </td>';
  60. $html .= '</tr>';
  61. }
  62. $html .= '</tbody></table>';
  63. $html .= ' <pagebreak>';
  64. }
  65. }
  66. }
  67. $html = substr($html, 0, strlen($html) - 11);
  68. echo $html;
  69. function line_product($product, $orders)
  70. {
  71. $productModule = ProductModule::getInstance();
  72. $html = '';
  73. if (has_quantity($product, $orders)) {
  74. $html .= '<tr>';
  75. $html .= '<td>' . $product->name . '</td>';
  76. foreach ($orders as $order) {
  77. $quantity = '';
  78. foreach ($order->productOrder as $productOrder) {
  79. if ($product->id == $productOrder->id_product) {
  80. $unit = ($productModule->getSolver()->strUnit($productOrder->product, 'wording_short', true) == 'p.') ? '' : '&nbsp;' . $productModule->getSolver()->strUnit($productOrder->product, 'wording_short', true);
  81. $quantity .= $productOrder->quantity . $unit;
  82. if ($productOrder->quantity > 1) {
  83. $quantity = '<strong>' . $quantity . '</strong>';
  84. }
  85. }
  86. }
  87. $html .= '<td class="td-nb-products">' . $quantity . '</td>';
  88. }
  89. $html .= '</tr>';
  90. }
  91. return $html;
  92. }
  93. function has_quantity($product, $orders)
  94. {
  95. foreach ($orders as $order) {
  96. foreach ($order->productOrder as $productOrder) {
  97. if ($product->id == $productOrder->id_product) {
  98. return true;
  99. }
  100. }
  101. }
  102. return false;
  103. }