fix: Liquidität Kontostand + ganzzahlig + Jahresspalte

- Kontostand/LIQUIDITAET: Jahresspalte zeigt Dez-Wert (nicht Summe)
- Alle Werte ganzzahlig (keine Nachkommastellen)
- Engine: Brutto, Sozial, AfA, Material alles Math.round()
- formatCell: immer maximumFractionDigits: 0
- GuV: Jahreswerte gerundet

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-27 17:26:30 +01:00
parent 85949dbf8e
commit f849fd729a
2 changed files with 16 additions and 10 deletions

View File

@@ -39,10 +39,10 @@ export function computePersonalkosten(positions: FPPersonalkosten[]): FPPersonal
const { year } = monthToDate(m)
const yearsFromStart = year - startDate.getFullYear()
const raise = Math.pow(1 + (p.annual_raise_pct || 0) / 100, yearsFromStart)
const monthlyBrutto = Math.round(p.brutto_monthly * raise * 100) / 100
const monthlyBrutto = Math.round(p.brutto_monthly * raise)
brutto[`m${m}`] = monthlyBrutto
sozial[`m${m}`] = Math.round(monthlyBrutto * (p.ag_sozial_pct || 20.425) / 100 * 100) / 100
sozial[`m${m}`] = Math.round(monthlyBrutto * (p.ag_sozial_pct || 20.425) / 100)
total[`m${m}`] = brutto[`m${m}`] + sozial[`m${m}`]
}
@@ -67,7 +67,7 @@ export function computeInvestitionen(items: FPInvestitionen[]): FPInvestitionen[
// AfA (linear depreciation)
if (item.afa_years && item.afa_years > 0) {
const afaMonths = item.afa_years * 12
const monthlyAfa = Math.round(item.purchase_amount / afaMonths * 100) / 100
const monthlyAfa = Math.round(item.purchase_amount / afaMonths)
for (let m = purchaseM; m < purchaseM + afaMonths && m <= MONTHS; m++) {
if (m >= 1) afa[`m${m}`] = monthlyAfa
}
@@ -170,7 +170,7 @@ export async function computeFinanzplan(pool: Pool, scenarioId: string): Promise
if (qty && price) {
for (let m = 1; m <= MONTHS; m++) {
const v = (qty.values[`m${m}`] || 0) * (price.values[`m${m}`] || 0)
rev.values[`m${m}`] = Math.round(v * 100) / 100
rev.values[`m${m}`] = Math.round(v)
totalRevenue[`m${m}`] += rev.values[`m${m}`]
}
await pool.query('UPDATE fp_umsatzerloese SET values = $1 WHERE id = $2', [JSON.stringify(rev.values), rev.id])
@@ -194,7 +194,7 @@ export async function computeFinanzplan(pool: Pool, scenarioId: string): Promise
if (uc && qty) {
for (let m = 1; m <= MONTHS; m++) {
const v = (qty.values[`m${m}`] || 0) * (uc.values[`m${m}`] || 0)
cost.values[`m${m}`] = Math.round(v * 100) / 100
cost.values[`m${m}`] = Math.round(v)
totalMaterial[`m${m}`] += cost.values[`m${m}`]
}
await pool.query('UPDATE fp_materialaufwand SET values = $1 WHERE id = $2', [JSON.stringify(cost.values), cost.id])