1
This commit is contained in:
1 parent
0f71fff9ac
commit
cd107604a9
9 files changed
+124
-117
No files matched your search
@@ -164,14 +164,18 @@ const formatReadonlyBudgetFee = (params: any) => {
|
||||
|
||||
const syncComputedValuesToRows = () => {
|
||||
let totalBudgetFee = 0
|
||||
let hasValidRow = false
|
||||
for (const row of detailRows.value) {
|
||||
if (isSubtotalRow(row)) continue
|
||||
if (row.quantity == null || row.unitPrice == null) {
|
||||
const quantity = typeof row.quantity === 'number' && Number.isFinite(row.quantity) ? row.quantity : null
|
||||
const unitPrice = typeof row.unitPrice === 'number' && Number.isFinite(row.unitPrice) ? row.unitPrice : null
|
||||
if (quantity == null || unitPrice == null) {
|
||||
row.budgetFee = null
|
||||
continue
|
||||
}
|
||||
row.budgetFee = roundTo(toDecimal(row.quantity).mul(row.unitPrice), 2)
|
||||
row.budgetFee = roundTo(toDecimal(quantity).mul(unitPrice), 2)
|
||||
if (typeof row.budgetFee === 'number' && Number.isFinite(row.budgetFee)) {
|
||||
hasValidRow = true
|
||||
totalBudgetFee = roundTo(toDecimal(totalBudgetFee).add(row.budgetFee), 2)
|
||||
}
|
||||
}
|
||||
@@ -181,7 +185,7 @@ const syncComputedValuesToRows = () => {
|
||||
subtotalRow.unit = ''
|
||||
subtotalRow.quantity = null
|
||||
subtotalRow.unitPrice = null
|
||||
subtotalRow.budgetFee = totalBudgetFee
|
||||
subtotalRow.budgetFee = hasValidRow ? totalBudgetFee : null
|
||||
subtotalRow.remark = ''
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user