Quittio 0.3 API

DocumentBuilder
in package
uses Macroable

Fluent builder for documents. Parties, lines, notes, discounts and payment data work exactly like in the {@see InvoiceBuilder}.

Table of Contents

Properties

$macros  : array<string, callable>

Methods

__call()  : mixed
__construct()  : mixed
accountStatement()  : static
An account statement (Kontoauszug): open items of a statementPeriod() with an opening balance.
alternativeLine()  : static
Alternative to another line, shown but not included in the totals.
build()  : DocumentData
The immutable document, not calculated yet (DocumentCalculator, or the render run).
buyer()  : static
buyerReference()  : static
The buyer's reference; null removes it.
cashDiscount()  : static
Cash discount ("Skonto"), see InvoiceBuilder::cashDiscount().
creditTransfer()  : static
Bank account for the payment, see InvoiceBuilder::creditTransfer().
currency()  : static
Currency, ISO 4217; default EUR.
custom()  : static
Free data for templates (view model key meta.custom).
deadline()  : static
Payment deadline of a payment reminder.
defaultVat()  : static
VAT treatment of the lines that set none, see InvoiceBuilder::defaultVat().
deliverTo()  : static
Deliver-to party: recipient name and address, see InvoiceBuilder::deliverTo().
deliveryDate()  : static
Delivery date.
deliveryNote()  : static
A delivery note (Lieferschein), e.g. with packages and serialised lines.
discountAmount()  : static
Absolute discount on the lines that count towards the totals, see InvoiceBuilder::discountAmount().
discountPercent()  : static
Percentage discount on the lines that count towards the totals, see InvoiceBuilder::discountPercent().
dueInDays()  : static
Payment target in days, see InvoiceBuilder::dueInDays().
fee()  : static
Adds a fee of a payment reminder, e.g. a reminder fee.
flushMacros()  : void
hasMacro()  : bool
interest()  : static
Default interest from $from (first day with interest) until $until (exclusive: the last day with interest is the day before). $dayCount null counts actual/actual (365 or 366 days per calendar year); 365 or 360 use a fixed basis, e.g. from the dayCount of the country pack's DunningLaw.
interestCharge()  : static
Adds calculated interest charges, e.g. of Dunning\DefaultInterest::calculate(), with their own day count basis and texts. The base is taken over as amount in the document currency.
issueDate()  : static
Document date; default today.
line()  : static
A line in the forms of InvoiceBuilder::line(), e.g. ->line('Consulting', netPrice: '120.00').
lines()  : static
locale()  : static
Language of the document, see InvoiceBuilder::locale().
macro()  : void
make()  : static
A new builder for a document of $type.
note()  : static
Adds a note with an optional subject code, see InvoiceBuilder::note().
number()  : static
Document number.
openingBalance()  : static
Opening balance of an account statement.
openItem()  : static
Adds an open invoice of a payment reminder or account statement: number, date, amount (string), due date, the amount paid so far and a description.
optionalLine()  : static
Optional quote line, shown with its price but not included in the totals.
orderConfirmation()  : static
An order confirmation (Auftragsbestätigung), e.g. with reference() to the quote.
package()  : static
Adds a package of a delivery note.
paymentReminder()  : static
paymentTerms()  : static
presentation()  : static
Design of this document, see InvoiceBuilder::presentation().
proforma()  : static
A proforma invoice: looks like an invoice, but is not one for tax purposes.
purchaseOrderReference()  : static
The buyer's purchase order reference; null removes it.
quote()  : static
A quote (Angebot): lines, optional and alternative lines, validUntil().
reference()  : static
Preceding document, e.g. the quote of an order confirmation or the order of a delivery note.
seller()  : static
serialisedLine()  : static
Delivery note line with serial numbers.
statementPeriod()  : static
Period of an account statement.
tap()  : static
Direct access to the underlying invoice builder for everything not wrapped here.
validUntil()  : static
Date until which a quote is valid.

Properties

$macros

protected static array<string, callable> $macros = []

Methods

__call()

public __call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string
$parameters : array<string|int, mixed>

accountStatement()

An account statement (Kontoauszug): open items of a statementPeriod() with an opening balance.

public static accountStatement() : static
Return values
static

alternativeLine()

