InvoiceListGenerator

Implements \InvoiceListGeneratorInterface

Class InvoiceListGenerator

category

System

package

Invoice

Methods

InvoiceListGenerator constructor.

__construct(\CI_DB_query_builder $db, \PaymentTitleProvider $paymentTitleProvider) 

Arguments

$db

\CI_DB_query_builder

$paymentTitleProvider

\PaymentTitleProvider

Creates and returns a customer memo collection by the given customers id.

_createMemoCollectionByCustomersId(integer $customersId) : \CustomerMemoCollection
Todo

Equal to OrderListGenerator::_createMemoCollectionByCustomersId() method. Maybe outsource in abstract parent.

Arguments

$customersId

integer

Id of customer.

Response

\CustomerMemoCollection

Creates an order address block object by the given type and row_array (looped result of CIDB::result_array())

_createOrderAddressBlockByRow(string $type, array $row) : \OrderAddressBlock
Todo

Equal to OrderListGenerator::_createOrderAddressBlockByRow() method. Maybe outsource in abstract parent.

Arguments

$type

string

Whether delivery or billing.

$row

array

Array which contain data about an order result row.

Response

\OrderAddressBlock

Creates and returns payment type instance by the given class and method argument.

_createOrderType( $class,  $method) : \OrderPaymentType
Throws
\InvalidArgumentException

Arguments

$class

data about the class type.

$method

data about the method type.

Response

\OrderPaymentType

Filter the invoice records.

_filter(array $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.

Throws
\BadMethodCallException

Arguments

$filterParameters

array

Contains the column slug-names and their values.

$startIndex

\IntType|null

The start index of the wanted array to be returned (default = null).

$maxCount

\IntType|null

Maximum amount of items which should be returned (default = null).

$orderBy

\StringType|null

A string which defines how the items should be ordered (default = null).

Response

\CI_DB_result

Execute the group by statement.

_group() : \InvoiceListGenerator

Response

\InvoiceListGenerator

Returns the instance object for method chaining.

Returns a string for the ::_select() method which contains column names of the invoices table.

_invoicesColumns() : string

Response

string

Add limit configuration to the database object.

_limit(\IntType $startIndex = null, \IntType $maxCount = null) : $this|\InvoiceListGenerator
Todo

Equal to OrderListGenerator::_limit() method. Maybe outsource in abstract parent.

Arguments

$startIndex

\IntType

$maxCount

\IntType

Response

$this|\InvoiceListGenerator

Returns the instance object for method chaining.

Set the order by clause of the query.

_order(\StringType $orderBy = null) : $this|\InvoiceListGenerator
Todo

Equal to OrderListGenerator::_order() method. Maybe outsource in abstract parent.

Arguments

$orderBy

\StringType

Response

$this|\InvoiceListGenerator

Returns the instance object for method chaining.

Returns a string for the ::_select() method which contains column names of the orders table.

_ordersColumns() : string

Response

string

Returns a string for the ::_select() method which contains column names of the orders_status table.

_ordersStatusColumns() : string

Response

string

Prepares the InvoiceListItemCollection by the passed result array.

_prepareCollection(array $resultArray) : \InvoiceListItemCollection

Arguments

$resultArray

array

Result array with fetched invoice data.

Response

\InvoiceListItemCollection

Execute the select and join methods.

_select() : $this|\InvoiceListGenerator

Response

$this|\InvoiceListGenerator

Returns the instance object for method chaining.

Filter invoice list items by the provided parameters.

filterInvoiceList(array $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
Throws
\BadMethodCallException
\InvalidArgumentException

Arguments

$filterParameters

array

Contains the column slug-names and their values.

$startIndex

\IntType|null

The start index of the wanted array to be returned (default = null).

$maxCount

\IntType|null

Maximum amount of items which should be returned (default = null).

$orderBy

\StringType|null

A string which defines how the items should be ordered (default = null).

Response

\InvoiceListItemCollection

Get the filtered invoice count.

filterInvoiceListCount(array $filterParameters) : integer

This number is useful for pagination functionality where the app needs to know the number of the filtered rows.

Throws
\BadMethodCallException

Arguments

$filterParameters

array

Response

integer

Returns an invoice list item collection by the given conditions.

getInvoiceListByConditions(array $conditions = array(), \IntType|null $startIndex = null, \IntType|null $maxCount = null, \StringType|null $orderBy = null) : \InvoiceListItemCollection

The other arguments helps to control fetched data.

Arguments

$conditions

array

(Optional) Conditions for tht where clause.

$startIndex

\IntType|null

(Optional) Start index for the limit clause.

$maxCount

\IntType|null

(Optional) Max count for the limit clause.

$orderBy

\StringType|null

(Optional) Sort order of fetched data.

Response

\InvoiceListItemCollection

Properties

db

db : \CI_DB_query_builder
var

Type(s)

\CI_DB_query_builder

defaultLanguageId

defaultLanguageId : integer
var

Type(s)

integer

paymentTitleProvider

paymentTitleProvider : \PaymentTitleProvider
var

Type(s)

\PaymentTitleProvider