From 9608ab6207a2b506f2635f5bbb8c560e10458dc0 Mon Sep 17 00:00:00 2001 From: yashkanakiya Date: Mon, 28 Aug 2023 15:49:20 +0530 Subject: [PATCH] remove compound interest and remove unused code --- .../estimate-invoice-common/CreateItemRow.vue | 18 +++------------ .../CreateItemRowTax.vue | 13 +---------- .../estimate-invoice-common/CreateTotal.vue | 10 +-------- .../modal-components/TaxTypeModal.vue | 22 +------------------ .../admin/views/settings/TaxTypesSetting.vue | 20 ----------------- 5 files changed, 6 insertions(+), 77 deletions(-) diff --git a/resources/scripts/admin/components/estimate-invoice-common/CreateItemRow.vue b/resources/scripts/admin/components/estimate-invoice-common/CreateItemRow.vue index 3a25fda8c..705df7f45 100644 --- a/resources/scripts/admin/components/estimate-invoice-common/CreateItemRow.vue +++ b/resources/scripts/admin/components/estimate-invoice-common/CreateItemRow.vue @@ -309,7 +309,7 @@ const showRemoveButton = computed(() => { const totalSimpleTax = computed(() => { return Math.round( sumBy(props.itemData.taxes, function (tax) { - if (!tax.compound_tax) { + if (tax.amount) { return tax.amount } return 0 @@ -317,18 +317,7 @@ const totalSimpleTax = computed(() => { ) }) -const totalCompoundTax = computed(() => { - return Math.round( - sumBy(props.itemData.taxes, function (tax) { - if (tax.compound_tax) { - return tax.amount - } - return 0 - }) - ) -}) - -const totalTax = computed(() => totalSimpleTax.value + totalCompoundTax.value) +const totalTax = computed(() => totalSimpleTax.value) const rules = { name: { @@ -395,7 +384,7 @@ const v$ = useVuelidate( function updateTax(data) { props.store.$patch((state) => { - state[props.storeProp].items[props.index].taxes[data.index] = data.item + state[props.storeProp].items[props.index]['taxes'][data.index] = data.item }) let lastTax = props.itemData.taxes[props.itemData.taxes.length - 1] @@ -491,7 +480,6 @@ function syncItemToStore() { total: total.value, sub_total: subtotal.value, totalSimpleTax: totalSimpleTax.value, - totalCompoundTax: totalCompoundTax.value, totalTax: totalTax.value, tax: totalTax.value, taxes: [...itemTaxes], diff --git a/resources/scripts/admin/components/estimate-invoice-common/CreateItemRowTax.vue b/resources/scripts/admin/components/estimate-invoice-common/CreateItemRowTax.vue index a61a10550..eecd3e5fe 100644 --- a/resources/scripts/admin/components/estimate-invoice-common/CreateItemRowTax.vue +++ b/resources/scripts/admin/components/estimate-invoice-common/CreateItemRowTax.vue @@ -146,16 +146,7 @@ const filteredTypes = computed(() => { }) const taxAmount = computed(() => { - if (localTax.compound_tax && props.discountedTotal) { - const taxPerItemEnabled = props.store[props.storeProp].tax_per_item === 'YES' - const discountPerItemEnabled = props.store[props.storeProp].discount_per_item === 'YES' - if (taxPerItemEnabled && !discountPerItemEnabled){ - return getTaxAmount() - } - return ((props.discountedTotal + props.totalTax) * localTax.percent) / 100 - } - - if (props.discountedTotal && localTax.percent) { + if (props.discountedTotal && localTax.percent) { const taxPerItemEnabled = props.store[props.storeProp].tax_per_item === 'YES' const discountPerItemEnabled = props.store[props.storeProp].discount_per_item === 'YES' if (taxPerItemEnabled && !discountPerItemEnabled){ @@ -163,7 +154,6 @@ const taxAmount = computed(() => { } return (props.discountedTotal * localTax.percent) / 100 } - return 0 }) @@ -200,7 +190,6 @@ updateRowTax() function onSelectTax(val) { localTax.percent = val.percent localTax.tax_type_id = val.id - localTax.compound_tax = val.compound_tax localTax.name = val.name updateRowTax() diff --git a/resources/scripts/admin/components/estimate-invoice-common/CreateTotal.vue b/resources/scripts/admin/components/estimate-invoice-common/CreateTotal.vue index 2d756592e..2a2935e9b 100644 --- a/resources/scripts/admin/components/estimate-invoice-common/CreateTotal.vue +++ b/resources/scripts/admin/components/estimate-invoice-common/CreateTotal.vue @@ -323,14 +323,7 @@ function selectPercentage() { function onSelectTax(selectedTax) { let amount = 0 - - if (selectedTax.compound_tax && props.store.getSubtotalWithDiscount) { - amount = Math.round( - ((props.store.getSubtotalWithDiscount + props.store.getTotalSimpleTax) * - selectedTax.percent) / - 100 - ) - } else if (props.store.getSubtotalWithDiscount && selectedTax.percent) { + if (props.store.getSubtotalWithDiscount && selectedTax.percent) { amount = Math.round( (props.store.getSubtotalWithDiscount * selectedTax.percent) / 100 ) @@ -341,7 +334,6 @@ function onSelectTax(selectedTax) { id: Guid.raw(), name: selectedTax.name, percent: selectedTax.percent, - compound_tax: selectedTax.compound_tax, tax_type_id: selectedTax.id, amount, } diff --git a/resources/scripts/admin/components/modal-components/TaxTypeModal.vue b/resources/scripts/admin/components/modal-components/TaxTypeModal.vue index e7c1d76a4..5f4e83e4f 100644 --- a/resources/scripts/admin/components/modal-components/TaxTypeModal.vue +++ b/resources/scripts/admin/components/modal-components/TaxTypeModal.vue @@ -77,17 +77,6 @@ @input="v$.currentTaxType.description.$touch()" /> - - - -
- -