InvoiceListGenerator
in package
implements
InvoiceListGeneratorInterface
Class InvoiceListGenerator
Tags
Interfaces, Classes and Traits
- InvoiceListGeneratorInterface
- Interface InvoiceListGeneratorInterface
Table of Contents
- $db : CI_DB_query_builder
- $defaultLanguageId : int
- $paymentTitleProvider : PaymentTitleProvider
- __construct() : mixed
- InvoiceListGenerator constructor.
- filterInvoiceList() : InvoiceListItemCollection
- Filter invoice list items by the provided parameters.
- filterInvoiceListCount() : int
- Get the filtered invoice count.
- getInvoiceListByConditions() : InvoiceListItemCollection
- Returns an invoice list item collection by the given conditions.
- _createMemoCollectionByCustomersId() : CustomerMemoCollection
- Creates and returns a customer memo collection by the given customers id.
- _createOrderAddressBlockByRow() : OrderAddressBlock
- Creates an order address block object by the given type and row_array (looped result of CIDB::result_array())
- _createOrderType() : OrderPaymentType
- Creates and returns payment type instance by the given class and method argument.
- _filter() : CI_DB_result
- Filter the invoice records.
- _group() : InvoiceListGenerator
- Execute the group by statement.
- _invoicesColumns() : string
- Returns a string for the ::_select() method which contains column names of the invoices table.
- _limit() : $this|InvoiceListGenerator
- Add limit configuration to the database object.
- _order() : $this|InvoiceListGenerator
- Set the order by clause of the query.
- _ordersColumns() : string
- Returns a string for the ::_select() method which contains column names of the orders table.
- _ordersStatusColumns() : string
- Returns a string for the ::_select() method which contains column names of the orders_status table.
- _prepareCollection() : InvoiceListItemCollection
- Prepares the InvoiceListItemCollection by the passed result array.
- _select() : $this|InvoiceListGenerator
- Execute the select and join methods.
Properties
$db
protected
CI_DB_query_builder
$db
$defaultLanguageId
protected
int
$defaultLanguageId
$paymentTitleProvider
protected
PaymentTitleProvider
$paymentTitleProvider
Methods
__construct()
InvoiceListGenerator constructor.
public
__construct(CI_DB_query_builder $db, PaymentTitleProvider $paymentTitleProvider) : mixed
Parameters
- $db : CI_DB_query_builder
- $paymentTitleProvider : PaymentTitleProvider
Return values
mixed —filterInvoiceList()
Filter invoice list items by the provided parameters.
public
filterInvoiceList(array<string|int, mixed> $filterParameters[, IntType|null $startIndex = null ][, IntType|null $maxCount = null ][, StringType|null $orderBy = null ]) : InvoiceListItemCollection
The following slug names need to be used:
- invoiceNumber => invoices.invoice_number
- invoiceDate => invoices.invoice_date
- sum => invoices.total_sum
- customer => invoices.billing_firstname invoices.billing_lastname
- group => invoices.customer_status_name
- countryIsoCode => invoices.billing_country_iso_code_2
- orderNumber => invoices.order_id
- orderDate => invoices.order_date_purchased
- paymentMethod => invoices.payment_class
- status => orders_status.orders_status_name
Parameters
- $filterParameters : array<string|int, mixed>
-
Contains the column slug-names and their values.
- $startIndex : IntType|null = null
-
The start index of the wanted array to be returned (default = null).
- $maxCount : IntType|null = null
-
Maximum amount of items which should be returned (default = null).
- $orderBy : StringType|null = null
-
A string which defines how the items should be ordered (default = null).
Tags
Return values
InvoiceListItemCollection —filterInvoiceListCount()
Get the filtered invoice count.
public
filterInvoiceListCount(array<string|int, mixed> $filterParameters) : int
This number is useful for pagination functionality where the app needs to know the number of the filtered rows.
Parameters
- $filterParameters : array<string|int, mixed>
Tags
Return values
int —getInvoiceListByConditions()
Returns an invoice list item collection by the given conditions.
public
getInvoiceListByConditions([array<string|int, mixed> $conditions = [] ][, IntType|null $startIndex = null ][, IntType|null $maxCount = null ][, StringType|null $orderBy = null ]) : InvoiceListItemCollection
The other arguments helps to control fetched data.
Parameters
- $conditions : array<string|int, mixed> = []
-
(Optional) Conditions for tht where clause.
- $startIndex : IntType|null = null
-
(Optional) Start index for the limit clause.
- $maxCount : IntType|null = null
-
(Optional) Max count for the limit clause.
- $orderBy : StringType|null = null
-
(Optional) Sort order of fetched data.
Return values
InvoiceListItemCollection —_createMemoCollectionByCustomersId()
Creates and returns a customer memo collection by the given customers id.
protected
_createMemoCollectionByCustomersId(int $customersId) : CustomerMemoCollection
Parameters
- $customersId : int
-
Id of customer.
Tags
Return values
CustomerMemoCollection —_createOrderAddressBlockByRow()
Creates an order address block object by the given type and row_array (looped result of CIDB::result_array())
protected
_createOrderAddressBlockByRow(string $type, array<string|int, mixed> $row) : OrderAddressBlock
Parameters
- $type : string
-
Whether delivery or billing.
- $row : array<string|int, mixed>
-
Array which contain data about an order result row.
Tags
Return values
OrderAddressBlock —_createOrderType()
Creates and returns payment type instance by the given class and method argument.
protected
_createOrderType( $class, $method) : OrderPaymentType
Parameters
Tags
Return values
OrderPaymentType —_filter()
Filter the invoice records.
protected
_filter(array<string|int, mixed> $filterParameters[, IntType|null $startIndex = null ][, IntType|null $maxCount = null ][, StringType|null $orderBy = null ]) : CI_DB_result
This method contains the filtering logic. It can be overloaded in order to provide a custom filtering logic.
Parameters
- $filterParameters : array<string|int, mixed>
-
Contains the column slug-names and their values.
- $startIndex : IntType|null = null
-
The start index of the wanted array to be returned (default = null).
- $maxCount : IntType|null = null
-
Maximum amount of items which should be returned (default = null).
- $orderBy : StringType|null = null
-
A string which defines how the items should be ordered (default = null).
Tags
Return values
CI_DB_result —_group()
Execute the group by statement.
protected
_group() : InvoiceListGenerator
Return values
InvoiceListGenerator —Returns the instance object for method chaining.
_invoicesColumns()
Returns a string for the ::_select() method which contains column names of the invoices table.
protected
_invoicesColumns() : string
Return values
string —_limit()
Add limit configuration to the database object.
protected
_limit([IntType $startIndex = null ][, IntType $maxCount = null ]) : $this|InvoiceListGenerator
Parameters
Tags
Return values
$this|InvoiceListGenerator —Returns the instance object for method chaining.
_order()
Set the order by clause of the query.
protected
_order([StringType $orderBy = null ]) : $this|InvoiceListGenerator
Parameters
- $orderBy : StringType = null
Tags
Return values
$this|InvoiceListGenerator —Returns the instance object for method chaining.
_ordersColumns()
Returns a string for the ::_select() method which contains column names of the orders table.
protected
_ordersColumns() : string
Return values
string —_ordersStatusColumns()
Returns a string for the ::_select() method which contains column names of the orders_status table.
protected
_ordersStatusColumns() : string
Return values
string —_prepareCollection()
Prepares the InvoiceListItemCollection by the passed result array.
protected
_prepareCollection(array<string|int, mixed> $resultArray) : InvoiceListItemCollection
Parameters
- $resultArray : array<string|int, mixed>
-
Result array with fetched invoice data.
Return values
InvoiceListItemCollection —_select()
Execute the select and join methods.
protected
_select() : $this|InvoiceListGenerator
Return values
$this|InvoiceListGenerator —Returns the instance object for method chaining.