Przeglądaj źródła

[backend] Vente au kilo : adaptation export CSV

dev
Guillaume Bourgeois 5 lat temu
rodzic
commit
7f5cc6b798
1 zmienionych plików z 17 dodań i 13 usunięć
  1. +17
    -13
      backend/controllers/DistributionController.php

+ 17
- 13
backend/controllers/DistributionController.php Wyświetl plik

@@ -464,7 +464,7 @@ class DistributionController extends BackendController
foreach($pointSale->orders as $order) {
$orderLine = [$order->getStrUser()] ;
foreach($order->productOrder as $productOrder) {
$orderLine[$productsIndexArray[$productOrder->id_product]] = $productOrder->quantity ;
$orderLine[$productsIndexArray[$productOrder->id_product]] = $productOrder->quantity . ' '.Product::strUnit($productOrder->unit, true, true);
}
$datas[] = $this->_lineOrderReportCSV($orderLine, $cpt) ;
}
@@ -472,13 +472,15 @@ class DistributionController extends BackendController
// total point de vente
$totalsPointSaleArray = ['Total'] ;
foreach ($productsArray as $product) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders);
if($quantity) {
$index = $productsIndexArray[$product->id] ;
if(!isset($totalsPointSaleArray[$index])) {
$totalsPointSaleArray[$index] = 0 ;
foreach(Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit);
if ($quantity) {
$index = $productsIndexArray[$product->id] ;
if(!isset($totalsPointSaleArray[$index])) {
$totalsPointSaleArray[$index] = '' ;
}
$totalsPointSaleArray[$index] .= $quantity . ' '.Product::strUnit($unit, true, true).' ';
}
$totalsPointSaleArray[$index] += $quantity ;
}
}
@@ -490,13 +492,15 @@ class DistributionController extends BackendController
// global
$totalsGlobalArray = ['> Totaux'] ;
foreach ($productsArray as $product) {
$quantity = Order::getProductQuantity($product->id, $ordersArray);
if($quantity) {
$index = $productsIndexArray[$product->id] ;
if(!isset($totalsGlobalArray[$index])) {
$totalsGlobalArray[$index] = 0 ;
foreach(Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $ordersArray, false, $unit);
if ($quantity) {
$index = $productsIndexArray[$product->id] ;
if(!isset($totalsGlobalArray[$index])) {
$totalsGlobalArray[$index] = '' ;
}
$totalsGlobalArray[$index] .= $quantity . ' '.Product::strUnit($unit, true, true).' ';
}
$totalsGlobalArray[$index] += $quantity ;
}
}


Ładowanie…
Anuluj
Zapisz