Przeglądaj źródła

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

refactoring
Guillaume Bourgeois 2 lat temu
rodzic
commit
dfefc56c8e
1 zmienionych plików z 2 dodań i 15 usunięć
  1. +2
    -15
      backend/controllers/DistributionController.php

+ 2
- 15
backend/controllers/DistributionController.php Wyświetl plik

@@ -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) : []
];
}
}

Ładowanie…
Anuluj
Zapisz