diff --git a/ui/src/pages/ProductionProductCostingHasCostDetail.vue b/ui/src/pages/ProductionProductCostingHasCostDetail.vue
index bc3b278..4c29208 100644
--- a/ui/src/pages/ProductionProductCostingHasCostDetail.vue
+++ b/ui/src/pages/ProductionProductCostingHasCostDetail.vue
@@ -465,19 +465,19 @@
{{ grp.sAciklama3 || 'TANIMSIZ' }}
- Toplam Miktar: {{ formatBarQuantity(resolveGroupQuantity(grp, gi)) }} MT
+ Toplam Miktar: {{ formatBarQuantity(resolveGroupQuantity(grp)) }} MT
- Grup Toplamı TRY: {{ formatBarMoney(resolveGroupTRYTutar(grp, gi, groupTotalsRevision)) }}
+ Grup Toplamı TRY: {{ formatBarMoney(resolveGroupTRYTutar(gi, groupTotalsRevision)) }}
|
- USD: {{ formatBarMoney(resolveGroupUSDTutar(grp, gi, groupTotalsRevision)) }}
+ USD: {{ formatBarMoney(resolveGroupUSDTutar(gi, groupTotalsRevision)) }}
- Tanı: {{ resolveGroupIncludedCount(grp, gi) }}/{{ rowsForGroupTotal(grp, gi).length }} kalem
+ Tanı: {{ resolveRenderedGroupIncludedCount(gi) }}/{{ resolveRenderedGroupRowCount(gi) }} kalem
|
- Ham TRY: {{ formatBarMoney(resolveGroupRawTRYTutar(grp, gi)) }}
+ Ham TRY: {{ formatBarMoney(resolveGroupTRYTutar(gi, groupTotalsRevision)) }}
+
+
+ {{ formatMoney(props.value) }}
+ {{ captureRenderedGroupAmount(gi, grp, props.row, 'try', props.value) }}
+
+
+
+
+
+ {{ formatMoney(props.value) }}
+ {{ captureRenderedGroupAmount(gi, grp, props.row, 'usd', props.value) }}
+
+
+
{{ props.value }}
@@ -1127,7 +1140,7 @@ const detailLoading = ref(false)
const detailError = ref('')
const detailGroups = ref([])
const groupTotalsRevision = ref(0)
-const groupTableRefs = ref([])
+const renderedGroupAmounts = ref({})
const detailHeader = ref(null)
const costDate = ref('')
const exchangeRates = ref(createEmptyExchangeRates())
@@ -2911,55 +2924,68 @@ function shouldIncludeRowInGroupTotal (grp, row) {
return normalizedValue !== '0' && normalizedValue !== 'false' && normalizedValue !== 'hayir'
}
-function setGroupTableRef (groupIndex, tableRef) {
- groupTableRefs.value[groupIndex] = tableRef || null
-}
+const pendingRenderedAmounts = new Map()
+let renderedAmountFlushScheduled = false
-function rowsForGroupTotal (grp, groupIndex) {
- const tableRef = groupTableRefs.value[groupIndex]
- if (tableRef && typeof tableRef.getFilteredSortedRows === 'function') {
- const renderedRows = tableRef.getFilteredSortedRows()
- if (Array.isArray(renderedRows)) return renderedRows
+function captureRenderedGroupAmount (groupIndex, grp, row, currency, value) {
+ const rowKey = String(row?.__rowKey || row?.nOnMLDetNo || row?.sKodu || '').trim()
+ const cacheKey = `${groupIndex}:${rowKey}`
+ const previousPending = pendingRenderedAmounts.get(cacheKey) || {}
+ pendingRenderedAmounts.set(cacheKey, {
+ ...previousPending,
+ groupIndex,
+ rowKey,
+ included: shouldIncludeRowInGroupTotal(grp, row),
+ [currency]: parseMoneyInput(value)
+ })
+
+ if (!renderedAmountFlushScheduled) {
+ renderedAmountFlushScheduled = true
+ Promise.resolve().then(() => {
+ const next = { ...renderedGroupAmounts.value }
+ let changed = false
+ pendingRenderedAmounts.forEach(entry => {
+ const groupRows = { ...(next[entry.groupIndex] || {}) }
+ const previous = groupRows[entry.rowKey] || {}
+ if (previous.try !== entry.try || previous.usd !== entry.usd || previous.included !== entry.included) {
+ groupRows[entry.rowKey] = { ...previous, ...entry }
+ changed = true
+ }
+ next[entry.groupIndex] = groupRows
+ })
+ pendingRenderedAmounts.clear()
+ renderedAmountFlushScheduled = false
+ if (changed) {
+ renderedGroupAmounts.value = next
+ groupTotalsRevision.value += 1
+ }
+ })
}
- return Array.isArray(grp?.items) ? grp.items : []
+ return ''
}
-function resolveGroupIncludedCount (grp, groupIndex) {
- return rowsForGroupTotal(grp, groupIndex).filter(row => shouldIncludeRowInGroupTotal(grp, row)).length
+function renderedRowsForGroup (groupIndex) {
+ return Object.values(renderedGroupAmounts.value[groupIndex] || {})
}
-function resolveGroupRawTRYTutar (grp, groupIndex) {
- return rowsForGroupTotal(grp, groupIndex).reduce((total, row) => total + parseMoneyInput(row?.lTutar), 0)
+function resolveRenderedGroupIncludedCount (groupIndex) {
+ return renderedRowsForGroup(groupIndex).filter(row => row.included).length
}
-function resolveGroupRowTRYAmount (row) {
- const storedAmount = parseMoneyInput(row?.lTutar)
- if (storedAmount !== 0) return storedAmount
- const lastValidAmount = parseMoneyInput(row?.__lastValidTRYAmount)
- return lastValidAmount !== 0 ? lastValidAmount : resolveRowTRYTutar(row)
+function resolveRenderedGroupRowCount (groupIndex) {
+ return renderedRowsForGroup(groupIndex).length
}
-function resolveGroupRowUSDAmount (row) {
- const storedAmount = parseMoneyInput(row?.usdTutar ?? row?.lTutarUSD)
- if (storedAmount !== 0) return storedAmount
- const lastValidAmount = parseMoneyInput(row?.__lastValidUSDAmount)
- return lastValidAmount !== 0 ? lastValidAmount : resolveRowUSDTutar(row)
+function resolveGroupTRYTutar (groupIndex, _revision) {
+ return renderedRowsForGroup(groupIndex).reduce((total, row) => total + (row.included ? parseMoneyInput(row.try) : 0), 0)
}
-function resolveGroupTRYTutar (grp, groupIndex, _revision) {
- return rowsForGroupTotal(grp, groupIndex).reduce((total, row) => (
- total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveGroupRowTRYAmount(row) : 0)
- ), 0)
+function resolveGroupUSDTutar (groupIndex, _revision) {
+ return renderedRowsForGroup(groupIndex).reduce((total, row) => total + (row.included ? parseMoneyInput(row.usd) : 0), 0)
}
-function resolveGroupUSDTutar (grp, groupIndex, _revision) {
- return rowsForGroupTotal(grp, groupIndex).reduce((total, row) => (
- total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveGroupRowUSDAmount(row) : 0)
- ), 0)
-}
-
-function resolveGroupQuantity (grp, groupIndex) {
- return rowsForGroupTotal(grp, groupIndex).reduce((total, row) => (
+function resolveGroupQuantity (grp) {
+ return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
total + resolveNumericRowQuantity(row)
), 0)
}
@@ -3080,6 +3106,8 @@ async function fetchDetail (options = {}) {
detailLoading.value = true
detailError.value = ''
detailGroups.value = []
+ renderedGroupAmounts.value = {}
+ pendingRenderedAmounts.clear()
detailHeader.value = null
costDate.value = ''
exchangeRates.value = createEmptyExchangeRates()