fix initial tax per item issue

This commit is contained in:
yashkanakiya
2023-08-25 09:33:30 +05:30
parent 05d5ce26fd
commit 27660c6bce
7 changed files with 81 additions and 8 deletions

View File

@ -138,6 +138,7 @@
<script setup>
import { computed, ref, watch, onMounted } from 'vue'
import { cloneDeep } from 'lodash'
import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import {
@ -257,11 +258,23 @@ async function submitForm() {
isSaving.value = true
let data = {
let data = cloneDeep({
...estimateStore.newEstimate,
sub_total: estimateStore.getSubTotal,
total: estimateStore.getTotal,
tax: estimateStore.getTotalTax,
})
if (data.discount_per_item === 'NO') {
data.items.forEach((item, index) => {
if (item.discount_type === 'fixed'){
data.items[index].discount = Math.round(item.discount * 100)
}
})
}
else {
if (data.discount_type === 'fixed'){
data.discount = Math.round(data.discount * 100)
}
}
const action = isEdit.value