---
title: "LineBuilder – API-Referenz · Quittio"
description: "Fluent builder for an invoice line (BG-25)."
canonical_url: "https://quittio.dev/docs/api/Quittio/Core/Builder/LineBuilder"
locale: de
meta:
  "og:description": "Fluent builder for an invoice line (BG-25)."
  "og:image": "https://quittio.dev/og/quittio-de.jpg"
  "og:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "LineBuilder – API-Referenz · Quittio"
  "twitter:image": "https://quittio.dev/og/quittio-de.jpg"
  "twitter:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
---

> Index of every page on this site: [llms.txt](https://quittio.dev/llms.txt)

[API reference](https://quittio.dev/docs/api) / [Quittio](https://quittio.dev/docs/api/Quittio) \\ [Core](https://quittio.dev/docs/api/Quittio/Core) \\ [Builder](https://quittio.dev/docs/api/Quittio/Core/Builder)

# LineBuilder

final class in quittio/core · uses [`Macroable`](https://quittio.dev/docs/api/Quittio/Core/Support/Macroable)

`Quittio\Core\Builder\LineBuilder` · [Source](https://github.com/Quittio/quittio/blob/v0.7.1/packages/core/src/Builder/LineBuilder.php#L44)

Fluent builder for an invoice line (BG-25).

## Constants \#

| Constant | Value | Description |
| --- | --- | --- |
| `ARRAY_KEYS` | `['id', 'name', 'description', 'note', 'quantity', 'unit', 'netPrice', 'listPrice', 'priceInclVat', 'vat', 'period', 'allowance', 'charge', 'sellerId', 'buyerId' …` | Keys of a line given as array (InvoiceBuilder::line(), Line::fromArray()): the methods of this builder that can be called with the value. |

## Properties \#

| Property | Type | Description |
| --- | --- | --- |
| `$macros` protected static | `array<string, callable>` | |

## Methods \#

| Method | Description |
| --- | --- |
| `->__call()` | |
| `->allowance()` | Adds a line allowance (BG-27): an amount (BT-136), or a percentage (BT-138) of the base amount (BT-137, default quantity × net price), with reason (BT-139) and reason code (BT-140). |
| `->attribute()` | Adds an item attribute (BG-32): name (BT-160) and value (BT-161). |
| `->build()` | Builds the line; called by InvoiceBuilder. $vatDefault is a builder whose VAT treatment applies to this line and its sub lines when they have none (InvoiceBuilder::defaultVat()). $supplyDate is the supply date of the document (SupplyDate); a line period wins. It resolves presets whose rate depends on the date (DatedTaxPreset). |
| `->buyerAccountingReference()` | The buyer's accounting reference of the line (BT-133); null removes it. |
| `->buyerId()` | The buyer's item number (BT-156); null removes it. |
| `->charge()` | Adds a line charge (BG-28): an amount (BT-141), or a percentage (BT-143) of the base amount (BT-142, default quantity × net price), with reason (BT-144) and reason code (BT-145). |
| `->classification()` | Adds an item classification (BT-158) with list identifier (BT-158-1) and version (BT-158-2). |
| `->description()` | Item description (BT-154); null removes it. |
| `->explicitId()` | Identifier set with id(); null when the invoice builder assigns one. |
| `->extended()` | Line data of the profile EXTENDED; other profiles do not write it. |
| `->fill()` | Calls the method of every key with its value: \['name' => 'Consulting', 'quantity' => 4, 'netPrice' => '120.00']. An array value holds the arguments, as list or by name (\['quantity' => \[4, UnitCode::Hour]], \['allowance' => \['percent' => '10', 'reason' => 'Early bird']]); null values are skipped. |
| `::flushMacros()` | |
| `->fromModel()` | Lets an application model fill this line (ProvidesInvoiceLine::fillLine()). |
| `->group()` | Assigns the line to a presentation group of the PDF (see InvoiceBuilder::group()). |
| `::hasMacro()` | |
| `->hasPrice()` | Whether a net price, list price or price including VAT was set. |
| `->hasVat()` | Whether vat() was called. |
| `->highlight()` | Highlights the line in the PDF and HTML (the default templates shade it and mark it in the secondary colour). |
| `->id()` | Line identifier (BT-126); default the position, "1", "2", … |
| `->lacksVat()` | Whether the line or one of its sub lines has no VAT treatment yet. |
| `->listPrice()` | List price before price discount (BT-148) and the discount per unit (BT-147). The net price is derived as list price minus discount unless set explicitly. |
| `::macro()` | |
| `->name()` | Item name (BT-153). Required. |
| `->netPrice()` | Net price per base quantity (BT-146, BT-149, BT-150). |
| `->note()` | Line note (BT-127); null removes it. |
| `->objectId()` | Invoiced object identifier of the line (BT-128) with its scheme. |
| `->orderLineReference()` | Line of the purchase order (BT-132); null removes it. |
| `->originCountry()` | Country of origin of the item (BT-159), ISO 3166-1 alpha-2, uppercased; null removes it. |
| `->period()` | Line period (BG-26): start (BT-134) and end (BT-135); one of them may be null. |
| `->priceInclVat()` | Price including VAT (gross price mode for B2C and shops). The calculator derives the net price so that the customer pays exactly the gross amount. |
| `->quantity()` | Invoiced quantity (BT-129), optionally with the unit (BT-130); default 1. Negative quantities for returns and discounts. |
| `->reference()` | Adds a reference to an order, contract, despatch or receiving advice or another document (profile EXTENDED only). |
| `->sellerId()` | The seller's item number (BT-155); null removes it. |
| `->showGrossPrice()` | Prints the price including VAT below the net unit price of this line (true) or not (false), whatever Presentation::$showGrossPrices says for the invoice; null follows the presentation again. It is printed only for lines with a price including VAT (priceInclVat()). |
| `->standardId()` | Standard item identifier (BT-157) with its scheme (BT-157-1); default scheme GTIN (0160). |
| `->subLine()` | Adds a sub line (profile EXTENDED or XRechnung extension), in the forms of InvoiceBuilder::line(): a name with the common values, Line::make(), an array, a model or a callable. |
| `->unit()` | Unit of the quantity (BT-130), UN/ECE Recommendation 20/21; default C62 (one). Unknown codes are kept as RawCode. |
| `->vat()` | Sets the VAT treatment, either via a preset of a country pack or as category and rate. |

### `__call()`#

```
public function __call(string $method, array<mixed> $parameters): mixed
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$method` | `string` | |
| `$parameters` | `array<mixed>` | |

<dl><dt>Returns</dt>
<dd><code>mixed</code></dd>
</dl>

### `allowance()`#

```
public function allowance(
    ?string $amount = null,
    ?string $percent = null,
    ?string $reason = null,
    AllowanceReasonCode|RawCode|string|null $reasonCode = null,
    ?string $baseAmount = null,
): self
```

Adds a line allowance (BG-27): an amount (BT-136), or a percentage (BT-138) of the base amount (BT-137, default quantity × net price), with reason (BT-139) and reason code (BT-140).

| Parameter | Type | Description |
| --- | --- | --- |
| `$amount` | `?string` = `null` | |
| `$percent` | `?string` = `null` | |
| `$reason` | `?string` = `null` | |
| `$reasonCode` | `[AllowanceReasonCode](https://quittio.dev/docs/api/Quittio/Core/Enums/AllowanceReasonCode)\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|string\|null` = `null` | |
| `$baseAmount` | `?string` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `attribute()`#

```
public function attribute(string $name, string $value): self
```

Adds an item attribute (BG-32): name (BT-160) and value (BT-161).

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` | |
| `$value` | `string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `build()`#

```
public function build(
    string $currency,
    string $defaultId,
    ?string $locale = null,
    ?self $vatDefault = null,
    ?Date $supplyDate = null,
): InvoiceLine
```

Builds the line; called by InvoiceBuilder. $vatDefault is a builder whose VAT treatment applies to this line and its sub lines when they have none (InvoiceBuilder::defaultVat()). $supplyDate is the supply date of the document (SupplyDate); a line period wins. It resolves presets whose rate depends on the date (DatedTaxPreset).

| Parameter | Type | Description |
| --- | --- | --- |
| `$currency` | `string` | |
| `$defaultId` | `string` | |
| `$locale` | `?string` = `null` | |
| `$vatDefault` | `?self` = `null` | |
| `$supplyDate` | `? [Date](https://quittio.dev/docs/api/Quittio/Core/Support/Date)` = `null` | |

<dl><dt>Returns</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Data/Lines/InvoiceLine">InvoiceLine</a></code></dd>
</dl>

### `buyerAccountingReference()`#

```
public function buyerAccountingReference(?string $reference): self
```

The buyer's accounting reference of the line (BT-133); null removes it.

| Parameter | Type | Description |
| --- | --- | --- |
| `$reference` | `?string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `buyerId()`#

```
public function buyerId(?string $id): self
```

The buyer's item number (BT-156); null removes it.

| Parameter | Type | Description |
| --- | --- | --- |
| `$id` | `?string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `charge()`#

```
public function charge(
    ?string $amount = null,
    ?string $percent = null,
    ?string $reason = null,
    ChargeReasonCode|RawCode|string|null $reasonCode = null,
    ?string $baseAmount = null,
): self
```

Adds a line charge (BG-28): an amount (BT-141), or a percentage (BT-143) of the base amount (BT-142, default quantity × net price), with reason (BT-144) and reason code (BT-145).

| Parameter | Type | Description |
| --- | --- | --- |
| `$amount` | `?string` = `null` | |
| `$percent` | `?string` = `null` | |
| `$reason` | `?string` = `null` | |
| `$reasonCode` | `[ChargeReasonCode](https://quittio.dev/docs/api/Quittio/Core/Enums/ChargeReasonCode)\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|string\|null` = `null` | |
| `$baseAmount` | `?string` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `classification()`#

```
public function classification(
    string $code,
    ItemClassificationScheme|RawCode|string $scheme,
    ?string $version = null,
): self
```

Adds an item classification (BT-158) with list identifier (BT-158-1) and version (BT-158-2).

| Parameter | Type | Description |
| --- | --- | --- |
| `$code` | `string` | |
| `$scheme` | `[ItemClassificationScheme](https://quittio.dev/docs/api/Quittio/Core/Enums/ItemClassificationScheme)\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|string` | |
| `$version` | `?string` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `description()`#

```
public function description(?string $description): self
```

Item description (BT-154); null removes it.

| Parameter | Type | Description |
| --- | --- | --- |
| `$description` | `?string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `explicitId()`#

```
public function explicitId(): ?string
```

Identifier set with id(); null when the invoice builder assigns one.

<dl><dt>Returns</dt>
<dd><code>?string</code></dd>
</dl>

### `extended()`#

```
public function extended(LineExtendedData $extended): self
```

Line data of the profile EXTENDED; other profiles do not write it.

| Parameter | Type | Description |
| --- | --- | --- |
| `$extended` | `[LineExtendedData](https://quittio.dev/docs/api/Quittio/Core/Data/Extensions/LineExtendedData)` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `fill()`#

```
public function fill(array<array-key, mixed> $values): self
```

Calls the method of every key with its value: \['name' => 'Consulting', 'quantity' => 4, 'netPrice' => '120.00']. An array value holds the arguments, as list or by name (\['quantity' => \[4, UnitCode::Hour]], \['allowance' => \['percent' => '10', 'reason' => 'Early bird']]); null values are skipped.

| Parameter | Type | Description |
| --- | --- | --- |
| `$values` | `array<array-key, mixed>` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `flushMacros()`#

```
public static function flushMacros(): void
```

static

### `fromModel()`#

```
public function fromModel(ProvidesInvoiceLine $model): self
```

Lets an application model fill this line (ProvidesInvoiceLine::fillLine()).

| Parameter | Type | Description |
| --- | --- | --- |
| `$model` | `[ProvidesInvoiceLine](https://quittio.dev/docs/api/Quittio/Core/Contracts/ProvidesInvoiceLine)` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `group()`#

```
public function group(string $groupId): self
```

Assigns the line to a presentation group of the PDF (see InvoiceBuilder::group()).

| Parameter | Type | Description |
| --- | --- | --- |
| `$groupId` | `string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `hasMacro()`#

```
public static function hasMacro(string $name): bool
```

static

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` | |

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `hasPrice()`#

```
public function hasPrice(): bool
```

Whether a net price, list price or price including VAT was set.

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `hasVat()`#

```
public function hasVat(): bool
```

Whether vat() was called.

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `highlight()`#

```
public function highlight(bool $highlight = true): self
```

Highlights the line in the PDF and HTML (the default templates shade it and mark it in the secondary colour).

| Parameter | Type | Description |
| --- | --- | --- |
| `$highlight` | `bool` = `true` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `id()`#

```
public function id(string $id): self
```

Line identifier (BT-126); default the position, "1", "2", …

| Parameter | Type | Description |
| --- | --- | --- |
| `$id` | `string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `lacksVat()`#

```
public function lacksVat(): bool
```

Whether the line or one of its sub lines has no VAT treatment yet.

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `listPrice()`#

```
public function listPrice(
    BigDecimal|int|float|string $grossPrice,
    BigDecimal|int|float|string|null $discount = null,
): self
```

List price before price discount (BT-148) and the discount per unit (BT-147). The net price is derived as list price minus discount unless set explicitly.

| Parameter | Type | Description |
| --- | --- | --- |
| `$grossPrice` | `Brick\Math\BigDecimal\|int\|float\|string` | |
| `$discount` | `Brick\Math\BigDecimal\|int\|float\|string\|null` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `macro()`#

```
public static function macro(string $name, callable $macro): void
```

static

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` | |
| `$macro` | `callable` | |

### `name()`#

```
public function name(string $name): self
```

Item name (BT-153). Required.

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `netPrice()`#

```
public function netPrice(
    BigDecimal|int|float|string $price,
    BigDecimal|int|float|string|null $baseQuantity = null,
    UnitCode|RawCode|string|null $baseQuantityUnit = null,
): self
```

Net price per base quantity (BT-146, BT-149, BT-150).

| Parameter | Type | Description |
| --- | --- | --- |
| `$price` | `Brick\Math\BigDecimal\|int\|float\|string` | |
| `$baseQuantity` | `Brick\Math\BigDecimal\|int\|float\|string\|null` = `null` | |
| `$baseQuantityUnit` | `[UnitCode](https://quittio.dev/docs/api/Quittio/Core/Enums/UnitCode)\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|string\|null` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `note()`#

```
public function note(?string $note): self
```

Line note (BT-127); null removes it.

| Parameter | Type | Description |
| --- | --- | --- |
| `$note` | `?string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `objectId()`#

```
public function objectId(string $value, string|RawCode|null $scheme = null): self
```

Invoiced object identifier of the line (BT-128) with its scheme.

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `string` | |
| `$scheme` | `string\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|null` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `orderLineReference()`#

```
public function orderLineReference(?string $reference): self
```

Line of the purchase order (BT-132); null removes it.

| Parameter | Type | Description |
| --- | --- | --- |
| `$reference` | `?string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `originCountry()`#

```
public function originCountry(?string $country): self
```

Country of origin of the item (BT-159), ISO 3166-1 alpha-2, uppercased; null removes it.

| Parameter | Type | Description |
| --- | --- | --- |
| `$country` | `?string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `period()`#

```
public function period(Date|string|null $start, Date|string|null $end = null): self
```

Line period (BG-26): start (BT-134) and end (BT-135); one of them may be null.

| Parameter | Type | Description |
| --- | --- | --- |
| `$start` | `[Date](https://quittio.dev/docs/api/Quittio/Core/Support/Date)\|string\|null` | |
| `$end` | `[Date](https://quittio.dev/docs/api/Quittio/Core/Support/Date)\|string\|null` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `priceInclVat()`#

```
public function priceInclVat(BigDecimal|int|float|string $price): self
```

Price including VAT (gross price mode for B2C and shops). The calculator derives the net price so that the customer pays exactly the gross amount.

| Parameter | Type | Description |
| --- | --- | --- |
| `$price` | `Brick\Math\BigDecimal\|int\|float\|string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `quantity()`#

```
public function quantity(
    BigDecimal|int|float|string $quantity,
    UnitCode|RawCode|string|null $unit = null,
): self
```

Invoiced quantity (BT-129), optionally with the unit (BT-130); default 1. Negative quantities for returns and discounts.

| Parameter | Type | Description |
| --- | --- | --- |
| `$quantity` | `Brick\Math\BigDecimal\|int\|float\|string` | |
| `$unit` | `[UnitCode](https://quittio.dev/docs/api/Quittio/Core/Enums/UnitCode)\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|string\|null` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
<dt>Throws</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Exceptions/InvalidArgumentException">InvalidArgumentException</a></code> – for a float</dd></dl>

### `reference()`#

```
public function reference(DocumentReference $reference): self
```

Adds a reference to an order, contract, despatch or receiving advice or another document (profile EXTENDED only).

| Parameter | Type | Description |
| --- | --- | --- |
| `$reference` | `[DocumentReference](https://quittio.dev/docs/api/Quittio/Core/Data/References/DocumentReference)` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `sellerId()`#

```
public function sellerId(?string $id): self
```

The seller's item number (BT-155); null removes it.

| Parameter | Type | Description |
| --- | --- | --- |
| `$id` | `?string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `showGrossPrice()`#

```
public function showGrossPrice(?bool $show = true): self
```

Prints the price including VAT below the net unit price of this line (true) or not (false), whatever Presentation::$showGrossPrices says for the invoice; null follows the presentation again. It is printed only for lines with a price including VAT (priceInclVat()).

| Parameter | Type | Description |
| --- | --- | --- |
| `$show` | `?bool` = `true` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `standardId()`#

```
public function standardId(
    string $value,
    IdentifierScheme|RawCode|string $scheme = \Quittio\Core\Enums\IdentifierScheme::Gtin,
): self
```

Standard item identifier (BT-157) with its scheme (BT-157-1); default scheme GTIN (0160).

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `string` | |
| `$scheme` | `[IdentifierScheme](https://quittio.dev/docs/api/Quittio/Core/Enums/IdentifierScheme)\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|string` = `\Quittio\Core\Enums\IdentifierScheme::Gtin` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `subLine()`#

```
public function subLine(
    self|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,
): self
```

Adds a sub line (profile EXTENDED or XRechnung extension), in the forms of InvoiceBuilder::line(): a name with the common values, Line::make(), an array, a model or a callable.

| Parameter | Type | Description |
| --- | --- | --- |
| `$line` | `self\| [ProvidesInvoiceLine](https://quittio.dev/docs/api/Quittio/Core/Contracts/ProvidesInvoiceLine)\|array\|callable\|string` | |
| `$netPrice` | `Brick\Math\BigDecimal\|int\|float\|string\|null` = `null` | |
| `$quantity` | `Brick\Math\BigDecimal\|int\|float\|string\|null` = `null` | |
| `$unit` | `[UnitCode](https://quittio.dev/docs/api/Quittio/Core/Enums/UnitCode)\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|string\|null` = `null` | |
| `$vat` | `[TaxPreset](https://quittio.dev/docs/api/Quittio/Core/Tax/TaxPreset)\| [VatCategory](https://quittio.dev/docs/api/Quittio/Core/Enums/VatCategory)\|null` = `null` | |
| `$description` | `?string` = `null` | |
| `$priceInclVat` | `Brick\Math\BigDecimal\|int\|float\|string\|null` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `unit()`#

```
public function unit(UnitCode|RawCode|string $unit): self
```

Unit of the quantity (BT-130), UN/ECE Recommendation 20/21; default C62 (one). Unknown codes are kept as RawCode.

| Parameter | Type | Description |
| --- | --- | --- |
| `$unit` | `[UnitCode](https://quittio.dev/docs/api/Quittio/Core/Enums/UnitCode)\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `vat()`#

```
public function vat(
    TaxPreset|VatCategory $presetOrCategory,
    BigDecimal|int|float|string|null $rate = null,
    ?string $exemptionReason = null,
    VatExemptionReasonCode|RawCode|string|null $exemptionReasonCode = null,
): self
```

Sets the VAT treatment, either via a preset of a country pack or as category and rate.

| Parameter | Type | Description |
| --- | --- | --- |
| `$presetOrCategory` | `[TaxPreset](https://quittio.dev/docs/api/Quittio/Core/Tax/TaxPreset)\| [VatCategory](https://quittio.dev/docs/api/Quittio/Core/Enums/VatCategory)` | |
| `$rate` | `Brick\Math\BigDecimal\|int\|float\|string\|null` = `null` | |
| `$exemptionReason` | `?string` = `null` | |
| `$exemptionReasonCode` | `[VatExemptionReasonCode](https://quittio.dev/docs/api/Quittio/Core/Enums/VatExemptionReasonCode)\| [RawCode](https://quittio.dev/docs/api/Quittio/Core/Codes/RawCode)\|string\|null` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://quittio.dev/#website","@type":"WebSite","description":"E-Rechnungen für PHP und Laravel: ZUGFeRD, XRechnung und Peppol erstellen, prüfen, lesen und archivieren.","inLanguage":"de-DE","name":"Quittio","url":"https://quittio.dev/","publisher":{"@id":"https://quittio.dev/#identity"},"workTranslation":{"@id":"https://quittio.dev/en#website"}},{"@id":"https://quittio.dev/docs/api/Quittio/Core/Builder/LineBuilder#webpage","@type":"WebPage","description":"Fluent builder for an invoice line (BG-25).","name":"LineBuilder – API-Referenz","url":"https://quittio.dev/docs/api/Quittio/Core/Builder/LineBuilder","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/docs/api/Quittio/Core/Builder/LineBuilder"]}],"primaryImageOfPage":{"@id":"https://quittio.dev/#logo"}},{"@id":"https://quittio.dev/#identity","@type":"Organization","description":"Open-Source-Bibliothek für E-Rechnungen in PHP und Laravel (ZUGFeRD, XRechnung, Peppol) und Quittio Managed.","email":"kontakt@niklasforst.de","legalName":"Niklas Forst – Softwareentwicklung","name":"Quittio","url":"https://quittio.dev","founder":{"@type":"Person","name":"Niklas Forst","url":"https://quittio.dev/ueber"},"logo":{"@id":"https://quittio.dev/#logo"},"sameAs":["https://github.com/Quittio/quittio","https://packagist.org/packages/quittio/quittio"]},{"@id":"https://quittio.dev/#logo","@type":"ImageObject","caption":"Quittio","contentUrl":"https://quittio.dev/logo.png","inLanguage":"de-DE","url":"https://quittio.dev/logo.png"}]}
```