API reference / Quittio \ Core \ Data
Meta
final readonly class in quittio/core · uses Immutable
Quittio\Core\Data\Meta · Source
Package-internal metadata: locale, time zone, exchange rate, free data for templates and flags for country packs.
The flags of the declared amounts (FLAG_DECLARED_AMOUNTS, FLAG_DECLARED_AMOUNTS_RECALCULATED, FLAG_CANCELLATION_VAT_ALIGNED, amountsFingerprint(), declaredVatInTaxCurrency()) are their stored format; Quittio reads and writes them together as Calculation\DeclaredAmountsState.
Constants#
| Constant | Value | Description |
|---|---|---|
FLAG_CANCELLATION_VAT_ALIGNED | 'cancellation_vat_aligned' | A partial cancellation or price reduction whose VAT (BT-117, BT-111) is aligned with the earlier partial cancellations and price reductions of the original (Corrections\CancellationHistory), in gross price mode also the taxable amounts (BT-116) of a partial cancellation: a VAT amount may differ from round2(taxable amount × rate) by a cent, reported as QUITTIO-CANCELLATION-VAT-ALIGNED instead of QUITTIO-VAT-ROUNDING (which still reports larger differences and a sign other than that of the taxable amount). Dropped once amounts change. The name stays for stored data; it covers price reductions as well. |
FLAG_DECLARED_AMOUNTS | 'declared_amounts' | The line net amounts (BT-131) and the VAT breakdown (BT-116, BT-117) of the data are the declared amounts of an existing document that another system rounded differently, e.g. of a cancellation or of data started with InvoiceBuilder::from() whose amounts were not changed. Set by the builder only, and only if the recalculation does not reproduce the declared amounts, together with the fingerprint of the amount inputs (amountsFingerprint()). The calculator keeps declared BT-131 within 0.02 of quantity × price ± allowances and charges (PEPPOL-EN16931-R120) and declared BT-117 within less than one currency unit (BR-CO-17), so that foreign rounding is reversed exactly; once the amount inputs no longer match the fingerprint (e.g. changed with with() or in stored JSON), everything is recalculated. |
FLAG_DECLARED_AMOUNTS_RECALCULATED | 'declared_amounts_recalculated' | Set by the calculator when declared amounts could not be kept (QUITTIO-DECLARED-AMOUNTS). |
FLAG_PREPAYMENT_CORRECTION | 'prepayment_correction' | A full or partial cancellation or a corrected invoice (Corrections\Cancellation, Corrections\Correction) of a prepayment invoice (type code 386): it reverses or replaces an invoice for an advance payment, for a supply not made yet. Set by Quittio and kept by the documents built from it, e.g. the cancellation of such a cancellation; country packs treat these documents like the prepayment invoice (DE-USTG-03: no date of the supply), and a price reduction (Corrections\PriceReduction) refuses them. |
FLAG_PRICE_REDUCTION | 'price_reduction' | A document on the reduction of the consideration of an invoice (Corrections\PriceReduction, section 17 UStG), not a cancellation or correction of it. |
FLAG_SMALL_BUSINESS | 'small_business' | The seller applies a small business scheme and must not charge VAT (DE: section 19 UStG). |
Properties#
| Property | Type | Description |
|---|---|---|
$custom readonly | array<string, mixed> | |
$exchangeRate readonly | ?Brick\Math\BigDecimal | |
$exchangeRateDate readonly | ?Date | |
$flags readonly | list<string> | |
$locale readonly | ?string | |
$source readonly | ?string | |
$timezone readonly | ?string |
Methods#
| Method | Description |
|---|---|
->__construct() | |
->amountsFingerprint() | Fingerprint of the amount inputs (Calculation\DeclaredAmounts) for which the line net amounts and the VAT breakdown of the data were calculated or declared; set by the calculator and the builder. Data whose inputs no longer match was changed afterwards (e.g. with with() or in stored JSON): its amounts are stale. Stored as a flag, so that it survives toArray(). |
->declaredVatInTaxCurrency() | Declared VAT total in accounting currency (BT-111) that belongs to the declared amounts (FLAG_DECLARED_AMOUNTS), e.g. of a partial cancellation whose VAT is aligned with the earlier ones: the calculator keeps it within 0.01 of round2(BT-110 × exchange rate). Data built with InvoiceBuilder has no totals, so it is stored as a flag, like the fingerprint. |
->hasFlag() | Whether $flag (e.g. FLAG_SMALL_BUSINESS) is set. |
->with() | Returns a copy with the given properties replaced. |
->withAmountsFingerprint() | Copy with another fingerprint of the amount inputs (see amountsFingerprint()); null removes it. |
->withDeclaredVatInTaxCurrency() | Copy with another declared VAT total in accounting currency (BT-111, see declaredVatInTaxCurrency()); null removes it. |
->withFlag() | Copy with $flag set, or removed when $enabled is false; a flag is never set twice. |
__construct()#
public function __construct(
?string $locale = null,
?string $timezone = null,
?BigDecimal $exchangeRate = null,
?Date $exchangeRateDate = null,
array<string, mixed> $custom = [],
?string $source = null,
list<string> $flags = [],
)| Parameter | Type | Description |
|---|---|---|
$locale | ?string = null | |
$timezone | ?string = null | |
$exchangeRate | ?Brick\Math\BigDecimal = null | |
$exchangeRateDate | ?Date = null | |
$custom | array<string, mixed> = [] | |
$source | ?string = null | |
$flags | list<string> = [] |
amountsFingerprint()#
public function amountsFingerprint(): ?stringFingerprint of the amount inputs (Calculation\DeclaredAmounts) for which the line net amounts and the VAT breakdown of the data were calculated or declared; set by the calculator and the builder. Data whose inputs no longer match was changed afterwards (e.g. with with() or in stored JSON): its amounts are stale. Stored as a flag, so that it survives toArray().
- Returns
?string
declaredVatInTaxCurrency()#
public function declaredVatInTaxCurrency(): ?BigDecimalDeclared VAT total in accounting currency (BT-111) that belongs to the declared amounts (FLAG_DECLARED_AMOUNTS), e.g. of a partial cancellation whose VAT is aligned with the earlier ones: the calculator keeps it within 0.01 of round2(BT-110 × exchange rate). Data built with InvoiceBuilder has no totals, so it is stored as a flag, like the fingerprint.
- Returns
?Brick\Math\BigDecimal
hasFlag()#
public function hasFlag(string $flag): boolWhether $flag (e.g. FLAG_SMALL_BUSINESS) is set.
| Parameter | Type | Description |
|---|---|---|
$flag | string |
- Returns
bool
with()#
public function with(array<string, mixed> $changes): staticReturns a copy with the given properties replaced.
| Parameter | Type | Description |
|---|---|---|
$changes | array<string, mixed> |
- Returns
static
withAmountsFingerprint()#
public function withAmountsFingerprint(?string $fingerprint): selfCopy with another fingerprint of the amount inputs (see amountsFingerprint()); null removes it.
| Parameter | Type | Description |
|---|---|---|
$fingerprint | ?string |
- Returns
self
withDeclaredVatInTaxCurrency()#
public function withDeclaredVatInTaxCurrency(?BigDecimal $amount): selfCopy with another declared VAT total in accounting currency (BT-111, see declaredVatInTaxCurrency()); null removes it.
| Parameter | Type | Description |
|---|---|---|
$amount | ?Brick\Math\BigDecimal |
- Returns
self
withFlag()#
public function withFlag(string $flag, bool $enabled = true): selfCopy with $flag set, or removed when $enabled is false; a flag is never set twice.
| Parameter | Type | Description |
|---|---|---|
$flag | string | |
$enabled | bool = true |
- Returns
self