ADD: added einnahmen, ausgaben and bilanz

This commit is contained in:
hwinkel
2026-03-24 14:48:32 +01:00
parent 1bbeaf2c34
commit 6d8c4b615f
32 changed files with 2982 additions and 10 deletions
+89 -3
View File
@@ -67,9 +67,12 @@ model Company {
archivedAt DateTime?
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
customers Customer[]
invoices Invoice[]
services Service[]
customers Customer[]
invoices Invoice[]
services Service[]
betriebsausgaben Betriebsausgabe[]
betriebseinnahmen Betriebseinnahme[]
anlagegueter Anlagegut[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -143,6 +146,89 @@ enum InvoiceStatus {
DELETED
}
enum EinnahmeKategorie {
FUSSPFLEGE
PRIVATEINLAGEN
DARLEHEN
STEUERERSTATTUNGEN
VERSICHERUNGSERSTATTUNGEN
ZINSERTRAEGE
VERMIETUNG_VERPACHTUNG
VERAEUSSERUNGSERLOES
EIGENVERBRAUCH
SONSTIGE_EINNAHMEN
}
model Betriebseinnahme {
id String @id @default(cuid())
companyId String
company Company @relation(fields: [companyId], references: [id], onDelete: Cascade)
kategorie EinnahmeKategorie
betrag Decimal @db.Decimal(10, 2)
datum DateTime
beschreibung String? @db.Text
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([companyId])
@@index([datum])
@@map("betriebseinnahmen")
}
model Anlagegut {
id String @id @default(cuid())
companyId String
company Company @relation(fields: [companyId], references: [id], onDelete: Cascade)
bezeichnung String
anschaffungsdatum DateTime
anschaffungskosten Decimal @db.Decimal(10, 2)
nutzungsdauerJahre Int
restwert Decimal @db.Decimal(10, 2) @default(0)
beschreibung String? @db.Text
aktiv Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([companyId])
@@map("anlagegueter")
}
enum AusgabeKategorie {
WAREN_ROHSTOFFE
GERINGWERTIGE_WIRTSCHAFTSGUETER
ABSCHREIBUNGEN
MIETE
STROM_WASSER
TELEKOMMUNIKATION
FORTBILDUNG_MESSEN
BEITRAEGE
VERSICHERUNGEN
WERBEKOSTEN
ZINSEN
REISEKOSTEN
REPARATUREN_INSTANDHALTUNG
BUEROBEDARF
REPRAESENTATIONSKOSTEN
SONSTIGER_BETRIEBSBEDARF
NEBENKOSTEN_GELDVERKEHR
}
model Betriebsausgabe {
id String @id @default(cuid())
companyId String
company Company @relation(fields: [companyId], references: [id], onDelete: Cascade)
kategorie AusgabeKategorie
betrag Decimal @db.Decimal(10, 2)
datum DateTime
beschreibung String? @db.Text
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([companyId])
@@index([datum])
@@map("betriebsausgaben")
}
model InvoiceItem {
id String @id @default(cuid())
invoiceId String