AuftragAndRechnungDaoHelper.ktShared utility object providing database filter criteria builders and validation logic used by both AuftragDao (orders) and RechnungDao (invoices). Centralizes common patterns like period-of-performance filtering, date range query construction, and invoice save-time validation (maturity calculation, payment date/amount consistency).
createCriterionForPeriodOfPerformance(myFilter)Returns: Optional<DBPredicate>
Builds a predicate for filtering by period of performance overlap. Uses the filter's periodOfPerformanceStartDate and periodOfPerformanceEndDate. The logic checks for overlapping date ranges:
popEnd >= startDate AND popBegin <= endDatepopEnd >= startDatepopBegin <= endDatecreateQueryFilterWithDateRestriction(myFilter)Returns: QueryFilter
Creates a QueryFilter from a RechnungFilter, adding date range constraints on the "datum" field (invoice date). Supports from-date, to-date, or both-range using between, ge, and le operators.
onSaveOrModify(rechnung)Parameter: AbstractRechnungDO
Master validation method called before persisting any invoice. Delegates to three private helpers:
checkAndCalculateFaelligkeit() — Auto-calculates faelligkeit (due date) from rechnungsDatum + zahlungsZielInTagen, but only if due date is null and payment term is setcheckAndCalculateDiscountMaturity() — Auto-calculates discountMaturity from rechnungsDatum + discountZahlungsZielInTagen, only when discount percent is non-null/non-zero and discount maturity is nullvalidateBezahlDatumAndZahlBetrag() — Enforces mutual consistency: if bezahlDatum is set, zahlBetrag must be set (and non-zero), and vice versa. Throws UserException with specific i18n keys on violations@JvmStatic for seamless Java interopSearchFilterWithPeriodOfPerformance interface for polymorphic filter handlingPFDateTime (for due date) and PFDay (for discount maturity)discountPercent is non-zero; if zero, no discount maturity is set868d6abb7 2025 -> 2026 f4540acfa WIP: Import of creditor invoices 63081666f Source file headers: 2024-> 2025. cec9dd314 Invoices: discountMaturity fixed b6092df09 Copyright 2023 -> 2024 ab45d51fa Copyright 2001-2022 -> 2001-2023. 5f7ef41b8 Copyright 2021 -> 2022 a7fceb731 Some compiler warnings fixed. db3b02da7 UserException moved from business to common package ceb63e8a1 Source code header: (C) 2001-2021. a0232cdba Code warnings. b209e00ba PFDay.from -> from, fromOrNow, fromOrNull, PFDateTime.from -> from, fromOrNow, fromOrNull 611b20d4e WIP: java.sql.Date -> LocalDate. 7c1c48782 Replacing more instance of java.sql.Date with java.time.LocalDate 78b436d9e Replace instances of java.util.date and java.sql.Date with java.time.LocalDate 7c79f1922 Copyright of source header -> 2020. a1c287b49 Week of year is now globally the same (independant from user's locale) 61b23c3fd DateHelper methods removed (replaced by PFDay/PFDateTime).