Zum Inhalt springen

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#

ConstantValueDescription
FLAG_CANCELLATION_VAT_ALIGNED'cancellation_vat_aligned'A partial cancellation whose VAT (BT-117, BT-111) is aligned with the earlier partial cancellations of the original (Corrections\CancellationHistory), in gross price mode also its taxable amounts (BT-116): 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.
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_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#

PropertyTypeDescription
$custom readonlyarray<string, mixed>
$exchangeRate readonly?Brick\Math\BigDecimal
$exchangeRateDate readonly?Date
$flags readonlylist<string>
$locale readonly?string
$source readonly?string
$timezone readonly?string

Methods#

MethodDescription
->__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()
->with()Returns a copy with the given properties replaced.
->withAmountsFingerprint()
->withDeclaredVatInTaxCurrency()
->withFlag()

__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 = [],
)
ParameterTypeDescription
$locale?string = null
$timezone?string = null
$exchangeRate?Brick\Math\BigDecimal = null
$exchangeRateDate?Date = null
$customarray<string, mixed> = []
$source?string = null
$flagslist<string> = []

amountsFingerprint()#

public function amountsFingerprint(): ?string

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().

Returns
?string

declaredVatInTaxCurrency()#

public function declaredVatInTaxCurrency(): ?BigDecimal

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.

Returns
?Brick\Math\BigDecimal

hasFlag()#

public function hasFlag(string $flag): bool
ParameterTypeDescription
$flagstring
Returns
bool

with()#

public function with(array<string, mixed> $changes): static

Returns a copy with the given properties replaced.

ParameterTypeDescription
$changesarray<string, mixed>
Returns
static

withAmountsFingerprint()#

public function withAmountsFingerprint(?string $fingerprint): self
ParameterTypeDescription
$fingerprint?string
Returns
self

withDeclaredVatInTaxCurrency()#

public function withDeclaredVatInTaxCurrency(?BigDecimal $amount): self
ParameterTypeDescription
$amount?Brick\Math\BigDecimal
Returns
self

withFlag()#

public function withFlag(string $flag, bool $enabled = true): self
ParameterTypeDescription
$flagstring
$enabledbool = true
Returns
self

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.