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:
parent
eaf7e22060
commit
8f3952a938
@ -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) {
|
||||
|
@ -374,7 +374,9 @@ class BasePaymentDriver
|
||||
]);
|
||||
|
||||
$items[] = $item;
|
||||
$total += $invoiceItem->cost * $invoiceItem->qty;
|
||||
|
||||
$invoiceItem->setRelation('invoice', $invoice);
|
||||
$total += $invoiceItem->amount();
|
||||
}
|
||||
|
||||
if ($total != $invoice->getRequestedAmount()) {
|
||||
|
Loading…
Reference in New Issue
Block a user