mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-20 11:44:05 +00:00
feat: Tax included (#370)
* feat: Tax included * Added a toggle switch in tax settings to enable the feature. * Database migration adding tax_included field into estimates, invoices and recurring invoices table. * Toggle switch to enable and store the tax_included by estimates, invoices and recurring invoices. * In case of tax included enabled, total taxes will be recalculated and the invoices, estimates and recurring invoices total won't be sum with taxes. * Apply tax included when discount_per_item/tax_per_item item is enabled. * Custom component to show the net total when tax included is enabled. * Update invoice and estimates pdfs with net total. * chore: Tax included by default A switch button inside the tax settings to enable the tax included by default in invoices, estimates and recurring invoices.
This commit is contained in:
@@ -42,6 +42,10 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
storeProp: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
data: {
|
||||
type: String,
|
||||
default: '',
|
||||
@@ -64,6 +68,13 @@ const taxAmount = computed(() => {
|
||||
100
|
||||
)
|
||||
}
|
||||
if (props.store.getSubtotalWithDiscount && props.tax.percent && props.store[props.storeProp].tax_included) {
|
||||
return Math.round(
|
||||
props.store.getSubtotalWithDiscount - (
|
||||
props.store.getSubtotalWithDiscount / (1 + (props.tax.percent / 100))
|
||||
)
|
||||
)
|
||||
}
|
||||
if (props.store.getSubtotalWithDiscount && props.tax.percent) {
|
||||
return Math.round(
|
||||
(props.store.getSubtotalWithDiscount * props.tax.percent) / 100
|
||||
@@ -81,6 +92,13 @@ watchEffect(() => {
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.store[props.storeProp].tax_included,
|
||||
(val) => {
|
||||
updateTax()
|
||||
}, { deep: true },
|
||||
)
|
||||
|
||||
function updateTax() {
|
||||
emit('update', {
|
||||
...props.tax,
|
||||
|
||||
Reference in New Issue
Block a user