#916: EingangsrechnungDO.kt
projectforge-business/src/main/kotlin/org/projectforge/business/fibu/EingangsrechnungDO.kt
Type: JPA Entity (Data Object)
Package: org.projectforge.business.fibu
Path: projectforge-business/src/main/kotlin/org/projectforge/business/fibu/EingangsrechnungDO.kt
Author: Kai Reinhard (k.reinhard@micromata.de)
167 lines · 108 code · 37 comments · 22 blank
Represents an incoming invoice (Eingangsrechnung) — a bill received from a creditor. Extends AbstractRechnungDO, inheriting common invoice fields (date, net/gross amounts, payment info, status). Adds incoming-invoice-specific fields like creditor details, bank account information (IBAN/BIC), and a creditor-side reference number. The entity is indexed by Hibernate Search and implements Comparable for sorting.
Database Mapping
| Table | t_fibu_eingangsrechnung |
| Indexes | idx_fk_t_fibu_eingangsrechnung_konto_id on konto_id |
| Annotations | @Indexed (Hibernate Search) |
Named Queries
| Constant | Query | Purpose |
SELECT_MIN_MAX_DATE | select min(datum), max(datum) from EingangsrechnungDO | Calculates the year range of all invoices for UI navigation |
Fields
Creditor Information
| Field | Type | Column | Constraints | Search | Description |
kreditor | String? | — | Length 255 | @FullTextField | Creditor name |
customernr | String? | — | — | @FullTextField | Customer number at the creditor |
Invoice Identification
| Field | Type | Column | Constraints | Search | Description |
referenz | String? | — | Length 1000 | @FullTextField | Creditor's invoice number / reference |
Bank Account
| Field | Type | Column | Constraints | Search | Description |
iban | String? | — | Length 50 | @FullTextField | Creditor's IBAN (for SEPA payments) |
bic | String? | — | Length 11 | @FullTextField | Creditor's BIC/SWIFT code |
Other
| Field | Type | Column | Constraints | Search | Description |
receiver | String? | — | — | @FullTextField | The person/entity receiving the invoice |
paymentType | PaymentType? | payment_type | Length 20, @Enumerated(STRING) | @GenericField (via bridge) | Payment method (e.g. bank transfer) |
Computed / Transient Properties
| Property | Type | Description |
displayName | String | "kreditor" or "kreditor: referenz" |
ibanFormatted | String? | IBAN formatted with spaces via IBANUtils.format() |
isValid | Boolean | !deleted — invoice is valid if not soft-deleted |
abstractPositionen | List? | Casts positionen to abstract type |
Position Management
Inherits from AbstractRechnungDO and specializes the position list as MutableList<EingangsrechnungsPositionDO>, annotated with:
@JsonManagedReference — JSON serialization parent side of bidirectional relationship
@SoftDeleteCollection — soft-delete support for positions
@PersistenceBehavior(autoUpdateCollectionEntries = true) — Hibernate cascading for child entries
@OneToMany(mappedBy = "eingangsrechnung", cascade = PERSIST, MERGE, REFRESH, DETACH) — no REMOVE cascade (orphanRemoval = false)
@OrderColumn(name = "number") / @ListIndexBase(1) — 1-based position numbering
Position Helper Methods
| Method | Description |
ensureAndGetPositionen() | Lazily initializes the positions list if null |
addPositionWithoutCheck(position) | Adds a position, casts to EingangsrechnungsPositionDO, sets back-reference |
setAbstractRechnung(position) | Sets the eingangsrechnung back-reference on a position |
Comparable Implementation
Sorts by: datum (desc), then kreditor (string-compare), then referenz (string-compare).
Inheritance Chain
EingangsrechnungDO → AbstractRechnungDO → DefaultBaseDO
Also implements DisplayNameCapable and Comparable<EingangsrechnungDO>.
Git History
868d6abb7 2025 -> 2026
8c2bf04f0 WIP: currency conversion with Claude Code.
a77a6570f WIP: Import of creditor invoices
1e0e7225b KostzuweisungsExport of invoices ignores now invalid invoices and 0.00 positions.
63081666f Source file headers: 2024-> 2025.
0237d5eba Json serialization refactored: IdOnlySerializer and IdsOnlySerializer introduced.
4bc37b3a1 Migration stuff in progress...
b47c21af6 Refactored caching and calculations with invoices (not yet finished)
fa194d7f8 Migration stuff in progress...
f5c09f87f Migration stuff in progress...
4f5a458c9 Migration stuff in progress...
c04fb0d51 Migration stuff in progress...
06828f490 Migration stuff in progress...
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.