Skip to content

API reference / Quittio \ Core \ Builder \ Concerns

BuildsHeader

trait in quittio/core

Quittio\Core\Builder\Concerns\BuildsHeader · Source

Invoice number, dates, type, currencies, business process and standard version.

Part of InvoiceBuilder, which holds the state; use the builder, not the trait.

Methods#

MethodDescription
->businessProcess()Business process identifier (BT-23); Peppol and XRechnung write their process when it is not set. null removes it.
->currency()Invoice currency (BT-5), ISO 4217; stored in upper case. Default EUR.
->dueDate()Due date (BT-9). Without it the calculator derives it from dueInDays(); otherwise the configured due_days apply when rendering, never for credit notes.
->exchangeRate()Exchange rate from the invoice currency to the VAT accounting currency (BT-6), used to calculate the VAT total in that currency (BT-111), with the date of the rate. Replaces a rate implied by declared amounts (see from()).
->issueDate()Issue date (BT-2); default today. A DateTimeInterface is converted in the time zone of timezone(), so call timezone() first.
->number()Invoice number (BT-1). Not checked here; the validation requires it.
->standard()Version of EN 16931 (BT-24 of the profile): 2017 (default) or 2026, which only the profile EN 16931 supports.
->taxCurrency()VAT accounting currency (BT-6). With an exchange rate, BT-111 is calculated.
->taxPointDate()Date when VAT becomes chargeable (BT-7), if it differs from the issue date. EN 16931 allows BT-7 or BT-8, not both (BR-CO-03).
->taxPointDateCode()Code of the date when VAT becomes chargeable (BT-8): issue, delivery or payment date. EN 16931 allows BT-7 or BT-8, not both (BR-CO-03).
->type()Type code (BT-3) from UNTDID 1001, e.g. 381 for a credit note; default 380. Unknown codes are kept as RawCode and reported by the validation.

businessProcess()#

public function businessProcess(?string $process): static

Business process identifier (BT-23); Peppol and XRechnung write their process when it is not set. null removes it.

ParameterTypeDescription
$process?string
Returns
static

currency()#

public function currency(string $currency): static

Invoice currency (BT-5), ISO 4217; stored in upper case. Default EUR.

ParameterTypeDescription
$currencystring
Returns
static

dueDate()#

public function dueDate(Date|DateTimeInterface|string $date): static

Due date (BT-9). Without it the calculator derives it from dueInDays(); otherwise the configured due_days apply when rendering, never for credit notes.

ParameterTypeDescription
$dateDate|DateTimeInterface|string
Returns
static

exchangeRate()#

public function exchangeRate(
    BigDecimal|int|float|string $rate,
    Date|DateTimeInterface|string|null $date = null,
): static

Exchange rate from the invoice currency to the VAT accounting currency (BT-6), used to calculate the VAT total in that currency (BT-111), with the date of the rate. Replaces a rate implied by declared amounts (see from()).

ParameterTypeDescription
$rateBrick\Math\BigDecimal|int|float|string
$dateDate|DateTimeInterface|string|null = null
Returns
static
Throws
InvalidArgumentException – for a float

issueDate()#

public function issueDate(Date|DateTimeInterface|string $date): static

Issue date (BT-2); default today. A DateTimeInterface is converted in the time zone of timezone(), so call timezone() first.

ParameterTypeDescription
$dateDate|DateTimeInterface|string
Returns
static

number()#

public function number(string $number): static

Invoice number (BT-1). Not checked here; the validation requires it.

ParameterTypeDescription
$numberstring
Returns
static

standard()#

public function standard(StandardVersion $version): static

Version of EN 16931 (BT-24 of the profile): 2017 (default) or 2026, which only the profile EN 16931 supports.

ParameterTypeDescription
$versionStandardVersion
Returns
static

taxCurrency()#

public function taxCurrency(
    string $currency,
    BigDecimal|int|float|string|null $exchangeRate = null,
    Date|DateTimeInterface|string|null $rateDate = null,
): static

VAT accounting currency (BT-6). With an exchange rate, BT-111 is calculated.

ParameterTypeDescription
$currencystring
$exchangeRateBrick\Math\BigDecimal|int|float|string|null = null
$rateDateDate|DateTimeInterface|string|null = null
Returns
static

taxPointDate()#

public function taxPointDate(Date|DateTimeInterface|string $date): static

Date when VAT becomes chargeable (BT-7), if it differs from the issue date. EN 16931 allows BT-7 or BT-8, not both (BR-CO-03).

ParameterTypeDescription
$dateDate|DateTimeInterface|string
Returns
static

taxPointDateCode()#

public function taxPointDateCode(TaxPointDateCode $code): static

Code of the date when VAT becomes chargeable (BT-8): issue, delivery or payment date. EN 16931 allows BT-7 or BT-8, not both (BR-CO-03).

ParameterTypeDescription
$codeTaxPointDateCode
Returns
static

type()#

public function type(InvoiceTypeCode|RawCode|string $type): static

Type code (BT-3) from UNTDID 1001, e.g. 381 for a credit note; default 380. Unknown codes are kept as RawCode and reported by the validation.

ParameterTypeDescription
$typeInvoiceTypeCode|RawCode|string
Returns
static

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.