DeclaredAmounts
in package
Declared amounts of an existing document (Meta::FLAG_DECLARED_AMOUNTS): whether they are needed at all, and the fingerprint of the amount inputs they belong to.
The fingerprint (Meta::amountsFingerprint(), set by the calculator on every result and by the builder on data with amounts) covers per line (with sub lines) the identifier, quantity, prices, base quantity, VAT category and rate, line allowances and charges and the net amount, the document allowances and charges, the VAT breakdown and the currency. Data whose fingerprint no longer matches was changed afterwards (e.g. with with() or in stored JSON): its amounts are stale and never kept. Data without fingerprint (e.g. read from XML) is taken as declared by its issuer.
Table of Contents
Constants
- LINE_TOLERANCE : string = '0.02'
- Tolerance of a declared line net amount (BT-131), as PEPPOL-EN16931-R120 tolerates it.
- TAX_CURRENCY_TOLERANCE : string = '0.01'
- Tolerance of a declared VAT total in accounting currency (BT-111) against round2(BT-110 × exchange rate): EN 16931 does not check it, the cumulative rounding of partial cancellations (Corrections\CancellationHistory) needs one cent.
Methods
- breakdownKey() : string
- VAT group key of a breakdown; categories without rate (O) ignore a rate written as 0.
- fingerprint() : string
- hasAmounts() : bool
- Whether the data carries line net amounts or a VAT breakdown.
- isStale() : bool
- Data whose amount inputs changed after Quittio calculated or declared its amounts (fingerprint mismatch), or flagged with declared amounts without fingerprint.
- isTrusted() : bool
- Data flagged with declared amounts whose amount inputs still match the fingerprint.
- needed() : bool
- Whether the recalculation does not reproduce the declared line net amounts (BT-131), the declared VAT breakdown (BT-116, BT-117) or the declared VAT total in accounting currency (BT-111) exactly, e.g. because another system rounded per line or a partial cancellation aligns its VAT with earlier ones. Data calculated by Quittio never needs declared amounts.
Constants
LINE_TOLERANCE
Tolerance of a declared line net amount (BT-131), as PEPPOL-EN16931-R120 tolerates it.
public
string
LINE_TOLERANCE
= '0.02'
TAX_CURRENCY_TOLERANCE
Tolerance of a declared VAT total in accounting currency (BT-111) against round2(BT-110 × exchange rate): EN 16931 does not check it, the cumulative rounding of partial cancellations (Corrections\CancellationHistory) needs one cent.
public
string
TAX_CURRENCY_TOLERANCE
= '0.01'
Methods
breakdownKey()
VAT group key of a breakdown; categories without rate (O) ignore a rate written as 0.
public
static breakdownKey(VatCategory $category, BigDecimal|null $rate) : string
Parameters
- $category : VatCategory
- $rate : BigDecimal|null
Return values
stringfingerprint()
public
static fingerprint(InvoiceData $data) : string
Parameters
- $data : InvoiceData
Return values
stringhasAmounts()
Whether the data carries line net amounts or a VAT breakdown.
public
static hasAmounts(InvoiceData $data) : bool
Parameters
- $data : InvoiceData
Return values
boolisStale()
Data whose amount inputs changed after Quittio calculated or declared its amounts (fingerprint mismatch), or flagged with declared amounts without fingerprint.
public
static isStale(InvoiceData $data) : bool
Parameters
- $data : InvoiceData
Return values
boolisTrusted()
Data flagged with declared amounts whose amount inputs still match the fingerprint.
public
static isTrusted(InvoiceData $data) : bool
Parameters
- $data : InvoiceData
Return values
boolneeded()
Whether the recalculation does not reproduce the declared line net amounts (BT-131), the declared VAT breakdown (BT-116, BT-117) or the declared VAT total in accounting currency (BT-111) exactly, e.g. because another system rounded per line or a partial cancellation aligns its VAT with earlier ones. Data calculated by Quittio never needs declared amounts.
public
static needed(InvoiceData $data[, TotalsCalculator $calculator = new En16931Calculator() ]) : bool
Parameters
- $data : InvoiceData
- $calculator : TotalsCalculator = new En16931Calculator()