Fix product performance grouped JSON build
This commit is contained in:
@@ -469,7 +469,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="sub-right pcd-sub-right-clickable" @click="toggleGroup(grp, gi)">
|
<div class="sub-right pcd-sub-right-clickable" @click="toggleGroup(grp, gi)">
|
||||||
<span class="pcd-group-total-text">
|
<span class="pcd-group-total-text" data-no-runtime-i18n="true">
|
||||||
Grup Toplamı TRY: {{ formatBarMoney(grp.tryTotal) }}
|
Grup Toplamı TRY: {{ formatBarMoney(grp.tryTotal) }}
|
||||||
<span class="pcd-group-total-divider">|</span>
|
<span class="pcd-group-total-divider">|</span>
|
||||||
USD: {{ formatBarMoney(grp.usdTotal) }}
|
USD: {{ formatBarMoney(grp.usdTotal) }}
|
||||||
@@ -2936,66 +2936,20 @@ const detailGroupsWithTotals = computed(() => (
|
|||||||
detailGroups.value.map(group => {
|
detailGroups.value.map(group => {
|
||||||
const items = Array.isArray(group?.items) ? group.items : []
|
const items = Array.isArray(group?.items) ? group.items : []
|
||||||
const totals = items.reduce((acc, row) => {
|
const totals = items.reduce((acc, row) => {
|
||||||
acc.rawTryTotal += parseMoneyInput(row?.lTutar)
|
|
||||||
acc.liveTryTotal += resolveRowTRYTutar(row)
|
|
||||||
if (!shouldIncludeRowInGroupTotal(group, row)) return acc
|
if (!shouldIncludeRowInGroupTotal(group, row)) return acc
|
||||||
acc.includedCount += 1
|
|
||||||
acc.tryTotal += resolveGroupRowTRYAmount(row)
|
acc.tryTotal += resolveGroupRowTRYAmount(row)
|
||||||
acc.usdTotal += resolveGroupRowUSDAmount(row)
|
acc.usdTotal += resolveGroupRowUSDAmount(row)
|
||||||
return acc
|
return acc
|
||||||
}, { tryTotal: 0, usdTotal: 0, rawTryTotal: 0, liveTryTotal: 0, includedCount: 0 })
|
}, { tryTotal: 0, usdTotal: 0 })
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...group,
|
...group,
|
||||||
tryTotal: totals.tryTotal,
|
tryTotal: totals.tryTotal,
|
||||||
usdTotal: totals.usdTotal,
|
usdTotal: totals.usdTotal
|
||||||
rawTryTotal: totals.rawTryTotal,
|
|
||||||
liveTryTotal: totals.liveTryTotal,
|
|
||||||
rowCount: items.length,
|
|
||||||
includedCount: totals.includedCount,
|
|
||||||
firstTryAmount: items.length > 0 ? resolveGroupRowTRYAmount(items[0]) : 0
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
))
|
))
|
||||||
|
|
||||||
watch(
|
|
||||||
detailGroupsWithTotals,
|
|
||||||
groups => {
|
|
||||||
const timestamp = new Date().toISOString()
|
|
||||||
console.groupCollapsed(`[PCD-GROUP-TOTALS] ${timestamp}`)
|
|
||||||
console.table((Array.isArray(groups) ? groups : []).map(group => ({
|
|
||||||
grup: String(group?.sAciklama3 || 'TANIMSIZ'),
|
|
||||||
satir: group?.rowCount || 0,
|
|
||||||
dahil: group?.includedCount || 0,
|
|
||||||
hamTRY: group?.rawTryTotal || 0,
|
|
||||||
canliTRY: group?.liveTryTotal || 0,
|
|
||||||
toplamTRY: group?.tryTotal || 0,
|
|
||||||
toplamUSD: group?.usdTotal || 0
|
|
||||||
})))
|
|
||||||
|
|
||||||
;(Array.isArray(groups) ? groups : []).forEach(group => {
|
|
||||||
console.groupCollapsed(`[PCD-GROUP-ROWS] ${String(group?.sAciklama3 || 'TANIMSIZ')}`)
|
|
||||||
console.table((Array.isArray(group?.items) ? group.items : []).map(row => ({
|
|
||||||
key: row?.__rowKey,
|
|
||||||
kod: row?.sKodu,
|
|
||||||
dahil: shouldIncludeRowInGroupTotal(group, row),
|
|
||||||
miktarInput: row?.miktarInput,
|
|
||||||
lMiktar: row?.lMiktar,
|
|
||||||
inputPrice: row?.inputPrice,
|
|
||||||
paraBirimi: row?.inputPricePrBr,
|
|
||||||
lFiyat: row?.lFiyat,
|
|
||||||
lTutar: row?.lTutar,
|
|
||||||
hesapTRY: resolveGroupRowTRYAmount(row),
|
|
||||||
usdTutar: row?.usdTutar,
|
|
||||||
hesapUSD: resolveGroupRowUSDAmount(row)
|
|
||||||
})))
|
|
||||||
console.groupEnd()
|
|
||||||
})
|
|
||||||
console.groupEnd()
|
|
||||||
},
|
|
||||||
{ deep: true, immediate: true, flush: 'post' }
|
|
||||||
)
|
|
||||||
|
|
||||||
function resolveGroupQuantity (grp) {
|
function resolveGroupQuantity (grp) {
|
||||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||||
total + resolveNumericRowQuantity(row)
|
total + resolveNumericRowQuantity(row)
|
||||||
|
|||||||
Reference in New Issue
Block a user