Browse Source

YT-2596现场出现供应商发票新增后材料款未税金额、材料款税额、材料款价税合计为0的错误数据,前端涉及到金额保留位数有问题

intex_online20250522
张立 3 weeks ago
parent
commit
f0b45fa124
  1. 89
      src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue
  2. 4
      src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts

89
src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue

@ -43,7 +43,7 @@
</template>
<template #differencePrice="{ row }">
<span :class="{ 'red-text': row.differencePrice != 0 }">{{
Number(row.differencePrice).toFixed(5)
Math.round(Number(row.differencePrice) * 100000) / 100000
}}</span>
</template>
<template #action="{ row, $index }">
@ -113,54 +113,48 @@
updateOriginFormModel(formModel)
}
formRef.value.setValues({
claimTaxAmount: Number(Number(claimAmount * taxRate * 0.01).toFixed(2)),// = *
claimTaxTotal :Number(Number(Number(claimAmount) + Number(claimTaxAmount)).toFixed(2)),// = +
moldTaxTotal :Number(Number(Number(moldUntaxedAmount) + Number(moldTaxAmount)).toFixed(2)),// = +
moldTaxAmount: Number(Number(moldUntaxedAmount * taxRate * 0.01).toFixed(2)),// = *
claimTaxAmount: Number( Math.round((claimAmount * taxRate * 0.01) * 100) / 100),// = *
claimTaxTotal :Number(Math.round(Number(Number(claimAmount) + Number(claimTaxAmount)) * 100) / 100),// = +
moldTaxTotal :Number(Math.round(Number(Number(moldUntaxedAmount) + Number(moldTaxAmount)) * 100) / 100),// = +
moldTaxAmount: Number(Math.round(Number(moldUntaxedAmount * taxRate * 0.01) * 100) / 100),// = *
afterTaxAmount: amount + taxAmount, // 3+-
invoiceAmountMain: amount - claimAmount, // -
adTaxAmount: beforeTaxAmount + totalTaxAmount, //6+
beforeTaxDiffAmount: Number(Number(Number(beforeTaxAmount) - (Number(amount) + Number(moldUntaxedAmount) - Number(discountAmount1) - Number(claimAmount))).toFixed(2)), // = - + - -
taxAmountDiff: Number(Number(Number(totalTaxAmount) - (Number(taxAmount) + Number(moldTaxAmount) - Number(rebateTax) - Number(claimTaxAmount))).toFixed(2)),// = - + - -
totalTaxDiffAmount: Number(Number(Number(adTaxAmount) - (Number(afterTaxAmount) + Number(moldTaxTotal) - Number(rebateTotal) - Number(claimTaxTotal))).toFixed(2)),// = - + - -
rebateTax: Number(Number(discountAmount1 * taxRate * 0.01).toFixed(2)),
beforeTaxDiffAmount: Number(Math.round(Number(Number(beforeTaxAmount) - (Number(amount) + Number(moldUntaxedAmount) - Number(discountAmount1) - Number(claimAmount))) * 100) / 100), // = - + - -
taxAmountDiff: Number( Math.round(Number(Number(totalTaxAmount) - (Number(taxAmount) + Number(moldTaxAmount) - Number(rebateTax) - Number(claimTaxAmount))) * 100) / 100),// = - + - -
totalTaxDiffAmount: Number(Math.round(Number(Number(adTaxAmount) - (Number(afterTaxAmount) + Number(moldTaxTotal) - Number(rebateTotal) - Number(claimTaxTotal))) * 100) / 100),// = - + - -
rebateTax: Number(Math.round(Number(discountAmount1 * taxRate * 0.01) * 100) / 100),
rebateTotal: rebateTax + discountAmount1,
beforeTaxAmount : Number(Number(Number(moldUntaxedAmount) + Number(amount)-Number(claimAmount) - Number(discountAmount1)).toFixed(2)), // = +-
beforeTaxAmount : Number(Math.round(Number(Number(moldUntaxedAmount) + Number(amount)-Number(claimAmount) - Number(discountAmount1)) * 100) / 100), // = +-
})
} else if (formType == 'create') {
//
let taxAmount_ = taxAmount
if (taxRate != originFormModel.taxRate) {
taxAmount_ = tableData.reduce(
(prev, item) =>
prev +
Number(
Number(
taxRate *
0.01 *
Number(Number(item['singlePrice'] * item['invoicableQuantity']).toFixed(2))
).toFixed(2)
),
prev +Number(Math.round(Number(taxRate * 0.01 *Number(Math.round(Number(item['singlePrice'] * item['invoicableQuantity']) * 100) / 100)) * 100) / 100),
0
)
updateOriginFormModel(formModel)
}
formRef.value.setValues({
claimTaxAmount: Number(Number(claimAmount * taxRate * 0.01).toFixed(2)),// = *
claimTaxTotal :Number(Number(Number(claimAmount) + Number(claimTaxAmount)).toFixed(2)),// = +
moldTaxTotal :Number(Number(Number(moldUntaxedAmount) + Number(moldTaxAmount)).toFixed(2)),// = +
moldTaxAmount: Number(Number(moldUntaxedAmount * taxRate * 0.01).toFixed(2)),// = *
claimTaxAmount: Number(Math.round(Number(claimAmount * taxRate * 0.01) * 100) / 100),// = *
claimTaxTotal :Number( Math.round(Number(Number(claimAmount) + Number(claimTaxAmount)) * 100) / 100),// = +
moldTaxTotal :Number(Math.round(Number(Number(moldUntaxedAmount) + Number(moldTaxAmount)) * 100) / 100),// = +
moldTaxAmount: Number(Math.round(Number(moldUntaxedAmount * taxRate * 0.01) * 100) / 100),// = *
taxAmount: taxAmount_,
afterTaxAmount: amount + taxAmount, // 3+-
invoiceAmountMain: amount - claimAmount, // -
adTaxAmount: beforeTaxAmount + totalTaxAmount, //6+
beforeTaxDiffAmount: Number(Number(Number(beforeTaxAmount) - (Number(amount) + Number(moldUntaxedAmount) - Number(discountAmount1) - Number(claimAmount))).toFixed(2)),// = - + - -
taxAmountDiff: Number(Number(Number(totalTaxAmount) - (Number(taxAmount) + Number(moldTaxAmount) - Number(rebateTax) - Number(claimTaxAmount))).toFixed(2)),// = - + - -
totalTaxDiffAmount: Number(Number(Number(adTaxAmount) - (Number(afterTaxAmount) + Number(moldTaxTotal) - Number(rebateTotal) - Number(claimTaxTotal))).toFixed(2)),// = - + - -
rebateTax: Number(Number(discountAmount1 * taxRate * 0.01).toFixed(2)),
beforeTaxDiffAmount: Number(Math.round(Number(Number(beforeTaxAmount) - (Number(amount) + Number(moldUntaxedAmount) - Number(discountAmount1) - Number(claimAmount))) * 100) / 100),// = - + - -
taxAmountDiff: Number(Math.round(Number(Number(totalTaxAmount) - (Number(taxAmount) + Number(moldTaxAmount) - Number(rebateTax) - Number(claimTaxAmount))) * 100) / 100),// = - + - -
totalTaxDiffAmount: Number(Math.round(Number(Number(adTaxAmount) - (Number(afterTaxAmount) + Number(moldTaxTotal) - Number(rebateTotal) - Number(claimTaxTotal))) * 100) / 100),// = - + - -
rebateTax: Number(Math.round(Number(discountAmount1 * taxRate * 0.01) * 100) / 100),
rebateTotal: rebateTax + discountAmount1,
beforeTaxAmount : Number(Number(Number(moldUntaxedAmount) + Number(amount)-Number(claimAmount) - Number(discountAmount1)).toFixed(2)), // = +-
beforeTaxAmount : Number(Math.round(Number(Number(moldUntaxedAmount) + Number(amount)-Number(claimAmount) - Number(discountAmount1)) * 100) / 100), // = +-
})
}
}
@ -169,36 +163,28 @@
(formRef, formModel, tableData) => {
// 1 XX
const { taxRate = 0 } = formModel
console.log(888,tableData)
const sumObject = {
amount: tableData.reduce(
(prev, item) =>
prev + Number(Number(item['singlePrice'] * item['invoicableQuantity']).toFixed(2)),
(prev, item) => prev + Number(Math.round((item['singlePrice'] * item['invoicableQuantity'])* 100)/ 100),
0
),
taxAmount: tableData.reduce(
(prev, item) =>
prev +
Number(
Number(
taxRate *
0.01 *
Number(Number(item['singlePrice'] * item['invoicableQuantity']).toFixed(2))
).toFixed(2)
),
Number(Math.round(Number(taxRate *0.01 * Number(Math.round(Number(item['singlePrice'] * item['invoicableQuantity']) * 100) / 100)) * 100) / 100),
0
),
moldUntaxedAmount: tableData.reduce(
(prev, item) =>
prev +
Number(
Number(item['allocationPrice'] * item['invoicableQuantity']).toFixed(2)
Math.round(Number(item['allocationPrice'] * item['invoicableQuantity']) * 100) / 100
),
0
) // = sum(*)
}
;(sumObject.invoiceAmountMain = (
Number(sumObject.amount) - Number(formRef.value.formModel.claimAmount)
).toFixed(2)) // -
;(sumObject.invoiceAmountMain = Math.round((Number(sumObject.amount) - Number(formRef.value.formModel.claimAmount)) * 100) / 100) // -
formRef.value.setValues(sumObject)
}
"
@ -218,18 +204,15 @@
<template #selectionsActionspoLine="{ selections }">
<div style="text-align: left; margin-right: 10px">
系统未税金额:{{
Number(
Math.round( Number(
selections.reduce(
(prev, item) =>
prev +
Number(
Number(
Number(Number(item['purchasePrice']).toFixed(5)) * item['invoicableQuantity']
).toFixed(2)
Number( Math.round(Number(Number(Math.round(Number(item['purchasePrice']) * 100000) / 100000) * item['invoicableQuantity']) * 100) / 100
),
0
)
).toFixed(2)
) * 100) / 100
}}
</div>
</template>
@ -243,7 +226,7 @@
<el-input
:disabled="true"
:class="{ 'is-red': row['singlePrice'] - row['purchasePrice'] > 0 }"
:modelValue="(row['singlePrice'] - row['purchasePrice']).toFixed(5)"
:modelValue="Math.round((row['singlePrice'] - row['purchasePrice']) * 100000) / 100000"
/>
</template>
<template #table>
@ -372,7 +355,7 @@
(formRef, formModel) => {
const { singlePrice = 0, purchasePrice = 0 } = formModel
formRef.value.setValues({
differencePrice: Number((Number(singlePrice) - Number(purchasePrice)).toFixed(5))
differencePrice: Number(Math.round((Number(singlePrice) - Number(purchasePrice)) * 100000) / 100000)
})
}
"
@ -1087,13 +1070,13 @@ const claimDetails = async (supplierCode) => {
claimDetailsList.value = await PurchaseClaimRequestDetailApi.getPurchaseClaimRequestDetailList(
supplierCode
)
formRef.value.formRef.formModel.claimAmount = claimDetailsList.value
formRef.value.formRef.formModel.claimAmount = Math.round(claimDetailsList.value
.map((item) => item.claimAmount)
.reduce((prev, item) => prev + item)
.toFixed(5)
formRef.value.formRef.formModel.invoiceAmountMain = (
* 100000) / 100000
formRef.value.formRef.formModel.invoiceAmountMain = Math.round((
Number(formRef.value.formRef.formModel.amount) - Number(formRef.value.formModel.claimAmount)
).toFixed(2) // -
) * 100) / 100 // -
}
//
const claimDetailsForUpdate = async (supplierCode, id) => {
@ -1561,7 +1544,7 @@ const submitForm = async (formType, submitData) => {
let data = { ...submitData }
tableData.value.forEach((item) => {
item.differencePrice = Number(
(Number(item?.singlePrice) - Number(item?.purchasePrice)).toFixed(5)
Math.round((Number(item?.singlePrice) - Number(item?.purchasePrice)) * 100000) / 100000
)
})
let flagInvoicableQuantity = false

4
src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts

@ -1299,7 +1299,7 @@ export const accountantFormartDetail = ( cellValue) => {
return ''
}
cellValue = cellValue + '' || ''
cellValue = Number(cellValue).toFixed(2)
cellValue = Math.round(Number(cellValue) * 100) / 100
let x = cellValue.split('.')
let x1 = x[0]
let x2 = x.length > 1 ? '.' + x[1] : ''
@ -1942,7 +1942,7 @@ export const SupplierinvoiceRequestDetailMain = useCrudSchemas(reactive<CrudSche
]))
const singlePriceFormart = (row, column, cellValue) => {
cellValue= Number(cellValue).toFixed(5)
cellValue = Math.round(Number(cellValue) * 100000) / 100000
cellValue = cellValue + '' || ''
let x = cellValue.split('.')

Loading…
Cancel
Save