diff --git a/ui/src/pages/ProductionProductCostingHasCostDetail.vue b/ui/src/pages/ProductionProductCostingHasCostDetail.vue index 178de85..5c4effa 100644 --- a/ui/src/pages/ProductionProductCostingHasCostDetail.vue +++ b/ui/src/pages/ProductionProductCostingHasCostDetail.vue @@ -2912,22 +2912,9 @@ function shouldIncludeRowInGroupTotal (grp, row) { } function refreshLiveGroupTotals () { - detailGroups.value = detailGroups.value.map(group => { - const totals = (Array.isArray(group?.items) ? group.items : []).reduce((acc, row) => { - if (!shouldIncludeRowInGroupTotal(group, row)) return acc - acc.tryTotal += resolveRowTRYTutar(row) - acc.usdTotal += resolveRowUSDTutar(row) - acc.quantity += resolveNumericRowQuantity(row) - return acc - }, { tryTotal: 0, usdTotal: 0, quantity: 0 }) - - return { - ...group, - liveTryTotal: totals.tryTotal, - liveUsdTotal: totals.usdTotal, - liveQuantity: totals.quantity - } - }) + // Totals are derived directly from reactive rows. The revision only forces + // Quasar's table/sub-header render after an in-place row edit. + groupTotalsRevision.value += 1 } const pendingRenderedAmounts = new Map() @@ -2975,25 +2962,35 @@ function renderedRowsForGroup (groupIndex) { } function resolveRenderedGroupIncludedCount (groupIndex) { - return renderedRowsForGroup(groupIndex).filter(row => row.included).length + const grp = detailGroups.value[groupIndex] + return (Array.isArray(grp?.items) ? grp.items : []).filter(row => shouldIncludeRowInGroupTotal(grp, row)).length } function resolveRenderedGroupRowCount (groupIndex) { - return renderedRowsForGroup(groupIndex).length + const grp = detailGroups.value[groupIndex] + return Array.isArray(grp?.items) ? grp.items.length : 0 } function resolveGroupTRYTutar (groupIndex, _revision) { const grp = detailGroups.value[groupIndex] - return parseMoneyInput(grp?.liveTryTotal) + return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => { + if (!shouldIncludeRowInGroupTotal(grp, row)) return total + return total + parseMoneyInput(row?.lTutar) + }, 0) } function resolveGroupUSDTutar (groupIndex, _revision) { const grp = detailGroups.value[groupIndex] - return parseMoneyInput(grp?.liveUsdTotal) + return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => { + if (!shouldIncludeRowInGroupTotal(grp, row)) return total + return total + parseMoneyInput(row?.usdTutar ?? row?.lTutarUSD) + }, 0) } function resolveGroupQuantity (grp) { - return parseMoneyInput(grp?.liveQuantity) + return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => ( + total + resolveNumericRowQuantity(row) + ), 0) } function groupKey (grp, gi) {