mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Fix for inclusive taxes
This commit is contained in:
parent
dd360fb271
commit
e960e4b369
@ -1429,7 +1429,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
$account = $this->account;
|
||||
|
||||
if ($account->inclusive_taxes) {
|
||||
return round(($taxable * 100) / (100 + ($rate * 100)), 2);
|
||||
return round($taxable - ($taxable / (1 + ($rate / 100))), 2);
|
||||
} else {
|
||||
return round($taxable * ($rate / 100), 2);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -671,7 +671,7 @@ function calculateAmounts(invoice) {
|
||||
} else if (invoice.account.inclusive_taxes != '1') {
|
||||
var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100);
|
||||
} else {
|
||||
var taxAmount1 = roundToTwo((lineTotal * 100) / (100 + (taxRate1 * 100)));
|
||||
var taxAmount1 = roundToTwo(lineTotal - (lineTotal / (1 + (taxRate1 / 100))))
|
||||
}
|
||||
if (taxAmount1 != 0 || taxName1) {
|
||||
hasTaxes = true;
|
||||
@ -688,7 +688,7 @@ function calculateAmounts(invoice) {
|
||||
} else if (invoice.account.inclusive_taxes != '1') {
|
||||
var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100);
|
||||
} else {
|
||||
var taxAmount2 = roundToTwo((lineTotal * 100) / (100 + (taxRate2 * 100)));
|
||||
var taxAmount2 = roundToTwo(lineTotal - (lineTotal / (1 + (taxRate2 / 100))))
|
||||
}
|
||||
if (taxAmount2 != 0 || taxName2) {
|
||||
hasTaxes = true;
|
||||
@ -743,8 +743,8 @@ function calculateAmounts(invoice) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
taxAmount1 = roundToTwo((total * 100) / (100 + (taxRate1 * 100)));
|
||||
taxAmount2 = roundToTwo((total * 100) / (100 + (taxRate2 * 100)));
|
||||
taxAmount1 = roundToTwo(total - (total / (1 + (taxRate1 / 100))))
|
||||
taxAmount2 = roundToTwo(total - (total / (1 + (taxRate2 / 100))))
|
||||
}
|
||||
|
||||
// custom fields w/o with taxes
|
||||
|
@ -426,14 +426,14 @@ function InvoiceModel(data) {
|
||||
|
||||
var taxRate1 = parseFloat(self.tax_rate1());
|
||||
@if ($account->inclusive_taxes)
|
||||
var tax1 = roundToTwo((total * 100) / (100 + (taxRate1 * 100)));
|
||||
var tax1 = roundToTwo(total - (total / (1 + (taxRate1 / 100))));
|
||||
@else
|
||||
var tax1 = roundToTwo(total * (taxRate1/100));
|
||||
@endif
|
||||
|
||||
var taxRate2 = parseFloat(self.tax_rate2());
|
||||
@if ($account->inclusive_taxes)
|
||||
var tax2 = roundToTwo((total * 100) / (100 + (taxRate2 * 100)));
|
||||
var tax2 = roundToTwo(total - (total / (1 + (taxRate2 / 100))));
|
||||
@else
|
||||
var tax2 = roundToTwo(total * (taxRate2/100));
|
||||
@endif
|
||||
@ -456,7 +456,7 @@ function InvoiceModel(data) {
|
||||
}
|
||||
|
||||
@if ($account->inclusive_taxes)
|
||||
var taxAmount = roundToTwo((lineTotal * 100) / (100 + (item.tax_rate1() * 100)));
|
||||
var taxAmount = roundToTwo(lineTotal - (lineTotal / (1 + (item.tax_rate1() / 100))))
|
||||
@else
|
||||
var taxAmount = roundToTwo(lineTotal * item.tax_rate1() / 100);
|
||||
@endif
|
||||
@ -470,7 +470,7 @@ function InvoiceModel(data) {
|
||||
}
|
||||
|
||||
@if ($account->inclusive_taxes)
|
||||
var taxAmount = roundToTwo((lineTotal * 100) / (100 + (item.tax_rate2() * 100)));
|
||||
var taxAmount = roundToTwo(lineTotal - (lineTotal / (1 + (item.tax_rate2() / 100))))
|
||||
@else
|
||||
var taxAmount = roundToTwo(lineTotal * item.tax_rate2() / 100);
|
||||
@endif
|
||||
|
Loading…
Reference in New Issue
Block a user