Quittio 0.3 API

InvoiceData
in package
uses Immutable

Read onlyYes
FinalYes

Root of the semantic invoice model (EN 16931, superset of the 2017 and 2026 versions).

The specification identifier (BT-24) is not part of the data: it is derived from the profile. Totals (BG-22) and the VAT breakdown (BG-23) are set by the calculator.

Table of Contents

Constants

SNAPSHOT_VERSION  : int = 1
Schema version of serialised snapshots, used by upcasters.

Properties

$allowances  : array<string|int, mixed>
$attachments  : array<string|int, mixed>
$businessProcess  : string|null
$buyer  : BuyerParty
$buyerAccountingReference  : string|null
$buyerReference  : string|null
$charges  : array<string|int, mixed>
$contractReference  : string|null
$currency  : string
$delivery  : Delivery|null
$despatchAdviceReference  : string|null
$dueDate  : Date|null
$extended  : ExtendedData|null
$invoicedObject  : Identifier|null
$invoicingPeriod  : Period|null
$issueDate  : Date
$lines  : array<string|int, mixed>
$meta  : Meta
$notes  : array<string|int, mixed>
$number  : string
$payee  : PayeeParty|null
$paymentInstructions  : PaymentInstructions|null
$paymentTerms  : PaymentTerms|null
$precedingInvoices  : array<string|int, mixed>
$prepaidAmount  : Money|null
$presentation  : Presentation|null
$projectReference  : ProjectReference|null
$purchaseOrderReference  : string|null
$receivingAdviceReference  : string|null
$roundingAmount  : Money|null
$salesOrderReference  : string|null
$seller  : SellerParty
$sellerTaxRepresentative  : TaxRepresentativeParty|null
$standardVersion  : StandardVersion
$taxCurrency  : string|null
$taxPointDate  : Date|null
$taxPointDateCode  : TaxPointDateCode|RawCode|null
$tenderReference  : string|null
$totals  : Totals|null
$typeCode  : InvoiceTypeCode|RawCode
$vatBreakdown  : array<string|int, mixed>
$xrechnungExtension  : XRechnungExtensionData|null

Methods

__construct()  : mixed
allLines()  : array<int, InvoiceLine>
All lines including sub lines, depth first.
factory()  : InvoiceFactory
Deterministic test data, e.g. InvoiceData::factory()->reverseCharge()->withLines(5)->make().
fromArray()  : self
fromJson()  : self
fromSnapshot()  : self
Restores a stored snapshot of any older version through the upcaster chain.
isCalculated()  : bool
isCreditNote()  : bool
toArray()  : array<string, mixed>
toJson()  : string
toSnapshot()  : array<string, mixed>
Serialised form for storage (Managed layer). Includes the snapshot version.
typeCodeValue()  : string
with()  : static
Returns a copy with the given properties replaced.
withImpliedExchangeRate()  : self
Copy with the exchange rate implied by the declared VAT totals (BT-111 / BT-110, ten decimals), e.g. for data read from XML, which carries no exchange rate. A recalculation then reproduces BT-111, also with changed or negated amounts. Data with an exchange rate, without a VAT accounting currency (BT-6) or without a declared non-zero BT-110 is returned unchanged.
withIssueDate()  : self
withNumber()  : self

Constants

SNAPSHOT_VERSION

Schema version of serialised snapshots, used by upcasters.

public int SNAPSHOT_VERSION = 1

Properties

$allowances

public array<string|int, mixed> $allowances = []
Attributes
#[Bt]
'BG-20'
#[Cardinality]
'0..n'
#[Cii]
'ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator="false"]'
#[Level]
ProfileLevel::BasicWl
#[ListOf]
DocumentAllowance::class
#[Ubl]
'cac:AllowanceCharge[cbc:ChargeIndicator="false"]'

$attachments

public array<string|int, mixed> $attachments = []
Attributes
#[Bt]
'BG-24'
#[Cardinality]
'0..n'
#[Cii]
'ram:AdditionalReferencedDocument[ram:TypeCode="916"]'
#[ListOf]
Attachment::class
#[Ubl]
'cac:AdditionalDocumentReference'

$businessProcess

