Haken „zählt“: Posten dauerhaft aus der Liquidität nehmen (0.41.0)
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-26 09:34:21 +00:00
parent c0dd91718e
commit 83828c12f8
13 changed files with 257 additions and 49 deletions

View File

@@ -429,7 +429,8 @@ export async function baueApp(o: Optionen): Promise<FastifyInstance> {
zahlungen: zahlungen.rows,
kosten: kosten.rows,
laufend: laufend.rows.map((l) => ({
bezeichnung: l.bezeichnung, kategorie: l.kategorie, betrag: l.betrag, rhythmus: l.rhythmus, start: l.start, ende: l.ende ?? undefined,
id: l.id, bezeichnung: l.bezeichnung, kategorie: l.kategorie, betrag: l.betrag, rhythmus: l.rhythmus, start: l.start, ende: l.ende ?? undefined,
ohneTermine: l.ohne_termine ?? [],
})),
},
{ tage: e.arbeitstage },
@@ -450,6 +451,32 @@ export async function baueApp(o: Optionen): Promise<FastifyInstance> {
app.get("/api/liquiditaet", async (req) => berechneLiquiditaet(LiquiAnfrage.parse(req.query)));
// Haken „zählt“ (Henning, 26.10.2026): Posten bleibt sichtbar, zählt aber in der Liquidität nicht mehr mit; dauerhaft gespeichert
const ZaehltAnfrage = z.array(z.object({
quelle: z.string().regex(/^(zahlung:[0-9a-f-]{36}|kosten:[0-9a-f-]{36}|pauschale:[0-9a-f-]{36}:(material|fremd|sonstiges)|rest:[0-9a-f-]{36}|lk:[0-9a-f-]{36}:\d{4}-\d{2}-\d{2})$/),
zaehlt: z.boolean(),
})).min(1).max(500);
app.post("/api/liquiditaet/zaehlt", async (req) => {
const liste = ZaehltAnfrage.parse(req.body);
await transaktion(pool, benutzer(req), async (c) => {
for (const { quelle, zaehlt } of liste) {
const [art, id, teil] = quelle.split(":") as [string, string, string | undefined];
if (art === "zahlung" || art === "kosten") {
await c.query(`update ${art} set zaehlt = $2 where id = $1 and zaehlt <> $2`, [id, zaehlt]);
} else if (art === "pauschale" || art === "rest") {
const was = art === "rest" ? "rest" : teil!;
await c.query(zaehlt ? "update projekt set liqui_ohne = array_remove(liqui_ohne, $2) where id = $1 and $2 = any(liqui_ohne)"
: "update projekt set liqui_ohne = array_append(liqui_ohne, $2) where id = $1 and not ($2 = any(liqui_ohne))", [id, was]);
} else {
const datum = quelle.slice(quelle.lastIndexOf(":") + 1);
await c.query(zaehlt ? "update laufende_kosten set ohne_termine = array_remove(ohne_termine, $2) where id = $1 and $2 = any(ohne_termine)"
: "update laufende_kosten set ohne_termine = array_append(ohne_termine, $2) where id = $1 and not ($2 = any(ohne_termine))", [id, datum]);
}
}
});
return { ok: true };
});
// Lage der Liquidität (Henning, 21.10.2026): je Woche ab heute, frei verfügbar, Tiefpunkt und Grund
async function liquiLage(heute: string, anzahl: number) {
const e = await ladeEinstellungen();

View File

@@ -0,0 +1,8 @@
-- Haken „zählt“ (Henning, 26.10.2026): ohne Haken bleibt ein Posten sichtbar, zählt aber in der Liquidität
-- nicht mit (Summen, Kurve, Monatsplan, Übersicht). Anders als das Auge (nur ausblenden) und „Was wäre, wenn“ (nur probeweise).
alter table zahlung add column zaehlt boolean not null default true;
alter table kosten add column zaehlt boolean not null default true;
-- Pauschalen aus den Eckdaten und die Schlussrechnung (Rest): material, fremd, sonstiges, rest
alter table projekt add column liqui_ohne text[] not null default '{}';
-- einzelne Termine laufender Kosten (JJJJ-MM-TT)
alter table laufende_kosten add column ohne_termine text[] not null default '{}';

View File

@@ -359,6 +359,7 @@ export const TABELLEN: Tabelle[] = [
bezug_tage: z.number().int().min(-500).max(500).optional(),
freitag: z.boolean().optional(),
rest: z.boolean().optional(),
zaehlt: z.boolean().optional(),
}),
},
{
@@ -381,6 +382,7 @@ export const TABELLEN: Tabelle[] = [
freitag: z.boolean().optional(),
// aus dem Einsatz eines Subunternehmers; false = von Hand geändert, rechnet sich nicht mehr neu
automatisch: z.boolean().optional(),
zaehlt: z.boolean().optional(),
}),
},
{