1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Include line item discounts in tax reports

This commit is contained in:
Hillel Coren 2017-12-23 22:06:30 +02:00
parent eaf7e22060
commit 8f3952a938
2 changed files with 12 additions and 1 deletions

View File

@ -78,6 +78,15 @@ class InvoiceItem extends EntityModel
public function amount()
{
$amount = $this->cost * $this->qty;
if ($this->discount != 0) {
if ($this->invoice->is_amount_discount) {
$amount -= $this->discount;
} else {
$amount -= $amount * $this->discount / 100;
}
}
$preTaxAmount = $amount;
if ($this->tax_rate1) {

View File

@ -374,7 +374,9 @@ class BasePaymentDriver
]);
$items[] = $item;
$total += $invoiceItem->cost * $invoiceItem->qty;
$invoiceItem->setRelation('invoice', $invoice);
$total += $invoiceItem->amount();
}
if ($total != $invoice->getRequestedAmount()) {