class
Zugpferd::Invoice
- Zugpferd::Invoice
- Reference
- Object
Overview
A ZUGFeRD 2.x invoice. Construct via Invoice.build and call #to_xml to validate and serialise.
Defined in:
zugpferd/invoice.crConstructors
-
.build(profile : Profile = Profile::EN16931, &) : Invoice
Primary entry point for constructing invoices.
- .new(profile : Profile, document : ExchangedDocument, seller : TradeParty, buyer : TradeParty, settlement : TradeSettlement, line_items : Array(SupplyChainTradeLineItem) = [] of SupplyChainTradeLineItem, *, buyer_order_reference : String | Nil = nil, contract_reference : String | Nil = nil, despatch_advice_reference : String | Nil = nil, delivery_date : Time | Nil = nil)
Instance Method Summary
-
#buyer : TradeParty
Buyer party (BG-7).
-
#buyer=(buyer : TradeParty)
Buyer party (BG-7).
-
#buyer_order_reference : String | Nil
Purchase order reference from the buyer (BT-13).
-
#buyer_order_reference=(buyer_order_reference : String | Nil)
Purchase order reference from the buyer (BT-13).
-
#contract_reference : String | Nil
Contract reference (BT-12).
-
#contract_reference=(contract_reference : String | Nil)
Contract reference (BT-12).
-
#delivery_date : Time | Nil
Actual delivery date (BT-72).
-
#delivery_date=(delivery_date : Time | Nil)
Actual delivery date (BT-72).
-
#despatch_advice_reference : String | Nil
Despatch advice document reference (BT-16).
-
#despatch_advice_reference=(despatch_advice_reference : String | Nil)
Despatch advice document reference (BT-16).
-
#document : ExchangedDocument
Invoice header metadata: number, date, type code, and notes (BG-1).
-
#document=(document : ExchangedDocument)
Invoice header metadata: number, date, type code, and notes (BG-1).
-
#line_items : Array(SupplyChainTradeLineItem)
Invoice lines (BG-25).
-
#line_items=(line_items : Array(SupplyChainTradeLineItem))
Invoice lines (BG-25).
-
#profile : Profile
The compliance profile; controls which fields are required or forbidden during validation and generation.
-
#profile=(profile : Profile)
The compliance profile; controls which fields are required or forbidden during validation and generation.
-
#seller : TradeParty
Seller party (BG-4).
-
#seller=(seller : TradeParty)
Seller party (BG-4).
-
#settlement : TradeSettlement
Currency, VAT breakdown, payment means, and all monetary totals.
-
#settlement=(settlement : TradeSettlement)
Currency, VAT breakdown, payment means, and all monetary totals.
-
#to_xml(indent : String = " ") : String
Validates the invoice against EN 16931 business rules, then serialises to CII XML.
Constructor Detail
Primary entry point for constructing invoices.
Yields a Builder and returns a fully constructed Invoice on block exit.
Raises GenerationError if document, seller, buyer, or settlement are not set.
Instance Method Detail
Purchase order reference from the buyer (BT-13).
Actual delivery date (BT-72). Required for BASIC and above (BR-FX-EN-04).
Actual delivery date (BT-72). Required for BASIC and above (BR-FX-EN-04).
Despatch advice document reference (BT-16).
Invoice header metadata: number, date, type code, and notes (BG-1).
Invoice header metadata: number, date, type code, and notes (BG-1).
Invoice lines (BG-25). Required for BASIC and above; empty for MINIMUM and BASIC_WL.
Invoice lines (BG-25). Required for BASIC and above; empty for MINIMUM and BASIC_WL.
The compliance profile; controls which fields are required or forbidden during validation and generation.
The compliance profile; controls which fields are required or forbidden during validation and generation.
Currency, VAT breakdown, payment means, and all monetary totals.
Validates the invoice against EN 16931 business rules, then serialises to CII XML.
Raises ValidationError if any business rule is violated.