Fix product performance grouped JSON build
This commit is contained in:
@@ -1821,7 +1821,7 @@ const detailColumns = [
|
||||
{ name: 'maliyeteDahil', label: 'Maliyete Dahil', field: 'maliyeteDahil', align: 'center', sortable: false },
|
||||
{ name: 'cmPriceType', label: 'CMT', field: 'cm_price_type_id', align: 'center', sortable: false, style: 'width: 72px', headerStyle: 'width: 72px' },
|
||||
{ name: 'lFiyat', label: 'lFiyat', field: 'lFiyat', align: 'right', sortable: true, format: val => formatMoney(val) },
|
||||
{ name: 'lTutar', label: 'lTutar', field: row => resolveRowTRYTutar(row), align: 'right', sortable: true, format: val => formatMoney(val) },
|
||||
{ name: 'lTutar', label: 'lTutar', field: 'lTutar', align: 'right', sortable: true, format: val => formatMoney(val) },
|
||||
{ name: 'sFiyatTipi', label: 'sFiyatTipi', field: 'sFiyatTipi', align: 'left', sortable: true },
|
||||
{ name: 'sDovizCinsi', label: 'Döviz', field: 'sDovizCinsi', align: 'left', sortable: true },
|
||||
{ name: 'lDovizKuru', label: 'Kur', field: 'lDovizKuru', align: 'right', sortable: true, format: val => formatMoney(val) },
|
||||
@@ -2685,15 +2685,7 @@ function resolveAutoOrICodeHighlightClass (row) {
|
||||
}
|
||||
|
||||
function resolveNumericRowQuantity (row) {
|
||||
const editableQuantity = parseMoneyInput(row?.miktarInput)
|
||||
const storedQuantity = parseMoneyInput(row?.lMiktar)
|
||||
|
||||
// Some detail payloads/local drafts contain miktarInput=0 even though the
|
||||
// recipe quantity in lMiktar is populated. Nullish coalescing selected that
|
||||
// zero and consequently every amount was calculated as zero.
|
||||
if (editableQuantity > 0) return editableQuantity
|
||||
if (storedQuantity > 0) return storedQuantity
|
||||
return 0
|
||||
return parseMoneyInput(row?.miktarInput ?? row?.lMiktar)
|
||||
}
|
||||
|
||||
function resolveNumericRowInputPrice (row) {
|
||||
@@ -2872,25 +2864,6 @@ function recalculateAllDetailRows () {
|
||||
}
|
||||
|
||||
function resolveRowTRYTutar (row) {
|
||||
const quantity = resolveNumericRowQuantity(row)
|
||||
const inputPrice = resolveNumericRowInputPrice(row)
|
||||
const inputCurrency = resolveInputCurrency(row)
|
||||
const calculatedUnitPrice = resolveTRYUnitPriceByInput(
|
||||
inputPrice,
|
||||
inputCurrency,
|
||||
resolveExchangeRateValue('USD'),
|
||||
resolveExchangeRateValue('EUR'),
|
||||
resolveExchangeRateValue('GBP')
|
||||
)
|
||||
// lFiyat is already the TRY unit price rendered in the table. Keep it as a
|
||||
// fallback for hydrated/autofilled rows whose original input fields lag one
|
||||
// render behind.
|
||||
const unitPrice = calculatedUnitPrice > 0
|
||||
? calculatedUnitPrice
|
||||
: parseMoneyInput(row?.lFiyat)
|
||||
const liveAmount = unitPrice * quantity
|
||||
|
||||
if (Number.isFinite(liveAmount) && unitPrice > 0 && quantity > 0) return liveAmount
|
||||
return parseMoneyInput(row?.lTutar)
|
||||
}
|
||||
|
||||
@@ -2994,14 +2967,14 @@ function resolveRenderedGroupRowCount (groupIndex) {
|
||||
function resolveGroupTRYTutar (groupIndex, _revision) {
|
||||
const grp = detailGroups.value[groupIndex]
|
||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveRowTRYTutar(row) : 0)
|
||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? parseMoneyInput(row?.lTutar) : 0)
|
||||
), 0)
|
||||
}
|
||||
|
||||
function resolveGroupUSDTutar (groupIndex, _revision) {
|
||||
const grp = detailGroups.value[groupIndex]
|
||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveRowUSDTutar(row) : 0)
|
||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? parseMoneyInput(row?.usdTutar ?? row?.lTutarUSD) : 0)
|
||||
), 0)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user