Stundensätze im Personalmodul, Übergabe ans Angebot (0.26.0)
Some checks failed
Prüfung / tests (push) Has been cancelled
Prüfung / container (push) Has been cancelled

Rechentabellen je Lohnart wie Hennings Excel (Zeit, Kosten, Vollkostensatz),
Mittellohn mit Schaltern, Versionen mit gilt ab. Excel-Fassung centgenau
(80,38 / 107,81 EUR), Fassung nach S2 mit Akquise/Verwaltung als Kosten.
Angebote schreiben die geltenden Sätze fest, Lohnzuschlag 0 %, Nachfrage
bei neuer Version.

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-22 06:55:22 +00:00
parent 0d5f11c842
commit 45c21943bf
24 changed files with 1305 additions and 42 deletions

View File

@@ -1,5 +1,6 @@
// Stammdaten (Henning, 21.10.2026): Leistungen mit Vorkalkulation, GAEB-Import in Ordner, Materialstamm mit
// DATANORM-Import und Rabatten je Lieferant. Siehe Entwürfe 1–4 in stammdaten/entwurf.
import { aktuelleSaetze } from "./stundensaetze.js";
import type { FastifyInstance, FastifyRequest } from "fastify";
import { z } from "zod";
import { type Pool, transaktion } from "./db.js";
@@ -38,7 +39,7 @@ export function registriereStammdaten(app: FastifyInstance, pool: Pool, einstell
/** Leistungen mit Kosten, VK und Stunden je Einheit (Liste und Katalog im Angebot) */
app.get("/api/leistungen", async () => {
const s = stammSaetze(await einstellungen());
const s = stammSaetze(await einstellungen(), await aktuelleSaetze(pool, new Date().toISOString().slice(0, 10)));
return nurLeistungen(await vorlagen(pool)).map((v) => {
const r = rechneLeistung(v, s);
return {
@@ -56,7 +57,7 @@ export function registriereStammdaten(app: FastifyInstance, pool: Pool, einstell
const { id } = IdParam.parse(req.params);
const v = (await vorlagen(pool)).find((x) => String(x.id) === id);
if (!v) return reply.status(404).send({ fehler: "Diese Leistung gibt es nicht (mehr)." });
const s = stammSaetze(await einstellungen());
const s = stammSaetze(await einstellungen(), await aktuelleSaetze(pool, new Date().toISOString().slice(0, 10)));
const artikel = Object.fromEntries(await artikelNach(pool, (v.inhalt.ansaetze ?? []).map((z) => z.artikel_id).filter((x): x is string => !!x)));
const angebote = (await pool.query(`select a.id, a.nummer, a.datum from angebot_position p join angebot a on a.id = p.angebot_id
where p.aufmass -> 'vorlage' ->> 'id' = $1 order by a.datum desc, a.nummer desc`, [id])).rows;
@@ -99,7 +100,7 @@ export function registriereStammdaten(app: FastifyInstance, pool: Pool, einstell
ordner: z.string().trim().min(1).max(300).optional(),
prozent: z.number().min(-90).max(500).optional(),
}).parse(req.body ?? {});
const s = stammSaetze(await einstellungen());
const s = stammSaetze(await einstellungen(), await aktuelleSaetze(pool, new Date().toISOString().slice(0, 10)));
const alle = new Map((await vorlagen(pool)).map((v) => [String(v.id), v]));
const gewaehlt = q.ids.map((i) => alle.get(i)).filter((v): v is Mengenvorlage => !!v);
const eigene = gewaehlt.filter((v) => !v.fest);