Selaa lähdekoodia

[Administration] Documents : correctif prix unitaire invoice price

feature/souke
Guillaume Bourgeois 11 kuukautta sitten
vanhempi
commit
e7c8062cb0
2 muutettua tiedostoa jossa 19 lisäystä ja 4 poistoa
  1. +1
    -1
      backend/views/document/_download_product_line.php
  2. +18
    -3
      common/logic/Order/ProductOrder/Service/ProductOrderSolver.php

+ 1
- 1
backend/views/document/_download_product_line.php Näytä tiedosto

<?php if($displayPrices): ?> <?php if($displayPrices): ?>
<td class="align-center column-unit-price"> <td class="align-center column-unit-price">
<?php $displayPriceUnitReference = $producerModule->getSolver()->getConfig('option_document_display_price_unit_reference'); ?> <?php $displayPriceUnitReference = $producerModule->getSolver()->getConfig('option_document_display_price_unit_reference'); ?>
<?php $priceUnitReference = $productOrderModule->getSolver()->getPriceUnitReference($productOrder); ?>
<?php $priceUnitReference = $productOrderModule->getSolver()->getPriceUnitReference($productOrder, true); ?>
<?php $priceUnitReferenceString = Price::format($priceUnitReference, $documentPriceDecimals).' / kg' ?> <?php $priceUnitReferenceString = Price::format($priceUnitReference, $documentPriceDecimals).' / kg' ?>
<?php if($productOrder->unit == 'piece'): ?> <?php if($productOrder->unit == 'piece'): ?>
<?= Price::format($price, $documentPriceDecimals) ?> <?= Price::format($price, $documentPriceDecimals) ?>

+ 18
- 3
common/logic/Order/ProductOrder/Service/ProductOrderSolver.php Näytä tiedosto

return $productOrder->price; return $productOrder->price;
} }


public function getPriceUnitReference(ProductOrder $productOrder): ?float
public function getPriceUnitReference(ProductOrder $productOrder, bool $isInvoicePrice = false): ?float
{ {
$productOrderPrice = $productOrder->price;
if($isInvoicePrice) {
$productOrderPrice = $this->getInvoicePrice($productOrder);
}

if($productOrder->unit == 'piece') { if($productOrder->unit == 'piece') {
if($productOrder->product->weight) { if($productOrder->product->weight) {
$price = (1000 * $productOrder->price) / $productOrder->product->weight;
$price = (1000 * $productOrderPrice) / $productOrder->product->weight;
} }
else { else {
return null; return null;
} }
} }
else { else {
$price = $productOrder->price;
$price = $productOrderPrice;
} }


return $price; return $price;
} }

public function getInvoicePrice(ProductOrder $productOrder)
{
if($productOrder->invoice_price) {
return $productOrder->invoice_price;
}
else {
return $productOrder->price;
}
}
} }

Loading…
Peruuta
Tallenna