Alternative to another line, shown but not included in the totals.

public alternativeLine(string $alternativeTo, InvoiceLine|LineBuilder|array<string|int, mixed>|callable(LineBuilder): mixed|string $line[, BigDecimal|int|float|string|null $netPrice = null ][, BigDecimal|int|float|string|null $quantity = null ][, UnitCode|RawCode|string|null $unit = null ][, TaxPreset|VatCategory|null $vat = null ][, string|null $description = null ][, BigDecimal|int|float|string|null $priceInclVat = null ]) : static
Parameters
$alternativeTo : string
$line : InvoiceLine|LineBuilder|array<string|int, mixed>|callable(LineBuilder): mixed|string
$netPrice : BigDecimal|int|float|string|null = null
$quantity : BigDecimal|int|float|string|null = null
$unit : UnitCode|RawCode|string|null = null
$vat : TaxPreset|VatCategory|null = null
$description : string|null = null
$priceInclVat : BigDecimal|int|float|string|null = null
Return values
static

build()

The immutable document, not calculated yet (DocumentCalculator, or the render run).

public build() : DocumentData
Tags
throws
InvalidInvoiceData

when the seller or the buyer is missing, or an item name or the VAT of a line without default VAT

Return values
DocumentData

buyerReference()

The buyer's reference; null removes it.

public buyerReference(string|null $reference) : static
Parameters
$reference : string|null
Return values
static

cashDiscount()

Cash discount ("Skonto"), see InvoiceBuilder::cashDiscount().

public cashDiscount(int $days, string $percent[, string|null $baseAmount = null ]) : static
Parameters
$days : int
$percent : string
$baseAmount : string|null = null
Return values
static

creditTransfer()

Bank account for the payment, see InvoiceBuilder::creditTransfer().

public creditTransfer(string $iban[, string|null $bic = null ][, string|null $accountName = null ]) : static
Parameters
$iban : string
$bic : string|null = null
$accountName : string|null = null
Return values
static

currency()

Currency, ISO 4217; default EUR.

public currency(string $currency) : static
Parameters
$currency : string
Return values
static

custom()

Free data for templates (view model key meta.custom).

public custom(string $key, mixed $value) : static
Parameters
$key : string
$value : mixed
Return values
static

deadline()

Payment deadline of a payment reminder.

public deadline(Date|DateTimeInterface|string $date) : static
Parameters
$date : Date|DateTimeInterface|string
Return values
static

defaultVat()

VAT treatment of the lines that set none, see InvoiceBuilder::defaultVat().

public defaultVat(TaxPreset|VatCategory $presetOrCategory[, BigDecimal|int|float|string|null $rate = null ][, string|null $exemptionReason = null ][, VatExemptionReasonCode|RawCode|string|null $exemptionReasonCode = null ]) : static
Parameters
$presetOrCategory : TaxPreset|VatCategory
$rate : BigDecimal|int|float|string|null = null
$exemptionReason : string|null = null
$exemptionReasonCode : VatExemptionReasonCode|RawCode|string|null = null
Return values
static

deliverTo()

Deliver-to party: recipient name and address, see InvoiceBuilder::deliverTo().

public deliverTo(string|null $recipientName[, Address|null $address = null ]) : static
Parameters
$recipientName : string|null
$address : Address|null = null
Return values
static

deliveryDate()

Delivery date.

public deliveryDate(Date|DateTimeInterface|string $date) : static
Parameters
$date : Date|DateTimeInterface|string
Return values
static

deliveryNote()

A delivery note (Lieferschein), e.g. with packages and serialised lines.

public static deliveryNote() : static
Return values
static

discountAmount()

Absolute discount on the lines that count towards the totals, see InvoiceBuilder::discountAmount().

public discountAmount(BigDecimal|int|float|string $amount[, string|null $reason = null ][, AllowanceReasonCode|RawCode|string|null $reasonCode = AllowanceReasonCode::Discount ]) : static
Parameters
$amount : BigDecimal|int|float|string
$reason : string|null = null
$reasonCode : AllowanceReasonCode|RawCode|string|null = AllowanceReasonCode::Discount
Return values
static

discountPercent()

Percentage discount on the lines that count towards the totals, see InvoiceBuilder::discountPercent().

