Fix product performance grouped JSON build
This commit is contained in:
@@ -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 })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user