QuotationDelivery extends InvoiceDelivery
Quotation Delivery component
Consolidates quotation creation and delivery. Supports the same delivery methods as Invoices.
Table of Contents
Properties
| $components | |
| $helpers | |
| $models | |
| $company | |
| $company_settings | |
| $language | |
| $quotations |
Methods
| __construct() | Initialize the Quotation Delivery object |
| deliverInvoices() | Delivers a set of invoices using the given delivery method. All invoices are compiled together into a single document. |
| deliverQuotations() | Delivers a set of quotations using the given delivery method. All quotations are compiled together into a single document. |
| downloadInvoices() | Offers for download a set of invoices. All invoices are compiled together into a single document. |
| downloadQuotations() | Offers for download a set of quotations. All quotations are compiled together into a single document. |
| errors() | Returns an errors raised |
| trimSettings() | Removes all settings not relevant to invoices from a list of settings |
| buildDocument() | Generates a PDF document for the given quotations on a specific quotation template |
| buildQuotations() | Takes an array of quotations and constructs a single document object containing all quotation data (e.g. can create a single PDF containing multiple quotations). |
| getQuotations() | Fetches quotations and groups them by client ID |
| primeCompany() | Sets the company and company settings properties for the current company |
Properties
$components
protected
mixed
$components
$helpers
protected
mixed
$helpers
$models
protected
mixed
$models
$company
private
object
$company
An object representing the company being processed
$company_settings
private
array<string|int, mixed>
$company_settings
Company settings
$language
private
string
$language
The language code to use for all email correspondence
$quotations
private
array<string|int, mixed>
$quotations
An array of stdClass objects representing quotations
Methods
__construct()
Initialize the Quotation Delivery object
public
__construct() : mixed
deliverInvoices()
Delivers a set of invoices using the given delivery method. All invoices are compiled together into a single document.
public
deliverInvoices(array<string|int, mixed> $invoice_ids, string $delivery_method[, mixed $deliver_to = null ][, string $from_staff_id = null ][, array<string|int, mixed> $options = null ]) : mixed
Parameters
- $invoice_ids : array<string|int, mixed>
-
An array of invoice IDs to deliver
- $delivery_method : string
-
The delivery method (email, interfax, postalmethods)
- $deliver_to : mixed = null
-
The destination of the invoices, a string or array of email addresses or fax numbers (optional, can not override invoice postal address)
- $from_staff_id : string = null
-
The ID of the staff member this invoice is to be delivered from (optional)
- $options : array<string|int, mixed> = null
-
An array of additional options to pass and may include:
- base_client_url The base URL to the client interface
- email_template The email template name to use (optional)
- email_tags An array of key/value tag replacements (optional)
- language The language to use (optional, defaults to the invoice client's language, or the system's language otherwise)
deliverQuotations()
Delivers a set of quotations using the given delivery method. All quotations are compiled together into a single document.
public
deliverQuotations(array<string|int, mixed> $quotation_ids, string $delivery_method[, mixed $deliver_to = null ][, string $from_staff_id = null ][, array<string|int, mixed> $options = null ]) : mixed
Parameters
- $quotation_ids : array<string|int, mixed>
-
An array of quotation IDs to deliver
- $delivery_method : string
-
The delivery method (email, interfax, postalmethods)
- $deliver_to : mixed = null
-
The destination of the quotations, a string or array of email addresses or fax numbers (optional, can not override quotation postal address)
- $from_staff_id : string = null
-
The ID of the staff member this quotation is to be delivered from (optional)
- $options : array<string|int, mixed> = null
-
An array of additional options to pass and may include:
- base_client_url The base URL to the client interface
- email_template The email template name to use (optional)
- email_tags An array of key/value tag replacements (optional)
- language The language to use (optional, defaults to the quotation client's language, or the system's language otherwise)
downloadInvoices()
Offers for download a set of invoices. All invoices are compiled together into a single document.
public
downloadInvoices(array<string|int, mixed> $invoice_ids[, array<string|int, mixed> $options = null ]) : mixed
Parameters
- $invoice_ids : array<string|int, mixed>
-
A numerically-indexed array of invoice IDs from which to download
- $options : array<string|int, mixed> = null
-
An array of options including (optional):
- language The language to use (optional, defaults to the invoice client's language, or the system's language otherwise)
downloadQuotations()
Offers for download a set of quotations. All quotations are compiled together into a single document.
public
downloadQuotations(array<string|int, mixed> $quotation_ids[, array<string|int, mixed> $options = null ]) : mixed
Parameters
- $quotation_ids : array<string|int, mixed>
-
A numerically-indexed array of quotation IDs from which to download
- $options : array<string|int, mixed> = null
-
An array of options including (optional):
- language The language to use (optional, defaults to the quotation client's language, or the system's language otherwise)
errors()
Returns an errors raised
public
errors() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of errors, boolean false if no errors were set
trimSettings()
Removes all settings not relevant to invoices from a list of settings
protected
trimSettings(array<string|int, mixed> $settings[, mixed $company_id = null ]) : array<string|int, mixed>
Parameters
- $settings : array<string|int, mixed>
-
The list of settings to filter
- $company_id : mixed = null
Return values
array<string|int, mixed> —The filtered list of settings
buildDocument()
Generates a PDF document for the given quotations on a specific quotation template
private
buildDocument(string $language, bool $include_address[, array<string|int, mixed> $quotations = null ]) : InvoiceTemplates
Parameters
- $language : string
-
The language for all quotations in the document
- $include_address : bool
-
True to include the address on the quotation
- $quotations : array<string|int, mixed> = null
-
A numerically indexed array of quotation objects
Return values
InvoiceTemplates —The document of the quotations
buildQuotations()
Takes an array of quotations and constructs a single document object containing all quotation data (e.g. can create a single PDF containing multiple quotations).
private
buildQuotations(array<string|int, mixed> $quotations[, bool $include_address = true ][, array<string|int, mixed> $options = null ]) : object
Parameters
- $quotations : array<string|int, mixed>
- $include_address : bool = true
-
True to include address information on the quotations, false otherwise
- $options : array<string|int, mixed> = null
-
An array of options including (optional):
- language The language to use (optional, defaults to the quotation client's language, or the system's language otherwise)
Return values
object —The object containing the build quotations
getQuotations()
Fetches quotations and groups them by client ID
private
getQuotations(array<string|int, mixed> $quotation_ids[, bool $merge = false ]) : array<string|int, mixed>
Parameters
- $quotation_ids : array<string|int, mixed>
-
An array of quotation ID numbers to fetch
- $merge : bool = false
-
True to merge all quotations together in single large array, false to keep quotations divided by client ID
Return values
array<string|int, mixed> —An array of stdClass quotation object grouped by client ID (if $merge is true 1st index is numeric, otherwise 1st index is client ID, 2nd index is numeric)
primeCompany()
Sets the company and company settings properties for the current company
private
primeCompany([int $company_id = null ]) : mixed
Parameters
- $company_id : int = null
-
The ID of the company to prime