|
|
|
|
|
|
|
|
$productsHasQuantity = [] ; |
|
|
$productsHasQuantity = [] ; |
|
|
$cpt = 1 ; |
|
|
$cpt = 1 ; |
|
|
foreach ($productsArray as $product) { |
|
|
foreach ($productsArray as $product) { |
|
|
$productsHasQuantity[$product->id] = 0 ; |
|
|
|
|
|
foreach(Product::$unitsArray as $unit => $dataUnit) { |
|
|
|
|
|
$quantity = Order::getProductQuantity($product->id, $ordersArray, true, $unit); |
|
|
|
|
|
if($quantity) { |
|
|
|
|
|
$productsHasQuantity[$product->id] += $quantity ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if($productsHasQuantity[$product->id] > 0) { |
|
|
|
|
|
$theUnit = Product::strUnit($product->unit, 'wording_short', true) ; |
|
|
|
|
|
$theUnit = ($theUnit == 'p.') ? '' : ' ('.$theUnit.')' ; |
|
|
|
|
|
$productsNameArray[] = $product->name .$theUnit ; |
|
|
|
|
|
$productsIndexArray[$product->id] = $cpt ++ ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$theUnit = Product::strUnit($product->unit, 'wording_short', true) ; |
|
|
|
|
|
$theUnit = ($theUnit == 'p.') ? '' : ' ('.$theUnit.')' ; |
|
|
|
|
|
$productsNameArray[] = $product->name .$theUnit ; |
|
|
|
|
|
$productsIndexArray[$product->id] = $cpt ++ ; |
|
|
} |
|
|
} |
|
|
$datas[] = $productsNameArray ; |
|
|
$datas[] = $productsNameArray ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// total point de vente |
|
|
// total point de vente |
|
|
$totalsPointSaleArray = $this->_totalReportCSV( |
|
|
$totalsPointSaleArray = $this->_totalReportCSV( |
|
|
'Total', |
|
|
|
|
|
|
|
|
'Total point de vente', |
|
|
$pointSale->orders, |
|
|
$pointSale->orders, |
|
|
$productsArray, |
|
|
$productsArray, |
|
|
$productsIndexArray |
|
|
$productsIndexArray |