EingangsrechnungDao.ktDAO for EingangsrechnungDO (incoming invoices). Extends BaseDao<EingangsrechnungDO> providing CRUD, filtered listing, history merging, and payment-state filtering. Collaborates with EingangsrechnungCache for high-performance payment status queries and CurrencyConversionService for multi-currency statistics.
| Dependency | Role |
|---|---|
EingangsrechnungCache | Cached payment-status lookup via RechnungJdbcService |
KontoDao | Sets account (Konto) on incoming invoice records |
CurrencyConversionService | Currency conversion for statistics |
ConfigurationService | System default currency for statistics |
Guarded by UserRightId.FIBU_EINGANGSRECHNUNGEN, set in init.
The years property executes a named query EingangsrechnungDO.SELECT_MIN_MAX_DATE (selecting min(datum) and max(datum)) and converts the result to an IntArray via getYearsByTupleOfLocalDate().
buildStatistik(list) creates an EingangsrechnungsStatistik accumulator and adds each invoice to it. Before processing, it initializes the static currencyConversionService and configurationService on the shared AbstractRechnungsStatistik base class (companion object dependency injection pattern).
setKonto(eingangsrechnung, kontoId) looks up the KontoDO via kontoDao.findOrLoad() and assigns it. If kontoId is null, the konto is set to null.
select)Wraps the filter in an EingangsrechnungListFilter if needed. Creates a QueryFilter with date restrictions and payment type filters. Orders by datum DESC, then kreditor DESC. After querying, applies payment-state post-filtering based on RechnungInfo from the cache:
isShowUnbezahlt — filter to unpaid invoicesisShowBezahlt — filter to paid invoicesisShowUeberFaellig — filter to overdue invoices| Hook | Behavior |
|---|---|
afterLoad(obj) | Sets obj.info from cache via rechnungCache.ensureRechnungInfo(obj) |
onInsertOrModify(obj, opType) | Delegates to AuftragAndRechnungDaoHelper.onSaveOrModify(); scales zahlBetrag to 2 decimal places; calls recalculate(); ensures at least one position exists (throws UserException if empty); removes trailing empty positions; writes UI status to XML. |
afterInsertOrModify(obj, opType) | Calls rechnungCache.update(obj) to refresh the cache |
addOwnHistoryEntries() iterates over all positions and their cost assignments (KostZuweisungDO), merging each child's history into the parent context. getHistoryPropertyPrefix() provides contextual prefixes: position numbers and "kost #N" for cost assignments.
| Method | Description |
|---|---|
findNewestByKreditor(kreditor) | Finds the most recent (by created desc) non-deleted invoice for a given creditor |
getByDateRange(from, until) | Finds all non-deleted invoices in a date range, sorted by date and creditor. Used for import reconciliation. |
contains(idSet, entry) | Checks if any position id is in the given set (for bulk selection) |
Includes "positionen.text" in search queries, allowing full-text search across invoice line items.
Includes EingangsrechnungsPositionDO for cross-entity history searches.
Enabled for "kreditor" (creditor name).
868d6abb7 2025 -> 2026 6be9c2b84 WIP: currency conversion with Claude Code. 363d3b836 WIP: Import of creditor invoices. 63081666f Source file headers: 2024-> 2025. db2599ab8 History in orderbook, incming/outgoing invoices and projects. 18bf92219 WIP: History entries handling. VisitorBookDao. b71b5073d Migration stuff in progress... (all tests of all packages: OK). bbc198d03 Migration stuff in progress... (all tests of all packages: OK). ba2479571 Migration stuff in progress... b47c21af6 Refactored caching and calculations with invoices (not yet finished) 9e3c523c7 Migration stuff in progress... (all tests of all packages: OK). c97135a57 Migration stuff in progress... d18c899b5 Refactoring of history entries, FlatDisplayHistoryEntries and DisplayHistoryEntries... b79a1edca Migration stuff in progress... (all tests of all packages: OK). d67bce18b Migration stuff in progress...