DocumentData
in package
uses
Immutable
Quote, order confirmation, delivery note, proforma invoice, payment reminder or account statement. Shares parties, lines and calculation with {@see InvoiceData}, but never produces e-invoice XML. Payment reminders and account statements have no lines: their amount comes from {@see Dunning} and {@see AccountStatement}.
Table of Contents
Constants
- SNAPSHOT_VERSION : int = 1
- Version of the format of toSnapshot(); a new version comes with an upcaster.
Properties
- $allowances : array<string|int, mixed>
- $buyer : BuyerParty
- $buyerReference : string|null
- $charges : array<string|int, mixed>
- $currency : string
- $delivery : Delivery|null
- $dunning : Dunning|null
- $issueDate : Date
- $lineOptions : array<string|int, mixed>
- $lines : array<string|int, mixed>
- $meta : Meta
- $notes : array<string|int, mixed>
- $number : string
- $packages : array<string|int, mixed>
- $paymentInstructions : PaymentInstructions|null
- $paymentTerms : PaymentTerms|null
- $presentation : Presentation|null
- $purchaseOrderReference : string|null
- $reference : string|null
- $referenceDate : Date|null
- $seller : SellerParty
- $statement : AccountStatement|null
- $totals : Totals|null
- $type : DocumentType
- $validUntil : Date|null
- $vatBreakdown : array<string|int, mixed>
Methods
- __construct() : mixed
- billableLines() : array<int, InvoiceLine>
- Lines that count towards the totals (without optional and alternative lines).
- fromArray() : self
- The document from an array of toArray().
- fromJson() : self
- fromSnapshot() : self
- Restores a stored snapshot of any older version through the upcaster chain (default: SnapshotUpcasterChain::documentDefault()). Snapshots without "_version" are version 1.
- isCalculated() : bool
- options() : DocumentLineOptions
- toArray() : array<string, mixed>
- The document as plain array (scalars only); values equal to their default are left out.
- toInvoiceDraft() : InvoiceData
- The document as invoice data, e.g. for calculation or rendering. Never use it as an invoice.
- toJson() : string
- The document as JSON of toArray().
- toSnapshot() : array<string, mixed>
- The document for storage, with the version of the format ("_version"), e.g. for a queued render job. Read it with fromSnapshot().
- with() : static
- Returns a copy with the given properties replaced.
Constants
SNAPSHOT_VERSION
Version of the format of toSnapshot(); a new version comes with an upcaster.
public
int
SNAPSHOT_VERSION
= 1
Properties
$allowances
public
array<string|int, mixed>
$allowances
= []
Attributes
- #[ListOf]
- DocumentAllowance::class
$buyer
public
BuyerParty
$buyer
$buyerReference
public
string|null
$buyerReference
= null
$charges
public
array<string|int, mixed>
$charges
= []
Attributes
- #[ListOf]
- DocumentCharge::class
$currency
public
string
$currency
$delivery
public
Delivery|null
$delivery
= null
$dunning
public
Dunning|null
$dunning
= null
$issueDate
public
Date
$issueDate
$lineOptions
public
array<string|int, mixed>
$lineOptions
= []
Attributes
- #[MapOf]
- DocumentLineOptions::class
$lines
public
array<string|int, mixed>
$lines
= []
Attributes
- #[ListOf]
- InvoiceLine::class
$meta
public
Meta
$meta
= new Meta()
$notes
public
array<string|int, mixed>
$notes
= []
Attributes
- #[ListOf]
- Note::class
$number
public
string
$number
$packages
public
array<string|int, mixed>
$packages
= []
Attributes
- #[ListOf]
- Package::class
$paymentInstructions
public
PaymentInstructions|null
$paymentInstructions
= null
$paymentTerms
public
PaymentTerms|null
$paymentTerms
= null
$presentation
public
Presentation|null
$presentation
= null
$purchaseOrderReference
public
string|null
$purchaseOrderReference
= null
$reference
public
string|null
$reference
= null
$referenceDate
public
Date|null
$referenceDate
= null
$seller
public
SellerParty
$seller
$statement
public
AccountStatement|null
$statement
= null
$totals
public
Totals|null
$totals
= null
$type
public
DocumentType
$type
$validUntil
public
Date|null
$validUntil
= null
$vatBreakdown
public
array<string|int, mixed>
$vatBreakdown
= []
Attributes
- #[ListOf]
- VatBreakdown::class
Methods
__construct()
public
__construct(DocumentType $type, string $number, Date $issueDate, string $currency, SellerParty $seller, BuyerParty $buyer[, array<int, InvoiceLine> $lines = [] ][, array<string, DocumentLineOptions> $lineOptions = [] ][, array<int, DocumentAllowance> $allowances = [] ][, array<int, DocumentCharge> $charges = [] ][, array<int, Note> $notes = [] ][, Date|null $validUntil = null ][, string|null $reference = null ][, Date|null $referenceDate = null ][, string|null $buyerReference = null ][, string|null $purchaseOrderReference = null ][, Delivery|null $delivery = null ][, array<int, Package> $packages = [] ][, Dunning|null $dunning = null ][, AccountStatement|null $statement = null ][, PaymentTerms|null $paymentTerms = null ][, PaymentInstructions|null $paymentInstructions = null ][, Totals|null $totals = null ][, array<int, VatBreakdown> $vatBreakdown = [] ][, Presentation|null $presentation = null ][, Meta $meta = new Meta() ]) : mixed
Parameters
- $type : DocumentType
- $number : string
- $issueDate : Date
- $currency : string
- $seller : SellerParty
- $buyer : BuyerParty
- $lines : array<int, InvoiceLine> = []
- $lineOptions : array<string, DocumentLineOptions> = []
-
keyed by line identifier
- $allowances : array<int, DocumentAllowance> = []
- $charges : array<int, DocumentCharge> = []
- $notes : array<int, Note> = []
- $validUntil : Date|null = null
- $reference : string|null = null
- $referenceDate : Date|null = null
- $buyerReference : string|null = null
- $purchaseOrderReference : string|null = null
- $delivery : Delivery|null = null
- $packages : array<int, Package> = []
- $dunning : Dunning|null = null
- $statement : AccountStatement|null = null
- $paymentTerms : PaymentTerms|null = null
- $paymentInstructions : PaymentInstructions|null = null
- $totals : Totals|null = null
- $vatBreakdown : array<int, VatBreakdown> = []
- $presentation : Presentation|null = null
- $meta : Meta = new Meta()
billableLines()
Lines that count towards the totals (without optional and alternative lines).
public
billableLines() : array<int, InvoiceLine>
Return values
array<int, InvoiceLine>fromArray()
The document from an array of toArray().
public
static fromArray(array<string, mixed> $data) : self
Parameters
- $data : array<string, mixed>
Tags
Return values
selffromJson()
public
static fromJson(string $json) : self
Parameters
- $json : string
Tags
Return values
selffromSnapshot()
Restores a stored snapshot of any older version through the upcaster chain (default: SnapshotUpcasterChain::documentDefault()). Snapshots without "_version" are version 1.
public
static fromSnapshot(array<string|int, mixed> $snapshot[, SnapshotUpcasterChain|null $chain = null ]) : self
Parameters
- $snapshot : array<string|int, mixed>
- $chain : SnapshotUpcasterChain|null = null
Tags
Return values
selfisCalculated()
public
isCalculated() : bool
Return values
booloptions()
public
options(string $lineId) : DocumentLineOptions
Parameters
- $lineId : string
Return values
DocumentLineOptionstoArray()
The document as plain array (scalars only); values equal to their default are left out.
public
toArray() : array<string, mixed>
Return values
array<string, mixed>toInvoiceDraft()
The document as invoice data, e.g. for calculation or rendering. Never use it as an invoice.
public
toInvoiceDraft([bool $billableOnly = true ]) : InvoiceData
Parameters
- $billableOnly : bool = true
Return values
InvoiceDatatoJson()
The document as JSON of toArray().
public
toJson([int $flags = 0 ]) : string
Parameters
- $flags : int = 0
Return values
stringtoSnapshot()
The document for storage, with the version of the format ("_version"), e.g. for a queued render job. Read it with fromSnapshot().
public
toSnapshot() : array<string, mixed>
Return values
array<string, mixed>with()
Returns a copy with the given properties replaced.
public
with(array<string, mixed> $changes) : static
Parameters
- $changes : array<string, mixed>