public discountPercent(BigDecimal|int|float|string $percent[, string|null $reason = null ][, AllowanceReasonCode|RawCode|string|null $reasonCode = AllowanceReasonCode::Discount ]) : static
Parameters
$percent : BigDecimal|int|float|string
$reason : string|null = null
$reasonCode : AllowanceReasonCode|RawCode|string|null = AllowanceReasonCode::Discount
Return values
static

dueInDays()

Payment target in days, see InvoiceBuilder::dueInDays().

public dueInDays(int $days) : static
Parameters
$days : int
Return values
static

fee()

Adds a fee of a payment reminder, e.g. a reminder fee.

public fee(string $description, BigDecimal|int|float|string $amount) : static
Parameters
$description : string
$amount : BigDecimal|int|float|string
Tags
throws
InvalidArgumentException

for a float amount

Return values
static

flushMacros()

public static flushMacros() : void

hasMacro()

public static hasMacro(string $name) : bool
Parameters
$name : string
Return values
bool

interest()

Default interest from $from (first day with interest) until $until (exclusive: the last day with interest is the day before). $dayCount null counts actual/actual (365 or 366 days per calendar year); 365 or 360 use a fixed basis, e.g. from the dayCount of the country pack's DunningLaw.

public interest(string $base, BigDecimal|string $ratePercent, Date|DateTimeInterface|string $from, Date|DateTimeInterface|string $until[, string|null $description = null ][, int|null $dayCount = InterestCharge::ACTUAL_ACTUAL ]) : static
Parameters
$base : string
$ratePercent : BigDecimal|string
$from : Date|DateTimeInterface|string
$until : Date|DateTimeInterface|string
$description : string|null = null
$dayCount : int|null = InterestCharge::ACTUAL_ACTUAL
Return values
static

interestCharge()

Adds calculated interest charges, e.g. of Dunning\DefaultInterest::calculate(), with their own day count basis and texts. The base is taken over as amount in the document currency.

public interestCharge(InterestCharge ...$charges) : static
Parameters
$charges : InterestCharge
Return values
static

issueDate()

Document date; default today.

public issueDate(Date|DateTimeInterface|string $date) : static
Parameters
$date : Date|DateTimeInterface|string
Return values
static

line()

A line in the forms of InvoiceBuilder::line(), e.g. ->line('Consulting', netPrice: '120.00').

public line(InvoiceLine|LineBuilder|ProvidesInvoiceLine|array<string|int, mixed>|callable(LineBuilder): mixed|string $line[, BigDecimal|int|float|string|null $netPrice = null ][, BigDecimal|int|float|string|null $quantity = null ][, UnitCode|RawCode|string|null $unit = null ][, TaxPreset|VatCategory|null $vat = null ][, string|null $description = null ][, BigDecimal|int|float|string|null $priceInclVat = null ][, DocumentLineOptions|null $options = null ]) : static
Parameters
$line : InvoiceLine|LineBuilder|ProvidesInvoiceLine|array<string|int, mixed>|callable(LineBuilder): mixed|string
$netPrice : BigDecimal|int|float|string|null = null
$quantity : BigDecimal|int|float|string|null = null
$unit : UnitCode|RawCode|string|null = null
$vat : TaxPreset|VatCategory|null = null
$description : string|null = null
$priceInclVat : BigDecimal|int|float|string|null = null
$options : DocumentLineOptions|null = null
Return values
static

locale()

Language of the document, see InvoiceBuilder::locale().

public locale(string $locale) : static
Parameters
$locale : string
Return values
static

macro()

public static macro(string $name, callable $macro) : void
Parameters
$name : string
$macro : callable
Tags
param-closure-this

static $macro

number()

Document number.

public number(string $number) : static
Parameters
$number : string
Return values
static

openingBalance()

Opening balance of an account statement.

public openingBalance(BigDecimal|int|float|string $amount) : static
Parameters
$amount : BigDecimal|int|float|string
Tags
throws
InvalidArgumentException

for a float amount

Return values
static

openItem()

Adds an open invoice of a payment reminder or account statement: number, date, amount (string), due date, the amount paid so far and a description.

