'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.'

' ; $html .= '' . '' . '' . '' . '' . '' . '' . ($isBig ? '' : '') . '' . '' . '' . '' . '' . ''; foreach ($pointSale->orders as $order) { $html .= '' ; $strUser = ''; // username $strUser = $orderModule->getOrderUsername($order) ; if(strlen($order->comment_point_sale)) { $strUser .= '
'.$order->comment_point_sale.'' ; } $html .= ''; // téléphone $html .= '' ; // mail $html .= '' ; // produits $strProducts = ''; foreach ($productsArray as $product) { $add = false; foreach ($order->productOrder as $productOrder) { if($product->id == $productOrder->id_product) { $unit = ( $productModule->getSolver()->strUnit($productOrder->product, UnitDefinition::WORDING_SHORT, true) == 'p.') ? '' : ' '. $productModule->getSolver()->strUnit($productOrder->product, UnitDefinition::WORDING_SHORT, true) ; $strProducts .= $product->name . ' (' .$productOrder->quantity .$unit.')
'; $add = true; } } } $html .= ''; if($isBig) { $html .= '' ; } // commentaire $html .= ''; // paiement $html .= '' ; // moyen de paiement $html .= '' ; if($pointSale->payment_method_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 = $orderModule->getProductQuantity($product, $pointSale->orders, false, $unit); if ($quantity) { $theUnit = ( $unitModule->getSolver()->strUnit($unit, UnitDefinition::WORDING_SHORT, true) == 'p.') ? '' : ' '. $unitModule->getSolver()->strUnit($unit, UnitDefinition::WORDING_SHORT, true) ; $strProducts .= $product->name . ' (' .$quantity .$theUnit.')
'; } } if($isBig && $cpt == $limit) { $strProducts .= '' ; if($pointSale->payment_method_credit) { $html .= '' ; } $html .= ''; $html .= '
Nom / prénomTéléphoneMailProduitsProduitsCommentairePaiementMoyen de paiementMontant
'.$strUser.'' ; if (isset($order->user) && strlen($order->user->phone)) { $html .= $order->user->phone ; } $html .= '' ; if (isset($order->user) && strlen($order->user->email)) { $html .= $order->user->email ; } $html .= ''.substr($strProducts, 0, strlen($strProducts) - 6).''.$order->comment.'' ; if(isset($order->mean_payment) && strlen($order->mean_payment) > 0) { $html .= 'Payé' ; } $html .= '' ; $paymentLabelPaid = $orderModule->getRepository()->getPaymentLabelPaid($order); if($paymentLabelPaid) { $html .= $paymentLabelPaid; } $html .= ''.$credit.''.number_format($order->amount_with_tax, 2) . ' € '; $html .= '
Total' ; } $cpt ++ ; } $strProducts = substr($strProducts, 0, strlen($strProducts) - 6) ; $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 = $orderModule->getProductQuantity($product, $pointSale->orders, false, $unit); if ($quantity) { $theUnit = ( $unitModule->getSolver()->strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '. $unitModule->getSolver()->strUnit($unit, 'wording_short', true) ; $html .= $product->name . ' (' .$quantity .$theUnit.')
'; } } 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 = $orderModule->getProductQuantity($product, $ordersArray, false, $unit); if ($quantity) { $theUnit = ( $unitModule->getSolver()->strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '. $unitModule->getSolver()->strUnit($unit, 'wording_short', true) ; $html .= $product->name . ' (' .$quantity .$theUnit.')
'; } } if($isBig && $cpt == $limit) { $html .= '
' ; } $cpt ++ ; } $html = substr($html, 0, strlen($html) - 6) ; $html .= ''.number_format($revenues, 2).' €
' ; echo $html ; ?>