mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-29 04:31:08 -04:00
fix tax rounding errors and styling issues
This commit is contained in:
@ -13,4 +13,10 @@ export default {
|
|||||||
'inline-flex items-center justify-center text-black transition px-2 duration-150 ease-in-out border border-gray-300 border-solid focus:outline-none bg-white',
|
'inline-flex items-center justify-center text-black transition px-2 duration-150 ease-in-out border border-gray-300 border-solid focus:outline-none bg-white',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
sizes: {
|
||||||
|
discount: {
|
||||||
|
button: 'py-2 px-2 text-sm leading-5 rounded',
|
||||||
|
loadingIcon: 'w-4 h-4 -ml-2',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,9 @@ Vue.directive('click-outside', {
|
|||||||
Vue.directive('autoresize', {
|
Vue.directive('autoresize', {
|
||||||
inserted: function (el) {
|
inserted: function (el) {
|
||||||
el.style.height = el.scrollHeight + 'px'
|
el.style.height = el.scrollHeight + 'px'
|
||||||
|
if (el.style.overflow && el.style.overflow.y) {
|
||||||
el.style.overflow.y = 'hidden'
|
el.style.overflow.y = 'hidden'
|
||||||
|
}
|
||||||
el.style.resize = 'none'
|
el.style.resize = 'none'
|
||||||
function OnInput() {
|
function OnInput() {
|
||||||
this.style.height = 'auto'
|
this.style.height = 'auto'
|
||||||
|
|||||||
@ -322,8 +322,8 @@
|
|||||||
<sw-button
|
<sw-button
|
||||||
slot="activator"
|
slot="activator"
|
||||||
type="button"
|
type="button"
|
||||||
class="flex items-center justify-center w-12 border border-gray-300 border-solid rounded-tl-none rounded-bl-none font-base"
|
|
||||||
data-toggle="dropdown"
|
data-toggle="dropdown"
|
||||||
|
size="discount"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
style="height: 43px"
|
style="height: 43px"
|
||||||
|
|||||||
@ -85,9 +85,10 @@
|
|||||||
slot="activator"
|
slot="activator"
|
||||||
type="button"
|
type="button"
|
||||||
data-toggle="dropdown"
|
data-toggle="dropdown"
|
||||||
|
size="discount"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
style="height: 43px; padding: 6px"
|
style="height: 43px"
|
||||||
variant="white"
|
variant="white"
|
||||||
>
|
>
|
||||||
<span class="flex">
|
<span class="flex">
|
||||||
@ -266,22 +267,26 @@ export default {
|
|||||||
return this.subtotal - this.item.discount_val
|
return this.subtotal - this.item.discount_val
|
||||||
},
|
},
|
||||||
totalSimpleTax() {
|
totalSimpleTax() {
|
||||||
return window._.sumBy(this.item.taxes, function (tax) {
|
return Math.round(
|
||||||
|
window._.sumBy(this.item.taxes, function (tax) {
|
||||||
if (!tax.compound_tax) {
|
if (!tax.compound_tax) {
|
||||||
return tax.amount
|
return tax.amount
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
|
)
|
||||||
},
|
},
|
||||||
totalCompoundTax() {
|
totalCompoundTax() {
|
||||||
return window._.sumBy(this.item.taxes, function (tax) {
|
return Math.round(
|
||||||
|
window._.sumBy(this.item.taxes, function (tax) {
|
||||||
if (tax.compound_tax) {
|
if (tax.compound_tax) {
|
||||||
return tax.amount
|
return tax.amount
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
|
)
|
||||||
},
|
},
|
||||||
totalTax() {
|
totalTax() {
|
||||||
return this.totalSimpleTax + this.totalCompoundTax
|
return this.totalSimpleTax + this.totalCompoundTax
|
||||||
|
|||||||
@ -315,8 +315,8 @@
|
|||||||
<sw-button
|
<sw-button
|
||||||
slot="activator"
|
slot="activator"
|
||||||
type="button"
|
type="button"
|
||||||
class="flex items-center justify-center w-12 border border-gray-300 border-solid rounded-tl-none rounded-bl-none font-base"
|
|
||||||
data-toggle="dropdown"
|
data-toggle="dropdown"
|
||||||
|
size="discount"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
style="height: 43px"
|
style="height: 43px"
|
||||||
@ -565,23 +565,27 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
totalSimpleTax() {
|
totalSimpleTax() {
|
||||||
return window._.sumBy(this.newInvoice.taxes, function (tax) {
|
return Math.round(
|
||||||
|
window._.sumBy(this.newInvoice.taxes, function (tax) {
|
||||||
if (!tax.compound_tax) {
|
if (!tax.compound_tax) {
|
||||||
return tax.amount
|
return tax.amount
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
totalCompoundTax() {
|
totalCompoundTax() {
|
||||||
return window._.sumBy(this.newInvoice.taxes, function (tax) {
|
return Math.round(
|
||||||
|
window._.sumBy(this.newInvoice.taxes, function (tax) {
|
||||||
if (tax.compound_tax) {
|
if (tax.compound_tax) {
|
||||||
return tax.amount
|
return tax.amount
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
totalTax() {
|
totalTax() {
|
||||||
@ -589,9 +593,11 @@ export default {
|
|||||||
return this.totalSimpleTax + this.totalCompoundTax
|
return this.totalSimpleTax + this.totalCompoundTax
|
||||||
}
|
}
|
||||||
|
|
||||||
return window._.sumBy(this.newInvoice.items, function (tax) {
|
return Math.round(
|
||||||
|
window._.sumBy(this.newInvoice.items, function (tax) {
|
||||||
return tax.tax
|
return tax.tax
|
||||||
})
|
})
|
||||||
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
allTaxes() {
|
allTaxes() {
|
||||||
|
|||||||
@ -83,8 +83,8 @@
|
|||||||
<sw-button
|
<sw-button
|
||||||
slot="activator"
|
slot="activator"
|
||||||
type="button"
|
type="button"
|
||||||
class="flex items-center px-5 py-1 text-sm font-medium leading-none text-center text-gray-500 whitespace-nowrap border border-gray-300 border-solid rounded rounded-tl-none rounded-bl-none dropdown-toggle"
|
|
||||||
data-toggle="dropdown"
|
data-toggle="dropdown"
|
||||||
|
size="discount"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
style="height: 43px"
|
style="height: 43px"
|
||||||
@ -266,22 +266,26 @@ export default {
|
|||||||
return this.subtotal - this.item.discount_val
|
return this.subtotal - this.item.discount_val
|
||||||
},
|
},
|
||||||
totalSimpleTax() {
|
totalSimpleTax() {
|
||||||
return window._.sumBy(this.item.taxes, function (tax) {
|
return Math.round(
|
||||||
|
window._.sumBy(this.item.taxes, function (tax) {
|
||||||
if (!tax.compound_tax) {
|
if (!tax.compound_tax) {
|
||||||
return tax.amount
|
return tax.amount
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
|
)
|
||||||
},
|
},
|
||||||
totalCompoundTax() {
|
totalCompoundTax() {
|
||||||
return window._.sumBy(this.item.taxes, function (tax) {
|
return Math.round(
|
||||||
|
window._.sumBy(this.item.taxes, function (tax) {
|
||||||
if (tax.compound_tax) {
|
if (tax.compound_tax) {
|
||||||
return tax.amount
|
return tax.amount
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
|
)
|
||||||
},
|
},
|
||||||
totalTax() {
|
totalTax() {
|
||||||
return this.totalSimpleTax + this.totalCompoundTax
|
return this.totalSimpleTax + this.totalCompoundTax
|
||||||
|
|||||||
Reference in New Issue
Block a user