add changes in tax per item calculation

This commit is contained in:
yashkanakiya
2023-08-25 17:45:43 +05:30
parent 4fc67c74e4
commit dbd75bbe68
7 changed files with 148 additions and 48 deletions

View File

@ -264,7 +264,7 @@ async function submitForm() {
total: estimateStore.getTotal,
tax: estimateStore.getTotalTax,
})
if (data.discount_per_item === 'NO') {
if (data.discount_per_item === 'YES') {
data.items.forEach((item, index) => {
if (item.discount_type === 'fixed'){
data.items[index].discount = Math.round(item.discount * 100)
@ -277,6 +277,13 @@ async function submitForm() {
}
}
if (
!estimateStore.newEstimate.tax_per_item === 'YES'
&& data.taxes.length
){
data.tax_type_ids = data.taxes.map(_t => _t.tax_type_id)
}
const action = isEdit.value
? estimateStore.updateEstimate
: estimateStore.addEstimate

View File

@ -265,7 +265,7 @@ async function submitForm() {
total: invoiceStore.getTotal,
tax: invoiceStore.getTotalTax,
})
if (data.discount_per_item === 'NO') {
if (data.discount_per_item === 'YES') {
data.items.forEach((item, index) => {
if (item.discount_type === 'fixed'){
data.items[index].discount = item.discount * 100
@ -277,6 +277,12 @@ async function submitForm() {
data.discount = data.discount * 100
}
}
if (
!invoiceStore.newInvoice.tax_per_item === 'YES'
&& data.taxes.length
){
data.tax_type_ids = data.taxes.map(_t => _t.tax_type_id)
}
try {
const action = isEdit.value