InvoiceTemplateItem
extends InvoiceTemplateItem
in package
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_invoicer_invoice_template_items'
- #[TableAlias]
- 'invoiceTemplateItem'
Table of Contents
Constants
- QUANTITY_SCALE : int = 2
- Number of decimal places of the `decimal(8,2)` column.
Properties
- $code : string|null
- $currencyId : int|null
- $description : string|null
- $discount : string|null
- $discountInMoney : string|null
- $id : int|null
- $invoiceTemplate : InvoiceTemplate|null
- $invoiceTemplateId : int|null
- $name : string
- $price : string
- $priceAfterDiscount : string|null
- $priceAfterDiscountWithVat : string|null
- $priceWithVat : string|null
- $quantity : string
- $supplyKindId : int|null
- $totalPrice : string
- $totalPriceWithVat : string|null
- $unit : string|null
- $useDiscount : bool
- $useVat : bool
- $vat : string|null
- $vatInMoney : string|null
Methods
- __construct() : mixed
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getCode() : string|null
- getCurrencyId() : int|null
- getDescription() : string|null
- getDiscount() : string|null
- getDiscountInMoney() : string|null
- getId() : int|null
- getInvoiceTemplate() : InvoiceTemplate|null
- getInvoiceTemplateId() : int|null
- getName() : string
- getPrice() : string
- getPriceAfterDiscount() : string|null
- getPriceAfterDiscountWithVat() : string|null
- getPriceWithVat() : string|null
- getQuantity() : string
- getSupplyKindId() : int|null
- getTotalPrice() : string
- getTotalPriceWithVat() : string|null
- getUnit() : string|null
- getUseDiscount() : bool
- getUseVat() : bool
- getVat() : string|null
- VAT rate in percent as a numeric-string ('21.00'); null when the line carries no rate.
- getVatInMoney() : string|null
- isPersisted() : bool
- isUseDiscount() : bool
- isUseVat() : bool
- setCode() : $this
- setCurrencyId() : $this
- setDescription() : $this
- setDiscount() : $this
- setDiscountInMoney() : $this
- setId() : $this
- setInvoiceTemplate() : self
- setInvoiceTemplateId() : $this
- setName() : $this
- setPrice() : $this
- setPriceAfterDiscount() : $this
- setPriceAfterDiscountWithVat() : $this
- setPriceWithVat() : $this
- setQuantity() : $this
- setSupplyKindId() : $this
- setTotalPrice() : $this
- setTotalPriceWithVat() : $this
- setUnit() : $this
- setUseDiscount() : $this
- setUseVat() : $this
- setVat() : $this
- Also accepts int/float (forms, legacy callers) and normalizes to a decimal(5,2) string.
- setVatInMoney() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
- normalizeQuantity() : string
- Converts input from any writer to a numeric string with scale 2.
Constants
QUANTITY_SCALE
Number of decimal places of the `decimal(8,2)` column.
private
int
QUANTITY_SCALE
= 2
Properties
$code
protected
string|null
$code
= null
Attributes
- #[Column]
- $name: 'code'
- $type: 'string'
- $length: 255
- $nullable: true
$currencyId
protected
int|null
$currencyId
= null
Attributes
- #[Column]
- $name: 'cms_system_currencies_currency_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$description
protected
string|null
$description
= null
Attributes
- #[Column]
- $name: 'description'
- $type: 'text'
- $nullable: true
$discount
protected
string|null
$discount
= null
Attributes
- #[Column]
- $name: 'discount'
- $type: 'decimal'
- $precision: 5
- $scale: 2
- $nullable: true
$discountInMoney
protected
string|null
$discountInMoney
= null
Attributes
- #[Column]
- $name: 'discount_in_money'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $nullable: true
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'invoice_template_item_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$invoiceTemplate
protected
InvoiceTemplate|null
$invoiceTemplate
= null
Attributes
- #[JoinColumn]
- $name: 'cms_mod_invoicer_invoice_templates_invoice_template_id'
- $referencedColumnName: 'invoice_template_id'
- $onDelete: 'CASCADE'
- #[ManyToOne]
- $targetEntity: \App\UI\Api\Invoicer\Models\Entities\InvoiceTemplate::class
- $inversedBy: 'items'
$invoiceTemplateId
protected
int|null
$invoiceTemplateId
= null
Attributes
- #[Column]
- $name: 'cms_mod_invoicer_invoice_templates_invoice_template_id'
- $type: 'integer'
- $insertable: false
- $updatable: false
- $nullable: true
- $options: ['unsigned' => true]
$name
protected
string
$name
= ''
Attributes
- #[Column]
- $name: 'name'
- $type: 'string'
- $length: 255
$price
protected
string
$price
= '0.000'
Attributes
- #[Column]
- $name: 'price'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$priceAfterDiscount
protected
string|null
$priceAfterDiscount
= null
Attributes
- #[Column]
- $name: 'price_after_discount'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $nullable: true
$priceAfterDiscountWithVat
protected
string|null
$priceAfterDiscountWithVat
= null
Attributes
- #[Column]
- $name: 'price_after_discount_with_vat'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $nullable: true
$priceWithVat
protected
string|null
$priceWithVat
= null
Attributes
- #[Column]
- $name: 'price_with_vat'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $nullable: true
$quantity
protected
string
$quantity
= '0.00'
Attributes
- #[Column]
- $name: 'quantity'
- $type: 'decimal'
- $precision: 8
- $scale: 2
$supplyKindId
protected
int|null
$supplyKindId
= null
Attributes
- #[Column]
- $name: 'cms_system_supply_kinds_supply_kind_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$totalPrice
protected
string
$totalPrice
= '0.000'
Attributes
- #[Column]
- $name: 'total_price'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$totalPriceWithVat
protected
string|null
$totalPriceWithVat
= null
Attributes
- #[Column]
- $name: 'total_price_with_vat'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $nullable: true
$unit
protected
string|null
$unit
= 'ks'
Attributes
- #[Column]
- $name: 'unit'
- $type: 'string'
- $length: 255
- $nullable: true
$useDiscount
protected
bool
$useDiscount
= false
Attributes
- #[Column]
- $name: 'use_discount'
- $type: 'boolean'
$useVat
protected
bool
$useVat
= false
Attributes
- #[Column]
- $name: 'use_vat'
- $type: 'boolean'
$vat
protected
string|null
$vat
= null
Attributes
- #[Column]
- $name: 'vat'
- $type: 'decimal'
- $precision: 5
- $scale: 2
- $nullable: true
- $options: ['unsigned' => true]
$vatInMoney
protected
string|null
$vatInMoney
= null
Attributes
- #[Column]
- $name: 'vat_in_money'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $nullable: true
Methods
__construct()
public
__construct([int|null $id = null ][, int|null $invoiceTemplateId = null ][, int|null $currencyId = null ][, string $name = '' ][, string|null $description = null ][, string $price = '0.000' ][, string|null $priceWithVat = null ][, string $totalPrice = '0.000' ][, string|null $totalPriceWithVat = null ][, bool $useVat = false ][, string|null $vat = null ][, string $quantity = '0.00' ][, string|null $unit = 'ks' ][, string|null $code = null ][, bool $useDiscount = false ][, string|null $discount = null ][, string|null $discountInMoney = null ][, string|null $priceAfterDiscount = null ][, string|null $priceAfterDiscountWithVat = null ][, string|null $vatInMoney = null ][, int|null $supplyKindId = null ]) : mixed
Parameters
- $id : int|null = null
- $invoiceTemplateId : int|null = null
- $currencyId : int|null = null
- $name : string = ''
- $description : string|null = null
- $price : string = '0.000'
- $priceWithVat : string|null = null
- $totalPrice : string = '0.000'
- $totalPriceWithVat : string|null = null
- $useVat : bool = false
- $vat : string|null = null
- $quantity : string = '0.00'
- $unit : string|null = 'ks'
- $code : string|null = null
- $useDiscount : bool = false
- $discount : string|null = null
- $discountInMoney : string|null = null
- $priceAfterDiscount : string|null = null
- $priceAfterDiscountWithVat : string|null = null
- $vatInMoney : string|null = null
- $supplyKindId : int|null = null
callInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getAllTraits()
Returns all traits the class uses, including those used by parent classes and nested traits.
public
getAllTraits() : array<string, string>
Return values
array<string, string>getCode()
public
getCode() : string|null
Return values
string|nullgetCurrencyId()
public
getCurrencyId() : int|null
Return values
int|nullgetDescription()
public
getDescription() : string|null
Return values
string|nullgetDiscount()
public
getDiscount() : string|null
Return values
string|nullgetDiscountInMoney()
public
getDiscountInMoney() : string|null
Return values
string|nullgetId()
public
getId() : int|null
Return values
int|nullgetInvoiceTemplate()
public
getInvoiceTemplate() : InvoiceTemplate|null
Return values
InvoiceTemplate|nullgetInvoiceTemplateId()
public
getInvoiceTemplateId() : int|null
Return values
int|nullgetName()
public
getName() : string
Return values
stringgetPrice()
public
getPrice() : string
Return values
stringgetPriceAfterDiscount()
public
getPriceAfterDiscount() : string|null
Return values
string|nullgetPriceAfterDiscountWithVat()
public
getPriceAfterDiscountWithVat() : string|null
Return values
string|nullgetPriceWithVat()
public
getPriceWithVat() : string|null
Return values
string|nullgetQuantity()
public
getQuantity() : string
Return values
stringgetSupplyKindId()
public
getSupplyKindId() : int|null
Return values
int|nullgetTotalPrice()
public
getTotalPrice() : string
Return values
stringgetTotalPriceWithVat()
public
getTotalPriceWithVat() : string|null
Return values
string|nullgetUnit()
public
getUnit() : string|null
Return values
string|nullgetUseDiscount()
public
getUseDiscount() : bool
Return values
boolgetUseVat()
public
getUseVat() : bool
Return values
boolgetVat()
VAT rate in percent as a numeric-string ('21.00'); null when the line carries no rate.
public
getVat() : string|null
Return values
string|nullgetVatInMoney()
public
getVatInMoney() : string|null
Return values
string|nullisPersisted()
public
isPersisted() : bool
Return values
boolisUseDiscount()
public
isUseDiscount() : bool
Return values
boolisUseVat()
public
isUseVat() : bool
Return values
boolsetCode()
public
setCode(string|null $code) : $this
Parameters
- $code : string|null
Return values
$thissetCurrencyId()
public
setCurrencyId(int|null $currencyId) : $this
Parameters
- $currencyId : int|null
Return values
$thissetDescription()
public
setDescription(string|null $description) : $this
Parameters
- $description : string|null
Return values
$thissetDiscount()
public
setDiscount(string|null $discount) : $this
Parameters
- $discount : string|null
Return values
$thissetDiscountInMoney()
public
setDiscountInMoney(string|null $discountInMoney) : $this
Parameters
- $discountInMoney : string|null
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInvoiceTemplate()
public
setInvoiceTemplate(InvoiceTemplate|null $invoiceTemplate) : self
Parameters
- $invoiceTemplate : InvoiceTemplate|null
Return values
selfsetInvoiceTemplateId()
public
setInvoiceTemplateId(int|null $invoiceTemplateId) : $this
Parameters
- $invoiceTemplateId : int|null
Return values
$thissetName()
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$thissetPrice()
public
setPrice(string $price) : $this
Parameters
- $price : string
Return values
$thissetPriceAfterDiscount()
public
setPriceAfterDiscount(string|null $priceAfterDiscount) : $this
Parameters
- $priceAfterDiscount : string|null
Return values
$thissetPriceAfterDiscountWithVat()
public
setPriceAfterDiscountWithVat(string|null $priceAfterDiscountWithVat) : $this
Parameters
- $priceAfterDiscountWithVat : string|null
Return values
$thissetPriceWithVat()
public
setPriceWithVat(string|null $priceWithVat) : $this
Parameters
- $priceWithVat : string|null
Return values
$thissetQuantity()
public
setQuantity(int|float|string $quantity) : $this
Parameters
- $quantity : int|float|string
Return values
$thissetSupplyKindId()
public
setSupplyKindId(int|null $supplyKindId) : $this
Parameters
- $supplyKindId : int|null
Return values
$thissetTotalPrice()
public
setTotalPrice(string $totalPrice) : $this
Parameters
- $totalPrice : string
Return values
$thissetTotalPriceWithVat()
public
setTotalPriceWithVat(string|null $totalPriceWithVat) : $this
Parameters
- $totalPriceWithVat : string|null
Return values
$thissetUnit()
public
setUnit(string|null $unit) : $this
Parameters
- $unit : string|null
Return values
$thissetUseDiscount()
public
setUseDiscount(bool $useDiscount) : $this
Parameters
- $useDiscount : bool
Return values
$thissetUseVat()
public
setUseVat(bool $useVat) : $this
Parameters
- $useVat : bool
Return values
$thissetVat()
Also accepts int/float (forms, legacy callers) and normalizes to a decimal(5,2) string.
public
setVat(int|float|string|null $vat) : $this
Parameters
- $vat : int|float|string|null
Return values
$thissetVatInMoney()
public
setVatInMoney(string|null $vatInMoney) : $this
Parameters
- $vatInMoney : string|null
Return values
$thisgetTraitsRecursive()
Walks the trait list recursively and collects nested traits too.
private
static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
- $traits : array<string, string>
Return values
array<string, string>normalizeQuantity()
Converts input from any writer to a numeric string with scale 2.
private
normalizeQuantity(int|float|string $quantity) : string
A string is stripped of thousand separators (including non-breaking and narrow spaces) and a
comma is taken as the decimal separator. The admin form and external callers send 2,5 as
often as 2.5, and without the conversion is_numeric('2,5') would fail and the quantity
would silently drop to zero.
The cleanup is done by the shared Decimal::clean() so that the entity and the form see the same input; scale and zero instead of null belong to this entity.
Parameters
- $quantity : int|float|string