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>
|
</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>
|
||||||
<td className={`text-right py-1.5 px-2 font-bold text-xs ${sumAnnual < 0 ? 'text-red-400' : 'text-white/80'}`}>
|
{yearOffset === -1 ? (
|
||||||
{formatCell(sumAnnual)}
|
[2026, 2027, 2028, 2029, 2030].map(y => {
|
||||||
</td>
|
const yStart = (y - 2026) * 12 + 1
|
||||||
{Array.from({ length: 12 }, (_, idx) => {
|
const yEnd = yStart + 11
|
||||||
const mKey = `m${monthStart + idx}`
|
let yVal = 0
|
||||||
const v = sumValues[mKey] || 0
|
for (let m = yStart; m <= yEnd; m++) {
|
||||||
return (
|
for (const row of nonSumRows) yVal += getValues(row)[`m${m}`] || 0
|
||||||
<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)}
|
return (
|
||||||
</td>
|
<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>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user