瀏覽代碼

[Administration] Distributions > formulaire commande : ajout champs prix HT #577

refactoring
Guillaume Bourgeois 2 年之前
父節點
當前提交
dfefc56c8e
共有 1 個文件被更改,包括 2 次插入15 次删除
  1. +2
    -15
      backend/controllers/DistributionController.php

+ 2
- 15
backend/controllers/DistributionController.php 查看文件

@@ -194,14 +194,7 @@ class DistributionController extends BackendController
])
->orderBy('product_distribution.active DESC, order ASC');

/*$productsObjectsArray = $productsQuery->all();
foreach($productsObjectsArray as $product) {
$productsObjectsArray[$product->id] = $product;
}*/

$productsArray = $productsQuery->asArray()->all();


$potentialRevenues = 0;
$potentialWeight = 0;

@@ -241,30 +234,24 @@ class DistributionController extends BackendController
$ordersArrayObject = $ordersArray;
if ($ordersArray) {
foreach ($ordersArray as &$order) {
$user = $order->user ? : null;
$pointSale = $order->pointSale ? : null;

$productOrderArray = [];
foreach ($order->productOrder as $productOrder) {
//$product = isset($productsObjectsArray[$productOrder->id_product]) ? $productsObjectsArray[$productOrder->id_product] : null;
$productOrderArray[$productOrder->id_product] = [
'quantity' => $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'],
'unit' => $productOrder->unit,
'price' => $productOrder->price,
'price' => number_format($productOrder->price, 3),
'price_with_tax' => Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value),
//'prices' => $product ? $product->getPriceArray($user, $pointSale) : []
];
}

foreach ($productsArray as $product) {
//$productObject = isset($productsObjectsArray[$productOrder->id_product]) ? $productsObjectsArray[$productOrder->id_product] : null;
if (!isset($productOrderArray[$product['id']])) {
$productOrderArray[$product['id']] = [
'quantity' => 0,
'unit' => $product['unit'],
'price' => $product['price'],
'price' => number_format($product['price'], 3),
'price_with_tax' => Price::getPriceWithTax($product['price'], $product['taxRate']['value']),
//'prices' => $productObject ? $productObject->getPriceArray($user, $pointSale) : []
];
}
}

Loading…
取消
儲存