Fix product performance grouped JSON build

This commit is contained in:
M_Kececi
2026-08-18 20:03:12 +03:00
parent 1945fd4456
commit a9ab9fd9b0
@@ -2830,6 +2830,18 @@ function recalculateAllDetailRows () {
} }
function resolveRowTRYTutar (row) { function resolveRowTRYTutar (row) {
const quantity = resolveNumericRowQuantity(row)
const inputPrice = resolveNumericRowInputPrice(row)
const inputCurrency = resolveInputCurrency(row)
const liveAmount = resolveTRYUnitPriceByInput(
inputPrice,
inputCurrency,
resolveExchangeRateValue('USD'),
resolveExchangeRateValue('EUR'),
resolveExchangeRateValue('GBP')
) * quantity
if (Number.isFinite(liveAmount) && inputPrice > 0) return liveAmount
return parseMoneyInput(row?.lTutar) return parseMoneyInput(row?.lTutar)
} }
@@ -2842,14 +2854,26 @@ function resolveRowGBPTutar (row) {
} }
function resolveRowUSDTutar (row) { function resolveRowUSDTutar (row) {
const quantity = resolveNumericRowQuantity(row)
const inputPrice = resolveNumericRowInputPrice(row)
const inputCurrency = resolveInputCurrency(row)
const liveAmount = resolveUSDUnitPriceByInput(
inputPrice,
inputCurrency,
resolveExchangeRateValue('USD'),
resolveExchangeRateValue('EUR'),
resolveExchangeRateValue('GBP')
) * quantity
if (Number.isFinite(liveAmount) && inputPrice > 0) return liveAmount
const rawUSDAmount = row?.usdTutar const rawUSDAmount = row?.usdTutar
if (rawUSDAmount !== undefined && rawUSDAmount !== null && String(rawUSDAmount).trim() !== '') { if (rawUSDAmount !== undefined && rawUSDAmount !== null && String(rawUSDAmount).trim() !== '') {
return parseMoneyInput(rawUSDAmount) return parseMoneyInput(rawUSDAmount)
} }
const miktar = resolveNumericRowQuantity(row)
const dovizFiyati = parseMoneyInput(row?.lDovizFiyati) const dovizFiyati = parseMoneyInput(row?.lDovizFiyati)
const calc = miktar * dovizFiyati const calc = quantity * dovizFiyati
return Number.isFinite(calc) ? calc : 0 return Number.isFinite(calc) ? calc : 0
} }
@@ -3460,6 +3484,11 @@ async function fetchBulkItemPrices () {
error: String(e?.message || e || '') error: String(e?.message || e || '')
}) })
} }
// Bulk price and previous-cost autofill paths can update many rows at once.
// Recalculate once more as a whole so group sub-header totals react immediately.
recalculateAllDetailRows()
schedulePersistLocalDraft()
triggerUIUpdate()
} catch (err) { } catch (err) {
$q.notify({ $q.notify({
type: 'negative', type: 'negative',