diff --git a/src/Entity/Invoice.php b/src/Entity/Invoice.php index 2353b925..305c7d84 100644 --- a/src/Entity/Invoice.php +++ b/src/Entity/Invoice.php @@ -59,8 +59,7 @@ class Invoice */ protected $items; - // total discount (amount, not %) for resq - // for cmb, discount is the percentage + // total discount (amount, not %) /** * @ORM\Column(type="decimal", precision=9, scale=2) */ diff --git a/src/Service/InvoiceGenerator/CMBInvoiceGenerator.php b/src/Service/InvoiceGenerator/CMBInvoiceGenerator.php index fa13b752..f1563d63 100644 --- a/src/Service/InvoiceGenerator/CMBInvoiceGenerator.php +++ b/src/Service/InvoiceGenerator/CMBInvoiceGenerator.php @@ -385,17 +385,13 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface protected function processDiscount(&$total, InvoiceCriteria $criteria, Invoice $invoice) { - $rate = 0; + $discount = 0; $meta = $criteria->getMeta(); if (isset($meta['discount'])) - $rate = $meta['discount']; + $discount = $meta['discount']; else return; - // compute discount - $rate = $rate * 0.01; - $discount = round($total['sell_price'] * $rate, 2); - // if discount is higher than 0, display in invoice if ($discount > 0) {