'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 .= '
Client | ' . 'Produits | ' . ($isBig ? 'Produits | ' : '') . 'Commentaire | ' . $colCredit . 'Montant | ' . '|
---|---|---|---|---|---|
'.$strUser.' | '; // produits $strProducts = ''; foreach ($productsArray as $product) { $add = false; 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) ; $strProducts .= '('.$productOrder->quantity .$unit.') '.$product->getNameExport() . ''.substr($strProducts, 0, strlen($strProducts) - 6).' | '; if($isBig) { $html .= '' ; } $html .= ' | '.$order->getCommentReport().' | '; 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 .= ''.$credit.' | ' ; } $html .= ''.number_format($order->amount_with_tax, 2) . ' € '; if($order->getPaymentStatus() == Order::PAYMENT_PAID) { $html .= '(payé)' ; } elseif($order->getPaymentStatus() == Order::PAYMENT_UNPAID && $order->getAmount(Order::AMOUNT_PAID)) { $html .= '(reste '.$order->getAmount(Order::AMOUNT_REMAINING, true).' à payer)' ; } elseif($order->getPaymentStatus() == Order::PAYMENT_SURPLUS) { $html .= '(surplus : '.$order->getAmount(Order::PAYMENT_SURPLUS, true).' à rembourser)' ; } $html .= ' | ' ; $html .= '
Total | ' ; $strProducts = ''; $cpt = 0 ; foreach ($productsArray as $product) { foreach( Product::$unitsArray as $unit => $dataUnit) { $quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit); if ($quantity) { $theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '. Product::strUnit($unit, 'wording_short', true) ; $strProducts .= '(' .$quantity .$theUnit.') '.$product->getNameExport() . '' ; } $cpt ++ ; } //$strProducts = substr($strProducts, 0, strlen($strProducts) - 6) ; $html .= ' | '.$strProducts.' | ' ; if($pointSale->credit) { $html .= ' | ' ; } $html .= ' | '.Price::format($pointSale->revenues_with_tax) . ' | '; $html .= '
Point de vente | ' . 'Produits | ' . ( $isBig ? 'Produits | ' : '') . 'Montant | ' . '
---|---|---|---|
'.$pointSale->name.' | ' ;
$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '. Product::strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$product->getNameExport() . ' '; } } 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 = Order::getProductQuantity($product->id, $ordersArray, false, $unit);
if ($quantity) {
$theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '. Product::strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$product->name . ' '; } } if($isBig && $cpt == $limit) { $html .= ' | ' ; } $cpt ++ ; } //$html = substr($html, 0, strlen($html) - 6) ; $html .= ' | '.number_format($revenues, 2).' € |