Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

report-grid.php 5.1KB

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