mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Report fixes
This commit is contained in:
parent
441d1f2724
commit
587601ce7d
@ -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,23 +83,34 @@ 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;
|
||||
|
||||
if ($this->tax_rate1) {
|
||||
$amount += $preTaxAmount * $this->tax_rate1 / 100;
|
||||
}
|
||||
|
||||
if ($this->tax_rate2) {
|
||||
$amount += $preTaxAmount * $this->tax_rate2 / 100;
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
public function getTaxAmount()
|
||||
{
|
||||
$tax = 0;
|
||||
$preTaxAmount = $this->getPreTaxAmount();
|
||||
|
||||
if ($this->tax_rate1) {
|
||||
$tax += round($preTaxAmount * $this->tax_rate1 / 100, 2);
|
||||
}
|
||||
|
||||
if ($this->tax_rate2) {
|
||||
$tax += round($preTaxAmount * $this->tax_rate2 / 100, 2);
|
||||
}
|
||||
|
||||
return $tax;
|
||||
}
|
||||
|
||||
public function amount()
|
||||
{
|
||||
return $this->getPreTaxAmount() + $this->getTaxAmount();
|
||||
}
|
||||
|
||||
public function markFeePaid()
|
||||
{
|
||||
if ($this->invoice_item_type_id == INVOICE_ITEM_TYPE_PENDING_GATEWAY_FEE) {
|
||||
|
@ -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')) {
|
||||
|
@ -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));
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user