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>
__construct()
public
final __construct(DocumentType $type) : mixed
Parameters
- $type : DocumentType
accountStatement()
An account statement (Kontoauszug): open items of a statementPeriod() with an opening balance.
public
static accountStatement() : static
Return values
staticalternativeLine()
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
staticbuild()
The immutable document, not calculated yet (DocumentCalculator, or the render run).
public
build() : DocumentData
Tags
Return values
DocumentDatabuyer()
public
buyer(BuyerParty|PartyBuilder|ProvidesParty|callable(PartyBuilder): mixed $buyer) : static
Parameters
- $buyer : BuyerParty|PartyBuilder|ProvidesParty|callable(PartyBuilder): mixed
Return values
staticbuyerReference()
The buyer's reference; null removes it.
public
buyerReference(string|null $reference) : static
Parameters
- $reference : string|null
Return values
staticcashDiscount()
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
staticcreditTransfer()
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
staticcurrency()
Currency, ISO 4217; default EUR.
public
currency(string $currency) : static
Parameters
- $currency : string
Return values
staticcustom()
Free data for templates (view model key meta.custom).
public
custom(string $key, mixed $value) : static
Parameters
- $key : string
- $value : mixed
Return values
staticdeadline()
Payment deadline of a payment reminder.
public
deadline(Date|DateTimeInterface|string $date) : static
Parameters
- $date : Date|DateTimeInterface|string
Return values
staticdefaultVat()
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
staticdeliverTo()
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
staticdeliveryDate()
Delivery date.
public
deliveryDate(Date|DateTimeInterface|string $date) : static
Parameters
- $date : Date|DateTimeInterface|string
Return values
staticdeliveryNote()
A delivery note (Lieferschein), e.g. with packages and serialised lines.
public
static deliveryNote() : static
Return values
staticdiscountAmount()
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
staticdiscountPercent()
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
staticdueInDays()
Payment target in days, see InvoiceBuilder::dueInDays().
public
dueInDays(int $days) : static
Parameters
- $days : int
Return values
staticfee()
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
Return values
staticflushMacros()
public
static flushMacros() : void
hasMacro()
public
static hasMacro(string $name) : bool
Parameters
- $name : string
Return values
boolinterest()
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
staticinterestCharge()
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
staticissueDate()
Document date; default today.
public
issueDate(Date|DateTimeInterface|string $date) : static
Parameters
- $date : Date|DateTimeInterface|string
Return values
staticline()
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
staticlines()
public
lines(iterable<string|int, InvoiceLine|LineBuilder|ProvidesInvoiceLine|array<string|int, mixed>|callable(LineBuilder): mixed|string> $lines) : static
Parameters
- $lines : iterable<string|int, InvoiceLine|LineBuilder|ProvidesInvoiceLine|array<string|int, mixed>|callable(LineBuilder): mixed|string>
Return values
staticlocale()
Language of the document, see InvoiceBuilder::locale().
public
locale(string $locale) : static
Parameters
- $locale : string
Return values
staticmacro()
public
static macro(string $name, callable $macro) : void
Parameters
- $name : string
- $macro : callable
Tags
make()
A new builder for a document of $type.
public
static make(DocumentType $type) : static
Parameters
- $type : DocumentType
Return values
staticnote()
Adds a note with an optional subject code, see InvoiceBuilder::note().
public
note(string $content[, NoteSubjectCode|RawCode|string|null $subject = null ]) : static
Parameters
- $content : string
- $subject : NoteSubjectCode|RawCode|string|null = null
Return values
staticnumber()
Document number.
public
number(string $number) : static
Parameters
- $number : string
Return values
staticopeningBalance()
Opening balance of an account statement.
public
openingBalance(BigDecimal|int|float|string $amount) : static
Parameters
- $amount : BigDecimal|int|float|string
Tags
Return values
staticopenItem()
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
staticoptionalLine()
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
staticorderConfirmation()
An order confirmation (Auftragsbestätigung), e.g. with reference() to the quote.
public
static orderConfirmation() : static
Return values
staticpackage()
Adds a package of a delivery note.
public
package(Package $package) : static
Parameters
- $package : Package
Return values
staticpaymentReminder()
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
staticpaymentTerms()
public
paymentTerms(PaymentTerms|string|callable(PaymentTermsBuilder): mixed $terms) : static
Parameters
- $terms : PaymentTerms|string|callable(PaymentTermsBuilder): mixed
Return values
staticpresentation()
Design of this document, see InvoiceBuilder::presentation().
public
presentation(Presentation|array<string, mixed>|callable(Presentation): Presentation $presentation) : static
Parameters
- $presentation : Presentation|array<string, mixed>|callable(Presentation): Presentation
Return values
staticproforma()
A proforma invoice: looks like an invoice, but is not one for tax purposes.
public
static proforma() : static
Return values
staticpurchaseOrderReference()
The buyer's purchase order reference; null removes it.
public
purchaseOrderReference(string|null $reference) : static
Parameters
- $reference : string|null
Return values
staticquote()
A quote (Angebot): lines, optional and alternative lines, validUntil().
public
static quote() : static
Return values
staticreference()
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
staticseller()
public
seller(SellerParty|PartyBuilder|ProvidesParty|callable(PartyBuilder): mixed $seller) : static
Parameters
- $seller : SellerParty|PartyBuilder|ProvidesParty|callable(PartyBuilder): mixed
Return values
staticserialisedLine()
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
staticstatementPeriod()
Period of an account statement.
public
statementPeriod(Date|DateTimeInterface|string $start, Date|DateTimeInterface|string $end) : static
Parameters
Return values
statictap()
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
staticvalidUntil()
Date until which a quote is valid.
public
validUntil(Date|DateTimeInterface|string $date) : static
Parameters
- $date : Date|DateTimeInterface|string