diff --git a/.idea/bssapp.iml b/.idea/bssapp.iml index 5e764c4..9c408cc 100644 --- a/.idea/bssapp.iml +++ b/.idea/bssapp.iml @@ -1,6 +1,7 @@ + diff --git a/svc/routes/production_product_costing.go b/svc/routes/production_product_costing.go index 760f131..1626b87 100644 --- a/svc/routes/production_product_costing.go +++ b/svc/routes/production_product_costing.go @@ -1427,6 +1427,12 @@ func postProductionProductCostingOnMLSaveHandler(w http.ResponseWriter, r *http. totalUSD := 0.0 totalEUR := 0.0 for _, r := range req.Detail.Upserts { + // The top header in the detail screen only includes rows marked + // "Maliyete Dahil". Persist that exact business total to the master + // record as well; excluded detail rows must not inflate the cost. + if r.MaliyeteDahil != 1 { + continue + } qty := r.LMiktar if qty < 0 { qty = 0 diff --git a/ui/src/pages/ProductionProductCostingHasCostDetail.vue b/ui/src/pages/ProductionProductCostingHasCostDetail.vue index eccb84d..38c1bcb 100644 --- a/ui/src/pages/ProductionProductCostingHasCostDetail.vue +++ b/ui/src/pages/ProductionProductCostingHasCostDetail.vue @@ -1558,7 +1558,7 @@ function ensureBeforeUnloadGuard (enabled) { } } const toolbarSummary = computed(() => flatDetailRows.value.reduce((acc, row) => { - if (!row?.maliyeteDahil) return acc + if (!normalizeBooleanFlag(row?.maliyeteDahil ?? row?.maliyete_dahil ?? row?.Maliyete_dahil)) return acc acc.tryTotal += resolveRowTRYTutar(row) acc.usdTotal += resolveRowUSDTutar(row) acc.eurTotal += resolveRowEURTutar(row) @@ -2848,12 +2848,10 @@ function resolveRowUSDTutar (row) { return Number.isFinite(calc) ? calc : 0 } -function shouldIgnoreGroupMaliyeteDahil (grp) { - return isCMGroupName(grp?.sAciklama3) -} - -function shouldIncludeRowInGroupTotal (grp, row) { - return shouldIgnoreGroupMaliyeteDahil(grp) || normalizeBooleanFlag(row?.maliyeteDahil) +function shouldIncludeRowInGroupTotal (_grp, row) { + // Keep sub-header totals aligned with the top header and the value persisted + // to spUrtOnMLMas: only rows explicitly included in costing contribute. + return normalizeBooleanFlag(row?.maliyeteDahil ?? row?.maliyete_dahil ?? row?.Maliyete_dahil) } function resolveGroupTRYTutar (grp) {