Browse Source

Merge branch 'dev'

prodstable
Guillaume Bourgeois 2 years ago
parent
commit
b5efecfccb
2 changed files with 5 additions and 2 deletions
  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 View File

var price = pricesArray[i].price; var price = pricesArray[i].price;
var fromQuantity = pricesArray[i].from_quantity; var fromQuantity = pricesArray[i].from_quantity;


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

+ 3
- 2
common/models/Product.php View File

// base price // base price
$priceArray[] = [ $priceArray[] = [
'from_quantity' => 0, 'from_quantity' => 0,
'price' => $this->getPrice(),
'price_with_tax' => $this->getPriceWithTax(), 'price_with_tax' => $this->getPriceWithTax(),
]; ];
} }


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

Loading…
Cancel
Save