You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
4.0KB

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