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#
| Method | Description |
|---|---|
->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): staticBusiness process identifier (BT-23); Peppol and XRechnung write their process when it is not set. null removes it.
| Parameter | Type | Description |
|---|---|---|
$process | ?string |
- Returns
static
currency()#
public function currency(string $currency): staticInvoice currency (BT-5), ISO 4217; stored in upper case. Default EUR.
| Parameter | Type | Description |
|---|---|---|
$currency | string |
- Returns
static
dueDate()#
public function dueDate(Date|DateTimeInterface|string $date): staticDue date (BT-9). Without it the calculator derives it from dueInDays(); otherwise the configured due_days apply when rendering, never for credit notes.
| Parameter | Type | Description |
|---|---|---|
$date | Date|DateTimeInterface|string |
- Returns
static
exchangeRate()#
public function exchangeRate(
BigDecimal|int|float|string $rate,
Date|DateTimeInterface|string|null $date = null,
): staticExchange 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()).
| Parameter | Type | Description |
|---|---|---|
$rate | Brick\Math\BigDecimal|int|float|string | |
$date | Date|DateTimeInterface|string|null = null |
- Returns
static- Throws
InvalidArgumentException– for a float
issueDate()#
public function issueDate(Date|DateTimeInterface|string $date): staticIssue date (BT-2); default today. A DateTimeInterface is converted in the time zone of timezone(), so call timezone() first.
| Parameter | Type | Description |
|---|---|---|
$date | Date|DateTimeInterface|string |
- Returns
static
number()#
public function number(string $number): staticInvoice number (BT-1). Not checked here; the validation requires it.
| Parameter | Type | Description |
|---|---|---|
$number | string |
- Returns
static
standard()#
public function standard(StandardVersion $version): staticVersion of EN 16931 (BT-24 of the profile): 2017 (default) or 2026, which only the profile EN 16931 supports.
| Parameter | Type | Description |
|---|---|---|
$version | StandardVersion |
- Returns
static
taxCurrency()#
public function taxCurrency(
string $currency,
BigDecimal|int|float|string|null $exchangeRate = null,
Date|DateTimeInterface|string|null $rateDate = null,
): staticVAT accounting currency (BT-6). With an exchange rate, BT-111 is calculated.
| Parameter | Type | Description |
|---|---|---|
$currency | string | |
$exchangeRate | Brick\Math\BigDecimal|int|float|string|null = null | |
$rateDate | Date|DateTimeInterface|string|null = null |
- Returns
static
taxPointDate()#
public function taxPointDate(Date|DateTimeInterface|string $date): staticDate 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).
| Parameter | Type | Description |
|---|---|---|
$date | Date|DateTimeInterface|string |
- Returns
static
taxPointDateCode()#
public function taxPointDateCode(TaxPointDateCode $code): staticCode 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).
| Parameter | Type | Description |
|---|---|---|
$code | TaxPointDateCode |
- Returns
static
type()#
public function type(InvoiceTypeCode|RawCode|string $type): staticType 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.
| Parameter | Type | Description |
|---|---|---|
$type | InvoiceTypeCode|RawCode|string |
- Returns
static