[209] Kostenschätzung grob: Kennwert-Methode nach eBKP-H (Panel, Blatt-Tabelle, CSV/PDF)
- Modell: Project.costEstimate (CostEstimate/CostGroup/CostBasis/CostMethod) in generated.rs, KNOWN_KEYS, set_field; LayoutTableSource „costs“; npm run gen:types. - Kern kosten.rs: Menge × Kennwert je Zeile (Bezug Methode = m³ GV oder m² GF, wahlweise HNF, Fassade, Dach, pauschal) × Region × Index; Summe B–J, Honorare V auf B–J, Reserve Y auf B–J + V, MwSt Z, Bandbreite ±, Total je m³ GV / m² GF. Mengen aus der SIA-416-Flächentabelle (eine Quelle mit [225]); neu in flaechen.rs facade_area (Aussenumfang × Geschosshöhe bzw. Körper) und above_ground_outline_area (Dach ohne Dachelement). Abfragen costEstimate / costDefaults. Kaputte Eingaben (NaN, negative %) ohne Panic. - Vorgaben: BEISPIELWERTE ≈ 800 CHF/m³ GV bzw. 2'600 CHF/m² GF für B–J (Preisstand 2025, typische Verteilung der Hauptgruppen), Honorare 15 %, Reserve 10 % — keine offizielle Quelle, im Code dokumentiert und in Panel, Tabelle und Export als Beispielwert markiert. Belegt: MwSt 8.1 % (seit 1.1.2024), Genauigkeit nach SIA 102 (Vorprojekt ±15 %, Vorstudie ±25 %). - Blatt-Tabelle Quelle „costs“ (sheet_table.rs), Franken mit Tausender-Apostroph (Cell.g, area_report::fmt_num; CSV ohne Trenner). - TS: Fassade analysis/costEstimate.ts, Bericht export/costReport.ts (CSV/PDF über den Flächen-Nachweis), Panel CostEstimateSection im Flächenbilanz-Panel (Methode, Zuschläge, Faktoren, Preisstand, Kennwerte je Zeile, Zeile hinzufügen/entfernen, Beispielwerte). Methodenwechsel: Beispielwerte getauscht, eigene Werte über das Mengenverhältnis umgerechnet. i18n de+en. - e2e release10: Schritte 5b (Panel, Kennwert ändern, CSV/PDF, Methode GF) und 10b (Blatt-Tabelle) statt fixme; RELEASE-1.0.md Abschnitt 9 nachgeführt. Geprüft: cargo test dossier-core (1585 ok), tsc, vitest gesamt (3070 ok, Goldens unverändert), e2e/release10.spec.ts (Chromium, Port 5186). Nicht geprüft: Tauri-App/Mac, PDF nur über das SVG-Layout angesehen.
This commit is contained in:
28 files changed
+1595
-25
No files matched your search
@@ -0,0 +1,79 @@
|
||||
// Kostenschätzung grob ([209]): Menge × Kennwert je eBKP-H-Hauptgruppe, Honorare, Reserve, MwSt. Rechnet der
|
||||
// Kern auf dem Projekt-Dokument (`src-tauri/core/src/kosten.rs`; Mengen aus der SIA-416-Flächentabelle,
|
||||
// Herkunft der Vorgabewerte im Modulkopf dort). Diese Datei ist nur die typisierte Fassade.
|
||||
|
||||
import type { CostBasis, CostEstimate, CostMethod, Project } from "../model/types";
|
||||
import { documentFor } from "../core/document";
|
||||
|
||||
export type { CostBasis, CostEstimate, CostGroup, CostMethod } from "../model/types";
|
||||
|
||||
export interface CostQuantities {
|
||||
gv: number;
|
||||
gf: number;
|
||||
hnf: number;
|
||||
facade: number;
|
||||
roof: number;
|
||||
gvSource: "solids" | "levels" | null;
|
||||
}
|
||||
|
||||
export interface CostRow {
|
||||
code: string;
|
||||
name: string | null;
|
||||
/** Aufgelöste Bezugsmenge (nie „method“). */
|
||||
basis: Exclude<CostBasis, "method">;
|
||||
quantity: number;
|
||||
/** „m³“, „m²“ oder leer (pauschal). */
|
||||
unit: string;
|
||||
rate: number;
|
||||
amount: number;
|
||||
/** Kennwert ist der Beispielwert. */
|
||||
example: boolean;
|
||||
}
|
||||
|
||||
export interface CostResult {
|
||||
method: CostMethod;
|
||||
quantities: CostQuantities;
|
||||
rows: CostRow[];
|
||||
factor: number;
|
||||
regionFactor: number;
|
||||
indexFactor: number;
|
||||
subtotal: number;
|
||||
feesPct: number;
|
||||
fees: number;
|
||||
reservePct: number;
|
||||
reserve: number;
|
||||
net: number;
|
||||
vatPct: number;
|
||||
vat: number;
|
||||
gross: number;
|
||||
accuracyPct: number;
|
||||
low: number;
|
||||
high: number;
|
||||
perGv: number | null;
|
||||
perGf: number | null;
|
||||
priceBase: string;
|
||||
isDefault: boolean;
|
||||
hasExample: boolean;
|
||||
/** Hinweis-Schlüssel (`costs.note.*`). */
|
||||
notes: string[];
|
||||
}
|
||||
|
||||
/** Kostenschätzung des Projekts (ohne `costEstimate` mit Beispielwerten). */
|
||||
export function computeCostEstimate(project: Project): CostResult {
|
||||
return documentFor(project).query<CostResult>("costEstimate");
|
||||
}
|
||||
|
||||
/** Beispielwerte (Kennwerte B–J, Zuschläge) für eine Methode. */
|
||||
export function defaultCostEstimate(project: Project, method: CostMethod = "gv"): CostEstimate {
|
||||
return documentFor(project).query<CostEstimate>("costDefaults", [], method);
|
||||
}
|
||||
|
||||
/** Schweizer Schreibweise mit Tausender-Apostroph (wie der Kern, `area_report::fmt_num`). */
|
||||
export function formatChf(n: number, digits = 0): string {
|
||||
if (!Number.isFinite(n)) return "–";
|
||||
const s = n.toFixed(digits);
|
||||
const [int, frac] = s.split(".");
|
||||
const neg = int.startsWith("-");
|
||||
const grouped = (neg ? int.slice(1) : int).replace(/\B(?=(\d{3})+(?!\d))/g, "'");
|
||||
return `${neg ? "-" : ""}${grouped}${frac !== undefined ? `.${frac}` : ""}`;
|
||||
}
|
||||
@@ -145,6 +145,8 @@ export type QueryName =
|
||||
| "presentationSheet"
|
||||
| "kennzahlen"
|
||||
| "areaTable"
|
||||
| "costEstimate"
|
||||
| "costDefaults"
|
||||
| "programCompare"
|
||||
| "programLayout"
|
||||
| "ivhb"
|
||||
|
||||
@@ -104,3 +104,7 @@ export {
|
||||
BlenderMissingError, RenderCancelled, RENDER_SIZE_PRESETS, RENDER_QUALITY_PRESETS, RENDER_VIEW_PRESETS, BLENDER_CANDIDATES, BLENDER_DOWNLOAD_URL,
|
||||
} from "../export/blenderRender";
|
||||
export type { BlenderHost, RenderPackage, RenderOptions, RenderScene, RenderCamera, RenderCameraSpec, RenderViewPreset, RenderMaterial, RenderRole, RenderCameraChoice, TextureLoader, BlenderEvent, RenderResult, RenderRunOptions } from "../export/blenderRender";
|
||||
// [209] Kostenschätzung grob (Kern kosten.rs): Rechnung, Beispielwerte, Bericht (CSV/PDF wie der Flächen-Nachweis)
|
||||
export { computeCostEstimate, defaultCostEstimate, formatChf } from "../analysis/costEstimate";
|
||||
export type { CostResult, CostRow, CostQuantities, CostEstimate, CostGroup, CostMethod, CostBasis } from "../analysis/costEstimate";
|
||||
export { buildCostReport, costGroupLabel, costUnitLabel } from "../export/costReport";
|
||||
@@ -36,6 +36,7 @@ bekommen.
|
||||
| Datei | Inhalt |
|
||||
|---|---|
|
||||
| `areaReport.ts` | Flächen- und Kennzahlen-Nachweis (`[70]`); Aufbau, den die übrigen Berichte nutzen |
|
||||
| `costReport.ts` | Kostenschätzung grob als Bericht (CSV/PDF über `areaReport.ts`, [209]) |
|
||||
| `programReport.ts` | Soll/Ist-Vergleich des Raumprogramms (`[61]`) |
|
||||
| `elementSchedule.ts` | Bauteilliste mit U-Werten (`[71]`) |
|
||||
| `openingSchedule.ts` | Fenster- und Türliste (`[97]`) |
|
||||
|
||||
@@ -17,7 +17,7 @@ import { computeAreaTable, computeIvhb } from "../analysis/areaTable";
|
||||
import type { AreaRow, IvhbOptions } from "../analysis/areaTable";
|
||||
|
||||
/** Zelle: Text oder Zahl (`d` Nachkommastellen, `null` = nicht berechenbar). */
|
||||
export type Cell = string | { n: number | null; d: number };
|
||||
export type Cell = string | { n: number | null; d: number; g?: boolean };
|
||||
|
||||
export interface ReportRow {
|
||||
cells: Cell[];
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import type { Layout, Project, Room, Wall } from "../model/types";
|
||||
import { computeAreaTable } from "../analysis/areaTable";
|
||||
import { computeCostEstimate, defaultCostEstimate, formatChf } from "../analysis/costEstimate";
|
||||
import { areaReportToCsv, layoutAreaReport, parseAreaReportCsv } from "./areaReport";
|
||||
import { buildCostReport } from "./costReport";
|
||||
import { sheetTables } from "./sheetTable";
|
||||
|
||||
// Haus wie im Flächen-Nachweis-Test: Achsen 10 × 8 m, Wände 0.3 m, GF 85.49 m², GV = GF × 2.6 m.
|
||||
function house(): Project {
|
||||
const base = structuredClone(sampleProject) as Project;
|
||||
const wt = base.wallTypes[0]!;
|
||||
const type = { ...wt, id: "w30", layers: [{ ...wt.layers[0]!, thickness: 0.3 }] };
|
||||
const pts = [[0, 0], [10, 0], [10, 8], [0, 8]] as const;
|
||||
const walls = pts.map((a, i): Wall => {
|
||||
const b = pts[(i + 1) % 4]!;
|
||||
return { ...(base.walls[0] as Wall), id: `hw${i}`, floorId: "eg", start: { x: a[0], y: a[1] }, end: { x: b[0], y: b[1] }, wallTypeId: "w30", height: 2.6, bottom: undefined, top: undefined };
|
||||
});
|
||||
const room: Room = { ...(base.rooms![0] as Room), id: "a", floorId: "eg", siaCategory: "HNF", name: "a", boundary: [{ x: 0.15, y: 0.15 }, { x: 9.85, y: 0.15 }, { x: 9.85, y: 7.85 }, { x: 0.15, y: 7.85 }] };
|
||||
return { ...base, name: "Haus", wallTypes: [type], walls, rooms: [room], openings: [], extrudedSolids: undefined, roofs: undefined, layouts: [] };
|
||||
}
|
||||
|
||||
describe("Kostenschätzung grob [209]", () => {
|
||||
it("Beispielwerte: Mengen aus der Flächentabelle, Summen und MwSt", () => {
|
||||
const p = house();
|
||||
const r = computeCostEstimate(p);
|
||||
const area = computeAreaTable(p);
|
||||
expect(r.isDefault).toBe(true);
|
||||
expect(r.hasExample).toBe(true);
|
||||
expect(r.method).toBe("gv");
|
||||
expect(r.quantities.gv).toBeCloseTo(area.gv, 9);
|
||||
expect(r.quantities.gf).toBeCloseTo(area.total.gf, 9);
|
||||
expect(r.rows.map((x) => x.code)).toEqual(["B", "C", "D", "E", "F", "G", "H", "I", "J"]);
|
||||
// 800 CHF/m³ GV für B–J (Beispiel), +15 % Honorare, +10 % Reserve, +8.1 % MwSt.
|
||||
expect(r.subtotal).toBeCloseTo(area.gv * 800, 6);
|
||||
expect(r.gross).toBeCloseTo(area.gv * 800 * 1.15 * 1.1 * 1.081, 4);
|
||||
expect(r.low).toBeCloseTo(r.gross * 0.85, 4);
|
||||
expect(r.perGv).toBeCloseTo(r.gross / area.gv, 6);
|
||||
});
|
||||
|
||||
it("Methode m² GF, eigene Kennwerte und Bezug Fassade", () => {
|
||||
const p = house();
|
||||
const est = defaultCostEstimate(p, "gf");
|
||||
est.groups = [{ code: "B–J", name: "Gebäude", basis: "method", rate: 3000 }, { code: "E", basis: "facade", rate: 200 }];
|
||||
est.feesPct = 0;
|
||||
est.reservePct = 0;
|
||||
const r = computeCostEstimate({ ...p, costEstimate: est });
|
||||
expect(r.hasExample).toBe(false);
|
||||
expect(r.rows[0]!.unit).toBe("m²");
|
||||
expect(r.rows[0]!.amount).toBeCloseTo(85.49 * 3000, 1); // i_overlay-Raster
|
||||
// Fassade: Aussenumfang 2 × (10.3 + 8.3) × 2.6 m.
|
||||
expect(r.rows[1]!.quantity).toBeCloseTo(37.2 * 2.6, 3);
|
||||
expect(r.net).toBeCloseTo(r.subtotal, 9);
|
||||
});
|
||||
|
||||
it("Bericht: CSV-Rundreise mit denselben Zahlen, PDF-Layout mit Apostroph", () => {
|
||||
const p = house();
|
||||
const r = computeCostEstimate(p);
|
||||
const report = buildCostReport(p, r);
|
||||
const csv = areaReportToCsv(report);
|
||||
expect(csv).toContain("Kostenschätzung grob");
|
||||
expect(csv).toContain("Konstruktion Gebäude");
|
||||
expect(csv).not.toMatch(/\d'\d{3}/); // CSV ohne Tausender-Trenner
|
||||
const back = parseAreaReportCsv(csv);
|
||||
const rows = back.sections[0]!.rows;
|
||||
const gross = rows.find((x) => x[1] === "Total inkl. MwSt.")!;
|
||||
expect(gross[5]).toBe(Math.round(r.gross));
|
||||
const texts = layoutAreaReport(report).pages.flat().flatMap((x) => (x.k === "text" ? [x.s] : []));
|
||||
expect(texts).toContain(formatChf(r.gross));
|
||||
expect(texts.some((s) => s.includes("Beispielwert"))).toBe(true);
|
||||
});
|
||||
|
||||
it("Blatt-Tabelle „costs“ folgt dem Modell", () => {
|
||||
const p = house();
|
||||
const layout: Layout = { id: "L", name: "Blatt", tables: [{ id: "k", source: "costs", xMm: 10, yMm: 10, widthMm: 180 }] } as unknown as Layout;
|
||||
const q = { ...p, layouts: [layout] };
|
||||
const out = sheetTables(q, "L");
|
||||
const texts = out[0]!.prims.flatMap((x) => (x.k === "text" ? [x.s] : []));
|
||||
expect(texts).toContain(formatChf(computeCostEstimate(q).gross));
|
||||
expect(texts.some((s) => s.startsWith("Total inkl. MwSt."))).toBe(true);
|
||||
expect(texts).toContain("Konstruktion Gebäude");
|
||||
});
|
||||
|
||||
it("formatChf: Schweizer Schreibweise", () => {
|
||||
expect(formatChf(1234567.5, 2)).toBe("1'234'567.50");
|
||||
expect(formatChf(-1000)).toBe("-1'000");
|
||||
expect(formatChf(999)).toBe("999");
|
||||
expect(formatChf(Number.NaN)).toBe("–");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,87 @@
|
||||
// Kostenschätzung grob ([209]) als Bericht: dasselbe Berichtsmodell wie der Flächen-Nachweis ([70]), daher
|
||||
// dieselben Ausgaben (CSV über `areaReportToCsv`, Vektor-PDF über `buildAreaReportPdf`). Gerechnet wird im
|
||||
// Kern (`analysis/costEstimate.ts` → `kosten.rs`); hier nur Aufbau und Beschriftung mit `t()`.
|
||||
|
||||
import type { Project } from "../model/types";
|
||||
import { t } from "../i18n/translate";
|
||||
import { computeCostEstimate, formatChf } from "../analysis/costEstimate";
|
||||
import type { CostResult, CostRow } from "../analysis/costEstimate";
|
||||
import type { AreaReport, Cell, ReportRow } from "./areaReport";
|
||||
|
||||
/** Franken (ganze, Tausender-Apostroph in PDF/Blatt; die CSV bleibt ohne Trenner). */
|
||||
const chf = (n: number | null | undefined): Cell => ({ n: n === undefined || n === null || !Number.isFinite(n) ? null : n, d: 0, g: true });
|
||||
const qty = (n: number, d = 1): Cell => ({ n: Number.isFinite(n) ? n : null, d, g: true });
|
||||
const pctText = (v: number) => `${Number.isInteger(v) ? v.toFixed(0) : v.toFixed(1)} %`;
|
||||
|
||||
/** Bezeichnung einer Kennwert-Zeile: eigener Name oder eBKP-H-Hauptgruppe. */
|
||||
export function costGroupLabel(code: string, name?: string | null): string {
|
||||
if (name && name.trim()) return name;
|
||||
const key = `costs.group.${code}`;
|
||||
const s = t(key);
|
||||
return s === key ? code : s;
|
||||
}
|
||||
|
||||
export function costUnitLabel(r: Pick<CostRow, "unit">): string {
|
||||
return r.unit || t("costs.lump");
|
||||
}
|
||||
|
||||
/** Bericht der Kostenschätzung (Tabelle, Mengen, Kennwerte/Bandbreite, Fussnoten). */
|
||||
export function buildCostReport(project: Project, result: CostResult = computeCostEstimate(project)): AreaReport {
|
||||
const r = result;
|
||||
const rows: ReportRow[] = r.rows.map((g) => ({
|
||||
cells: [g.code, costGroupLabel(g.code, g.name) + (g.example ? " *" : ""), qty(g.quantity, g.unit ? 1 : 0), costUnitLabel(g), chf(g.rate), chf(g.amount)],
|
||||
}));
|
||||
const sum = (label: string, n: number, total = false, code = ""): ReportRow => ({ total, cells: [code, label, "", "", "", chf(n)] });
|
||||
rows.push(sum(t("costs.row.subtotal"), r.subtotal, true));
|
||||
rows.push(sum(`${t("costs.row.fees")} ${pctText(r.feesPct)}`, r.fees, false, "V"));
|
||||
rows.push(sum(`${t("costs.row.reserve")} ${pctText(r.reservePct)}`, r.reserve, false, "Y"));
|
||||
rows.push(sum(t("costs.row.net"), r.net, true));
|
||||
rows.push(sum(`${t("costs.row.vat")} ${pctText(r.vatPct)}`, r.vat, false, "Z"));
|
||||
rows.push(sum(t("costs.row.gross"), r.gross, true));
|
||||
|
||||
const q = r.quantities;
|
||||
const notes: string[] = [];
|
||||
if (r.hasExample) notes.push(t("costs.foot.example"));
|
||||
notes.push(t("costs.foot.priceBase", { base: r.priceBase || "–", region: r.regionFactor.toFixed(2), index: r.indexFactor.toFixed(2) }));
|
||||
for (const k of r.notes) notes.push(t(`costs.note.${k}`, { pct: pctText(r.accuracyPct) }));
|
||||
notes.push(t("costs.foot.ebkp"));
|
||||
|
||||
return {
|
||||
title: t("costs.title"),
|
||||
projectName: project.name ?? "",
|
||||
sections: [
|
||||
{
|
||||
heading: `${t("costs.table")} · ${t(`costs.method.${r.method}`)}`,
|
||||
columns: [t("costs.col.code"), t("costs.col.group"), t("costs.col.quantity"), t("costs.col.unit"), t("costs.col.rate"), t("costs.col.amount")],
|
||||
widths: [1, 5, 1.8, 1, 1.6, 2.2],
|
||||
rows,
|
||||
},
|
||||
{
|
||||
heading: t("costs.range.title"),
|
||||
columns: [t("costs.col.value"), "CHF"],
|
||||
widths: [6, 2.2],
|
||||
rows: [
|
||||
{ cells: [t("costs.range.low", { pct: pctText(r.accuracyPct) }), chf(r.low)] },
|
||||
{ cells: [t("costs.range.high", { pct: pctText(r.accuracyPct) }), chf(r.high)] },
|
||||
{ cells: [t("costs.perGv"), chf(r.perGv)] },
|
||||
{ cells: [t("costs.perGf"), chf(r.perGf)] },
|
||||
],
|
||||
},
|
||||
{
|
||||
heading: t("costs.quantities"),
|
||||
columns: [t("costs.col.quantityName"), t("costs.col.quantity"), t("costs.col.unit")],
|
||||
widths: [6, 1.8, 1],
|
||||
rows: [
|
||||
{ cells: [t("costs.q.gv"), qty(q.gv), "m³"] },
|
||||
{ cells: [t("costs.q.gf"), qty(q.gf), "m²"] },
|
||||
{ cells: [t("costs.q.hnf"), qty(q.hnf), "m²"] },
|
||||
{ cells: [t("costs.q.facade"), qty(q.facade), "m²"] },
|
||||
{ cells: [t("costs.q.roof"), qty(q.roof), "m²"] },
|
||||
],
|
||||
},
|
||||
],
|
||||
notes,
|
||||
};
|
||||
}
|
||||
|
||||
export { formatChf };
|
||||
@@ -55,10 +55,10 @@ describe("Tabellen auf dem Blatt ([111])", () => {
|
||||
|
||||
it("alle Quellen liefern Primitive; Katalog nennt die Spalten", () => {
|
||||
const cat = tableCatalog(sampleProject);
|
||||
expect(Object.keys(cat.sources).sort()).toEqual(["areas", "earthworks", "elements", "openings", "roomBook", "rooms"]);
|
||||
const p = withTables((["openings", "areas", "rooms", "elements", "earthworks", "roomBook"] as const).map((source) => table({ id: source, source })));
|
||||
expect(Object.keys(cat.sources).sort()).toEqual(["areas", "costs", "earthworks", "elements", "openings", "roomBook", "rooms"]);
|
||||
const p = withTables((["openings", "areas", "rooms", "elements", "earthworks", "roomBook", "costs"] as const).map((source) => table({ id: source, source })));
|
||||
const out = sheetTables(p, "L1");
|
||||
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements", "earthworks", "roomBook"]);
|
||||
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements", "earthworks", "roomBook", "costs"]);
|
||||
for (const o of out) expect(o.prims.some((x) => x.k === "text")).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ interface Catalog {
|
||||
valueKeys: string[];
|
||||
}
|
||||
|
||||
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements", "earthworks", "roomBook"];
|
||||
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements", "earthworks", "roomBook", "costs"];
|
||||
|
||||
export function tableSourceLabel(s: LayoutTableSource): string {
|
||||
return t(`sheetTable.source.${s}`);
|
||||
|
||||
@@ -4004,6 +4004,90 @@ export const de = {
|
||||
"render.toLayout.target": "Blatt",
|
||||
"render.toLayout.none": "Noch kein Layout-Blatt vorhanden: zuerst ein Blatt anlegen.",
|
||||
"render.toLayout.done": "Rendering ins Blatt „{name}“ eingesetzt.",
|
||||
// ── [209] Kostenschätzung grob ──
|
||||
"sheetTable.source.costs": "Kostenschätzung grob (eBKP-H)",
|
||||
"sheetTable.col.costCode": "eBKP-H",
|
||||
"sheetTable.col.costGroup": "Gruppe",
|
||||
"sheetTable.col.quantity": "Menge",
|
||||
"sheetTable.col.unit": "Einheit",
|
||||
"sheetTable.col.rate": "Kennwert CHF",
|
||||
"sheetTable.col.amount": "Betrag CHF",
|
||||
"costs.title": "Kostenschätzung grob",
|
||||
"costs.table": "Kennwert-Methode nach eBKP-H",
|
||||
"costs.method": "Methode",
|
||||
"costs.method.gv": "CHF/m³ GV",
|
||||
"costs.method.gf": "CHF/m² GF",
|
||||
"costs.basis.method": "Methode",
|
||||
"costs.basis.gv": "m³ GV",
|
||||
"costs.basis.gf": "m² GF",
|
||||
"costs.basis.hnf": "m² HNF",
|
||||
"costs.basis.facade": "m² Fassade",
|
||||
"costs.basis.roof": "m² Dach",
|
||||
"costs.basis.lump": "pauschal",
|
||||
"costs.group.B": "Vorbereitung",
|
||||
"costs.group.C": "Konstruktion Gebäude",
|
||||
"costs.group.D": "Technik Gebäude",
|
||||
"costs.group.E": "Äussere Wandbekleidung Gebäude",
|
||||
"costs.group.F": "Bedachung Gebäude",
|
||||
"costs.group.G": "Ausbau Gebäude",
|
||||
"costs.group.H": "Nutzungsspezifische Anlage Gebäude",
|
||||
"costs.group.I": "Umgebung Gebäude",
|
||||
"costs.group.J": "Ausstattung Gebäude",
|
||||
"costs.row.subtotal": "Summe Gebäude (B–J)",
|
||||
"costs.row.fees": "Honorare",
|
||||
"costs.row.reserve": "Reserve",
|
||||
"costs.row.net": "Total exkl. MwSt.",
|
||||
"costs.row.vat": "MwSt.",
|
||||
"costs.row.gross": "Total inkl. MwSt.",
|
||||
"costs.lump": "pauschal",
|
||||
"costs.col.code": "eBKP-H",
|
||||
"costs.col.group": "Gruppe",
|
||||
"costs.col.basis": "Bezug",
|
||||
"costs.col.quantity": "Menge",
|
||||
"costs.col.unit": "Einheit",
|
||||
"costs.col.rate": "Kennwert CHF",
|
||||
"costs.col.amount": "Betrag CHF",
|
||||
"costs.col.value": "Kennzahl",
|
||||
"costs.col.quantityName": "Menge (SIA 416)",
|
||||
"costs.fees": "Honorare %",
|
||||
"costs.reserve": "Reserve %",
|
||||
"costs.vat": "MwSt. %",
|
||||
"costs.accuracy": "Genauigkeit ± %",
|
||||
"costs.accuracy.hint": "SIA 102: Vorstudie/Wettbewerb ±25 %, Vorprojekt ±15 %.",
|
||||
"costs.region": "Region-Faktor",
|
||||
"costs.index": "Index-Faktor",
|
||||
"costs.index.hint": "Teuerung seit dem Preisstand der Kennwerte: Baupreisindex heute / Index beim Preisstand.",
|
||||
"costs.priceBase": "Preisstand",
|
||||
"costs.reset": "Beispielwerte",
|
||||
"costs.reset.hint": "Kennwerte und Zuschläge auf die Beispielwerte der Methode zurücksetzen.",
|
||||
"costs.addGroup": "Zeile",
|
||||
"costs.addGroup.hint": "Kennwert-Zeile hinzufügen (z. B. zusammengefasste Gruppe B–J).",
|
||||
"costs.removeGroup": "Zeile entfernen",
|
||||
"costs.example": "Beispielwert",
|
||||
"costs.exampleBanner": "Beispielwerte, bitte anpassen: keine offiziellen Kennwerte (Herkunft s. Fussnote).",
|
||||
"costs.range": "Bandbreite",
|
||||
"costs.range.title": "Bandbreite und Kennwerte gesamt",
|
||||
"costs.range.low": "Untergrenze (−{pct})",
|
||||
"costs.range.high": "Obergrenze (+{pct})",
|
||||
"costs.perGv": "Total inkl. MwSt. je m³ GV",
|
||||
"costs.perGf": "Total inkl. MwSt. je m² GF",
|
||||
"costs.quantities": "Mengen aus dem Modell",
|
||||
"costs.q.gv": "Gebäudevolumen GV",
|
||||
"costs.q.gf": "Geschossfläche GF",
|
||||
"costs.q.hnf": "Hauptnutzfläche HNF",
|
||||
"costs.q.facade": "Fassadenfläche (Aussenumfang × Geschosshöhe)",
|
||||
"costs.q.roof": "Dachfläche",
|
||||
"costs.note.example": "* Beispielwert: runde Annahme für ein Gebäude mittleren Standards (Preisstand 2025), keine offizielle Quelle — bitte durch eigene Kennwerte ersetzen.",
|
||||
"costs.note.noQuantity": "Keine Mengen: das Modell hat weder GV noch GF (Geschosse mit Wänden/Räumen oder freie Körper zeichnen).",
|
||||
"costs.note.gvSolids": "GV aus den freien Körpern (Massenmodell), GF/HNF aus der Flächentabelle SIA 416.",
|
||||
"costs.note.gvLevels": "Mengen aus der Flächentabelle SIA 416 (GV ≈ GF × Geschosshöhe).",
|
||||
"costs.note.facade": "Fassadenfläche = Aussenumfang der oberirdischen Geschosse × Geschosshöhe; Innenhöfe, Brüstungen und Attiken fehlen.",
|
||||
"costs.note.roofFootprint": "Kein Dach im Modell: Dachfläche = Fläche im Aussenumriss (Flachdach-Annahme).",
|
||||
"costs.note.accuracy": "Genauigkeit ±{pct} (SIA 102: Vorstudie ±25 %, Vorprojekt ±15 %).",
|
||||
"costs.foot.example": "Mit * markierte Kennwerte sind Beispielwerte, bitte anpassen.",
|
||||
"costs.foot.priceBase": "Preisstand {base}; Region-Faktor {region}, Index-Faktor {index}.",
|
||||
"costs.foot.ebkp": "Gliederung nach eBKP-H (SN 506 511); ohne Grundstück (A). Honorare (V) auf B–J, Reserve (Y) auf B–J + V, MwSt (Z) auf das Total.",
|
||||
"costs.export.fail": "Export der Kostenschätzung fehlgeschlagen.",
|
||||
} as const;
|
||||
|
||||
export type TranslationKey = keyof typeof de;
|
||||
@@ -3990,4 +3990,88 @@ export const en: Record<TranslationKey, string> = {
|
||||
"render.toLayout.target": "Sheet",
|
||||
"render.toLayout.none": "No layout sheet yet: create a sheet first.",
|
||||
"render.toLayout.done": "Rendering placed on sheet \"{name}\".",
|
||||
// ── [209] Kostenschätzung grob ──
|
||||
"sheetTable.source.costs": "Cost estimate (eBKP-H)",
|
||||
"sheetTable.col.costCode": "eBKP-H",
|
||||
"sheetTable.col.costGroup": "Group",
|
||||
"sheetTable.col.quantity": "Quantity",
|
||||
"sheetTable.col.unit": "Unit",
|
||||
"sheetTable.col.rate": "Rate CHF",
|
||||
"sheetTable.col.amount": "Amount CHF",
|
||||
"costs.title": "Rough cost estimate",
|
||||
"costs.table": "Cost rates by eBKP-H",
|
||||
"costs.method": "Method",
|
||||
"costs.method.gv": "CHF/m³ GV",
|
||||
"costs.method.gf": "CHF/m² GF",
|
||||
"costs.basis.method": "Method",
|
||||
"costs.basis.gv": "m³ GV",
|
||||
"costs.basis.gf": "m² GF",
|
||||
"costs.basis.hnf": "m² HNF",
|
||||
"costs.basis.facade": "m² facade",
|
||||
"costs.basis.roof": "m² roof",
|
||||
"costs.basis.lump": "lump sum",
|
||||
"costs.group.B": "Preparation",
|
||||
"costs.group.C": "Building structure",
|
||||
"costs.group.D": "Building services",
|
||||
"costs.group.E": "External wall cladding",
|
||||
"costs.group.F": "Roofing",
|
||||
"costs.group.G": "Interior fit-out",
|
||||
"costs.group.H": "Use-specific installations",
|
||||
"costs.group.I": "Surroundings",
|
||||
"costs.group.J": "Furnishings",
|
||||
"costs.row.subtotal": "Building total (B–J)",
|
||||
"costs.row.fees": "Fees",
|
||||
"costs.row.reserve": "Contingency",
|
||||
"costs.row.net": "Total excl. VAT",
|
||||
"costs.row.vat": "VAT",
|
||||
"costs.row.gross": "Total incl. VAT",
|
||||
"costs.lump": "lump sum",
|
||||
"costs.col.code": "eBKP-H",
|
||||
"costs.col.group": "Group",
|
||||
"costs.col.basis": "Basis",
|
||||
"costs.col.quantity": "Quantity",
|
||||
"costs.col.unit": "Unit",
|
||||
"costs.col.rate": "Rate CHF",
|
||||
"costs.col.amount": "Amount CHF",
|
||||
"costs.col.value": "Figure",
|
||||
"costs.col.quantityName": "Quantity (SIA 416)",
|
||||
"costs.fees": "Fees %",
|
||||
"costs.reserve": "Contingency %",
|
||||
"costs.vat": "VAT %",
|
||||
"costs.accuracy": "Accuracy ± %",
|
||||
"costs.accuracy.hint": "SIA 102: preliminary study/competition ±25 %, preliminary design ±15 %.",
|
||||
"costs.region": "Regional factor",
|
||||
"costs.index": "Index factor",
|
||||
"costs.index.hint": "Price increase since the rates' price base: construction price index today / index at price base.",
|
||||
"costs.priceBase": "Price base",
|
||||
"costs.reset": "Example values",
|
||||
"costs.reset.hint": "Reset rates and surcharges to the example values of the method.",
|
||||
"costs.addGroup": "Row",
|
||||
"costs.addGroup.hint": "Add a rate row (e.g. a combined group B–J).",
|
||||
"costs.removeGroup": "Remove row",
|
||||
"costs.example": "Example value",
|
||||
"costs.exampleBanner": "Example values, please adjust: no official rates (source see footnote).",
|
||||
"costs.range": "Range",
|
||||
"costs.range.title": "Range and overall rates",
|
||||
"costs.range.low": "Lower bound (−{pct})",
|
||||
"costs.range.high": "Upper bound (+{pct})",
|
||||
"costs.perGv": "Total incl. VAT per m³ GV",
|
||||
"costs.perGf": "Total incl. VAT per m² GF",
|
||||
"costs.quantities": "Quantities from the model",
|
||||
"costs.q.gv": "Building volume GV",
|
||||
"costs.q.gf": "Gross floor area GF",
|
||||
"costs.q.hnf": "Main usable area HNF",
|
||||
"costs.q.facade": "Facade area (outer perimeter × storey height)",
|
||||
"costs.q.roof": "Roof area",
|
||||
"costs.note.example": "* Example value: round assumption for a building of medium standard (price base 2025), no official source — please replace with your own rates.",
|
||||
"costs.note.noQuantity": "No quantities: the model has neither GV nor GF (draw storeys with walls/rooms or free solids).",
|
||||
"costs.note.gvSolids": "GV from the free solids (massing model), GF/HNF from the SIA 416 area table.",
|
||||
"costs.note.gvLevels": "Quantities from the SIA 416 area table (GV ≈ GF × storey height).",
|
||||
"costs.note.facade": "Facade area = outer perimeter of the storeys above ground × storey height; courtyards, parapets and attics missing.",
|
||||
"costs.note.roofFootprint": "No roof in the model: roof area = area inside the outline (flat roof assumption).",
|
||||
"costs.note.accuracy": "Accuracy ±{pct} (SIA 102: preliminary study ±25 %, preliminary design ±15 %).",
|
||||
"costs.foot.example": "Rates marked * are example values, please adjust.",
|
||||
"costs.foot.priceBase": "Price base {base}; regional factor {region}, index factor {index}.",
|
||||
"costs.foot.ebkp": "Structure per eBKP-H (SN 506 511); without land (A). Fees (V) on B–J, contingency (Y) on B–J + V, VAT (Z) on the total.",
|
||||
"costs.export.fail": "Export of the cost estimate failed.",
|
||||
};
|
||||
@@ -590,6 +590,51 @@ export type ContourSet = {
|
||||
contours: Array<Contour>;
|
||||
};
|
||||
|
||||
/** [209] Bezugsmenge eines Kostenkennwerts (Kostenschätzung nach der Kennwert-Methode). */
|
||||
export type CostBasis = "method" | "gv" | "gf" | "hnf" | "facade" | "roof" | "lump";
|
||||
|
||||
/**
|
||||
* [209] Grobe Kostenschätzung (Vorprojekt/Wettbewerb) nach der Kennwert-Methode: Menge × Kennwert je
|
||||
* eBKP-H-Hauptgruppe, dazu Honorare, Reserve und MwSt in Prozent. Fehlt das Feld, rechnet der Kern mit
|
||||
* Beispielwerten (`kosten::default_estimate`).
|
||||
*/
|
||||
export type CostEstimate = {
|
||||
method: CostMethod;
|
||||
groups: Array<CostGroup>;
|
||||
/** Honorare (eBKP-H V) in % der Summe B–J. */
|
||||
feesPct: number;
|
||||
/** Reserve/Unvorhergesehenes (eBKP-H Y) in % der Summe B–J + Honorare. */
|
||||
reservePct: number;
|
||||
/** Mehrwertsteuer (eBKP-H Z) in %. */
|
||||
vatPct: number;
|
||||
/** Genauigkeit der Schätzung ± in %. */
|
||||
accuracyPct: number;
|
||||
/** Region-Faktor auf alle Kennwerte (1 = keiner). */
|
||||
regionFactor: number;
|
||||
/**
|
||||
* Teuerung vom Preisstand der Kennwerte bis heute als Faktor (Baupreisindex neu / alt; 1 = keine).
|
||||
*/
|
||||
indexFactor: number;
|
||||
/** Preisstand der Kennwerte (Text, z. B. „Okt. 2025, Baupreisindex Hochbau“). */
|
||||
priceBase: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* [209] Eine Zeile der Kennwert-Tabelle: eBKP-H-Hauptgruppe (B–J) oder eine zusammengefasste Gruppe.
|
||||
*/
|
||||
export type CostGroup = {
|
||||
/** Kennung der Gruppe nach eBKP-H (SN 506 511), z. B. „C“ oder „B–J“. */
|
||||
code: string;
|
||||
/** Eigene Bezeichnung; fehlt = Name der eBKP-H-Hauptgruppe (aus `code`). */
|
||||
name?: string;
|
||||
basis: CostBasis;
|
||||
/** Kennwert in CHF je Einheit der Bezugsmenge (pauschal: CHF). */
|
||||
rate: number;
|
||||
};
|
||||
|
||||
/** [209] Hauptmenge der Kostenschätzung: m³ GV oder m² GF. */
|
||||
export type CostMethod = "gv" | "gf";
|
||||
|
||||
/**
|
||||
* Eine benutzerdefinierte Farbpalette (Farbmischer → „Diese Farbe
|
||||
* speichern", `ui/FreeColorPicker.tsx`). Anders als Stiftsätze: reine
|
||||
@@ -1987,7 +2032,14 @@ export type LayoutTable = {
|
||||
};
|
||||
|
||||
/** Quelle einer Blatt-Tabelle ([111]). */
|
||||
export type LayoutTableSource = "openings" | "areas" | "rooms" | "elements" | "earthworks" | "roomBook";
|
||||
export type LayoutTableSource =
|
||||
| "openings"
|
||||
| "areas"
|
||||
| "rooms"
|
||||
| "elements"
|
||||
| "earthworks"
|
||||
| "roomBook"
|
||||
| "costs";
|
||||
|
||||
/**
|
||||
* Einfache Textfelder des Titelblocks (Master). Alle optional — leere Felder
|
||||
@@ -3052,6 +3104,8 @@ export type Project = {
|
||||
projectNumber?: string;
|
||||
/** Wettbewerb ([208]): anonyme Abgabe mit Kennwort. */
|
||||
competition?: CompetitionSettings;
|
||||
/** [209] Kostenschätzung grob (Kennwerte, Zuschläge); fehlt = Beispielwerte. */
|
||||
costEstimate?: CostEstimate;
|
||||
/**
|
||||
* Höhe von ±0.00 (OK fertig Boden des Bezugsgeschosses, `DrawingLevel.zeroLevel`)
|
||||
* in Metern über Meer (m ü. M.), editierbar im Einstellungs-Fenster. Optional.
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
// Kostenschätzung grob ([209]) im Flächenbilanz-Panel: Kennwert-Tabelle (eBKP-H-Hauptgruppen) und Zuschläge
|
||||
// bearbeiten, Ergebnis mit Summen, Bandbreite und Mengen; Export CSV/PDF aus demselben Bericht.
|
||||
//
|
||||
// • Rechnet der Kern (`kosten.rs`, Mengen aus der SIA-416-Flächentabelle); hier nur Anzeige und Eingabe.
|
||||
// • Fehlt `Project.costEstimate`, zeigt die Tabelle die Beispielwerte; die erste Änderung schreibt sie ins
|
||||
// Projekt (eine Op, Undo-fähig; Tippen in dasselbe Feld = ein Undo-Schritt über den coalesceKey).
|
||||
// • Methodenwechsel: Beispiel-Kennwerte werden durch die der neuen Methode ersetzt, eigene Kennwerte über das
|
||||
// Mengenverhältnis umgerechnet (Betrag bleibt gleich).
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { areaReportToCsv, buildAreaReportPdf, buildCostReport, computeCostEstimate, costGroupLabel, costUnitLabel, defaultCostEstimate, formatChf, setField } from "../core";
|
||||
import type { CostBasis, CostEstimate, CostGroup, CostMethod, CostResult } from "../core";
|
||||
import type { Project } from "../model/types";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
import { useStore } from "../state/appStore";
|
||||
|
||||
const BASES: CostBasis[] = ["method", "gv", "gf", "hnf", "facade", "roof", "lump"];
|
||||
const METHODS: CostMethod[] = ["gv", "gf"];
|
||||
|
||||
/** Zahl-Eingabe, übernimmt bei Enter/Verlassen (Komma oder Punkt). */
|
||||
function NumField(props: { value: number; onCommit: (v: number) => void; testId?: string; title?: string; width?: number }) {
|
||||
const [text, setText] = useState(String(props.value));
|
||||
useEffect(() => setText(String(props.value)), [props.value]);
|
||||
const commit = () => {
|
||||
const v = Number(text.replace(/'/g, "").replace(",", "."));
|
||||
if (Number.isFinite(v) && v !== props.value) props.onCommit(v);
|
||||
else setText(String(props.value));
|
||||
};
|
||||
return (
|
||||
<input
|
||||
type="text"
|
||||
inputMode="decimal"
|
||||
className="kz-input kz-num"
|
||||
style={props.width ? { width: props.width } : undefined}
|
||||
value={text}
|
||||
title={props.title}
|
||||
data-testid={props.testId}
|
||||
onChange={(e) => setText(e.target.value)}
|
||||
onBlur={commit}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") commit();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/** Kennwerte beim Methodenwechsel: Beispielwerte tauschen, eigene Werte über das Mengenverhältnis umrechnen. */
|
||||
function switchMethod(p: Project, est: CostEstimate, res: CostResult, method: CostMethod): CostEstimate {
|
||||
const from = est.method === "gf" ? res.quantities.gf : res.quantities.gv;
|
||||
const to = method === "gf" ? res.quantities.gf : res.quantities.gv;
|
||||
const examples = new Map(defaultCostEstimate(p, method).groups.map((g) => [g.code, g.rate]));
|
||||
const groups = est.groups.map((g, i) => {
|
||||
if (g.basis !== "method") return g;
|
||||
const ex = examples.get(g.code);
|
||||
if (res.rows[i]?.example && ex !== undefined) return { ...g, rate: ex };
|
||||
return from > 0 && to > 0 ? { ...g, rate: Math.round((g.rate * from) / to) } : g;
|
||||
});
|
||||
return { ...est, method, groups };
|
||||
}
|
||||
|
||||
export function CostEstimateSection() {
|
||||
const project = useStore((s) => s.project);
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const notify = useStore((s) => s.notify);
|
||||
const res = useMemo(() => computeCostEstimate(project), [project]);
|
||||
const est: CostEstimate = useMemo(() => project.costEstimate ?? defaultCostEstimate(project, "gv"), [project]);
|
||||
const stem = `${project.name || "projekt"}-kosten`;
|
||||
|
||||
const update = (next: (e: CostEstimate) => CostEstimate, key: string) =>
|
||||
applyChange((p: Project) => [setField("costEstimate", next(p.costEstimate ?? defaultCostEstimate(p, "gv")))], `costEstimate.${key}`);
|
||||
const patch = (fields: Partial<CostEstimate>, key: string) => update((e) => ({ ...e, ...fields }), key);
|
||||
const patchGroup = (i: number, g: Partial<CostGroup>, key: string) =>
|
||||
update((e) => ({ ...e, groups: e.groups.map((x, j) => (j === i ? { ...x, ...g } : x)) }), `${key}.${i}`);
|
||||
|
||||
const exportCsv = () => downloadCsv(`${stem}.csv`, areaReportToCsv(buildCostReport(project, res)));
|
||||
const exportPdf = () => {
|
||||
try {
|
||||
buildAreaReportPdf(buildCostReport(project, res)).save(`${stem}.pdf`);
|
||||
} catch {
|
||||
notify(t("costs.export.fail"));
|
||||
}
|
||||
};
|
||||
const pctLabel = (v: number) => `${Number.isInteger(v) ? v.toFixed(0) : v.toFixed(1)} %`;
|
||||
const sumRow = (label: string, n: number, testId: string, total = false, code = "") => (
|
||||
<tr className={total ? "total" : ""} data-testid={testId}>
|
||||
<td>{code}</td>
|
||||
<td colSpan={2}>{label}</td>
|
||||
<td className="num">{formatChf(n)}</td>
|
||||
<td />
|
||||
</tr>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="area-section cost-section" data-testid="cost-section">
|
||||
<div className="balance-head">
|
||||
<span className="balance-section-label">{t("costs.title")}</span>
|
||||
<span className="area-actions">
|
||||
<button type="button" className="balance-export" data-testid="cost-export-csv" onClick={exportCsv}>
|
||||
{t("areas.exportCsv")}
|
||||
</button>
|
||||
<button type="button" className="balance-export" data-testid="cost-export-pdf" onClick={exportPdf}>
|
||||
{t("areas.exportPdf")}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{res.hasExample && <div className="cost-example-banner">{t("costs.exampleBanner")}</div>}
|
||||
|
||||
<div className="cost-settings">
|
||||
<label className="kz-parcel">
|
||||
<span>{t("costs.method")}</span>
|
||||
<select
|
||||
className="kz-input"
|
||||
data-testid="cost-method"
|
||||
value={res.method}
|
||||
onChange={(e) => update((x) => switchMethod(project, x, res, e.target.value as CostMethod), "method")}
|
||||
>
|
||||
{METHODS.map((m) => (
|
||||
<option key={m} value={m}>
|
||||
{t(`costs.method.${m}`)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="kz-parcel">
|
||||
<span>{t("costs.priceBase")}</span>
|
||||
<input
|
||||
type="text"
|
||||
className="kz-input"
|
||||
style={{ width: 64 }}
|
||||
value={est.priceBase}
|
||||
data-testid="cost-price-base"
|
||||
onChange={(e) => patch({ priceBase: e.target.value }, "priceBase")}
|
||||
/>
|
||||
</label>
|
||||
<label className="kz-parcel">
|
||||
<span>{t("costs.fees")}</span>
|
||||
<NumField value={est.feesPct} testId="cost-fees" onCommit={(v) => patch({ feesPct: v }, "fees")} />
|
||||
</label>
|
||||
<label className="kz-parcel">
|
||||
<span>{t("costs.reserve")}</span>
|
||||
<NumField value={est.reservePct} testId="cost-reserve" onCommit={(v) => patch({ reservePct: v }, "reserve")} />
|
||||
</label>
|
||||
<label className="kz-parcel">
|
||||
<span>{t("costs.vat")}</span>
|
||||
<NumField value={est.vatPct} testId="cost-vat" onCommit={(v) => patch({ vatPct: v }, "vat")} />
|
||||
</label>
|
||||
<label className="kz-parcel" title={t("costs.accuracy.hint")}>
|
||||
<span>{t("costs.accuracy")}</span>
|
||||
<NumField value={est.accuracyPct} testId="cost-accuracy" title={t("costs.accuracy.hint")} onCommit={(v) => patch({ accuracyPct: v }, "accuracy")} />
|
||||
</label>
|
||||
<label className="kz-parcel">
|
||||
<span>{t("costs.region")}</span>
|
||||
<NumField value={est.regionFactor} testId="cost-region" onCommit={(v) => patch({ regionFactor: v }, "region")} />
|
||||
</label>
|
||||
<label className="kz-parcel" title={t("costs.index.hint")}>
|
||||
<span>{t("costs.index")}</span>
|
||||
<NumField value={est.indexFactor} testId="cost-index" title={t("costs.index.hint")} onCommit={(v) => patch({ indexFactor: v }, "index")} />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<table className="area-table cost-table" data-testid="cost-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("costs.col.code")}</th>
|
||||
<th>
|
||||
{t("costs.col.group")} · {t("costs.col.basis")}
|
||||
</th>
|
||||
<th className="num">{t("costs.col.rate")}</th>
|
||||
<th className="num">{t("costs.col.amount")}</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{res.rows.map((r, i) => (
|
||||
<tr key={i} data-testid={`cost-row-${r.code}`}>
|
||||
<td>
|
||||
<input type="text" className="kz-input cost-code" value={est.groups[i]?.code ?? r.code} onChange={(e) => patchGroup(i, { code: e.target.value }, "code")} />
|
||||
</td>
|
||||
<td className="cost-name">
|
||||
<input
|
||||
type="text"
|
||||
className="kz-input"
|
||||
value={est.groups[i]?.name ?? ""}
|
||||
placeholder={costGroupLabel(r.code)}
|
||||
title={costGroupLabel(r.code, r.name)}
|
||||
onChange={(e) => patchGroup(i, { name: e.target.value || undefined }, "name")}
|
||||
/>
|
||||
<div className="cost-sub">
|
||||
<select className="kz-input" value={est.groups[i]?.basis ?? "method"} title={t("costs.col.basis")} onChange={(e) => patchGroup(i, { basis: e.target.value as CostBasis }, "basis")}>
|
||||
{BASES.map((b) => (
|
||||
<option key={b} value={b}>
|
||||
{b === "method" ? `${t(`costs.basis.${res.method}`)} (${t("costs.basis.method")})` : t(`costs.basis.${b}`)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<span className="cost-qty">{r.unit ? `${formatChf(r.quantity, 1)} ${r.unit}` : costUnitLabel(r)}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className="num">
|
||||
<span className={r.example ? "cost-rate example" : "cost-rate"} title={r.example ? t("costs.example") : undefined}>
|
||||
<NumField value={r.rate} testId={`cost-rate-${r.code}`} width={52} onCommit={(v) => patchGroup(i, { rate: v }, "rate")} />
|
||||
{r.example ? "*" : ""}
|
||||
</span>
|
||||
</td>
|
||||
<td className="num">{formatChf(r.amount)}</td>
|
||||
<td>
|
||||
<button
|
||||
type="button"
|
||||
className="site-remove"
|
||||
title={t("costs.removeGroup")}
|
||||
aria-label={t("costs.removeGroup")}
|
||||
onClick={() => update((e) => ({ ...e, groups: e.groups.filter((_, j) => j !== i) }), "remove")}
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{sumRow(t("costs.row.subtotal"), res.subtotal, "cost-subtotal", true)}
|
||||
{sumRow(`${t("costs.row.fees")} ${pctLabel(res.feesPct)}`, res.fees, "cost-fees-row", false, "V")}
|
||||
{sumRow(`${t("costs.row.reserve")} ${pctLabel(res.reservePct)}`, res.reserve, "cost-reserve-row", false, "Y")}
|
||||
{sumRow(t("costs.row.net"), res.net, "cost-net", true)}
|
||||
{sumRow(`${t("costs.row.vat")} ${pctLabel(res.vatPct)}`, res.vat, "cost-vat-row", false, "Z")}
|
||||
{sumRow(t("costs.row.gross"), res.gross, "cost-gross", true)}
|
||||
<tr data-testid="cost-range" className="cost-range">
|
||||
<td />
|
||||
<td colSpan={3}>
|
||||
{t("costs.range")} ±{pctLabel(res.accuracyPct)}: {formatChf(res.low)} – {formatChf(res.high)}
|
||||
</td>
|
||||
<td />
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div className="area-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="balance-export"
|
||||
title={t("costs.addGroup.hint")}
|
||||
onClick={() => update((e) => ({ ...e, groups: [...e.groups, { code: "", basis: "method", rate: 0 }] }), "add")}
|
||||
>
|
||||
+ {t("costs.addGroup")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="balance-export"
|
||||
title={t("costs.reset.hint")}
|
||||
data-testid="cost-reset"
|
||||
onClick={() => applyChange((p: Project) => [setField("costEstimate", defaultCostEstimate(p, res.method))], "costEstimate.reset")}
|
||||
>
|
||||
{t("costs.reset")}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table className="area-table cost-quantities" data-testid="cost-quantities">
|
||||
<tbody>
|
||||
{(
|
||||
[
|
||||
["costs.q.gv", formatChf(res.quantities.gv, 1), "m³"],
|
||||
["costs.q.gf", formatChf(res.quantities.gf, 1), "m²"],
|
||||
["costs.q.hnf", formatChf(res.quantities.hnf, 1), "m²"],
|
||||
["costs.q.facade", formatChf(res.quantities.facade, 1), "m²"],
|
||||
["costs.q.roof", formatChf(res.quantities.roof, 1), "m²"],
|
||||
["costs.perGv", res.perGv === null ? "–" : formatChf(res.perGv), "CHF"],
|
||||
["costs.perGf", res.perGf === null ? "–" : formatChf(res.perGf), "CHF"],
|
||||
] as const
|
||||
).map(([key, value, unit]) => (
|
||||
<tr key={key}>
|
||||
<td>{t(key)}</td>
|
||||
<td className="num">
|
||||
{value} {unit}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<ul className="area-notes">
|
||||
{res.notes.map((k) => (
|
||||
<li key={k}>{t(`costs.note.${k}`, { pct: pctLabel(res.accuracyPct) })}</li>
|
||||
))}
|
||||
<li>{t("costs.foot.ebkp")}</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import type { Room } from "../model/types";
|
||||
import { roomDisplayName } from "../model/roomStamp";
|
||||
import { KennzahlenSection } from "./KennzahlenSection";
|
||||
import { AreaTableSection } from "./AreaTableSection";
|
||||
import { CostEstimateSection } from "./CostEstimateSection";
|
||||
import { OpeningScheduleSection } from "./OpeningScheduleSection";
|
||||
import { ElementScheduleSection } from "./ElementScheduleSection";
|
||||
import { RoomBookSection } from "./RoomBookSection";
|
||||
@@ -45,6 +46,7 @@ export function RoomBalancePanel() {
|
||||
<div className="balance-panel">
|
||||
<KennzahlenSection />
|
||||
<AreaTableSection />
|
||||
<CostEstimateSection />
|
||||
<OpeningScheduleSection />
|
||||
<ElementScheduleSection />
|
||||
<div className="balance-empty">{t("balance.empty")}</div>
|
||||
@@ -82,6 +84,9 @@ export function RoomBalancePanel() {
|
||||
{/* Flächentabelle und IVHB-Kennziffern. */}
|
||||
<AreaTableSection />
|
||||
|
||||
{/* Kostenschätzung grob ([209]). */}
|
||||
<CostEstimateSection />
|
||||
|
||||
{/* Fenster- und Türliste. */}
|
||||
<OpeningScheduleSection />
|
||||
|
||||
|
||||
@@ -8550,6 +8550,97 @@ body {
|
||||
color: var(--ink-2);
|
||||
}
|
||||
|
||||
/* [209] Kostenschätzung grob (CostEstimateSection). */
|
||||
.cost-example-banner {
|
||||
padding: 4px 6px;
|
||||
border-radius: 4px;
|
||||
background: var(--panel-2);
|
||||
border-left: 3px solid var(--accent);
|
||||
color: var(--ink);
|
||||
font-size: 11px;
|
||||
}
|
||||
.cost-settings {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
|
||||
gap: 3px 10px;
|
||||
}
|
||||
.cost-settings .kz-num {
|
||||
width: 48px;
|
||||
}
|
||||
.cost-settings .kz-parcel > span:first-child {
|
||||
font-size: 11px;
|
||||
}
|
||||
.cost-table {
|
||||
table-layout: fixed;
|
||||
}
|
||||
.cost-table th:nth-child(1) {
|
||||
width: 34px;
|
||||
}
|
||||
.cost-table th:nth-child(3) {
|
||||
width: 62px;
|
||||
}
|
||||
.cost-table th:nth-child(4) {
|
||||
width: 62px;
|
||||
}
|
||||
.cost-table th:nth-child(5) {
|
||||
width: 16px;
|
||||
}
|
||||
.cost-table th:nth-child(5),
|
||||
.cost-table td:nth-child(5) {
|
||||
padding: 2px 0;
|
||||
}
|
||||
.cost-table th {
|
||||
white-space: normal;
|
||||
}
|
||||
.cost-table td {
|
||||
vertical-align: top;
|
||||
}
|
||||
.cost-table .kz-input {
|
||||
font-size: 11px;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.cost-table .cost-code {
|
||||
width: 30px;
|
||||
}
|
||||
.cost-table .cost-name {
|
||||
white-space: normal;
|
||||
}
|
||||
.cost-table .cost-name > .kz-input {
|
||||
width: 100%;
|
||||
}
|
||||
.cost-sub {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-top: 2px;
|
||||
color: var(--ink-2);
|
||||
font-size: 10px;
|
||||
}
|
||||
.cost-sub select {
|
||||
flex: 0 0 auto;
|
||||
width: 84px;
|
||||
font-size: 10px;
|
||||
}
|
||||
.cost-qty {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.cost-table tr.cost-range td {
|
||||
white-space: normal;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
.cost-rate {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.cost-rate.example .kz-input {
|
||||
font-style: italic;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
.cost-quantities td {
|
||||
white-space: normal;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* Raumprogramm: Gruppenspalte, Aktionen, Soll/Ist-Vergleich, Import-Dialog ([61]). */
|
||||
.kz-program-row {
|
||||
grid-template-columns: minmax(0, 1fr) 52px 36px 64px 56px 18px;
|
||||
|
||||
Reference in new issue
Block a user