fix(pitch-deck): engine includes manual revenue rows in GESAMTUMSATZ
Some checks failed
Build pitch-deck / build-push-deploy (push) Successful in 1m19s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-consent (push) Successful in 33s
CI / test-python-voice (push) Successful in 34s
CI / test-bqas (push) Has been cancelled
Some checks failed
Build pitch-deck / build-push-deploy (push) Successful in 1m19s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-consent (push) Successful in 33s
CI / test-python-voice (push) Successful in 34s
CI / test-bqas (push) Has been cancelled
Revenue rows without qty/price (e.g. Beratung & Service) were excluded from total. Now all revenue rows contribute to GESAMTUMSATZ. Same fix for materialaufwand SUMME. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -162,7 +162,8 @@ export async function computeFinanzplan(pool: Pool, scenarioId: string): Promise
|
||||
const revenueRows = (umsatzRows.rows as FPUmsatzerloese[]).filter(r => r.section === 'revenue')
|
||||
const totalRevenue = emptyMonthly()
|
||||
|
||||
// Revenue = quantity × price for each module
|
||||
// Revenue = quantity × price for each module (if qty+price exist)
|
||||
// Revenue rows WITHOUT matching qty/price are kept as-is (e.g. Beratung & Service)
|
||||
for (const rev of revenueRows) {
|
||||
if (rev.row_label === 'GESAMTUMSATZ') continue
|
||||
const qty = quantities.find(q => q.row_label === rev.row_label)
|
||||
@@ -171,10 +172,13 @@ export async function computeFinanzplan(pool: Pool, scenarioId: string): Promise
|
||||
for (let m = 1; m <= MONTHS; m++) {
|
||||
const v = (qty.values[`m${m}`] || 0) * (price.values[`m${m}`] || 0)
|
||||
rev.values[`m${m}`] = Math.round(v)
|
||||
totalRevenue[`m${m}`] += rev.values[`m${m}`]
|
||||
}
|
||||
await pool.query('UPDATE fp_umsatzerloese SET values = $1 WHERE id = $2', [JSON.stringify(rev.values), rev.id])
|
||||
}
|
||||
// Add ALL revenue rows to total (computed or manual)
|
||||
for (let m = 1; m <= MONTHS; m++) {
|
||||
totalRevenue[`m${m}`] += rev.values[`m${m}`] || 0
|
||||
}
|
||||
}
|
||||
// Update GESAMTUMSATZ
|
||||
const gesamtUmsatz = revenueRows.find(r => r.row_label === 'GESAMTUMSATZ')
|
||||
@@ -195,10 +199,13 @@ export async function computeFinanzplan(pool: Pool, scenarioId: string): Promise
|
||||
for (let m = 1; m <= MONTHS; m++) {
|
||||
const v = (qty.values[`m${m}`] || 0) * (uc.values[`m${m}`] || 0)
|
||||
cost.values[`m${m}`] = Math.round(v)
|
||||
totalMaterial[`m${m}`] += cost.values[`m${m}`]
|
||||
}
|
||||
await pool.query('UPDATE fp_materialaufwand SET values = $1 WHERE id = $2', [JSON.stringify(cost.values), cost.id])
|
||||
}
|
||||
// Add ALL cost rows to total (computed or manual)
|
||||
for (let m = 1; m <= MONTHS; m++) {
|
||||
totalMaterial[`m${m}`] += cost.values[`m${m}`] || 0
|
||||
}
|
||||
}
|
||||
const matSumme = matCosts.find(r => r.row_label === 'SUMME')
|
||||
if (matSumme) {
|
||||
|
||||
Reference in New Issue
Block a user