fix(pitch-deck): SUMME footer works in both annual and monthly view
All checks were successful
Build pitch-deck / build-push-deploy (push) Successful in 1m4s
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 34s
CI / test-python-voice (push) Successful in 29s
CI / test-bqas (push) Successful in 27s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-04-20 10:46:16 +02:00
parent f57bdfa151
commit 73e3749960

View File

@@ -735,41 +735,56 @@ export default function FinanzplanSlide({ lang, investorId, preferredScenarioId,
})} })}
</tbody> </tbody>
{/* Summenzeile für relevante Sheets */} {/* Summenzeile für relevante Sheets */}
{yearOffset !== -1 && ['personalkosten', 'betriebliche', 'investitionen'].includes(activeSheet) && rows.length > 0 && (() => { {['personalkosten', 'betriebliche', 'investitionen'].includes(activeSheet) && rows.length > 0 && (() => {
const sumValues: Record<string, number> = {}
let sumAnnual = 0
const nonSumRows = rows.filter(r => { const nonSumRows = rows.filter(r => {
const l = getLabel(r) const l = getLabel(r)
return !(r.is_sum_row || l.includes('GESAMT') || l.includes('Summe') || l.includes('Gesamtkosten') || l === 'SUMME') return !(r.is_sum_row || l.includes('GESAMT') || l.includes('Summe') || l.includes('Gesamtkosten') || l === 'SUMME')
}) })
for (let idx = 0; idx < 12; idx++) {
const mKey = `m${monthStart + idx}`
let colSum = 0
for (const row of nonSumRows) {
const v = getValues(row)
colSum += v[mKey] || 0
}
sumValues[mKey] = colSum
sumAnnual += colSum
}
return ( return (
<tfoot> <tfoot>
<tr className="border-t-2 border-white/20 bg-white/[0.05]"> <tr className="border-t-2 border-white/20 bg-white/[0.05]">
<td className="py-1.5 px-2 sticky left-0 bg-slate-900/90 backdrop-blur font-bold text-white/80 text-xs"> <td className="py-1.5 px-2 sticky left-0 bg-slate-900/90 backdrop-blur font-bold text-white/80 text-xs">
{de ? 'SUMME' : 'TOTAL'} {de ? 'SUMME' : 'TOTAL'}
</td> </td>
{yearOffset === -1 ? (
[2026, 2027, 2028, 2029, 2030].map(y => {
const yStart = (y - 2026) * 12 + 1
const yEnd = yStart + 11
let yVal = 0
for (let m = yStart; m <= yEnd; m++) {
for (const row of nonSumRows) yVal += getValues(row)[`m${m}`] || 0
}
return (
<td key={y} className={`text-right py-1.5 px-3 font-bold text-xs ${yVal < 0 ? 'text-red-400' : 'text-white/80'}`}>
{formatCell(Math.round(yVal))}
</td>
)
})
) : (
<>
{(() => {
let sumAnnual = 0
for (let m = monthStart; m <= monthEnd; m++) {
for (const row of nonSumRows) sumAnnual += getValues(row)[`m${m}`] || 0
}
return (
<td className={`text-right py-1.5 px-2 font-bold text-xs ${sumAnnual < 0 ? 'text-red-400' : 'text-white/80'}`}> <td className={`text-right py-1.5 px-2 font-bold text-xs ${sumAnnual < 0 ? 'text-red-400' : 'text-white/80'}`}>
{formatCell(sumAnnual)} {formatCell(sumAnnual)}
</td> </td>
)
})()}
{Array.from({ length: 12 }, (_, idx) => { {Array.from({ length: 12 }, (_, idx) => {
const mKey = `m${monthStart + idx}` const mKey = `m${monthStart + idx}`
const v = sumValues[mKey] || 0 let v = 0
for (const row of nonSumRows) v += getValues(row)[mKey] || 0
return ( return (
<td key={idx} className={`text-right py-1.5 px-1.5 font-bold text-xs ${v < 0 ? 'text-red-400' : v > 0 ? 'text-white/70' : 'text-white/15'}`}> <td key={idx} className={`text-right py-1.5 px-1.5 font-bold text-xs ${v < 0 ? 'text-red-400' : v > 0 ? 'text-white/70' : 'text-white/15'}`}>
{formatCell(v)} {formatCell(v)}
</td> </td>
) )
})} })}
</>
)}
</tr> </tr>
</tfoot> </tfoot>
) )