0.36.0: Status Intern mit I-Nummern und Ordner 05 Intern, Eckdaten unten und einklappbar
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:
@@ -7,7 +7,7 @@ import { type Termin, kalender } from "../domain/ical.js";
|
||||
import type { Pool } from "./db.js";
|
||||
import { terminplan } from "./terminplan.js";
|
||||
|
||||
const IM_KALENDER = new Set(["auftrag", "ausfuehrung"]);
|
||||
const IM_KALENDER = new Set(["auftrag", "ausfuehrung", "intern"]);
|
||||
|
||||
/** Vorgang in Abschnitte aus zusammenhängenden Arbeitstagen teilen, damit Freitag und Wochenende frei bleiben. */
|
||||
export function arbeitsbloecke(von: Datum, bis: Datum, woche: Arbeitswoche): [Datum, Datum][] {
|
||||
|
||||
4
src/server/migrations/025_status_intern.sql
Normal file
4
src/server/migrations/025_status_intern.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- Interne Projekte (Henning, 24.10.2026): eigene Arbeiten ohne Kunden, Nummer I-26-001, Ordner „05 Intern“
|
||||
alter table projekt drop constraint if exists projekt_status_check;
|
||||
alter table projekt add constraint projekt_status_check
|
||||
check (status in ('anfrage', 'angebot', 'auftrag', 'ausfuehrung', 'abgerechnet', 'gewaehrleistung', 'abgeschlossen', 'intern'));
|
||||
@@ -23,6 +23,8 @@ export const STATUSORDNER: Record<string, string> = {
|
||||
abgerechnet: "02 laufende Projekte",
|
||||
gewaehrleistung: "03 Gewährl.-Projekte",
|
||||
abgeschlossen: "04 Archiv",
|
||||
// interne Projekte (Henning, 24.10.2026)
|
||||
intern: "05 Intern",
|
||||
};
|
||||
|
||||
export const UNTERORDNER = ["01 Auftrag", "01 Auftrag/03 Stundenlohnarb.", "02 Umsetzung", "03 Bilder"];
|
||||
|
||||
@@ -112,7 +112,7 @@ export const TABELLEN: Tabelle[] = [
|
||||
nummer: text,
|
||||
bezeichnung: text,
|
||||
bauherr_id: id.nullable().optional(),
|
||||
status: z.enum(["anfrage", "angebot", "auftrag", "ausfuehrung", "abgerechnet", "gewaehrleistung", "abgeschlossen"]).optional(),
|
||||
status: z.enum(["anfrage", "angebot", "auftrag", "ausfuehrung", "abgerechnet", "gewaehrleistung", "abgeschlossen", "intern"]).optional(),
|
||||
umsatz_netto: cent.optional(),
|
||||
material_kosten: cent.optional(),
|
||||
fremd_kosten: cent.optional(),
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { terminplan } from "./terminplan.js";
|
||||
import { projektFarbe } from "../domain/farbe.js";
|
||||
|
||||
/** Projekte, deren Vorgänge auf der Startseite und in den Warnungen zählen */
|
||||
const LAUFEND = new Set(["auftrag", "ausfuehrung"]);
|
||||
const LAUFEND = new Set(["auftrag", "ausfuehrung", "intern"]);
|
||||
/** Wie weit vorausgeschaut wird: Besetzung und Freigabe müssen bis dahin stehen */
|
||||
const VORLAUF_TAGE = 14;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export function zeitraumText(von: string, bis: string): string {
|
||||
async function einsaetzeIm(c: Abfrage, kontaktId: string, von: string, bis: string, woche: { tage: number[] }, nurFreigegeben: boolean) {
|
||||
const r = await c.query(`select v.id, v.name, v.start, v.start_teil, v.dauer, v.freitage, p.nummer, p.bezeichnung from besetzung_person b join vorgang v on v.id = b.vorgang_id
|
||||
join abschnitt a on a.id = v.abschnitt_id join projekt p on p.id = a.projekt_id
|
||||
where b.kontakt_id = $1 and ($2 or b.freigegeben) and p.status in ('auftrag', 'ausfuehrung') and v.dauer > 0`, [kontaktId, !nurFreigegeben]);
|
||||
where b.kontakt_id = $1 and ($2 or b.freigegeben) and p.status in ('auftrag', 'ausfuehrung', 'intern') and v.dauer > 0`, [kontaktId, !nurFreigegeben]);
|
||||
return r.rows
|
||||
.map((v) => ({ name: v.name, projekt: `${v.nummer} ${v.bezeichnung}`, anfang: anfang({ ...v, dauer: Number(v.dauer) }, woche), ende: ende({ ...v, dauer: Number(v.dauer) }, woche) }))
|
||||
.filter((v) => v.anfang <= bis && v.ende >= von)
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function legeZahlungsplanAn(c: Client, projektId: string, umsatz: n
|
||||
export async function zahlungsplaeneAutomatisch(c: Client, woche: Arbeitswoche): Promise<void> {
|
||||
const neu = await c.query<{ id: string; umsatz_netto: string }>(
|
||||
`select p.id, p.umsatz_netto from projekt p
|
||||
where p.zahlungsplan is null and p.umsatz_netto > 0
|
||||
where p.zahlungsplan is null and p.umsatz_netto > 0 and p.status <> 'intern'
|
||||
and exists (select 1 from vorgang v join abschnitt a on a.id = v.abschnitt_id where a.projekt_id = p.id)
|
||||
and not exists (select 1 from zahlung z where z.projekt_id = p.id)`);
|
||||
for (const p of neu.rows) await legeZahlungsplanAn(c, p.id, Number(p.umsatz_netto), woche);
|
||||
|
||||
@@ -135,7 +135,7 @@ export function registriereZeiten(app: FastifyInstance, pool: Pool, einstellunge
|
||||
pool.query(`select p.id, p.nummer, p.bezeichnung, coalesce(json_agg(json_build_object('id', v.id, 'name', v.name) order by a.reihenfolge, v.reihenfolge, v.nummer)
|
||||
filter (where v.id is not null), '[]') as vorgaenge
|
||||
from projekt p left join abschnitt a on a.projekt_id = p.id left join vorgang v on v.abschnitt_id = a.id
|
||||
where p.status in ('auftrag', 'ausfuehrung') group by p.id order by p.nummer`),
|
||||
where p.status in ('auftrag', 'ausfuehrung', 'intern') group by p.id order by p.nummer`),
|
||||
]);
|
||||
const einsaetze = einsatz.rows.map((v) => ({ id: v.id, name: v.name, projekt_id: v.projekt_id,
|
||||
anfang: anfang({ ...v, dauer: Number(v.dauer) }, woche), ende: ende({ ...v, dauer: Number(v.dauer) }, woche) }));
|
||||
|
||||
Reference in New Issue
Block a user