1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Report fixes

This commit is contained in:
Hillel Coren 2018-04-23 12:44:23 +03:00
parent 441d1f2724
commit 587601ce7d
3 changed files with 19 additions and 11 deletions

View File

@ -75,7 +75,7 @@ class InvoiceItem extends EntityModel
return $this->belongsTo('App\Models\Account');
}
public function amount()
public function getPreTaxAmount()
{
$amount = $this->cost * $this->qty;
@ -83,21 +83,32 @@ class InvoiceItem extends EntityModel
if ($this->invoice->is_amount_discount) {
$amount -= $this->discount;
} else {
$amount -= $amount * $this->discount / 100;
$amount -= round($amount * $this->discount / 100, 4);
}
}
$preTaxAmount = $amount;
return $amount;
}
public function getTaxAmount()
{
$tax = 0;
$preTaxAmount = $this->getPreTaxAmount();
if ($this->tax_rate1) {
$amount += $preTaxAmount * $this->tax_rate1 / 100;
$tax += round($preTaxAmount * $this->tax_rate1 / 100, 2);
}
if ($this->tax_rate2) {
$amount += $preTaxAmount * $this->tax_rate2 / 100;
$tax += round($preTaxAmount * $this->tax_rate2 / 100, 2);
}
return $amount;
return $tax;
}
public function amount()
{
return $this->getPreTaxAmount() + $this->getTaxAmount();
}
public function markFeePaid()

View File

@ -75,10 +75,7 @@ class ProductReport extends AbstractReport
];
if ($account->invoice_item_taxes) {
$row[] = $item->present()->tax1;
if ($account->enable_second_tax_rate) {
$row[] = $item->present()->tax2;
}
$row[] = Utils::roundSignificant($item->getTaxAmount(), 2);
}
if ($account->customLabel('product1')) {

View File

@ -702,7 +702,7 @@
var txt = $(this).find("td").eq(i).text();
subtotal += convertStringToNumber(txt) || 0;
});
$cell.find(".group-count").append(' - ' + label + ': ' + roundToTwo(subtotal, true));
$cell.find(".group-count").append(' | ' + label + ': ' + roundToTwo(subtotal, true));
}
},
}