Skip to content

API reference / Quittio \ Core \ Documents

DocumentCalculator

final class in quittio/core

Quittio\Core\Documents\DocumentCalculator · Source

Calculates documents with the invoice calculator. Optional and alternative lines get their line amounts but are excluded from the totals.

Methods#

MethodDescription
->__construct()
->calculate()Returns $document with the line amounts of all lines, and totals, VAT breakdown, allowances and charges of the billable lines only (DocumentData::billableLines()). A document without lines is returned unchanged.

__construct()#

public function __construct(
    TotalsCalculator $calculator = new \Quittio\Core\Calculation\En16931Calculator(),
)
ParameterTypeDescription
$calculatorTotalsCalculator = new \Quittio\Core\Calculation\En16931Calculator()

calculate()#

public function calculate(DocumentData $document): DocumentData

Returns $document with the line amounts of all lines, and totals, VAT breakdown, allowances and charges of the billable lines only (DocumentData::billableLines()). A document without lines is returned unchanged.

ParameterTypeDescription
$documentDocumentData
Returns
DocumentData

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.