public openItem(string $invoiceNumber, Date|DateTimeInterface|string $invoiceDate, string $amount[, Date|DateTimeInterface|string|null $dueDate = null ][, string|null $paid = null ][, string|null $description = null ]) : static
Parameters
$invoiceNumber : string
$invoiceDate : Date|DateTimeInterface|string
$amount : string
$dueDate : Date|DateTimeInterface|string|null = null
$paid : string|null = null
$description : string|null = null
Return values
static

optionalLine()

Optional quote line, shown with its price but not included in the totals.

public optionalLine(InvoiceLine|LineBuilder|array<string|int, mixed>|callable(LineBuilder): mixed|string $line[, BigDecimal|int|float|string|null $netPrice = null ][, BigDecimal|int|float|string|null $quantity = null ][, UnitCode|RawCode|string|null $unit = null ][, TaxPreset|VatCategory|null $vat = null ][, string|null $description = null ][, BigDecimal|int|float|string|null $priceInclVat = null ]) : static
Parameters
$line : InvoiceLine|LineBuilder|array<string|int, mixed>|callable(LineBuilder): mixed|string
$netPrice : BigDecimal|int|float|string|null = null
$quantity : BigDecimal|int|float|string|null = null
$unit : UnitCode|RawCode|string|null = null
$vat : TaxPreset|VatCategory|null = null
$description : string|null = null
$priceInclVat : BigDecimal|int|float|string|null = null
Return values
static

orderConfirmation()

An order confirmation (Auftragsbestätigung), e.g. with reference() to the quote.

public static orderConfirmation() : static
Return values
static

package()

Adds a package of a delivery note.

public package(Package $package) : static
Parameters
$package : Package
Return values
static

paymentReminder()

public static paymentReminder([int $level = 0 ]) : static
Parameters
$level : int = 0

0 = payment reminder (Zahlungserinnerung), 1 = first formal reminder (1. Mahnung), 2 = second …

Return values
static

proforma()

A proforma invoice: looks like an invoice, but is not one for tax purposes.

public static proforma() : static
Return values
static

purchaseOrderReference()

The buyer's purchase order reference; null removes it.

public purchaseOrderReference(string|null $reference) : static
Parameters
$reference : string|null
Return values
static

quote()

A quote (Angebot): lines, optional and alternative lines, validUntil().

public static quote() : static
Return values
static

reference()

Preceding document, e.g. the quote of an order confirmation or the order of a delivery note.

public reference(string $number[, Date|DateTimeInterface|string|null $date = null ]) : static
Parameters
$number : string
$date : Date|DateTimeInterface|string|null = null
Return values
static

serialisedLine()

Delivery note line with serial numbers.

public serialisedLine(InvoiceLine|LineBuilder|array<string|int, mixed>|callable(LineBuilder): mixed|string $line, array<int, string> $serialNumbers[, BigDecimal|int|float|string|null $netPrice = null ][, BigDecimal|int|float|string|null $quantity = null ][, UnitCode|RawCode|string|null $unit = null ][, TaxPreset|VatCategory|null $vat = null ][, string|null $description = null ][, BigDecimal|int|float|string|null $priceInclVat = null ]) : static
Parameters
$line : InvoiceLine|LineBuilder|array<string|int, mixed>|callable(LineBuilder): mixed|string
$serialNumbers : array<int, string>
$netPrice : BigDecimal|int|float|string|null = null
$quantity : BigDecimal|int|float|string|null = null
$unit : UnitCode|RawCode|string|null = null
$vat : TaxPreset|VatCategory|null = null
$description : string|null = null
$priceInclVat : BigDecimal|int|float|string|null = null
Return values
static

statementPeriod()

Period of an account statement.

public statementPeriod(Date|DateTimeInterface|string $start, Date|DateTimeInterface|string $end) : static
Parameters
$start : Date|DateTimeInterface|string
$end : Date|DateTimeInterface|string
Return values
static

tap()

Direct access to the underlying invoice builder for everything not wrapped here.

public tap(callable(InvoiceBuilder): mixed $callback) : static
Parameters
$callback : callable(InvoiceBuilder): mixed
Return values
static

validUntil()

Date until which a quote is valid.

public validUntil(Date|DateTimeInterface|string $date) : static
Parameters
$date : Date|DateTimeInterface|string
Return values
static
On this page

Search results