\Einvoicing\Invoice¶
__construct()
¶
Invoice constructor
public __construct($preset: string|null = null)
Parameters
$preset
:string
|null
— Preset classname or NULL for blank invoice
Throws
\InvalidArgumentException
if not a valid preset
getDecimals()
¶
Get number of decimal places for a given field
public getDecimals($field: string): int
Parameters
$field
:string
— Field name
Returns
int
— Number of decimal places
round()
¶
Round value
public round($value: float, $field: string): float
Parameters
$value
:float
— Value to round$field
:string
— Field name
Returns
float
— Rounded value
setRoundingMatrix()
¶
Set rounding matrix
public setRoundingMatrix($matrix: mixed[]): \Einvoicing\Invoice
Parameters
$matrix
:mixed
[] — Rounding matrix
Returns
\Einvoicing\Invoice
— Invoice instance
getSpecification()
¶
Get specification identifier
public getSpecification(): string|null
Returns
string
|null
— Specification identifier
setSpecification()
¶
Set specification identifier
public setSpecification($specification: string): \Einvoicing\Invoice
Parameters
$specification
:string
— Specification identifier
Returns
\Einvoicing\Invoice
— Invoice instance
getBusinessProcess()
¶
Get business process type
public getBusinessProcess(): string|null
Returns
string
|null
— Business process type
setBusinessProcess()
¶
Set business process type
public setBusinessProcess($businessProcess: string|null): \Einvoicing\Invoice
Parameters
$businessProcess
:string
|null
— Business process type
Returns
\Einvoicing\Invoice
— Invoice instance
getNumber()
¶
Get invoice number
public getNumber(): string|null
Returns
string
|null
— Invoice number
setNumber()
¶
Set invoice number
public setNumber($number: string): \Einvoicing\Invoice
Parameters
$number
:string
— Invoice number
Returns
\Einvoicing\Invoice
— Invoice instance
getType()
¶
Get invoice type code
public getType(): int
Returns
int
— Invoice type code
setType()
¶
Set invoice type code
public setType($typeCode: int): \Einvoicing\Invoice
Parameters
$typeCode
:int
— Invoice type code
Returns
\Einvoicing\Invoice
— Invoice instance
getCurrency()
¶
Get document currency code
public getCurrency(): string
Returns
string
— Document currency code
setCurrency()
¶
Set document currency code
public setCurrency($currencyCode: string): \Einvoicing\Invoice
Parameters
$currencyCode
:string
— Document currency code
Returns
\Einvoicing\Invoice
— Invoice instance
getVatCurrency()
¶
Get VAT accounting currency code
public getVatCurrency(): string|null
Returns
string
|null
— VAT accounting currency code or NULL if same as document's
setVatCurrency()
¶
Set VAT accounting currency code
public setVatCurrency($currencyCode: string|null): \Einvoicing\Invoice
Parameters
$currencyCode
:string
|null
— VAT accounting currency code or NULL if same as document's
Returns
\Einvoicing\Invoice
— Invoice instance
getIssueDate()
¶
Get invoice issue date
public getIssueDate(): \DateTime|null
Returns
\DateTime
|null
— Invoice issue date
setIssueDate()
¶
Set invoice issue date
public setIssueDate($issueDate: \DateTime): \Einvoicing\Invoice
Parameters
$issueDate
:\DateTime
— Invoice issue date
Returns
\Einvoicing\Invoice
— Invoice instance
getDueDate()
¶
Get payment due date
public getDueDate(): \DateTime|null
Returns
\DateTime
|null
— Payment due date
setDueDate()
¶
Set payment due date
public setDueDate($dueDate: \DateTime|null): \Einvoicing\Invoice
Parameters
$dueDate
:\DateTime
|null
— Payment due date
Returns
\Einvoicing\Invoice
— Invoice instance
getTaxPointDate()
¶
Get tax point date
public getTaxPointDate(): \DateTime|null
Returns
\DateTime
|null
— Tax point date
setTaxPointDate()
¶
Set tax point date
public setTaxPointDate($taxPointDate: \DateTime|null): \Einvoicing\Invoice
Parameters
$taxPointDate
:\DateTime
|null
— Tax point date
Returns
\Einvoicing\Invoice
— Invoice instance
getNotes()
¶
Get invoice notes
public getNotes(): string[]
Returns
string
[] — Invoice notes
addNote()
¶
Add invoice note
public addNote($note: string): \Einvoicing\Invoice
Parameters
$note
:string
— Invoice note
Returns
\Einvoicing\Invoice
— Invoice instance
removeNote()
¶
Remove invoice note
public removeNote($index: int): \Einvoicing\Invoice
Parameters
$index
:int
— Invoice note index
Returns
\Einvoicing\Invoice
— Invoice instance
Throws
\OutOfBoundsException
if invoice note index is out of bounds
clearNotes()
¶
Clear all invoice notes
public clearNotes(): \Einvoicing\Invoice
Returns
\Einvoicing\Invoice
— Invoice instance
getNote()
¶
Get invoice note
Deprecated since v0.2.1
Use \Einvoicing\Invoice::getNotes()
instead.
public getNote(): string|null
Returns
string
|null
— Invoice note
setNote()
¶
Set invoice note
Deprecated since v0.2.1
Use \Einvoicing\Invoice::addNote()
instead.
public setNote($note: string|null): \Einvoicing\Invoice
Parameters
$note
:string
|null
— Invoice note
Returns
\Einvoicing\Invoice
— Invoice instance
getBuyerReference()
¶
Get buyer reference
public getBuyerReference(): string|null
Returns
string
|null
— Buyer reference
setBuyerReference()
¶
Set buyer reference
public setBuyerReference($buyerReference: string|null): \Einvoicing\Invoice
Parameters
$buyerReference
:string
|null
— Buyer reference
Returns
\Einvoicing\Invoice
— Invoice instance
getPurchaseOrderReference()
¶
Get purchase order reference
public getPurchaseOrderReference(): string|null
Returns
string
|null
— Purchase order reference
setPurchaseOrderReference()
¶
Set purchase order reference
public setPurchaseOrderReference($purchaseOrderReference: string|null): \Einvoicing\Invoice
Parameters
$purchaseOrderReference
:string
|null
— Purchase order reference
Returns
\Einvoicing\Invoice
— Invoice instance
getSalesOrderReference()
¶
Get sales order reference
public getSalesOrderReference(): string|null
Returns
string
|null
— Sales order reference
setSalesOrderReference()
¶
Set sales order reference
public setSalesOrderReference($salesOrderReference: string|null): \Einvoicing\Invoice
Parameters
$salesOrderReference
:string
|null
— Sales order reference
Returns
\Einvoicing\Invoice
— Invoice instance
getTenderOrLotReference()
¶
Get tender or lot reference
public getTenderOrLotReference(): string|null
Returns
string
|null
— Tender or lot reference
setTenderOrLotReference()
¶
Set tender or lot reference
public setTenderOrLotReference($tenderOrLotReference: string|null): \Einvoicing\Invoice
Parameters
$tenderOrLotReference
:string
|null
— Tender or lot reference
Returns
\Einvoicing\Invoice
— Invoice instance
getContractReference()
¶
Get contract reference
public getContractReference(): string|null
Returns
string
|null
— Contract reference
setContractReference()
¶
Set contract reference
public setContractReference($contractReference: string|null): \Einvoicing\Invoice
Parameters
$contractReference
:string
|null
— Contract reference
Returns
\Einvoicing\Invoice
— Invoice instance
getPaidAmount()
¶
Get invoice prepaid amount
public getPaidAmount(): float
Returns
float
— Invoice prepaid amount
setPaidAmount()
¶
Set invoice prepaid amount
public setPaidAmount($paidAmount: float): \Einvoicing\Invoice
Parameters
$paidAmount
:float
— Invoice prepaid amount
Returns
\Einvoicing\Invoice
— Invoice instance
getRoundingAmount()
¶
Get invoice rounding amount
public getRoundingAmount(): float
Returns
float
— Invoice rounding amount
setRoundingAmount()
¶
Set invoice rounding amount
public setRoundingAmount($roundingAmount: float): \Einvoicing\Invoice
Parameters
$roundingAmount
:float
— Invoice rounding amount
Returns
\Einvoicing\Invoice
— Invoice instance
getCustomVatAmount()
¶
Get total VAT amount in VAT accounting currency
public getCustomVatAmount(): float|null
Returns
float
|null
— Total amount in accounting currency
setCustomVatAmount()
¶
Set total VAT amount in VAT accounting currency
public setCustomVatAmount($customVatAmount: float|null): \Einvoicing\Invoice
Parameters
$customVatAmount
:float
|null
— Total amount in accounting currency
Returns
\Einvoicing\Invoice
— Invoice instance
getSeller()
¶
Get seller
public getSeller(): \Einvoicing\Party|null
Returns
\Einvoicing\Party
|null
— Seller instance
setSeller()
¶
Set seller
public setSeller($seller: \Einvoicing\Party): \Einvoicing\Invoice
Parameters
$seller
:\Einvoicing\Party
— Seller instance
Returns
\Einvoicing\Invoice
— Invoice instance
getBuyer()
¶
Get buyer
public getBuyer(): \Einvoicing\Party|null
Returns
\Einvoicing\Party
|null
— Buyer instance
setBuyer()
¶
Set buyer
public setBuyer($buyer: \Einvoicing\Party): \Einvoicing\Invoice
Parameters
$buyer
:\Einvoicing\Party
— Buyer instance
Returns
\Einvoicing\Invoice
— Invoice instance
getPayee()
¶
Get payee
public getPayee(): \Einvoicing\Party|null
Returns
\Einvoicing\Party
|null
— Payee instance
setPayee()
¶
Set payee
public setPayee($payee: \Einvoicing\Party|null): \Einvoicing\Invoice
Parameters
$payee
:\Einvoicing\Party
|null
— Payee instance
Returns
\Einvoicing\Invoice
— Invoice instance
getDelivery()
¶
Get delivery information
public getDelivery(): \Einvoicing\Delivery|null
Returns
\Einvoicing\Delivery
|null
— Delivery instance
setDelivery()
¶
Set delivery information
public setDelivery($delivery: \Einvoicing\Delivery|null): \Einvoicing\Invoice
Parameters
$delivery
:\Einvoicing\Delivery
|null
— Delivery instance
Returns
\Einvoicing\Invoice
— Invoice instance
getPayment()
¶
Get payment information
public getPayment(): \Einvoicing\Payments\Payment|null
Returns
\Einvoicing\Payments\Payment
|null
— Payment instance
setPayment()
¶
Set payment information
public setPayment($payment: \Einvoicing\Payments\Payment|null): \Einvoicing\Invoice
Parameters
$payment
:\Einvoicing\Payments\Payment
|null
— Payment instance
Returns
\Einvoicing\Invoice
— Invoice instance
getLines()
¶
Get invoice lines
public getLines(): \Einvoicing\InvoiceLine[]
Returns
\Einvoicing\InvoiceLine
[] — Invoice lines
addLine()
¶
Add invoice line
public addLine($line: \Einvoicing\InvoiceLine): \Einvoicing\Invoice
Parameters
$line
:\Einvoicing\InvoiceLine
— Invoice line instance
Returns
\Einvoicing\Invoice
— Invoice instance
removeLine()
¶
Remove invoice line
public removeLine($index: int): \Einvoicing\Invoice
Parameters
$index
:int
— Invoice line index
Returns
\Einvoicing\Invoice
— Invoice instance
Throws
\OutOfBoundsException
if line index is out of bounds
clearLines()
¶
Clear all invoice lines
public clearLines(): \Einvoicing\Invoice
Returns
\Einvoicing\Invoice
— Invoice instance
getTotals()
¶
Get invoice total
public getTotals(): \Einvoicing\Models\InvoiceTotals
Returns
\Einvoicing\Models\InvoiceTotals
— Invoice totals
getAllowances()
¶
Get allowances
public getAllowances(): \Einvoicing\AllowanceOrCharge[]
Returns
\Einvoicing\AllowanceOrCharge
[] — Array of allowances
addAllowance()
¶
Add allowance
public addAllowance($allowance: \Einvoicing\AllowanceOrCharge): \Einvoicing\Invoice
Parameters
$allowance
:\Einvoicing\AllowanceOrCharge
— Allowance instance
Returns
\Einvoicing\Invoice
— This instance
removeAllowance()
¶
Remove allowance
public removeAllowance($index: int): \Einvoicing\Invoice
Parameters
$index
:int
— Allowance index
Returns
\Einvoicing\Invoice
— This instance
Throws
\OutOfBoundsException
if allowance index is out of bounds
clearAllowances()
¶
Clear all allowances
public clearAllowances(): \Einvoicing\Invoice
Returns
\Einvoicing\Invoice
— This instance
getCharges()
¶
Get charges
public getCharges(): \Einvoicing\AllowanceOrCharge[]
Returns
\Einvoicing\AllowanceOrCharge
[] — Array of charges
addCharge()
¶
Add charge
public addCharge($charge: \Einvoicing\AllowanceOrCharge): \Einvoicing\Invoice
Parameters
$charge
:\Einvoicing\AllowanceOrCharge
— Charge instance
Returns
\Einvoicing\Invoice
— This instance
removeCharge()
¶
Remove charge
public removeCharge($index: int): \Einvoicing\Invoice
Parameters
$index
:int
— Charge index
Returns
\Einvoicing\Invoice
— This instance
Throws
\OutOfBoundsException
if charge index is out of bounds
clearCharges()
¶
Clear all charges
public clearCharges(): \Einvoicing\Invoice
Returns
\Einvoicing\Invoice
— This instance
getAttachments()
¶
Get attachments
public getAttachments(): \Einvoicing\Attachment[]
Returns
\Einvoicing\Attachment
[] — Array of attachments
addAttachment()
¶
Add attachment
public addAttachment($attachment: \Einvoicing\Attachment): \Einvoicing\Invoice
Parameters
$attachment
:\Einvoicing\Attachment
— Attachment
Returns
\Einvoicing\Invoice
— This instance
removeAttachment()
¶
Remove attachment
public removeAttachment($index: int): \Einvoicing\Invoice
Parameters
$index
:int
— Attachment index
Returns
\Einvoicing\Invoice
— This instance
Throws
\OutOfBoundsException
if attachment index is out of bounds
clearAttachments()
¶
Clear all attachments
public clearAttachments(): \Einvoicing\Invoice
Returns
\Einvoicing\Invoice
— This instance
getBuyerAccountingReference()
¶
Get buyer accounting reference
public getBuyerAccountingReference(): string|null
Returns
string
|null
— Buyer accounting reference
setBuyerAccountingReference()
¶
Set buyer accounting reference
public setBuyerAccountingReference($buyerAccountingReference: string|null): \Einvoicing\Invoice
Parameters
$buyerAccountingReference
:string
|null
— Buyer accounting reference
Returns
\Einvoicing\Invoice
— This instance
getPeriodStartDate()
¶
Get period start date
public getPeriodStartDate(): \DateTime|null
Returns
\DateTime
|null
— Period start date
setPeriodStartDate()
¶
Set period start date
public setPeriodStartDate($periodStartDate: \DateTime|null): \Einvoicing\Invoice
Parameters
$periodStartDate
:\DateTime
|null
— Period start date
Returns
\Einvoicing\Invoice
— This instance
getPeriodEndDate()
¶
Get period end date
public getPeriodEndDate(): \DateTime|null
Returns
\DateTime
|null
— Period end date
setPeriodEndDate()
¶
Set period end date
public setPeriodEndDate($periodEndDate: \DateTime|null): \Einvoicing\Invoice
Parameters
$periodEndDate
:\DateTime
|null
— Period end date
Returns
\Einvoicing\Invoice
— This instance
validate()
¶
Validate invoice
public validate()
Throws
\Einvoicing\Exceptions\ValidationException
if failed to pass validation
getPrecedingInvoiceReferences()
¶
Get preceding invoice references
public getPrecedingInvoiceReferences(): \Einvoicing\InvoiceReference[]
Returns
\Einvoicing\InvoiceReference
[] — Array of preceding invoice references
addPrecedingInvoiceReference()
¶
Add preceding invoice reference
public addPrecedingInvoiceReference($reference: \Einvoicing\InvoiceReference): \Einvoicing\Invoice
Parameters
$reference
:\Einvoicing\InvoiceReference
— Preceding invoice reference
Returns
\Einvoicing\Invoice
— This instance
removePrecedingInvoiceReference()
¶
Remove preceding invoice reference
public removePrecedingInvoiceReference($index: int): \Einvoicing\Invoice
Parameters
$index
:int
— Preceding invoice reference index
Returns
\Einvoicing\Invoice
— This instance
Throws
\OutOfBoundsException
if preceding invoice reference index is out of bounds
clearPrecedingInvoiceReferences()
¶
Clear all preceding invoice references
public clearPrecedingInvoiceReferences(): \Einvoicing\Invoice
Returns
\Einvoicing\Invoice
— This instance