Meta
in package
uses
Immutable
Package-internal metadata: locale, time zone, exchange rate, free data for templates and flags for country packs.
Table of Contents
Constants
- FLAG_CANCELLATION_VAT_ALIGNED : string = '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 : string = '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()).
- FLAG_DECLARED_AMOUNTS_RECALCULATED : string = 'declared_amounts_recalculated'
- Set by the calculator when declared amounts could not be kept (QUITTIO-DECLARED-AMOUNTS).
- FLAG_SMALL_BUSINESS : string = 'small_business'
- The seller applies a small business scheme and must not charge VAT (DE: section 19 UStG).
Properties
- $custom : array<string|int, mixed>
- $exchangeRate : BigDecimal|null
- $exchangeRateDate : Date|null
- $flags : array<string|int, mixed>
- $locale : string|null
- $source : string|null
- $timezone : string|null
Methods
- __construct() : mixed
- amountsFingerprint() : string|null
- 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() : BigDecimal|null
- 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() : bool
- with() : static
- Returns a copy with the given properties replaced.
- withAmountsFingerprint() : self
- withDeclaredVatInTaxCurrency() : self
- withFlag() : self
Constants
FLAG_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.
public
string
FLAG_CANCELLATION_VAT_ALIGNED
= 'cancellation_vat_aligned'
FLAG_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()).
public
string
FLAG_DECLARED_AMOUNTS
= 'declared_amounts'
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
Set by the calculator when declared amounts could not be kept (QUITTIO-DECLARED-AMOUNTS).
public
string
FLAG_DECLARED_AMOUNTS_RECALCULATED
= 'declared_amounts_recalculated'
FLAG_SMALL_BUSINESS
The seller applies a small business scheme and must not charge VAT (DE: section 19 UStG).
public
string
FLAG_SMALL_BUSINESS
= 'small_business'
Properties
$custom
public
array<string|int, mixed>
$custom
= []
Attributes
- #[Internal]
$exchangeRate
public
BigDecimal|null
$exchangeRate
= null
Attributes
- #[Internal]
$exchangeRateDate
public
Date|null
$exchangeRateDate
= null
Attributes
- #[Internal]
$flags
public
array<string|int, mixed>
$flags
= []
Attributes
- #[Internal]
- #[ListOf]
- 'string'
$locale
public
string|null
$locale
= null
Attributes
- #[Internal]
$source
public
string|null
$source
= null
Attributes
- #[Internal]
$timezone
public
string|null
$timezone
= null
Attributes
- #[Internal]
Methods
__construct()
public
__construct([string|null $locale = null ][, string|null $timezone = null ][, BigDecimal|null $exchangeRate = null ][, Date|null $exchangeRateDate = null ][, array<string, mixed> $custom = [] ][, string|null $source = null ][, array<int, string> $flags = [] ]) : mixed
Parameters
- $locale : string|null = null
- $timezone : string|null = null
- $exchangeRate : BigDecimal|null = null
- $exchangeRateDate : Date|null = null
- $custom : array<string, mixed> = []
- $source : string|null = null
- $flags : array<int, string> = []
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().
public
amountsFingerprint() : string|null
Return values
string|nulldeclaredVatInTaxCurrency()
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.
public
declaredVatInTaxCurrency() : BigDecimal|null
Return values
BigDecimal|nullhasFlag()
public
hasFlag(string $flag) : bool
Parameters
- $flag : string
Return values
boolwith()
Returns a copy with the given properties replaced.
public
with(array<string, mixed> $changes) : static
Parameters
- $changes : array<string, mixed>
Return values
staticwithAmountsFingerprint()
public
withAmountsFingerprint(string|null $fingerprint) : self
Parameters
- $fingerprint : string|null
Return values
selfwithDeclaredVatInTaxCurrency()
public
withDeclaredVatInTaxCurrency(BigDecimal|null $amount) : self
Parameters
- $amount : BigDecimal|null
Return values
selfwithFlag()
public
withFlag(string $flag[, bool $enabled = true ]) : self
Parameters
- $flag : string
- $enabled : bool = true