mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-05-28 14:14:54 +00:00
Merge branch 'master' into frontend-performance-improvements
This commit is contained in:
@@ -50,7 +50,12 @@
|
||||
v-else-if="store[storeProp].tax_per_item === 'YES'"
|
||||
class="m-0 text-sm font-semibold leading-5 text-gray-500 uppercase"
|
||||
>
|
||||
{{ tax.name }} - {{ tax.percent }}%
|
||||
<template v-if="tax.calculation_type === 'percentage'">
|
||||
{{ tax.name }} - {{ tax.percent }}%
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ tax.name }} - <BaseFormatMoney :amount="tax.fixed_amount" :currency="defaultCurrency" />
|
||||
</template>
|
||||
</label>
|
||||
|
||||
<BaseContentPlaceholders v-if="isLoading">
|
||||
@@ -277,6 +282,8 @@ const itemWiseTaxes = computed(() => {
|
||||
amount: Math.round(tax.amount),
|
||||
percent: tax.percent,
|
||||
name: tax.name,
|
||||
calculation_type: tax.calculation_type,
|
||||
fixed_amount: tax.fixed_amount
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -331,10 +338,12 @@ function selectPercentage() {
|
||||
|
||||
function onSelectTax(selectedTax) {
|
||||
let amount = 0
|
||||
if (props.store.getSubtotalWithDiscount && selectedTax.percent) {
|
||||
if (selectedTax.calculation_type === 'percentage' && props.store.getSubtotalWithDiscount && selectedTax.percent) {
|
||||
amount = Math.round(
|
||||
(props.store.getSubtotalWithDiscount * selectedTax.percent) / 100
|
||||
)
|
||||
} else if (selectedTax.calculation_type === 'fixed') {
|
||||
amount = selectedTax.fixed_amount
|
||||
}
|
||||
|
||||
let data = {
|
||||
@@ -344,6 +353,8 @@ function onSelectTax(selectedTax) {
|
||||
percent: selectedTax.percent,
|
||||
tax_type_id: selectedTax.id,
|
||||
amount,
|
||||
calculation_type: selectedTax.calculation_type,
|
||||
fixed_amount: selectedTax.fixed_amount
|
||||
}
|
||||
props.store.$patch((state) => {
|
||||
state[props.storeProp].taxes.push({ ...data })
|
||||
|
||||
Reference in New Issue
Block a user