0.34.0: Übersicht mit Projektfarben, zweizeiligen Aufgaben und Geldfluss ohne Kontostand
Some checks failed
Prüfung / tests (push) Has been cancelled
Prüfung / container (push) Has been cancelled

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
This commit is contained in:
Claude
2026-10-23 06:55:07 +00:00
parent 7314a63901
commit e348fd040c
15 changed files with 205 additions and 27 deletions

View File

@@ -79,6 +79,48 @@ export function lageKopfHtml(d: Zeile, zeitText: string): string {
}
/** Liniendiagramm je Woche: Kontostand als Fläche, Einnahmen und Ausgaben je Woche, Mindestgrenze, tiefster Punkt */
// Geldfluss ohne Kontostand (Henning, 23.10.2026): je Woche Einnahmen, Projektkosten, laufende Kosten und auf Wunsch die Umsatzsteuer
const FLUSS: [string, string, string][] = [["einnahmen", "fl-ein", "Einnahmen"], ["projektkosten", "fl-pk", "Projektkosten"], ["laufend", "fl-lk", "Laufende Kosten"], ["ust", "fl-ust", "Umsatzsteuer"]];
/** Kacheln mit den Summen des Zeitraums und dem Überschuss */
export function flussKachelnHtml(fluss: Zeile[], zeitText: string, mitUst: boolean): string {
const s = (k: string) => fluss.reduce((x, w) => x + Number(w[k] ?? 0), 0);
const ueber = s("einnahmen") - s("projektkosten") - s("laufend") - (mitUst ? s("ust") : 0);
return `<div class="fluss-kacheln">
<div><small>Einnahmen</small><b class="fl-ein">${glatt(s("einnahmen"))}</b></div>
<div><small>Projektkosten</small><b class="fl-pk">${glatt(-s("projektkosten"))}</b></div>
<div><small>Laufende Kosten</small><b class="fl-lk">${glatt(-s("laufend"))}</b></div>
${mitUst ? `<div><small>Umsatzsteuer (Schätzung)</small><b class="fl-ust">${glatt(-s("ust"))}</b></div>` : ""}
<div><small>Überschuss ${zeitText}</small><b class="${ueber < 0 ? "fehler" : ""}">${glatt(ueber)}</b></div></div>`;
}
/** Linien je Woche; Kosten als positive Beträge, Umsatzsteuer: Zahllast positiv, Erstattung negativ */
export function flussSvg(fluss: Zeile[], platz: number, mitUst: boolean): string {
if (!fluss.length) return '<p class="hinweis">Keine Wochen im Zeitraum.</p>';
const reihen = FLUSS.filter(([k]) => mitUst || k !== "ust");
const B = Math.max(340, Math.round(platz)), H = B < 600 ? 200 : 230, L = 56, R = 16, O = 14, U = 28;
const alle = fluss.flatMap((w) => reihen.map(([k]) => Number(w[k] ?? 0)));
const roh = { min: Math.min(0, ...alle), max: Math.max(1, ...alle) };
const grob = (roh.max - roh.min) / 4;
const p10 = 10 ** Math.floor(Math.log10(grob));
const schritt = [1, 2, 5, 10].map((f) => f * p10).find((s) => s >= grob)!;
const ymin = Math.floor(roh.min / schritt) * schritt, ymax = Math.ceil(roh.max / schritt) * schritt;
const n = fluss.length;
const x = (i: number) => L + (n === 1 ? (B - L - R) / 2 : (i * (B - L - R)) / (n - 1));
const y = (v: number) => O + ((ymax - v) * (H - O - U)) / (ymax - ymin || 1);
const linien: string[] = [];
for (let v = ymin; v <= ymax + 1; v += schritt) {
linien.push(`<line class="gitter${v === 0 ? " null" : ""}" x1="${L}" x2="${B - R}" y1="${y(v)}" y2="${y(v)}"/><text class="achse" x="${L - 8}" y="${y(v) + 4}" text-anchor="end">${glatt(v).replace(" €", "")}</text>`);
}
const jede = Math.max(1, Math.ceil(n / Math.max(2, Math.floor(B / 90))));
const beschriftung = fluss.map((w, i) => (i % jede === 0 || i === n - 1 ? `<text class="achse" x="${x(i)}" y="${H - 8}" text-anchor="${i === n - 1 && n > 1 ? "end" : i === 0 ? "start" : "middle"}">${kw(w.von)}</text>` : "")).join("");
const kurven = reihen.map(([k, kl]) => `<polyline class="fl-linie ${kl}" points="${fluss.map((w, i) => `${x(i).toFixed(1)},${y(Number(w[k] ?? 0)).toFixed(1)}`).join(" ")}"/>
${fluss.map((w, i) => `<circle class="fl-punkt ${kl}" cx="${x(i)}" cy="${y(Number(w[k] ?? 0))}" r="3.5"><title>${kw(w.von)} · ${dat(w.von).slice(0, 6)} – ${dat(w.bis).slice(0, 6)}
${reihen.map(([k2, , t]) => `${t}: ${glatt(Number(w[k2] ?? 0))}`).join("\n")}</title></circle>`).join("")}`).join("");
return `<svg class="liqui-svg fluss-svg" viewBox="0 0 ${B} ${H}" role="img" aria-label="${reihen.map(([, , t]) => t).join(", ")} je Woche">${linien.join("")}${kurven}${beschriftung}</svg>
<div class="fluss-legende">${reihen.map(([, kl, t]) => `<span><i class="${kl}"></i>${t} je Woche</span>`).join("")}${mitUst ? "<span>Umsatzsteuer unter 0 = Erstattung</span>" : ""}</div>`;
}
function kurveSvg(d: Zeile, platz: number, was?: Zeile[]): string {
const wochen = d.wochen as Zeile[];
if (!wochen.length) return '<p class="hinweis">Keine Wochen im Zeitraum.</p>';