瀏覽代碼

[backend] Vente au kilo : adaptation export CSV

dev
Guillaume Bourgeois 5 年之前
父節點
當前提交
7f5cc6b798
共有 1 個檔案被更改,包括 17 行新增13 行删除
  1. +17
    -13
      backend/controllers/DistributionController.php

+ 17
- 13
backend/controllers/DistributionController.php 查看文件

@@ -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 ;
}
}


Loading…
取消
儲存