API reference / Quittio \ Laravel \ Builder
RenderableInvoiceBuilder
final class in quittio/laravel · extends InvoiceBuilder
Quittio\Laravel\Builder\RenderableInvoiceBuilder · Source
The invoice builder of Quittio::invoice(): renders (or checks) itself at the end of the chain.
Properties#
| Property | Type | Description |
|---|---|---|
$macros protected static | array<string, callable> | from InvoiceBuilder |
Methods#
| Method | Description |
|---|---|
->__construct() | |
->__call() | |
->addPrepaid() | Adds to the amount already paid (BT-113), e.g. one of several advance payments. |
->allowance() | Document level allowance (BG-20) for one VAT category and rate. |
->applyDefaults() | Applies the defaults of a seller, e.g. the seller of config/quittio.php with its bank account and small business flag (Quittio::invoice()) or a Managed issuer. The builder remembers what they set: seller() with another seller removes it again. |
->attachment() | Supporting document (BG-24), either embedded ($content) or as external link. |
->build() | The invoice data, not calculated yet (the calculator or a render run adds the totals). |
->buildDraft() | Builds without requiring lines, e.g. for payment reminders or account statements, or for drafts. Data without lines can be calculated (its line sum is zero; document allowances and charges still count), but it is not a valid invoice: EN 16931 requires at least one line (BR-16), so validation reports it. |
->businessProcess() | Business process identifier (BT-23); Peppol and XRechnung write their process when it is not set. null removes it. |
->buyer() | The buyer (BG-7): a BuyerParty, a PartyBuilder (Party::make()) or an application model (ProvidesParty), e.g. ->buyer($customer), replace the buyer set before; a callable receives the builder of the buyer set before and changes it. |
->buyerAccountingReference() | The buyer's accounting reference (BT-19), e.g. a cost centre; null removes it. |
->buyerReference() | Buyer reference (BT-10). For public sector buyers in Germany this is the Leitweg-ID. |
->cashDiscount() | Cash discount ("Skonto") of $percent for payment within $days days after the issue date, optionally on a base amount; repeatable for several tiers. Continues the payment terms. |
->charge() | Document level charge (BG-21) for one VAT category and rate. See allowance() for the exemption reason. |
->check() | Validates the invoice like render() would, including the XML, without rendering a PDF; returns the result and does not throw for invalid data. |
->contractReference() | Contract reference (BT-12); null removes it. |
->creditTransfer() | Adds a further bank account (BG-17). |
->currency() | Invoice currency (BT-5), ISO 4217; stored in upper case. Default EUR. |
->custom() | Free data for templates (view model key meta.custom); the same key replaces the value. |
->defaultVat() | VAT treatment of the lines that set none (also sub lines), with the arguments of LineBuilder::vat(). Without it, the application default of useDefaultVat() applies. |
->deliverTo() | Deliver-to party and address (BT-70, BG-15). |
->delivery() | Replaces the whole delivery information (BG-13), including the delivery date (BT-72). |
->deliveryDate() | Actual delivery or service date (BT-72). |
->despatchAdviceReference() | Despatch advice reference (BT-16); null removes it. |
->directDebit() | SEPA direct debit (BG-19): mandate reference (BT-89), creditor identifier (BT-90) and the debited IBAN (BT-91, spaces removed). Without payment instructions it starts them with SepaDirectDebit (59). |
->discountAmount() | Absolute discount distributed over all VAT groups in proportion to their line totals. |
->discountPercent() | Percentage discount on all lines. Split into one allowance per VAT group. |
->dueDate() | Due date (BT-9). Without it the calculator derives it from dueInDays(); otherwise the configured due_days apply when rendering, never for credit notes. |
->dueInDays() | Payment target: the due date (BT-9) is the issue date plus $days unless dueDate() is set, and the payment terms say "Payable within … days without deduction." Continues the payment terms set before. |
->exchangeRate() | Exchange rate from the invoice currency to the VAT accounting currency (BT-6), used to calculate the VAT total in that currency (BT-111), with the date of the rate. Replaces a rate implied by declared amounts (see from()). |
->extended() | Data of the profile EXTENDED of ZUGFeRD/Factur-X (further parties, delivery terms, instalments …); other profiles do not write it. |
->flag() | Sets a flag that country packs evaluate (e.g. a small amount invoice in Germany). |
::flushMacros() | |
::from() | Starts a builder from existing data, e.g. to change a draft. |
::fromDocument() | Starts an invoice from a quote, order confirmation, delivery note or proforma invoice: parties, billable lines, document allowances and charges and payment data are taken over; number and issue date must be set. |
::fromUsing() | Like from(), with the calculator that decides whether the declared amounts of the data differ from a recalculation, e.g. the calculator of the Quittio instance. |
->group() | Defines a line group for the PDF. Lines join it via LineBuilder::group(). |
::hasMacro() | |
->invoicedObject() | Identifier of the invoiced object (BT-18), e.g. a meter or subscription number, with its scheme (BT-18-1). |
->invoicingPeriod() | Invoicing period (BG-14). |
->issueDate() | Issue date (BT-2); default today. A DateTimeInterface is converted in the time zone of timezone(), so call timezone() first. |
->lateFee() | Late payment terms: days, percentage and text. Continues the payment terms. |
->line() | Adds a line (BG-25): a name with the common values (->line('Consulting', netPrice: '120.00', quantity: 4, unit: UnitCode::Hour)), a LineBuilder (Line::make()), an array with the keys of LineBuilder::ARRAY_KEYS, an application model (ProvidesInvoiceLine), a callable that receives a new LineBuilder, or a finished InvoiceLine. |
->lines() | |
->locale() | Language of the invoice: labels, generated texts and the exemption texts of presets. The locale of a render call wins; without both, the configured locale or the country default. |
::macro() | |
::make() | A new, empty builder; type code 380 and the issue date today unless set. |
->note() | Adds an invoice note (BG-1): the text (BT-22) and an optional subject code (BT-21, UNTDID 4451, e.g. "REG" for regulatory information). Unknown codes are kept as RawCode. |
->number() | Invoice number (BT-1). Not checked here; the validation requires it. |
->payee() | Payee (BG-10), if different from the seller (e.g. a factoring company): the name with the identifier (BT-60) and the legal registration identifier (BT-61) and their schemes, a PartyBuilder (Party::make('Factoring AG')->identifier(…)), a PayeeParty, or a callable that receives a PartyBuilder and, like seller() and buyer(), continues an earlier payee. |
->payment() | Payment instructions (BG-16) with an optional credit transfer account (BG-17). |
->paymentCard() | Payment card (BG-18): the last 4 to 6 digits of the card number (BT-87) and the holder (BT-88). Without payment instructions it starts them with BankCard (48). |
->paymentTerms() | Payment terms (BT-20): a PaymentTerms object or a text replace earlier terms; a callable receives a PaymentTermsBuilder that continues the earlier terms, also those of a PaymentTerms object or of from(), like seller() and buyer(). |
->precedingInvoice() | Adds a reference to a preceding invoice (BG-3): its number (BT-25) and issue date (BT-26), e.g. for a corrected invoice or a credit note. |
->prepaid() | Amount already paid (BT-113), e.g. received advance payments. |
->presentation() | Design of this invoice in PDF and HTML: a Presentation replaces it, an array changes single values (->presentation(['introText' => 'Thank you for your order.', 'showGrossPrices' => true])), a callable receives the current Presentation and returns the new one. |
->projectReference() | Project reference (BT-11) with the project name, which CII requires in addition to the identifier. |
->purchaseOrderReference() | The buyer's purchase order reference (BT-13); null removes it. |
->receivingAdviceReference() | Receiving advice reference (BT-15); null removes it. |
->removeLine() | Removes an existing line by its identifier (BT-126). |
->render() | Builds and renders the invoice: without $format in the configured or automatically chosen format, otherwise in the given format, or formats (the first is the main result). For further options use Quittio::make($builder). |
->rounding() | Rounding amount (BT-114), e.g. cash rounding. Never use it to fix wrong totals. |
->salesOrderReference() | The seller's sales order reference (BT-14); null removes it. |
->seller() | The seller (BG-4). |
->source() | Origin of the data, e.g. "shop" (view model key meta.source). |
->standard() | Version of EN 16931 (BT-24 of the profile): 2017 (default) or 2026, which only the profile EN 16931 supports. |
->taxCurrency() | VAT accounting currency (BT-6). With an exchange rate, BT-111 is calculated. |
->taxPointDate() | Date when VAT becomes chargeable (BT-7), if it differs from the issue date. EN 16931 allows BT-7 or BT-8, not both (BR-CO-03). |
->taxPointDateCode() | Code of the date when VAT becomes chargeable (BT-8): issue, delivery or payment date. EN 16931 allows BT-7 or BT-8, not both (BR-CO-03). |
->taxRepresentative() | The seller's tax representative (BG-11): name (BT-62), VAT identifier (BT-63) and postal address (BG-12). |
->tenderReference() | Tender or lot reference (BT-17); null removes it. |
->timezone() | Time zone for DateTimeInterface values and for the default issue date; call it before the date setters. |
->type() | Type code (BT-3) from UNTDID 1001, e.g. 381 for a credit note; default 380. Unknown codes are kept as RawCode and reported by the validation. |
->updateLine() | Changes an existing line, e.g. of a correction draft started with {@see self::from()}: with the named values ->updateLine('2', netPrice: '80.00', quantity: 3), or with a callable that receives the InvoiceLine and returns the changed one, e.g. ->updateLine('2', fn (InvoiceLine $l) => $l->with(['note' => 'Delivered in two parts'])). The calculated line net amount is reset, and percentage allowances and charges on the line amount are recalculated from the new amount. |
::useDefaultVat() | Application default VAT of lines that set none, for invoices without defaultVat(): a preset, or a callable that receives the seller's country code and whether the invoice is flagged as small business invoice (Meta::FLAG_SMALL_BUSINESS) and returns a preset or null, e.g. Quittio\Core\Tax\CountryDefaultVat. The Laravel integration sets it from quittio.defaults.vat; null removes it. Lines without VAT and without a default make build() fail (BG-30). |
->xrechnungExtension() | Data of the XRechnung extension (e.g. third party payments), written only with the profile xrechnung-extension. |
__construct()#
final public function __construct()__call()#
public function __call(string $method, array<mixed> $parameters): mixed| Parameter | Type | Description |
|---|---|---|
$method | string | |
$parameters | array<mixed> |
- Returns
mixed
addPrepaid()#
public function addPrepaid(BigDecimal|int|float|string $amount): staticAdds to the amount already paid (BT-113), e.g. one of several advance payments.
| Parameter | Type | Description |
|---|---|---|
$amount | Brick\Math\BigDecimal|int|float|string |
- Returns
static
allowance()#
public function allowance(
VatCategory $category,
BigDecimal|int|float|string|null $rate,
?string $amount = null,
?string $percent = null,
?string $reason = null,
AllowanceReasonCode|RawCode|string|null $reasonCode = null,
?string $baseAmount = null,
?string $exemptionReason = null,
VatExemptionReasonCode|RawCode|string|null $exemptionReasonCode = null,
): staticDocument level allowance (BG-20) for one VAT category and rate.
The exemption reason (BT-120/BT-121) is used for the VAT breakdown when no invoice line of the same VAT group provides one, e.g. an exempt charge on a standard rated invoice.
| Parameter | Type | Description |
|---|---|---|
$category | VatCategory | |
$rate | Brick\Math\BigDecimal|int|float|string|null | |
$amount | ?string = null | |
$percent | ?string = null | |
$reason | ?string = null | |
$reasonCode | AllowanceReasonCode|RawCode|string|null = null | |
$baseAmount | ?string = null | |
$exemptionReason | ?string = null | |
$exemptionReasonCode | VatExemptionReasonCode|RawCode|string|null = null |
- Returns
static
applyDefaults()#
public function applyDefaults(callable $apply): staticApplies the defaults of a seller, e.g. the seller of config/quittio.php with its bank account and small business flag (Quittio::invoice()) or a Managed issuer. The builder remembers what they set: seller() with another seller removes it again.
| Parameter | Type | Description |
|---|---|---|
$apply | callable |
- Returns
static
attachment()#
public function attachment(
string $id,
?string $content = null,
MimeType|string|null $mimeType = null,
?string $filename = null,
?string $description = null,
?string $externalUri = null,
): staticSupporting document (BG-24), either embedded ($content) or as external link.
| Parameter | Type | Description |
|---|---|---|
$id | string | |
$content | ?string = null | |
$mimeType | MimeType|string|null = null | |
$filename | ?string = null | |
$description | ?string = null | |
$externalUri | ?string = null |
- Returns
static
build()#
public function build(): InvoiceDataThe invoice data, not calculated yet (the calculator or a render run adds the totals).
- Returns
InvoiceData- Throws
InvalidInvoiceData– when seller (BG-4), buyer (BG-7), the lines (BG-25), an item name (BT-153) or the VAT of a line without default VAT (BG-30) is missing, or a line identifier is used twice
buildDraft()#
public function buildDraft(): InvoiceDataBuilds without requiring lines, e.g. for payment reminders or account statements, or for drafts. Data without lines can be calculated (its line sum is zero; document allowances and charges still count), but it is not a valid invoice: EN 16931 requires at least one line (BR-16), so validation reports it.
- Returns
InvoiceData
businessProcess()#
public function businessProcess(?string $process): staticBusiness process identifier (BT-23); Peppol and XRechnung write their process when it is not set. null removes it.
| Parameter | Type | Description |
|---|---|---|
$process | ?string |
- Returns
static
buyer()#
public function buyer(BuyerParty|PartyBuilder|ProvidesParty|callable $buyer): staticThe buyer (BG-7): a BuyerParty, a PartyBuilder (Party::make()) or an application model (ProvidesParty), e.g. ->buyer($customer), replace the buyer set before; a callable receives the builder of the buyer set before and changes it.
| Parameter | Type | Description |
|---|---|---|
$buyer | BuyerParty|PartyBuilder|ProvidesParty|callable |
- Returns
static
buyerAccountingReference()#
public function buyerAccountingReference(?string $reference): staticThe buyer's accounting reference (BT-19), e.g. a cost centre; null removes it.
| Parameter | Type | Description |
|---|---|---|
$reference | ?string |
- Returns
static
buyerReference()#
public function buyerReference(?string $reference): staticBuyer reference (BT-10). For public sector buyers in Germany this is the Leitweg-ID.
| Parameter | Type | Description |
|---|---|---|
$reference | ?string |
- Returns
static
cashDiscount()#
public function cashDiscount(
int $days,
string $percent,
?string $baseAmount = null,
): staticCash discount ("Skonto") of $percent for payment within $days days after the issue date, optionally on a base amount; repeatable for several tiers. Continues the payment terms.
| Parameter | Type | Description |
|---|---|---|
$days | int | |
$percent | string | |
$baseAmount | ?string = null |
- Returns
static
charge()#
public function charge(
VatCategory $category,
BigDecimal|int|float|string|null $rate,
?string $amount = null,
?string $percent = null,
?string $reason = null,
ChargeReasonCode|RawCode|string|null $reasonCode = null,
?string $baseAmount = null,
?string $exemptionReason = null,
VatExemptionReasonCode|RawCode|string|null $exemptionReasonCode = null,
): staticDocument level charge (BG-21) for one VAT category and rate. See allowance() for the exemption reason.
| Parameter | Type | Description |
|---|---|---|
$category | VatCategory | |
$rate | Brick\Math\BigDecimal|int|float|string|null | |
$amount | ?string = null | |
$percent | ?string = null | |
$reason | ?string = null | |
$reasonCode | ChargeReasonCode|RawCode|string|null = null | |
$baseAmount | ?string = null | |
$exemptionReason | ?string = null | |
$exemptionReasonCode | VatExemptionReasonCode|RawCode|string|null = null |
- Returns
static
check()#
public function check(string|list<string>|null $format = null): ValidationResultValidates the invoice like render() would, including the XML, without rendering a PDF; returns the result and does not throw for invalid data.
| Parameter | Type | Description |
|---|---|---|
$format | string|list<string>|null = null |
- Returns
ValidationResult
contractReference()#
public function contractReference(?string $reference): staticContract reference (BT-12); null removes it.
| Parameter | Type | Description |
|---|---|---|
$reference | ?string |
- Returns
static
creditTransfer()#
public function creditTransfer(
string $accountId,
?string $bic = null,
?string $accountName = null,
): staticAdds a further bank account (BG-17).
| Parameter | Type | Description |
|---|---|---|
$accountId | string | |
$bic | ?string = null | |
$accountName | ?string = null |
- Returns
static
currency()#
public function currency(string $currency): staticInvoice currency (BT-5), ISO 4217; stored in upper case. Default EUR.
| Parameter | Type | Description |
|---|---|---|
$currency | string |
- Returns
static
custom()#
public function custom(string $key, mixed $value): staticFree data for templates (view model key meta.custom); the same key replaces the value.
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$value | mixed |
- Returns
static
defaultVat()#
public function defaultVat(
TaxPreset|VatCategory $presetOrCategory,
BigDecimal|int|float|string|null $rate = null,
?string $exemptionReason = null,
VatExemptionReasonCode|RawCode|string|null $exemptionReasonCode = null,
): staticVAT treatment of the lines that set none (also sub lines), with the arguments of LineBuilder::vat(). Without it, the application default of useDefaultVat() applies.
| Parameter | Type | Description |
|---|---|---|
$presetOrCategory | TaxPreset|VatCategory | |
$rate | Brick\Math\BigDecimal|int|float|string|null = null | |
$exemptionReason | ?string = null | |
$exemptionReasonCode | VatExemptionReasonCode|RawCode|string|null = null |
- Returns
static
deliverTo()#
public function deliverTo(
?string $recipientName,
?Address $address = null,
?Identifier $locationId = null,
): staticDeliver-to party and address (BT-70, BG-15).
| Parameter | Type | Description |
|---|---|---|
$recipientName | ?string | |
$address | ?Address = null | |
$locationId | ?Identifier = null |
- Returns
static
delivery()#
public function delivery(Delivery $delivery): staticReplaces the whole delivery information (BG-13), including the delivery date (BT-72).
| Parameter | Type | Description |
|---|---|---|
$delivery | Delivery |
- Returns
static
deliveryDate()#
public function deliveryDate(Date|DateTimeInterface|string $date): staticActual delivery or service date (BT-72).
| Parameter | Type | Description |
|---|---|---|
$date | Date|DateTimeInterface|string |
- Returns
static
despatchAdviceReference()#
public function despatchAdviceReference(?string $reference): staticDespatch advice reference (BT-16); null removes it.
| Parameter | Type | Description |
|---|---|---|
$reference | ?string |
- Returns
static
directDebit()#
public function directDebit(
?string $mandateReference,
?string $creditorId = null,
?string $debitedIban = null,
): staticSEPA direct debit (BG-19): mandate reference (BT-89), creditor identifier (BT-90) and the debited IBAN (BT-91, spaces removed). Without payment instructions it starts them with SepaDirectDebit (59).
| Parameter | Type | Description |
|---|---|---|
$mandateReference | ?string | |
$creditorId | ?string = null | |
$debitedIban | ?string = null |
- Returns
static
discountAmount()#
public function discountAmount(
BigDecimal|int|float|string $amount,
?string $reason = null,
AllowanceReasonCode|RawCode|string|null $reasonCode = \Quittio\Core\Enums\AllowanceReasonCode::Discount,
): staticAbsolute discount distributed over all VAT groups in proportion to their line totals.
| Parameter | Type | Description |
|---|---|---|
$amount | Brick\Math\BigDecimal|int|float|string | |
$reason | ?string = null | |
$reasonCode | AllowanceReasonCode|RawCode|string|null = \Quittio\Core\Enums\AllowanceReasonCode::Discount |
- Returns
static
discountPercent()#
public function discountPercent(
BigDecimal|int|float|string $percent,
?string $reason = null,
AllowanceReasonCode|RawCode|string|null $reasonCode = \Quittio\Core\Enums\AllowanceReasonCode::Discount,
): staticPercentage discount on all lines. Split into one allowance per VAT group.
| Parameter | Type | Description |
|---|---|---|
$percent | Brick\Math\BigDecimal|int|float|string | |
$reason | ?string = null | |
$reasonCode | AllowanceReasonCode|RawCode|string|null = \Quittio\Core\Enums\AllowanceReasonCode::Discount |
- Returns
static
dueDate()#
public function dueDate(Date|DateTimeInterface|string $date): staticDue date (BT-9). Without it the calculator derives it from dueInDays(); otherwise the configured due_days apply when rendering, never for credit notes.
| Parameter | Type | Description |
|---|---|---|
$date | Date|DateTimeInterface|string |
- Returns
static
dueInDays()#
public function dueInDays(int $days): staticPayment target: the due date (BT-9) is the issue date plus $days unless dueDate() is set, and the payment terms say "Payable within … days without deduction." Continues the payment terms set before.
| Parameter | Type | Description |
|---|---|---|
$days | int |
- Returns
static
exchangeRate()#
public function exchangeRate(
BigDecimal|int|float|string $rate,
Date|DateTimeInterface|string|null $date = null,
): staticExchange rate from the invoice currency to the VAT accounting currency (BT-6), used to calculate the VAT total in that currency (BT-111), with the date of the rate. Replaces a rate implied by declared amounts (see from()).
| Parameter | Type | Description |
|---|---|---|
$rate | Brick\Math\BigDecimal|int|float|string | |
$date | Date|DateTimeInterface|string|null = null |
- Returns
static- Throws
InvalidArgumentException– for a float
extended()#
public function extended(ExtendedData $extended): staticData of the profile EXTENDED of ZUGFeRD/Factur-X (further parties, delivery terms, instalments …); other profiles do not write it.
| Parameter | Type | Description |
|---|---|---|
$extended | ExtendedData |
- Returns
static
flag()#
public function flag(string $flag, bool $enabled = true): staticSets a flag that country packs evaluate (e.g. a small amount invoice in Germany).
| Parameter | Type | Description |
|---|---|---|
$flag | string | |
$enabled | bool = true |
- Returns
static
flushMacros()#
public static function flushMacros(): voidfrom()#
public static function from(InvoiceData $data): staticStarts a builder from existing data, e.g. to change a draft.
For data with a declared VAT total in accounting currency (BT-111) but without exchange rate (e.g. read from XML) the implied rate is taken over, so that BT-111 is recalculated. Once lines, allowances, charges or the VAT accounting currency (BT-6) change, the implied rate is dropped: it is only as precise as the declared amounts and holds only for the declared currency, so set the rate with exchangeRate() (BR-53 otherwise). Percentage document allowances and charges on the line sum of their VAT group, and discounts split over the VAT groups (discountAmount(), discountPercent()), follow the lines when lines are added, changed or removed.
As long as nothing amount-relevant changes, declared line net amounts and the VAT breakdown that the recalculation does not reproduce (e.g. rounded per line by another system) are kept by the calculator (Meta::FLAG_DECLARED_AMOUNTS with a fingerprint of the amount inputs). Data flagged earlier whose amount inputs no longer match its fingerprint (e.g. changed with with() or in stored JSON) is treated as changed lines and recalculated.
The declared amounts are compared with the result of the default En16931Calculator; use fromUsing() or Quittio::edit() to compare with another calculator.
| Parameter | Type | Description |
|---|---|---|
$data | InvoiceData |
- Returns
static
fromDocument()#
public static function fromDocument(DocumentData $document): staticStarts an invoice from a quote, order confirmation, delivery note or proforma invoice: parties, billable lines, document allowances and charges and payment data are taken over; number and issue date must be set.
| Parameter | Type | Description |
|---|---|---|
$document | DocumentData |
- Returns
static
fromUsing()#
public static function fromUsing(InvoiceData $data, TotalsCalculator $calculator): staticLike from(), with the calculator that decides whether the declared amounts of the data differ from a recalculation, e.g. the calculator of the Quittio instance.
| Parameter | Type | Description |
|---|---|---|
$data | InvoiceData | |
$calculator | TotalsCalculator |
- Returns
static
group()#
public function group(string $id, string $title, bool $showSubtotal = true): staticDefines a line group for the PDF. Lines join it via LineBuilder::group().
| Parameter | Type | Description |
|---|---|---|
$id | string | |
$title | string | |
$showSubtotal | bool = true |
- Returns
static
hasMacro()#
public static function hasMacro(string $name): bool| Parameter | Type | Description |
|---|---|---|
$name | string |
- Returns
bool
invoicedObject()#
public function invoicedObject(string $value, string|RawCode|null $scheme = null): staticIdentifier of the invoiced object (BT-18), e.g. a meter or subscription number, with its scheme (BT-18-1).
| Parameter | Type | Description |
|---|---|---|
$value | string | |
$scheme | string|RawCode|null = null |
- Returns
static
invoicingPeriod()#
public function invoicingPeriod(
Date|string|null $start,
Date|string|null $end = null,
): staticInvoicing period (BG-14).
| Parameter | Type | Description |
|---|---|---|
$start | Date|string|null | |
$end | Date|string|null = null |
- Returns
static
issueDate()#
public function issueDate(Date|DateTimeInterface|string $date): staticIssue date (BT-2); default today. A DateTimeInterface is converted in the time zone of timezone(), so call timezone() first.
| Parameter | Type | Description |
|---|---|---|
$date | Date|DateTimeInterface|string |
- Returns
static
lateFee()#
public function lateFee(
?int $days = null,
?string $percent = null,
?string $text = null,
): staticLate payment terms: days, percentage and text. Continues the payment terms.
| Parameter | Type | Description |
|---|---|---|
$days | ?int = null | |
$percent | ?string = null | |
$text | ?string = null |
- Returns
static
line()#
public function line(
InvoiceLine|LineBuilder|ProvidesInvoiceLine|array|callable|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 $description = null,
BigDecimal|int|float|string|null $priceInclVat = null,
): staticAdds a line (BG-25): a name with the common values (->line('Consulting', netPrice: '120.00', quantity: 4, unit: UnitCode::Hour)), a LineBuilder (Line::make()), an array with the keys of LineBuilder::ARRAY_KEYS, an application model (ProvidesInvoiceLine), a callable that receives a new LineBuilder, or a finished InvoiceLine.
| Parameter | Type | Description |
|---|---|---|
$line | InvoiceLine|LineBuilder|ProvidesInvoiceLine|array|callable|string | |
$netPrice | Brick\Math\BigDecimal|int|float|string|null = null | |
$quantity | Brick\Math\BigDecimal|int|float|string|null = null | |
$unit | UnitCode|RawCode|string|null = null | |
$vat | TaxPreset|VatCategory|null = null | |
$description | ?string = null | |
$priceInclVat | Brick\Math\BigDecimal|int|float|string|null = null |
- Returns
static
lines()#
public function lines(
iterable<InvoiceLine|LineBuilder|ProvidesInvoiceLine|array<array-key, mixed>|callable(LineBuilder): mixed|string> $lines,
): static| Parameter | Type | Description |
|---|---|---|
$lines | iterable<InvoiceLine|LineBuilder|ProvidesInvoiceLine|array<array-key, mixed>|callable(LineBuilder): mixed|string> |
- Returns
static
locale()#
public function locale(string $locale): staticLanguage of the invoice: labels, generated texts and the exemption texts of presets. The locale of a render call wins; without both, the configured locale or the country default.
| Parameter | Type | Description |
|---|---|---|
$locale | string |
- Returns
static
macro()#
public static function macro(string $name, callable $macro): void| Parameter | Type | Description |
|---|---|---|
$name | string | |
$macro | callable |
make()#
public static function make(): staticA new, empty builder; type code 380 and the issue date today unless set.
- Returns
static
note()#
public function note(
string $content,
NoteSubjectCode|RawCode|string|null $subject = null,
): staticAdds an invoice note (BG-1): the text (BT-22) and an optional subject code (BT-21, UNTDID 4451, e.g. "REG" for regulatory information). Unknown codes are kept as RawCode.
| Parameter | Type | Description |
|---|---|---|
$content | string | |
$subject | NoteSubjectCode|RawCode|string|null = null |
- Returns
static
number()#
public function number(string $number): staticInvoice number (BT-1). Not checked here; the validation requires it.
| Parameter | Type | Description |
|---|---|---|
$number | string |
- Returns
static
payee()#
public function payee(
PayeeParty|PartyBuilder|string|callable $payee,
?string $identifier = null,
?string $legalRegistration = null,
IdentifierScheme|RawCode|string|null $identifierScheme = null,
IdentifierScheme|RawCode|string|null $legalRegistrationScheme = null,
): staticPayee (BG-10), if different from the seller (e.g. a factoring company): the name with the identifier (BT-60) and the legal registration identifier (BT-61) and their schemes, a PartyBuilder (Party::make('Factoring AG')->identifier(…)), a PayeeParty, or a callable that receives a PartyBuilder and, like seller() and buyer(), continues an earlier payee.
| Parameter | Type | Description |
|---|---|---|
$payee | PayeeParty|PartyBuilder|string|callable | |
$identifier | ?string = null | |
$legalRegistration | ?string = null | |
$identifierScheme | IdentifierScheme|RawCode|string|null = null | |
$legalRegistrationScheme | IdentifierScheme|RawCode|string|null = null |
- Returns
static- Throws
InvalidArgumentException– for identifiers or schemes next to a PayeeParty or a callable
payment()#
public function payment(
PaymentMeansCode|RawCode|string $means,
?string $iban = null,
?string $bic = null,
?string $accountName = null,
?string $remittanceInformation = null,
?string $meansText = null,
): staticPayment instructions (BG-16) with an optional credit transfer account (BG-17).
A second call replaces the payment instructions: an account given here replaces the accounts, and data of other payment means is dropped (e.g. bank accounts when switching to direct debit). Without an account, existing accounts are kept for credit transfers (e.g. a seller default account); likewise card (BG-18) and direct debit (BG-19) data for card payments and direct debits. The remittance information (BT-83) is kept unless a new one is given. Further accounts are added with creditTransfer().
| Parameter | Type | Description |
|---|---|---|
$means | PaymentMeansCode|RawCode|string | |
$iban | ?string = null | |
$bic | ?string = null | |
$accountName | ?string = null | |
$remittanceInformation | ?string = null | |
$meansText | ?string = null |
- Returns
static
paymentCard()#
public function paymentCard(string $lastDigits, ?string $holderName = null): staticPayment card (BG-18): the last 4 to 6 digits of the card number (BT-87) and the holder (BT-88). Without payment instructions it starts them with BankCard (48).
| Parameter | Type | Description |
|---|---|---|
$lastDigits | string | |
$holderName | ?string = null |
- Returns
static- Throws
InvalidArgumentException– for more or fewer digits
paymentTerms()#
public function paymentTerms(PaymentTerms|string|callable $terms): staticPayment terms (BT-20): a PaymentTerms object or a text replace earlier terms; a callable receives a PaymentTermsBuilder that continues the earlier terms, also those of a PaymentTerms object or of from(), like seller() and buyer().
| Parameter | Type | Description |
|---|---|---|
$terms | PaymentTerms|string|callable |
- Returns
static
precedingInvoice()#
public function precedingInvoice(
string $number,
Date|DateTimeInterface|string|null $issueDate = null,
): staticAdds a reference to a preceding invoice (BG-3): its number (BT-25) and issue date (BT-26), e.g. for a corrected invoice or a credit note.
| Parameter | Type | Description |
|---|---|---|
$number | string | |
$issueDate | Date|DateTimeInterface|string|null = null |
- Returns
static
prepaid()#
public function prepaid(BigDecimal|int|float|string $amount): staticAmount already paid (BT-113), e.g. received advance payments.
| Parameter | Type | Description |
|---|---|---|
$amount | Brick\Math\BigDecimal|int|float|string |
- Returns
static
presentation()#
public function presentation(Presentation|array|callable $presentation): staticDesign of this invoice in PDF and HTML: a Presentation replaces it, an array changes single values (->presentation(['introText' => 'Thank you for your order.', 'showGrossPrices' => true])), a callable receives the current Presentation and returns the new one.
| Parameter | Type | Description |
|---|---|---|
$presentation | Presentation|array|callable |
- Returns
static
projectReference()#
public function projectReference(string $id, ?string $name = null): staticProject reference (BT-11) with the project name, which CII requires in addition to the identifier.
| Parameter | Type | Description |
|---|---|---|
$id | string | |
$name | ?string = null |
- Returns
static
purchaseOrderReference()#
public function purchaseOrderReference(?string $reference): staticThe buyer's purchase order reference (BT-13); null removes it.
| Parameter | Type | Description |
|---|---|---|
$reference | ?string |
- Returns
static
receivingAdviceReference()#
public function receivingAdviceReference(?string $reference): staticReceiving advice reference (BT-15); null removes it.
| Parameter | Type | Description |
|---|---|---|
$reference | ?string |
- Returns
static
removeLine()#
public function removeLine(string $id): staticRemoves an existing line by its identifier (BT-126).
| Parameter | Type | Description |
|---|---|---|
$id | string |
- Returns
static
render()#
public function render(string|list<string>|null $format = null): RenderedInvoiceBuilds and renders the invoice: without $format in the configured or automatically chosen format, otherwise in the given format, or formats (the first is the main result). For further options use Quittio::make($builder).
| Parameter | Type | Description |
|---|---|---|
$format | string|list<string>|null = null |
- Returns
RenderedInvoice
rounding()#
public function rounding(BigDecimal|int|float|string $amount): staticRounding amount (BT-114), e.g. cash rounding. Never use it to fix wrong totals.
| Parameter | Type | Description |
|---|---|---|
$amount | Brick\Math\BigDecimal|int|float|string |
- Returns
static
salesOrderReference()#
public function salesOrderReference(?string $reference): staticThe seller's sales order reference (BT-14); null removes it.
| Parameter | Type | Description |
|---|---|---|
$reference | ?string |
- Returns
static
seller()#
public function seller(SellerParty|PartyBuilder|ProvidesParty|callable $seller): staticThe seller (BG-4).
A SellerParty, a PartyBuilder (Party::make()) or an application model (ProvidesParty) replaces the seller set before. If the builder was started with the defaults of a seller (applyDefaults(), e.g. Quittio::invoice() with the seller of config/quittio.php or the current Managed issuer), another seller gets nothing of them: everything they set is removed again, i.e. the bank account and the small business flag, for a Managed issuer also payment terms, presentation, locale, time zone and currency. Values the caller set on the builder stay, also when they were set before seller().
A callable receives the builder of the seller set before and changes it, e.g. ->seller(fn ($s) => $s->contact('Max Muster')); the seller stays the same, and so do its defaults.
| Parameter | Type | Description |
|---|---|---|
$seller | SellerParty|PartyBuilder|ProvidesParty|callable |
- Returns
static
source()#
public function source(string $source): staticOrigin of the data, e.g. "shop" (view model key meta.source).
| Parameter | Type | Description |
|---|---|---|
$source | string |
- Returns
static
standard()#
public function standard(StandardVersion $version): staticVersion of EN 16931 (BT-24 of the profile): 2017 (default) or 2026, which only the profile EN 16931 supports.
| Parameter | Type | Description |
|---|---|---|
$version | StandardVersion |
- Returns
static
taxCurrency()#
public function taxCurrency(
string $currency,
BigDecimal|int|float|string|null $exchangeRate = null,
Date|DateTimeInterface|string|null $rateDate = null,
): staticVAT accounting currency (BT-6). With an exchange rate, BT-111 is calculated.
| Parameter | Type | Description |
|---|---|---|
$currency | string | |
$exchangeRate | Brick\Math\BigDecimal|int|float|string|null = null | |
$rateDate | Date|DateTimeInterface|string|null = null |
- Returns
static
taxPointDate()#
public function taxPointDate(Date|DateTimeInterface|string $date): staticDate when VAT becomes chargeable (BT-7), if it differs from the issue date. EN 16931 allows BT-7 or BT-8, not both (BR-CO-03).
| Parameter | Type | Description |
|---|---|---|
$date | Date|DateTimeInterface|string |
- Returns
static
taxPointDateCode()#
public function taxPointDateCode(TaxPointDateCode $code): staticCode of the date when VAT becomes chargeable (BT-8): issue, delivery or payment date. EN 16931 allows BT-7 or BT-8, not both (BR-CO-03).
| Parameter | Type | Description |
|---|---|---|
$code | TaxPointDateCode |
- Returns
static
taxRepresentative()#
public function taxRepresentative(string $name, string $vatId, Address $address): staticThe seller's tax representative (BG-11): name (BT-62), VAT identifier (BT-63) and postal address (BG-12).
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$vatId | string | |
$address | Address |
- Returns
static
tenderReference()#
public function tenderReference(?string $reference): staticTender or lot reference (BT-17); null removes it.
| Parameter | Type | Description |
|---|---|---|
$reference | ?string |
- Returns
static
timezone()#
public function timezone(string $timezone): staticTime zone for DateTimeInterface values and for the default issue date; call it before the date setters.
| Parameter | Type | Description |
|---|---|---|
$timezone | string |
- Returns
static
type()#
public function type(InvoiceTypeCode|RawCode|string $type): staticType code (BT-3) from UNTDID 1001, e.g. 381 for a credit note; default 380. Unknown codes are kept as RawCode and reported by the validation.
| Parameter | Type | Description |
|---|---|---|
$type | InvoiceTypeCode|RawCode|string |
- Returns
static
updateLine()#
public function updateLine(
string $id,
(callable(InvoiceLine): InvoiceLine)|null $change = null,
BigDecimal|int|float|string|null $netPrice = null,
BigDecimal|int|float|string|null $quantity = null,
BigDecimal|int|float|string|null $priceInclVat = null,
?string $name = null,
?string $description = null,
): staticChanges an existing line, e.g. of a correction draft started with {@see self::from()}: with the named values ->updateLine('2', netPrice: '80.00', quantity: 3), or with a callable that receives the InvoiceLine and returns the changed one, e.g. ->updateLine('2', fn (InvoiceLine $l) => $l->with(['note' => 'Delivered in two parts'])). The calculated line net amount is reset, and percentage allowances and charges on the line amount are recalculated from the new amount.
| Parameter | Type | Description |
|---|---|---|
$id | string | |
$change | (callable(InvoiceLine): InvoiceLine)|null = null | |
$netPrice | Brick\Math\BigDecimal|int|float|string|null = null | |
$quantity | Brick\Math\BigDecimal|int|float|string|null = null | |
$priceInclVat | Brick\Math\BigDecimal|int|float|string|null = null | |
$name | ?string = null | |
$description | ?string = null |
- Returns
static
useDefaultVat()#
public static function useDefaultVat(
(callable(?string, bool): ?TaxPreset)|TaxPreset|null $default,
): voidApplication default VAT of lines that set none, for invoices without defaultVat(): a preset, or a callable that receives the seller's country code and whether the invoice is flagged as small business invoice (Meta::FLAG_SMALL_BUSINESS) and returns a preset or null, e.g. Quittio\Core\Tax\CountryDefaultVat. The Laravel integration sets it from quittio.defaults.vat; null removes it. Lines without VAT and without a default make build() fail (BG-30).
| Parameter | Type | Description |
|---|---|---|
$default | (callable(?string, bool): ?TaxPreset)|TaxPreset|null |
xrechnungExtension()#
public function xrechnungExtension(XRechnungExtensionData $extension): staticData of the XRechnung extension (e.g. third party payments), written only with the profile xrechnung-extension.
| Parameter | Type | Description |
|---|---|---|
$extension | XRechnungExtensionData |
- Returns
static