'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday']; $fieldInfosPointSale = 'infos_' . $dayWeekArray[$dayWeek]; $html = '' ; $count = count($productsArray) ; $limit = 100 ; $isBig = $count > $limit ; // par point de vente foreach ($pointsSaleArray as $pointSale) { if (count($pointSale->orders)) { $html .= '

'.$pointSale->name.'

' ; $colCredit = ($pointSale->credit) ? 'Rappel crédit' : '' ; $html .= '' . '' . '' . '' . '' . ($isBig ? '' : '') . '' . $colCredit . '' . '' . ''; foreach ($pointSale->orders as $order) { $html .= '' ; $strUser = ''; // username $strUser .= $orderManager->getOrderUsername($order) ; if(strlen($order->comment_point_sale)) { $strUser .= '
'.$order->comment_point_sale.'' ; } // téléphone if (isset($order->user) && strlen($order->user->phone)) { $strUser .= '
' . $order->user->phone . ''; } // référence if($producer->option_order_reference_type == Producer::ORDER_REFERENCE_TYPE_YEARLY && $order->reference && strlen($order->reference) > 0) { $strUser .= '
'.$order->reference ; } $html .= ''; // produits $strProducts = ''; foreach ($productsArray as $product) { $add = false; foreach ($order->productOrder as $productOrder) { if($product->id == $productOrder->id_product) { $unit = ( $productManager->strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : ' '. $productManager->strUnit($productOrder->unit, 'wording_short', true) ; $strProducts .= '('.$productOrder->quantity .$unit.') '.$productManager->getNameExport($product) . '
'; $add = true; } } } $html .= ''; if($isBig) { $html .= '' ; } $html .= ''; if($pointSale->credit) { $credit = '' ; if(isset($order->user) && $order->user->id) { $userProducer = UserProducer::searchOne([ 'id_user' => $order->user->id ]); if($userProducer) { $credit = number_format($userProducer->credit,2).' €' ; } } $html .= '' ; } $html .= '' ; $html .= '' ; } $html .= '' ; $strProducts = ''; $cpt = 0 ; foreach ($productsArray as $product) { foreach( Product::$unitsArray as $unit => $dataUnit) { $quantity = $orderManager->getProductQuantity($product, $pointSale->orders, false, $unit); if ($quantity) { $theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '. $productManager->strUnit($unit, 'wording_short', true) ; $strProducts .= '(' .$quantity .$theUnit.') '.$productManager->getNameExport($product) . '
'; } } if($isBig && $cpt == $limit) { $strProducts .= '' ; if($pointSale->credit) { $html .= '' ; } $html .= ''; $html .= '
ClientProduitsProduitsCommentaireMontant
'.$strUser.''.substr($strProducts, 0, strlen($strProducts) - 6).''.$orderManager->getCommentReport($order).''.$credit.''.number_format($order->amount_with_tax, 2) . ' € '; if($orderManager->getPaymentStatus($order) == Order::PAYMENT_PAID) { $html .= '(payé)' ; } elseif($orderManager->getPaymentStatus($order) == Order::PAYMENT_UNPAID && $orderManager->getOrderAmount($order, Order::AMOUNT_PAID)) { $html .= '(reste '.$orderManager->getOrderAmount($order, Order::AMOUNT_REMAINING, true).' à payer)' ; } elseif($orderManager->getPaymentStatus($order) == Order::PAYMENT_SURPLUS) { $html .= '(surplus : '.$orderManager->getOrderAmount($order, Order::PAYMENT_SURPLUS, true).' à rembourser)' ; } $html .= '
Total' ; } $cpt ++ ; } $html .= ''.$strProducts.''.Price::format($pointSale->revenues_with_tax) . '
' ; } } // par point de vente $html .= '

Points de vente

' ; $html .= '' . '' . '' . '' . '' . ( $isBig ? '' : '') . '' . '' . ''; $revenues = 0 ; foreach ($pointsSaleArray as $pointSale) { if (count($pointSale->orders)) { $html .= '' ; $revenues += $pointSale->revenues_with_tax ; } } // total $html .= '' ; $html .= '
Point de venteProduitsProduitsMontant
'.$pointSale->name.'' ; $cpt = 0 ; foreach ($productsArray as $product) { foreach( Product::$unitsArray as $unit => $dataUnit) { $quantity = $orderManager->getProductQuantity($product, $pointSale->orders, false, $unit); if ($quantity) { $theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '. $productManager->strUnit($unit, 'wording_short', true) ; $html .= '(' .$quantity .$theUnit.') '.$productManager->getNameExport($product) . '
'; } } if($isBig && $cpt == $limit) { $html .= '
' ; } $cpt ++ ; } //$html = substr($html, 0, strlen($html) - 6) ; $html .= ''.Price::format($pointSale->revenues_with_tax, 2).'
Total' ; $cpt = 0 ; foreach ($productsArray as $product) { foreach( Product::$unitsArray as $unit => $dataUnit) { $quantity = $orderManager->getProductQuantity($product, $ordersArray, false, $unit); if ($quantity) { $theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '. $productManager->strUnit($unit, 'wording_short', true) ; $html .= '(' .$quantity .$theUnit.') '.$product->name . '
'; } } if($isBig && $cpt == $limit) { $html .= '
' ; } $cpt ++ ; } $html .= ''.number_format($revenues, 2).' €
' ; echo $html ; ?>