Invoice class.

NOTICE: Supports only Doctrine2 database engine.

category OSS
package OSS_Invoice
copyright Copyright (c) 2007 - 2012, Open Source Solutions Limited, Dublin, Ireland
license New BSD License

 Methods

Returns with this month's invoice to add new invoice items to.

getCurrentInvoice(\Entities\Customer $customer) : object
Static

If it does not exist then creates one. Returns with an Invoice model object.

see \global\self::getInvoicesFromThisMonth

Parameters

$customer

\Entities\Customer

Invoice for customer

Returns

objectInvoice model

Returns with a Doctrine_Collection object of all the invoices of which the start_date and end_date falls between $minDate and $maxDate respectively, ordered by start_date asc.

getInvoicesBetweenStartEnd(string $minDate, string $maxDate, \Entities\Customer | null $customer) : object
Static

Parameters

$minDate

string

$maxDate

string

$customer

\Entities\Customernull

Customer for filtering invoices.

Returns

objectDoctrine_Collection

Returns with a Doctrine_Collection object of all the invoices for which the start_date and end_date are in this month, ordered by start_date asc.

getInvoicesFromThisMonth(\Entities\Customer | null $customer) : object
Static

Calls getInvoicesBetweenStartEnd() .

see \global\self::getInvoicesBetweenStartEnd

Parameters

$customer

\Entities\Customernull

Customer for filtering invoices.

Returns

objectDoctrine_Collection

Returns with the non- and partially paid invoices as a Doctrine collection object.

getOutstanding(\Entities\Customer $customer, string $maxDate, string $orderBy, string $orderByDir) : object
Static

The Item objects in the collection are sorted by the due date, ascending.

Parameters

$customer

\Entities\Customer

default null if not null then will limit the serach to invoices for a given user

$maxDate

string

default null if not null then will limit the serach to invoices having tax_date <= $pMaxDate, must be in "YYYY-MM-DD" format

$orderBy

string

Order by field

$orderByDir

string

Order by direction e.g. ASC, DESC

Returns

object

Returns with a simple statistics about non- and partially paid invoices as an associative array in which the key 'sum_total' contains the sum of the total to be paid, 'sum_received' the sum of the already received money and 'howmany' the number of invoices.

getOutstandingStat(\Entities\Customer $customer) : array
Static

Parameters

$customer

\Entities\Customer

Returns

array

Returns with the sum of received amount from all invoices.

getReceivedSumValue(\Entities\Customer | null $customer) : float
Static

Parameters

$customer

\Entities\Customernull

Customer for filtering invoice

Returns

float

Returns unpaid invoices.

getUnpaidInvoices(\Entites\Customer | null $customer) : array
Static

If $customer not null it will filter unpaid invoices for customer.

Parameters

$customer

\Entites\Customernull

Customer for invoice filtering.

Returns

array

Getting Doctrine2 entity manager

getStaticD2EM() : \EntityManager
Static

Returns

\EntityManager