diff --git a/pitch-deck/components/slides/FinanzplanSlide.tsx b/pitch-deck/components/slides/FinanzplanSlide.tsx index 7c42d55..62fbe8b 100644 --- a/pitch-deck/components/slides/FinanzplanSlide.tsx +++ b/pitch-deck/components/slides/FinanzplanSlide.tsx @@ -735,41 +735,56 @@ export default function FinanzplanSlide({ lang, investorId, preferredScenarioId, })} {/* Summenzeile für relevante Sheets */} - {yearOffset !== -1 && ['personalkosten', 'betriebliche', 'investitionen'].includes(activeSheet) && rows.length > 0 && (() => { - const sumValues: Record = {} - 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 ( {de ? 'SUMME' : 'TOTAL'} - - {formatCell(sumAnnual)} - - {Array.from({ length: 12 }, (_, idx) => { - const mKey = `m${monthStart + idx}` - const v = sumValues[mKey] || 0 - return ( - 0 ? 'text-white/70' : 'text-white/15'}`}> - {formatCell(v)} - - ) - })} + {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 ( + + {formatCell(Math.round(yVal))} + + ) + }) + ) : ( + <> + {(() => { + let sumAnnual = 0 + for (let m = monthStart; m <= monthEnd; m++) { + for (const row of nonSumRows) sumAnnual += getValues(row)[`m${m}`] || 0 + } + return ( + + {formatCell(sumAnnual)} + + ) + })()} + {Array.from({ length: 12 }, (_, idx) => { + const mKey = `m${monthStart + idx}` + let v = 0 + for (const row of nonSumRows) v += getValues(row)[mKey] || 0 + return ( + 0 ? 'text-white/70' : 'text-white/15'}`}> + {formatCell(v)} + + ) + })} + + )} )