#907: AuftragsStatistik.kt

projectforge-business/src/main/kotlin/org/projectforge/business/fibu/AuftragsStatistik.kt Type: Data class (Serializable) · Purpose: Aggregates financial statistics across a set of orders · Package: org.projectforge.business.fibu
Source path: projectforge-business/src/main/kotlin/org/projectforge/business/fibu/AuftragsStatistik.kt 129 lines · 72 code · 44 comments · 13 blank
A Serializable accumulator class that summarizes monetary values and counts across multiple AuftragDO instances. Used in the order book and forecast views to display aggregated pipeline figures. Delegates per-order calculation to AuftragsCache.getOrderInfo() which returns an OrderInfo object with pre-computed sums. Provides separate rollups for acquisition (potential), commissioned, invoiced, not-yet-invoiced, and to-be-invoiced categories, plus corresponding counters.

Architecture & Design

Fields

FieldTypeDescription
nettoSumBigDecimal (private set)Total net sum across all orders
akquiseSumBigDecimal (private set)Sum for orders in acquisition/potential state only
beauftragtSumBigDecimal (private set)Sum for commissioned/ordered positions only (LOI, BEAUFTRAGT, ESKALATION)
invoicedSumBigDecimal (private set)Sum of already-invoiced amounts across all orders
notYetInvoicedSumBigDecimal (private set)Difference between net sum and invoiced sum (open remainder)
toBeInvoicedBigDecimal (private set)Sum of amounts from completed orders not yet fully invoiced or with unreached payment milestones
counterInt (private set)Total number of orders counted
counterAkquiseInt (private set)Number of orders with acquisition sum > 0
counterBeauftragtInt (private set)Number of orders with commissioned sum > 0
counterNotYetInvoicedInt (private set)Number of orders with not-yet-invoiced amount > 0
counterToBeInvoicedInt (private set)Number of orders with to-be-invoiced amount > 0
counterInvoicedInt (private set)Number of orders with invoiced amount > 0

Initialization

All sums are initialized to BigDecimal.ZERO and all counters to 0 in the init block.

Core Method: add(auftrag: AuftragDO)

For each order, retrieves the OrderInfo via WicketSupport.get(AuftragsCache::class.java).getOrderInfo(auftrag). The OrderInfo contains pre-computed breakdowns (akquiseSum, commissionedNetSum, notYetInvoicedSum, toBeInvoicedSum, invoicedSum, netSum). For each sum > BigDecimal.ZERO, the statistic accumulator increments the corresponding counter and adds the amount using NumberHelper.add() (safe BigDecimal addition that handles null values).

Calculated Semantics

Serialization

Implements Serializable with serialVersionUID = -5486964211679100585L for Wicket page serialization. The private set on all fields allows read access from outside while preventing direct mutation (only add() modifies state).

Related Classes

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
42dc9fa16 Orders: ordered -> commissioned.
87dd5b87c AuftragsCache refactored, migration stuff... (all tests OK)
f88994f41 Migration stuff in progress...
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
9a65e1bc0 AuftragDO: statistics refactored (not yet invoiced, to be invoiced, invoiced etc.)
f80509d49 OrderBook: statistics and to be invoiced values improved.
013c514bd AuftragsCache for much better performance of order book's list view.