Skip to main content

InvoiceType

Enum InvoiceType 

Source
pub enum InvoiceType {
    Initial,
    CreditNote,
    Correction {
        original_invoice_id: String,
        reason: Option<String>,
    },
    Cancellation {
        original_invoice_id: String,
    },
    Final,
    AdvancePayment,
    PartialInvoice,
}
Expand description

Whether this is an initial invoice, a correction, a cancellation, or a final settlement.

German energy suppliers frequently perform:

Initial invoice  →  Correction (corrected meter reading)
                 →  Cancellation (full reversal)
                 →  Final (annual Schlussabrechnung)

§§ 147 AO / GoBD compliance

Corrections must reference the original invoice ID for the 3-year audit trail. Cancellations reverse the original to EUR 0.

Variants§

§

Initial

Standard billing run (Abschlagsrechnung, periodic invoice).

§

CreditNote

Credit note (Gutschrift) — outgoing payment to a third party.

Used for:

  • EEG feed-in settlement (payment to generator)
  • EINSPEISUNG Direktvermarktung settlement
  • Reverse-charge scenarios

rechnungsart = "GUTSCHRIFT"

§

Correction

Correction superseding an earlier invoice (§ 147 AO / GoBD).

The original invoice must be referenced in the accounting system. The net effect is: original + correction = corrected total.

Fields

§original_invoice_id: String

ID of the original invoice this corrects.

§reason: Option<String>

Human-readable reason (for audit trail).

§

Cancellation

Full reversal of an earlier invoice (Stornorechnung).

All positions are sign-inverted to bring the original to EUR 0.

Fields

§original_invoice_id: String

ID of the original invoice being cancelled.

§

Final

Annual final settlement (Schlussabrechnung / Jahresabrechnung).

Reconciles advance payments against measured consumption. Include paid Abschläge in BillingContext::abschlage — they will be deducted from Invoice::zahlbetrag_eur.

§

AdvancePayment

Advance payment request (Abschlagsrechnung).

Use this for estimated periodic billing where no final meter reading is available yet. The customer pays on account; the annual settlement (InvoiceType::Final) reconciles the difference.

BO4E rechnungsart = "ABSCHLAGSRECHNUNG"

§Distinction from Initial

Initial represents billing for actual metered consumption — it maps to "RECHNUNG". AdvancePayment represents estimated advance payments that will be settled annually.

§

PartialInvoice

Partial delivery invoice (Teilrechnung) for incomplete supply periods.

Used when a customer switches supplier mid-period, moves in/out, or when a meter replacement creates a split period. The departing or arriving supplier issues a Teilrechnung for the exact days of actual supply.

§41 EnWG Abs. 1: the invoice must cover the actual supply period. StromGVV §17 / GasGVV §14: Lieferungsende is billed on the day of change.

rechnungsart = "TEILRECHNUNG"

Implementations§

Source§

impl InvoiceType

Source

pub fn rechnungsart(&self) -> &'static str

Process-level Rechnungsart label (mako vocabulary, superset of BO4E).

Emitted as the rechnungsart ZusatzAttribut for invoice types the BO4E Rechnungstyp enum cannot express losslessly.

Source

pub fn original_invoice_id(&self) -> Option<&str>

Returns the original invoice ID for corrections and cancellations.

Source

pub fn is_reversal(&self) -> bool

true when this invoice reverses all positions of the original.

Source

pub fn settles_advances(&self) -> bool

true when this document discharges the advances the context carries.

§ 40 Abs. 1 EnWG makes the settling invoice itemise and deduct each advance payment. An AdvancePayment is the document that collects one, so it discharges none: netting the advances already paid against it would reduce the very request that asks for the next.

Trait Implementations§

Source§

impl Clone for InvoiceType

Source§

fn clone(&self) -> InvoiceType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InvoiceType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InvoiceType

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for InvoiceType

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for InvoiceType

Source§

fn eq(&self, other: &InvoiceType) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for InvoiceType

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for InvoiceType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more