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
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:
@@ -735,41 +735,56 @@ export default function FinanzplanSlide({ lang, investorId, preferredScenarioId,
|
||||
})}
|
||||
</tbody>
|
||||
{/* Summenzeile für relevante Sheets */}
|
||||
{yearOffset !== -1 && ['personalkosten', 'betriebliche', 'investitionen'].includes(activeSheet) && rows.length > 0 && (() => {
|
||||
const sumValues: Record<string, number> = {}
|
||||
let sumAnnual = 0
|
||||
{['personalkosten', 'betriebliche', 'investitionen'].includes(activeSheet) && rows.length > 0 && (() => {
|
||||
const nonSumRows = rows.filter(r => {
|
||||
const l = getLabel(r)
|
||||
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 (
|
||||
<tfoot>
|
||||
<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">
|
||||
{de ? 'SUMME' : 'TOTAL'}
|
||||
</td>
|
||||
<td className={`text-right py-1.5 px-2 font-bold text-xs ${sumAnnual < 0 ? 'text-red-400' : 'text-white/80'}`}>
|
||||
{formatCell(sumAnnual)}
|
||||
</td>
|
||||
{Array.from({ length: 12 }, (_, idx) => {
|
||||
const mKey = `m${monthStart + idx}`
|
||||
const v = sumValues[mKey] || 0
|
||||
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'}`}>
|
||||
{formatCell(v)}
|
||||
</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'}`}>
|
||||
{formatCell(sumAnnual)}
|
||||
</td>
|
||||
)
|
||||
})()}
|
||||
{Array.from({ length: 12 }, (_, idx) => {
|
||||
const mKey = `m${monthStart + idx}`
|
||||
let v = 0
|
||||
for (const row of nonSumRows) v += getValues(row)[mKey] || 0
|
||||
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'}`}>
|
||||
{formatCell(v)}
|
||||
</td>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
</tr>
|
||||
</tfoot>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user