public string|null $businessProcess = null
Attributes
#[Bt]
'BT-23'
#[Cardinality]
'0..1'
#[Cii]
'ram:BusinessProcessSpecifiedDocumentContextParameter/ram:ID'
#[Level]
ProfileLevel::Minimum
#[Ubl]
'cbc:ProfileID'

$buyerAccountingReference

public string|null $buyerAccountingReference = null
Attributes
#[Bt]
'BT-19'
#[Cardinality]
'0..1'
#[Cii]
'ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID'
#[Level]
ProfileLevel::BasicWl
#[Ubl]
'cbc:AccountingCost'

$buyerReference

public string|null $buyerReference = null
Attributes
#[Bt]
'BT-10'
#[Cardinality]
'0..1'
#[Cii]
'ram:ApplicableHeaderTradeAgreement/ram:BuyerReference'
#[Level]
ProfileLevel::Minimum
#[RequiredIn]
'xrechnung'
#[Ubl]
'cbc:BuyerReference'

$charges

public array<string|int, mixed> $charges = []
Attributes
#[Bt]
'BG-21'
#[Cardinality]
'0..n'
#[Cii]
'ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator="true"]'
#[Level]
ProfileLevel::BasicWl
#[ListOf]
DocumentCharge::class
#[Ubl]
'cac:AllowanceCharge[cbc:ChargeIndicator="true"]'

$contractReference

public string|null $contractReference = null
Attributes
#[Bt]
'BT-12'
#[Cardinality]
'0..1'
#[Cii]
'ram:ContractReferencedDocument/ram:IssuerAssignedID'
#[Level]
ProfileLevel::BasicWl
#[Ubl]
'cac:ContractDocumentReference/cbc:ID'

$currency

public string $currency
Attributes
#[Bt]
'BT-5'
#[Cardinality]
'1'
#[Cii]
'ram:ApplicableHeaderTradeSettlement/ram:InvoiceCurrencyCode'
#[Level]
ProfileLevel::Minimum
#[Ubl]
'cbc:DocumentCurrencyCode'

$despatchAdviceReference

public string|null $despatchAdviceReference = null
Attributes
#[Bt]
'BT-16'
#[Cardinality]
'0..1'
#[Cii]
'ram:DespatchAdviceReferencedDocument/ram:IssuerAssignedID'
#[Level]
ProfileLevel::BasicWl
#[Ubl]
'cac:DespatchDocumentReference/cbc:ID'

$dueDate

public Date|null $dueDate = null
Attributes
#[Bt]
'BT-9'
#[Cardinality]
'0..1'
#[Cii]
'ram:SpecifiedTradePaymentTerms/ram:DueDateDateTime'
#[Level]
ProfileLevel::BasicWl
#[Ubl]
'cbc:DueDate (CreditNote: cac:PaymentMeans/cbc:PaymentDueDate)'

$invoicedObject

public Identifier|null $invoicedObject = null
Attributes
#[Bt]
'BT-18'
#[Cardinality]
'0..1'
#[Cii]
'ram:AdditionalReferencedDocument[ram:TypeCode="130"]/ram:IssuerAssignedID'
#[Ubl]
'cac:AdditionalDocumentReference[cbc:DocumentTypeCode="130"]/cbc:ID'

$lines

public array<string|int, mixed> $lines
Attributes
#[Bt]
'BG-25'
#[Cardinality]
'1..n'
#[Cii]
'rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem'
#[Level]
ProfileLevel::Basic
#[ListOf]
InvoiceLine::class
#[Ubl]
'cac:InvoiceLine | cac:CreditNoteLine'

$notes

public array<string|int, mixed> $notes = []
Attributes
#[Bt]
'BG-1'
#[Cardinality]
'0..n'
#[Cii]
'rsm:ExchangedDocument/ram:IncludedNote'
#[Level]
ProfileLevel::BasicWl
#[ListOf]
Note::class
#[Ubl]
'cbc:Note'

$precedingInvoices

public array<string|int, mixed> $precedingInvoices = []
Attributes
#[Bt]
'BG-3'
#[Cardinality]
'0..n'
#[Cii]
'ram:InvoiceReferencedDocument'
#[Level]
ProfileLevel::BasicWl
#[ListOf]
PrecedingInvoiceReference::class
#[Ubl]
'cac:BillingReference'

