Quittio 0.3 API

LineCalculator
in package

FinalYes

Calculates the invoice line net amount (BT-131):

net price BT-146 = BT-148 − BT-147 (if list price and discount are given) base amount B = round2(BT-129 × BT-146 / (BT-149 ?: 1)) allowance A_i = BT-136 or round2((BT-137 ?: B) × BT-138 / 100) charge C_i = BT-141 or round2((BT-142 ?: B) × BT-143 / 100) line amount BT-131 = B − Σ A_i + Σ C_i

Table of Contents

Methods

baseAmount()  : BigDecimal
calculate()  : InvoiceLine
exactAmount()  : BigDecimal|null
Unrounded line amount as PEPPOL-EN16931-R120 checks it: quantity × (net price / base quantity) + line charges − line allowances (BT-129, BT-146, BT-149, BT-141, BT-136).
priceFor()  : BigDecimal
Smallest-precision net price (2 to 10 decimals) for which the line formula yields exactly $amount.

Methods

baseAmount()

public static baseAmount(BigDecimal $quantity, BigDecimal $netPrice, BigDecimal|null $baseQuantity) : BigDecimal
Parameters
$quantity : BigDecimal
$netPrice : BigDecimal
$baseQuantity : BigDecimal|null
Return values
BigDecimal

exactAmount()

Unrounded line amount as PEPPOL-EN16931-R120 checks it: quantity × (net price / base quantity) + line charges − line allowances (BT-129, BT-146, BT-149, BT-141, BT-136).

public static exactAmount(InvoiceLine $line) : BigDecimal|null

Null without net price (BT-146).

Parameters
$line : InvoiceLine
Return values
BigDecimal|null

priceFor()

Smallest-precision net price (2 to 10 decimals) for which the line formula yields exactly $amount.

public static priceFor(BigDecimal $amount, BigDecimal $quantity, BigDecimal|null $baseQuantity) : BigDecimal
Parameters
$amount : BigDecimal
$quantity : BigDecimal
$baseQuantity : BigDecimal|null
Return values
BigDecimal
On this page

Search results