mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Include line item discounts in tax reports
This commit is contained in:
parent
cbbef24120
commit
eaf7e22060
@ -1292,7 +1292,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
{
|
||||
$total = $invoiceItem->qty * $invoiceItem->cost;
|
||||
|
||||
if ($this->discount > 0) {
|
||||
if ($this->discount != 0) {
|
||||
if ($this->is_amount_discount) {
|
||||
$total -= $invoiceTotal ? ($total / ($invoiceTotal + $this->discount) * $this->discount) : 0;
|
||||
} else {
|
||||
@ -1300,6 +1300,14 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
}
|
||||
}
|
||||
|
||||
if ($invoiceItem->discount != 0) {
|
||||
if ($this->is_amount_discount) {
|
||||
$total -= $invoiceItem->discount;
|
||||
} else {
|
||||
$total -= $total * $invoiceItem->discount / 100;
|
||||
}
|
||||
}
|
||||
|
||||
return round($total, 2);
|
||||
}
|
||||
|
||||
@ -1311,7 +1319,17 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
$total = 0;
|
||||
|
||||
foreach ($this->invoice_items as $invoiceItem) {
|
||||
$total += $invoiceItem->qty * $invoiceItem->cost;
|
||||
$lineTotal = $invoiceItem->qty * $invoiceItem->cost;
|
||||
|
||||
if ($invoiceItem->discount != 0) {
|
||||
if ($this->is_amount_discount) {
|
||||
$lineTotal -= $invoiceItem->discount;
|
||||
} else {
|
||||
$lineTotal -= $lineTotal * $invoiceItem->discount / 100;
|
||||
}
|
||||
}
|
||||
|
||||
$total += $lineTotal;
|
||||
}
|
||||
|
||||
if ($this->discount > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user