$projectReference

public ProjectReference|null $projectReference = null
Attributes
#[Bt]
'BT-11'
#[Cardinality]
'0..1'
#[Cii]
'ram:ApplicableHeaderTradeAgreement/ram:SpecifiedProcuringProject'
#[Ubl]
'cac:ProjectReference/cbc:ID'

$purchaseOrderReference

public string|null $purchaseOrderReference = null
Attributes
#[Bt]
'BT-13'
#[Cardinality]
'0..1'
#[Cii]
'ram:BuyerOrderReferencedDocument/ram:IssuerAssignedID'
#[Level]
ProfileLevel::Minimum
#[Ubl]
'cac:OrderReference/cbc:ID'

$receivingAdviceReference

public string|null $receivingAdviceReference = null
Attributes
#[Bt]
'BT-15'
#[Cardinality]
'0..1'
#[Cii]
'ram:ReceivingAdviceReferencedDocument/ram:IssuerAssignedID'
#[Ubl]
'cac:ReceiptDocumentReference/cbc:ID'

$salesOrderReference

public string|null $salesOrderReference = null
Attributes
#[Bt]
'BT-14'
#[Cardinality]
'0..1'
#[Cii]
'ram:SellerOrderReferencedDocument/ram:IssuerAssignedID'
#[Ubl]
'cac:OrderReference/cbc:SalesOrderID'

$taxCurrency

public string|null $taxCurrency = null
Attributes
#[Bt]
'BT-6'
#[Cardinality]
'0..1'
#[Cii]
'ram:ApplicableHeaderTradeSettlement/ram:TaxCurrencyCode'
#[Level]
ProfileLevel::BasicWl
#[Ubl]
'cbc:TaxCurrencyCode'

$taxPointDate

public Date|null $taxPointDate = null
Attributes
#[Bt]
'BT-7'
#[Cardinality]
'0..1'
#[Cii]
'ram:ApplicableTradeTax/ram:TaxPointDate'
#[Level]
ProfileLevel::BasicWl
#[Ubl]
'cbc:TaxPointDate'

$tenderReference

public string|null $tenderReference = null
Attributes
#[Bt]
'BT-17'
#[Cardinality]
'0..1'
#[Cii]
'ram:AdditionalReferencedDocument[ram:TypeCode="50"]/ram:IssuerAssignedID'
#[Ubl]
'cac:OriginatorDocumentReference/cbc:ID'

$vatBreakdown

public array<string|int, mixed> $vatBreakdown = []
Attributes
#[Bt]
'BG-23'
#[Cardinality]
'1..n'
#[Cii]
'ram:ApplicableTradeTax'
#[Computed]
#[Level]
ProfileLevel::BasicWl
#[ListOf]
VatBreakdown::class
#[Ubl]
'cac:TaxTotal/cac:TaxSubtotal'

Methods

__construct()

