$pointSale) { if(isset($ordersArray[$pointSale->id]) && count($ordersArray[$pointSale->id]) > 0) { $html .= '

'.$pointSale->name.'

' ; foreach ($ordersArray[$pointSale->id] as $indexPage => $orders) { $html .= '' . '' . '' . ''; foreach ($orders as $order) { $html .= ''; } $html .= '' . '' . ''; foreach ($categoriesArray as $category) { if ($category) { $html .= ''; } foreach ($productsArray as $product) { if (($category && $product->id_product_category == $category->id) || (!$category && !$product->id_product_category)) { $html .= line_product($product, $orders); } } } $html .= '' . '
' . '
' . $order->getStrUser() . '
' //.'
'.number_format($order->amount_with_tax, 2) .' €
' . '
' . $category->name . '
'; $html .= ''; $html .= '' . '' . '' . '' . '' . '' . '' . '' . ''; foreach ($orders as $order) { $html .= ''; $strUser = $order->getStrUser(); if ($producer->option_order_reference_type == Producer::ORDER_REFERENCE_TYPE_YEARLY && $order->reference && strlen($order->reference) > 0) { $strUser .= '
' . $order->reference; } $html .= ''; $contactUser = ''; if ($order->user) { $contactUser .= $order->user->phone . '
' . $order->user->email; } $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= '
ClientContactCommentaireMontant
' . $strUser . '' . $contactUser . '' . nl2br($order->comment) . '' . number_format($order->amount_with_tax, 2) . ' €
'; $html .= ' '; } } } $html = substr($html, 0, strlen($html) - 11) ; echo $html ; function line_product($product, $orders) { $html = '' ; if(has_quantity($product, $orders)) { $html .= '' ; $html .= ''.$product->name.'' ; foreach($orders as $order) { $quantity = '' ; foreach($order->productOrder as $productOrder) { if($product->id == $productOrder->id_product) { $unit = (Product::strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : ' '.Product::strUnit($productOrder->unit, 'wording_short', true) ; $quantity .= $productOrder->quantity .$unit ; if($productOrder->quantity > 1) { $quantity = ''.$quantity.'' ; } } } $html .= ''.$quantity.'' ; } $html .= '' ; } return $html ; } function has_quantity($product, $orders) { foreach($orders as $order) { foreach($order->productOrder as $productOrder) { if($product->id == $productOrder->id_product) { return true ; } } } return false ; }