Kaynağa Gözat

[Administration] Documents : correctif prix unitaire invoice price

feature/souke
Guillaume Bourgeois 11 ay önce
ebeveyn
işleme
e7c8062cb0
2 değiştirilmiş dosya ile 19 ekleme ve 4 silme
  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 Dosyayı Görüntüle

@@ -38,7 +38,7 @@ $unitModule = UnitModule::getInstance();
<?php if($displayPrices): ?>
<td class="align-center column-unit-price">
<?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 if($productOrder->unit == 'piece'): ?>
<?= Price::format($price, $documentPriceDecimals) ?>

+ 18
- 3
common/logic/Order/ProductOrder/Service/ProductOrderSolver.php Dosyayı Görüntüle

@@ -70,20 +70,35 @@ class ProductOrderSolver extends AbstractService implements SolverInterface
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->product->weight) {
$price = (1000 * $productOrder->price) / $productOrder->product->weight;
$price = (1000 * $productOrderPrice) / $productOrder->product->weight;
}
else {
return null;
}
}
else {
$price = $productOrder->price;
$price = $productOrderPrice;
}

return $price;
}

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

Yükleniyor…
İptal
Kaydet