public __construct(string $number, Date $issueDate, InvoiceTypeCode|RawCode $typeCode, string $currency, SellerParty $seller, BuyerParty $buyer, array<int, InvoiceLine> $lines[, string|null $taxCurrency = null ][, Date|null $taxPointDate = null ][, TaxPointDateCode|RawCode|null $taxPointDateCode = null ][, Date|null $dueDate = null ][, string|null $buyerReference = null ][, ProjectReference|null $projectReference = null ][, string|null $contractReference = null ][, string|null $purchaseOrderReference = null ][, string|null $salesOrderReference = null ][, string|null $receivingAdviceReference = null ][, string|null $despatchAdviceReference = null ][, string|null $tenderReference = null ][, Identifier|null $invoicedObject = null ][, string|null $buyerAccountingReference = null ][, PaymentTerms|null $paymentTerms = null ][, array<int, Note> $notes = [] ][, string|null $businessProcess = null ][, array<int, PrecedingInvoiceReference> $precedingInvoices = [] ][, PayeeParty|null $payee = null ][, TaxRepresentativeParty|null $sellerTaxRepresentative = null ][, Delivery|null $delivery = null ][, Period|null $invoicingPeriod = null ][, PaymentInstructions|null $paymentInstructions = null ][, array<int, DocumentAllowance> $allowances = [] ][, array<int, DocumentCharge> $charges = [] ][, Totals|null $totals = null ][, array<int, VatBreakdown> $vatBreakdown = [] ][, array<int, Attachment> $attachments = [] ][, Money|null $prepaidAmount = null ][, Money|null $roundingAmount = null ][, ExtendedData|null $extended = null ][, XRechnungExtensionData|null $xrechnungExtension = null ][, Presentation|null $presentation = null ][, Meta $meta = new Meta() ][, StandardVersion $standardVersion = StandardVersion::En16931_2017 ]) : mixed
Parameters
$number : string
$issueDate : Date
$typeCode : InvoiceTypeCode|RawCode
$currency : string
$seller : SellerParty
$buyer : BuyerParty
$lines : array<int, InvoiceLine>
$taxCurrency : string|null = null
$taxPointDate : Date|null = null
$taxPointDateCode : TaxPointDateCode|RawCode|null = null
$dueDate : Date|null = null
$buyerReference : string|null = null
$projectReference : ProjectReference|null = null
$contractReference : string|null = null
$purchaseOrderReference : string|null = null
$salesOrderReference : string|null = null
$receivingAdviceReference : string|null = null
$despatchAdviceReference : string|null = null
$tenderReference : string|null = null
$invoicedObject : Identifier|null = null
$buyerAccountingReference : string|null = null
$paymentTerms : PaymentTerms|null = null
$notes : array<int, Note> = []
$businessProcess : string|null = null
$precedingInvoices : array<int, PrecedingInvoiceReference> = []
$payee : PayeeParty|null = null
$sellerTaxRepresentative : TaxRepresentativeParty|null = null
$delivery : Delivery|null = null
$invoicingPeriod : Period|null = null
$paymentInstructions : PaymentInstructions|null = null
$allowances : array<int, DocumentAllowance> = []
$charges : array<int, DocumentCharge> = []
$totals : Totals|null = null
$vatBreakdown : array<int, VatBreakdown> = []
$attachments : array<int, Attachment> = []
$prepaidAmount : Money|null = null
$roundingAmount : Money|null = null
$extended : ExtendedData|null = null
$xrechnungExtension : XRechnungExtensionData|null = null
$presentation : Presentation|null = null
$meta : Meta = new Meta()
$standardVersion : StandardVersion = StandardVersion::En16931_2017

fromArray()

public static fromArray(array<string, mixed> $data) : self
Parameters
$data : array<string, mixed>
Return values
self

fromJson()

public static fromJson(string $json) : self
Parameters
$json : string
Return values
self

fromSnapshot()

Restores a stored snapshot of any older version through the upcaster chain.

public static fromSnapshot(array<string|int, mixed> $snapshot[, SnapshotUpcasterChain|null $chain = null ]) : self

Snapshots without "_version" are treated as version 1.

Parameters
$snapshot : array<string|int, mixed>
$chain : SnapshotUpcasterChain|null = null
Return values
self

isCalculated()

public isCalculated() : bool
Return values
bool

isCreditNote()

public isCreditNote() : bool
Return values
bool

toArray()

public toArray() : array<string, mixed>
Return values
array<string, mixed>

toJson()

public toJson([int $flags = 0 ]) : string
Parameters
$flags : int = 0
Return values
string

toSnapshot()

Serialised form for storage (Managed layer). Includes the snapshot version.

public toSnapshot() : array<string, mixed>
Return values
array<string, mixed>

typeCodeValue()

public typeCodeValue() : string
Return values
string

with()

Returns a copy with the given properties replaced.

public with(array<string, mixed> $changes) : static
Parameters
$changes : array<string, mixed>
Return values
static

withImpliedExchangeRate()

Copy with the exchange rate implied by the declared VAT totals (BT-111 / BT-110, ten decimals), e.g. for data read from XML, which carries no exchange rate. A recalculation then reproduces BT-111, also with changed or negated amounts. Data with an exchange rate, without a VAT accounting currency (BT-6) or without a declared non-zero BT-110 is returned unchanged.

public withImpliedExchangeRate() : self
Return values
self

withIssueDate()

public withIssueDate(Date $issueDate) : self
Parameters
$issueDate : Date
Return values
self

withNumber()

public withNumber(string $number) : self
Parameters
$number : string
Return values
self
On this page

Search results