Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

101 lines
3.4KB

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