Fix discount computation. #343
This commit is contained in:
parent
d439a411a8
commit
a15b45173c
2 changed files with 3 additions and 8 deletions
|
|
@ -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)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue