mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
fix tax rounding issues
This commit is contained in:
@ -954,12 +954,15 @@ export default {
|
|||||||
let amount = 0
|
let amount = 0
|
||||||
|
|
||||||
if (selectedTax.compound_tax && this.subtotalWithDiscount) {
|
if (selectedTax.compound_tax && this.subtotalWithDiscount) {
|
||||||
amount =
|
amount = Math.round(
|
||||||
((this.subtotalWithDiscount + this.totalSimpleTax) *
|
((this.subtotalWithDiscount + this.totalSimpleTax) *
|
||||||
selectedTax.percent) /
|
selectedTax.percent) /
|
||||||
100
|
100
|
||||||
|
)
|
||||||
} else if (this.subtotalWithDiscount && selectedTax.percent) {
|
} else if (this.subtotalWithDiscount && selectedTax.percent) {
|
||||||
amount = (this.subtotalWithDiscount * selectedTax.percent) / 100
|
amount = Math.round(
|
||||||
|
(this.subtotalWithDiscount * selectedTax.percent) / 100
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.newEstimate.taxes.push({
|
this.newEstimate.taxes.push({
|
||||||
@ -972,7 +975,7 @@ export default {
|
|||||||
amount,
|
amount,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (this.$$refs) {
|
if (this.$refs) {
|
||||||
this.$refs.taxModal.close()
|
this.$refs.taxModal.close()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -45,11 +45,13 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
taxAmount() {
|
taxAmount() {
|
||||||
if (this.tax.compound_tax && this.total) {
|
if (this.tax.compound_tax && this.total) {
|
||||||
return ((this.total + this.totalTax) * this.tax.percent) / 100
|
return Math.round(
|
||||||
|
((this.total + this.totalTax) * this.tax.percent) / 100
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.total && this.tax.percent) {
|
if (this.total && this.tax.percent) {
|
||||||
return (this.total * this.tax.percent) / 100
|
return Math.round((this.total * this.tax.percent) / 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@ -957,12 +957,15 @@ export default {
|
|||||||
let amount = 0
|
let amount = 0
|
||||||
|
|
||||||
if (selectedTax.compound_tax && this.subtotalWithDiscount) {
|
if (selectedTax.compound_tax && this.subtotalWithDiscount) {
|
||||||
amount =
|
amount = Math.round(
|
||||||
((this.subtotalWithDiscount + this.totalSimpleTax) *
|
((this.subtotalWithDiscount + this.totalSimpleTax) *
|
||||||
selectedTax.percent) /
|
selectedTax.percent) /
|
||||||
100
|
100
|
||||||
|
)
|
||||||
} else if (this.subtotalWithDiscount && selectedTax.percent) {
|
} else if (this.subtotalWithDiscount && selectedTax.percent) {
|
||||||
amount = (this.subtotalWithDiscount * selectedTax.percent) / 100
|
amount = Math.round(
|
||||||
|
(this.subtotalWithDiscount * selectedTax.percent) / 100
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.newInvoice.taxes.push({
|
this.newInvoice.taxes.push({
|
||||||
|
|||||||
@ -45,11 +45,13 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
taxAmount() {
|
taxAmount() {
|
||||||
if (this.tax.compound_tax && this.total) {
|
if (this.tax.compound_tax && this.total) {
|
||||||
return ((this.total + this.totalTax) * this.tax.percent) / 100
|
return Math.round(
|
||||||
|
((this.total + this.totalTax) * this.tax.percent) / 100
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.total && this.tax.percent) {
|
if (this.total && this.tax.percent) {
|
||||||
return (this.total * this.tax.percent) / 100
|
return Math.round((this.total * this.tax.percent) / 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@ -105,11 +105,13 @@ export default {
|
|||||||
},
|
},
|
||||||
taxAmount() {
|
taxAmount() {
|
||||||
if (this.tax.compound_tax && this.total) {
|
if (this.tax.compound_tax && this.total) {
|
||||||
return ((this.total + this.totalTax) * this.tax.percent) / 100
|
return Math.round(
|
||||||
|
((this.total + this.totalTax) * this.tax.percent) / 100
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.total && this.tax.percent) {
|
if (this.total && this.tax.percent) {
|
||||||
return (this.total * this.tax.percent) / 100
|
return Math.round((this.total * this.tax.percent) / 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user