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

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

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

Loading…
Cancel
Save