From 322bed753f3807bf6b6c8f8008c867775ff98127 Mon Sep 17 00:00:00 2001 From: M_Kececi Date: Wed, 19 Aug 2026 00:53:51 +0300 Subject: [PATCH] Fix product performance grouped JSON build --- .../ProductionProductCostingHasCostDetail.vue | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ui/src/pages/ProductionProductCostingHasCostDetail.vue b/ui/src/pages/ProductionProductCostingHasCostDetail.vue index 7c20e21..5f44998 100644 --- a/ui/src/pages/ProductionProductCostingHasCostDetail.vue +++ b/ui/src/pages/ProductionProductCostingHasCostDetail.vue @@ -2903,6 +2903,26 @@ function shouldIncludeRowInGroupTotal (grp, row) { return normalizedValue !== '0' && normalizedValue !== 'false' && normalizedValue !== 'hayir' } +function resolveGroupRowTRYAmount (row) { + const columnAmount = parseMoneyInput(row?.lTutar) + if (columnAmount !== 0) return columnAmount + + const liveAmount = resolveRowTRYTutar(row) + if (liveAmount !== 0) return liveAmount + + return parseMoneyInput(row?.__lastValidTRYAmount ?? row?.lTutarTL) +} + +function resolveGroupRowUSDAmount (row) { + const columnAmount = parseMoneyInput(row?.usdTutar ?? row?.lTutarUSD) + if (columnAmount !== 0) return columnAmount + + const liveAmount = resolveRowUSDTutar(row) + if (liveAmount !== 0) return liveAmount + + return parseMoneyInput(row?.__lastValidUSDAmount) +} + // OrderEntry groupedRows ile ayni desen: sub-header degerleri ayri bir // state/cache icinde tutulmaz; iki gorunen tutar kolonu satirlardan reaktif // olarak her degisiklikte yeniden toplanir. @@ -2910,8 +2930,8 @@ const detailGroupsWithTotals = computed(() => ( detailGroups.value.map(group => { const totals = (Array.isArray(group?.items) ? group.items : []).reduce((acc, row) => { if (!shouldIncludeRowInGroupTotal(group, row)) return acc - acc.tryTotal += parseMoneyInput(row?.lTutar) - acc.usdTotal += resolveRowUSDTutar(row) + acc.tryTotal += resolveGroupRowTRYAmount(row) + acc.usdTotal += resolveGroupRowUSDAmount(row) return acc }, { tryTotal: 0, usdTotal: 0 })