pub struct CalculationTrace {
pub explanation: String,
pub input_quantity: Decimal,
pub input_unit_price_eur: Decimal,
pub gross_eur: Decimal,
pub legal_refs: Vec<LegalReference>,
pub tariff_source: Option<TariffSource>,
pub regulatory_reduction_factor: Option<Decimal>,
pub rounding_note: Option<&'static str>,
}Expand description
Full audit record for how one InvoicePosition was computed.
Answers the question: “Why is this amount on the invoice?”
Every CalculationTrace carries the input values, the applied legal rules,
intermediate results, and the tariff source. This enables:
- Regulator audits (BNetzA §20 EnWG)
- Operator review
- LF dispute resolution
- AI-assisted invoice explainability (MCP tools)
Fields§
§explanation: StringHuman-readable explanation of this position.
Example: "Arbeit 1500 kWh × 3.5 ct/kWh = 52.50 EUR"
input_quantity: DecimalInput quantity used (before rounding).
input_unit_price_eur: DecimalInput unit price in EUR (before rounding, already converted from ct).
gross_eur: DecimalIntermediate result before rounding (qty × price).
legal_refs: Vec<LegalReference>Applied legal references (at least one required).
tariff_source: Option<TariffSource>Source of the tariff rate.
regulatory_reduction_factor: Option<Decimal>Any §14a reductions applied, expressed as a fraction (0.0–1.0).
None when no regulatory reduction applies.
Example: Some(Decimal::new(85, 2)) = 85% of full rate (15% reduction).
rounding_note: Option<&'static str>Notes on rounding applied.
Example: "rounded to 5 dp per StromNEV §17".
Trait Implementations§
Source§impl Clone for CalculationTrace
impl Clone for CalculationTrace
Source§fn clone(&self) -> CalculationTrace
fn clone(&self) -> CalculationTrace
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more