From dbb3f3f3809acfb85502f04e45798314caa88be8 Mon Sep 17 00:00:00 2001 From: M_Kececi Date: Tue, 18 Aug 2026 21:07:52 +0300 Subject: [PATCH] Fix product performance grouped JSON build --- .../ProductionProductCostingHasCostDetail.vue | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/ui/src/pages/ProductionProductCostingHasCostDetail.vue b/ui/src/pages/ProductionProductCostingHasCostDetail.vue index c0922f3..7b94d90 100644 --- a/ui/src/pages/ProductionProductCostingHasCostDetail.vue +++ b/ui/src/pages/ProductionProductCostingHasCostDetail.vue @@ -469,7 +469,7 @@
- Grup Toplami TRY: {{ formatBarMoney(groupLiveTotals[gi]?.tryTotal) }} | USD: {{ formatBarMoney(groupLiveTotals[gi]?.usdTotal) }} + Grup Toplami TRY: {{ formatBarMoney(resolveGroupTRYTutar(grp, groupTotalsRevision)) }} | USD: {{ formatBarMoney(resolveGroupUSDTutar(grp, groupTotalsRevision)) }} flatDetailRows.value.reduce((acc, row) => gbpTotal: 0 })) -const groupLiveTotals = computed(() => { - // Explicitly depend on inline-edit events as QTable can update a row without - // invalidating computations owned by the parent component. - void groupTotalsRevision.value - return detailGroups.value.map(group => ( - (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 }) - )) -}) - const summaryOpen = ref(false) function makeEmptySummaryRow (part) { @@ -2899,12 +2884,26 @@ function shouldIncludeRowInGroupTotal (grp, row) { // CM1/CM2 sub-headers always show their full group value. For every other // group, the explicit "Maliyete Dahil" selection controls the subtotal. if (isCMGroupName(grp?.sAciklama3 || row?.sAciklama3)) return true - return normalizeBooleanFlag(row?.maliyeteDahil ?? row?.maliyete_dahil ?? row?.Maliyete_dahil) + if (typeof row?.maliyeteDahil === 'boolean') return row.maliyeteDahil + return normalizeBooleanFlag(row?.maliyete_dahil ?? row?.Maliyete_dahil) +} + +function resolveGroupTRYTutar (grp, _revision) { + return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => ( + total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveRowTRYTutar(row) : 0) + ), 0) +} + +function resolveGroupUSDTutar (grp, _revision) { + return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => ( + total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveRowUSDTutar(row) : 0) + ), 0) } function resolveGroupQuantity (grp) { - const groupIndex = detailGroups.value.indexOf(grp) - return groupIndex >= 0 ? parseMoneyInput(groupLiveTotals.value[groupIndex]?.quantity) : 0 + return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => ( + total + resolveNumericRowQuantity(row) + ), 0) } function groupKey (grp, gi) { @@ -3397,6 +3396,9 @@ async function fetchBulkItemPrices () { }) }) })) + // Update sub-headers immediately after the bulk response is applied. Do + // not wait for the optional previous-cost autofill request below. + triggerUIUpdate() $q.notify({ type: appliedCount > 0 ? 'positive' : 'warning', @@ -3477,6 +3479,7 @@ async function fetchBulkItemPrices () { }) }) })) + triggerUIUpdate() if (filled > 0) { $q.notify({