Преглед на файлове

[Backend] Documents : problème prix spécifique #355

refactoring
Guillaume Bourgeois преди 2 години
родител
ревизия
5d3dd6446d
променени са 2 файла, в които са добавени 5 реда и са изтрити 2 реда
  1. +2
    -0
      backend/web/js/vuejs/document-form.js
  2. +3
    -2
      common/models/Product.php

+ 2
- 0
backend/web/js/vuejs/document-form.js Целия файл

@@ -178,6 +178,8 @@ var app = new Vue({
var price = pricesArray[i].price;
var fromQuantity = pricesArray[i].from_quantity;

console.log(pricesArray[i]);
console.log(price+" / "+thePrice+" / "+fromQuantity+" / "+theQuantity+" / ");
if (price < thePrice && fromQuantity <= theQuantity) {
thePrice = price;
}

+ 3
- 2
common/models/Product.php Целия файл

@@ -428,14 +428,15 @@ class Product extends ActiveRecordCommon
// base price
$priceArray[] = [
'from_quantity' => 0,
'price' => $this->getPrice(),
'price_with_tax' => $this->getPriceWithTax(),
];
}

usort($priceArray, function ($a, $b) {
if ($a['price_with_tax'] < $b['price_with_tax']) {
if ($a['price'] < $b['price']) {
return 1;
} elseif ($a['price_with_tax'] > $b['price_with_tax']) {
} elseif ($a['price'] > $b['price']) {
return -1;
} else {
return 0;

Loading…
Отказ
Запис