BuildsLines
Invoice lines (BG-25) and their groups.
Part of InvoiceBuilder, which holds the state; use the builder, not the trait.
Table of Contents
Methods
- group() : static
- Defines a line group for the PDF. Lines join it via LineBuilder::group().
- line() : static
- 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() : static
- removeLine() : static
- Removes an existing line by its identifier (BT-126).
- updateLine() : static
- 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.
Methods
group()
Defines a line group for the PDF. Lines join it via LineBuilder::group().
public
group(string $id, string $title[, bool $showSubtotal = true ]) : static
Parameters
- $id : string
- $title : string
- $showSubtotal : bool = true
Return values
staticline()
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.
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 ]) : 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
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
staticremoveLine()
Removes an existing line by its identifier (BT-126).
public
removeLine(string $id) : static
Parameters
- $id : string
Return values
staticupdateLine()
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.
public
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|null $name = null ][, string|null $description = null ]) : static
->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.
Parameters
- $id : string
- $change : callable(InvoiceLine): InvoiceLine|null = null
- $netPrice : BigDecimal|int|float|string|null = null
- $quantity : BigDecimal|int|float|string|null = null
- $priceInclVat : BigDecimal|int|float|string|null = null
- $name : string|null = null
- $description : string|null = null