#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

Tablet_fibu_eingangsrechnung
Indexesidx_fk_t_fibu_eingangsrechnung_konto_id on konto_id
Annotations@Indexed (Hibernate Search)

Named Queries

ConstantQueryPurpose
SELECT_MIN_MAX_DATEselect min(datum), max(datum) from EingangsrechnungDOCalculates the year range of all invoices for UI navigation

Fields

Creditor Information

FieldTypeColumnConstraintsSearchDescription
kreditorString?Length 255@FullTextFieldCreditor name
customernrString?@FullTextFieldCustomer number at the creditor

Invoice Identification

FieldTypeColumnConstraintsSearchDescription
referenzString?Length 1000@FullTextFieldCreditor's invoice number / reference

Bank Account

FieldTypeColumnConstraintsSearchDescription
ibanString?Length 50@FullTextFieldCreditor's IBAN (for SEPA payments)
bicString?Length 11@FullTextFieldCreditor's BIC/SWIFT code

Other

FieldTypeColumnConstraintsSearchDescription
receiverString?@FullTextFieldThe person/entity receiving the invoice
paymentTypePaymentType?payment_typeLength 20, @Enumerated(STRING)@GenericField (via bridge)Payment method (e.g. bank transfer)

Computed / Transient Properties

PropertyTypeDescription
displayNameString"kreditor" or "kreditor: referenz"
ibanFormattedString?IBAN formatted with spaces via IBANUtils.format()
isValidBoolean!deleted — invoice is valid if not soft-deleted
abstractPositionenList?Casts positionen to abstract type

Position Management

Inherits from AbstractRechnungDO and specializes the position list as MutableList<EingangsrechnungsPositionDO>, annotated with:

Position Helper Methods

MethodDescription
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

EingangsrechnungDOAbstractRechnungDODefaultBaseDO

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.