mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 03:31:09 -04:00
remove compound interest and remove unused code
This commit is contained in:
@ -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],
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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,
|
||||
}
|
||||
|
||||
@ -77,17 +77,6 @@
|
||||
@input="v$.currentTaxType.description.$touch()"
|
||||
/>
|
||||
</BaseInputGroup>
|
||||
|
||||
<BaseInputGroup
|
||||
:label="$t('tax_types.compound_tax')"
|
||||
variant="horizontal"
|
||||
class="flex flex-row-reverse"
|
||||
>
|
||||
<BaseSwitch
|
||||
v-model="taxTypeStore.currentTaxType.compound_tax"
|
||||
class="flex items-center"
|
||||
/>
|
||||
</BaseInputGroup>
|
||||
</BaseInputGrid>
|
||||
</div>
|
||||
<div
|
||||
@ -209,14 +198,7 @@ async function submitTaxTypeData() {
|
||||
|
||||
function SelectTax(taxData) {
|
||||
let amount = 0
|
||||
if (taxData.compound_tax && estimateStore.getSubtotalWithDiscount) {
|
||||
amount = Math.round(
|
||||
((estimateStore.getSubtotalWithDiscount +
|
||||
estimateStore.getTotalSimpleTax) *
|
||||
taxData.percent) /
|
||||
100
|
||||
)
|
||||
} else if (estimateStore.getSubtotalWithDiscount && taxData.percent) {
|
||||
if (estimateStore.getSubtotalWithDiscount && taxData.percent) {
|
||||
amount = Math.round(
|
||||
(estimateStore.getSubtotalWithDiscount * taxData.percent) / 100
|
||||
)
|
||||
@ -226,7 +208,6 @@ function SelectTax(taxData) {
|
||||
id: Guid.raw(),
|
||||
name: taxData.name,
|
||||
percent: taxData.percent,
|
||||
compound_tax: taxData.compound_tax,
|
||||
tax_type_id: taxData.id,
|
||||
amount,
|
||||
}
|
||||
@ -242,7 +223,6 @@ function selectItemTax(taxData) {
|
||||
id: Guid.raw(),
|
||||
name: taxData.name,
|
||||
percent: taxData.percent,
|
||||
compound_tax: taxData.compound_tax,
|
||||
tax_type_id: taxData.id,
|
||||
}
|
||||
modalStore.refreshData(data)
|
||||
|
||||
@ -20,21 +20,6 @@
|
||||
:data="fetchData"
|
||||
:columns="taxTypeColumns"
|
||||
>
|
||||
<template #cell-compound_tax="{ row }">
|
||||
<BaseBadge
|
||||
:bg-color="
|
||||
utils.getBadgeStatusColor(row.data.compound_tax ? 'YES' : 'NO')
|
||||
.bgColor
|
||||
"
|
||||
:color="
|
||||
utils.getBadgeStatusColor(row.data.compound_tax ? 'YES' : 'NO')
|
||||
.color
|
||||
"
|
||||
>
|
||||
{{ row.data.compound_tax ? 'Yes' : 'No'.replace('_', ' ') }}
|
||||
</BaseBadge>
|
||||
</template>
|
||||
|
||||
<template #cell-percent="{ row }"> {{ row.data.percent }} % </template>
|
||||
|
||||
<template v-if="hasAtleastOneAbility()" #cell-actions="{ row }">
|
||||
@ -91,11 +76,6 @@ const taxTypeColumns = computed(() => {
|
||||
thClass: 'extra',
|
||||
tdClass: 'font-medium text-gray-900',
|
||||
},
|
||||
{
|
||||
key: 'compound_tax',
|
||||
label: t('settings.tax_types.compound_tax'),
|
||||
tdClass: 'font-medium text-gray-900',
|
||||
},
|
||||
{
|
||||
key: 'percent',
|
||||
label: t('settings.tax_types.percent'),
|
||||
|
||||
Reference in New Issue
Block a user