#985: BuchungssatzExcelImporter.kt

projectforge-business/src/main/kotlin/org/projectforge/business/fibu/datev/BuchungssatzExcelImporter.kt Type: Excel Import Class
Package: org.projectforge.business.fibu.datev
Actual Path: projectforge-business/src/main/kotlin/org/projectforge/business/fibu/datev/BuchungssatzExcelImporter.kt
Note: The file does not exist at the requested path (.../excelimport/...). It resides in the datev sub-package. The documentation below reflects the actual source. 219 lines · 180 code · 30 comments · 9 blank

Imports Buchungssätze (accounting records / journal entries) from Excel workbooks using the Merlin Excel framework. Each Excel sheet represents one month (sheet name = month number 01–12). Reads 12 columns with validators and resolves referenced entities (Konto, Kost1, Kost2) during import.

Architecture

Dependencies

DependencyRole
ImportStorage<BuchungssatzDO>Accumulates imported sheets and elements with validation errors
KontoDaoResolves Konto/account numbers to KontoDO entities
Kost1DaoResolves legacy cost center (Kostenstelle 1) codes
Kost2DaoResolves cost center/carrier (Kostenstelle 2) codes

Column Mapping (Enum: Cols)

EnumHeaderAliasesValidatorTarget Property
SATZNRSatzNr.Satz-Nr.NumberValidator (>=1, required, unique)satznr
BETRAGBetragNumberValidator (required)betrag
SHSHS/HOptionsValidator ("S","H", required)sh
KONTOKontoNumberValidator (required)konto
GEGENKONTOGegenkontoValidator (required)gegenKonto
KOST1Alt.-Kst.Kost1Validator (required)kost1
KOST2Kostenstelle/-trägerKost2, Kst.Validator (required)kost2
MENGEMengemenge
BELEGBelegbeleg
DATUMDatumDateValidator (German formats, 1990–2100)datum
TEXTTexttext
KOMMENTARKommentarBemerkungcomment

Import Flow

  1. doImport(workbook) iterates all sheets (0..N).
  2. Sheet name is parsed as month integer (01 for January). If parsing fails, sheet is skipped.
  3. Columns are registered with validators via the Merlin framework.
  4. Empty-row check columns: DATUM, SATZNR, BETRAG, KONTO, GEGENKONTO, KOST1, KOST2.
  5. sheet.analyze(true) validates all data.
  6. importBuchungssaetze(sheet, month) iterates data rows:

Date Validation

Uses ExcelColumnDateValidator with German date formats. Range: 1990-01-01 to 2100-12-31.

Git History

868d6abb7 2025 -> 2026
312d5e61c Clean-up
63081666f Source file headers: 2024-> 2025.
1012e347a Migration stuff in progress... (all tests of all packages: OK).
1204b927b Migration stuff in progress... (all tests of all packages: OK).
3aeda5ef5 Big change: all save|update|...InTrans renamed (InTrans removed).
b095e6f7d !!!!! Big change of Transaction handling: Re-uses PfPersistenceContext.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
5f7ef41b8 Copyright 2021 -> 2022