Browse Source

[Administration] Distributions > quantités restantes : problème valeur miches À pain de loup #1255

feature/souke
Guillaume Bourgeois 1 year ago
parent
commit
e8778d9a2d
3 changed files with 12 additions and 6 deletions
  1. +3
    -0
      backend/controllers/DistributionController.php
  2. +5
    -2
      backend/web/js/vuejs/distribution-index.js
  3. +4
    -4
      common/logic/Producer/Producer/Repository/ProducerRepository.php

+ 3
- 0
backend/controllers/DistributionController.php View File

$productOrderArray[$productOrder->id_product] = [ $productOrderArray[$productOrder->id_product] = [
'quantity' => $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'], 'quantity' => $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'],
'unit' => $productOrder->unit, 'unit' => $productOrder->unit,
'unit_coefficient' => Product::$unitsArray[$productOrder->unit]['coefficient'],
'price' => number_format($productOrder->price, 5), 'price' => number_format($productOrder->price, 5),
'invoice_price' => number_format($productOrder->invoice_price, 5), 'invoice_price' => number_format($productOrder->invoice_price, 5),
'price_with_tax' => Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value), 'price_with_tax' => Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value),
$productOrderArray[$product['id']] = [ $productOrderArray[$product['id']] = [
'quantity' => 0, 'quantity' => 0,
'unit' => $product['unit'], 'unit' => $product['unit'],
'unit_coefficient' => Product::$unitsArray[$product['unit']]['coefficient'],
'price' => number_format($product['price'], 5), 'price' => number_format($product['price'], 5),
'price_with_tax' => Price::getPriceWithTax($product['price'], $product['taxRate']['value']), 'price_with_tax' => Price::getPriceWithTax($product['price'], $product['taxRate']['value']),
]; ];
$productOrderArray[$product['id']] = [ $productOrderArray[$product['id']] = [
'quantity' => 0, 'quantity' => 0,
'unit' => $product['unit'], 'unit' => $product['unit'],
'unit_coefficient' => Product::$unitsArray[$product['unit']]['coefficient'],
'price' => number_format($product['price'], 5), 'price' => number_format($product['price'], 5),
'price_with_tax' => Price::getPriceWithTax($product['price'], $product['taxRate']['value']), 'price_with_tax' => Price::getPriceWithTax($product['price'], $product['taxRate']['value']),
]; ];

+ 5
- 2
backend/web/js/vuejs/distribution-index.js View File

var order = null; var order = null;
var app = this; var app = this;
var productQuantityOrder = 0; var productQuantityOrder = 0;
var unitCoefficient = 1;


for(key in app.orders) { for(key in app.orders) {
order = app.orders[key]; order = app.orders[key];
productQuantityOrder += order.productOrder[product.id].quantity;
unitCoefficient = order.productOrder[product.id].unit_coefficient;
productQuantityOrder += order.productOrder[product.id].quantity / unitCoefficient;
} }


if(app.create == 1) { if(app.create == 1) {
productQuantityOrder += app.order.productOrder[product.id].quantity;
unitCoefficient = app.order.productOrder[product.id].unit_coefficient;
productQuantityOrder += app.order.productOrder[product.id].quantity / unitCoefficient;
} }


return product.productDistribution[0].quantity_max - productQuantityOrder; return product.productDistribution[0].quantity_max - productQuantityOrder;

+ 4
- 4
common/logic/Producer/Producer/Repository/ProducerRepository.php View File



public function getOnlinePaymentMinimumAmount(): float public function getOnlinePaymentMinimumAmount(): float
{ {
$onlinePaymentMinimumAmount = $this->getConfig('option_online_payment_minimum_amount');
$onlinePaymentMinimumAmount = $this->producerSolver->getConfig('option_online_payment_minimum_amount');
if (!$onlinePaymentMinimumAmount) { if (!$onlinePaymentMinimumAmount) {
$onlinePaymentMinimumAmount = Producer::ONLINE_PAYMENT_MINIMUM_AMOUNT_DEFAULT; $onlinePaymentMinimumAmount = Producer::ONLINE_PAYMENT_MINIMUM_AMOUNT_DEFAULT;
} }
public function isDocumentDisplayOrders(DocumentInterface $document): bool public function isDocumentDisplayOrders(DocumentInterface $document): bool
{ {
return ($this->documentSolver->getClass($document) == 'Invoice') ? return ($this->documentSolver->getClass($document) == 'Invoice') ?
$this->getConfig('document_display_orders_invoice') :
$this->getConfig('document_display_orders_delivery_note');
$this->producerSolver->getConfig('document_display_orders_invoice') :
$this->producerSolver->getConfig('document_display_orders_delivery_note');
} }


/** /**
{ {
return strlen($pointSale->credit_functioning) > 0 ? return strlen($pointSale->credit_functioning) > 0 ?
$pointSale->credit_functioning : $pointSale->credit_functioning :
$this->getConfig('credit_functioning');
$this->producerSolver->getConfig('credit_functioning');
} }


public function findProducersActive() public function findProducersActive()

Loading…
Cancel
Save