| 
				 public 
				
				
				 | 
			#
			__construct( )
				
Initialize Invoices Overrides | 
		
			| 
				 public 
				integer
				
				 | 
			#
			add( array $vars )
				
Creates a new invoice using the given data 
				
Creates a new invoice using the given data Parameters
						$varsarray$vars An array of invoice data including: - client_id The client ID the invoice
belongs to - date_billed The date the invoice goes into effect - date_due The
date the invoice is due - date_closed The date the invoice was closed -
date_autodebit The date the invoice should be autodebited - status
'active','draft','proforma', or 'void' - currency The ISO 4217 3-character
currency code of the invoice - note_public Notes visible to the client -
note_private Notes visible only to staff members - lines A numerically indexed
array of line item info including: - service_id The service ID attached to this
line item (optional) - description The line item description - qty The quantity
for this line item (min. 1) - amount The unit cost (cost per quantity) for this
line item - tax Whether or not to tax the line item - term The term for the
recurring invoice as an integer 1-65535, if blank will not be considered for a
recurring invoice - period The period for the recurring invoice ('day', 'week',
'month', 'year') - duration The duration of the recurring invoice
('indefinitely' for forever or 'times' for a set number of times) -
duration_time The number of times an invoice should recur - recur_date_billed
The date the next invoice will be created - delivery A numerically indexed array
of delivery methods
Returns
						integerThe invoice ID, void on error
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			addRecurring( array $vars )
				
Creates a new recurring invoice using the given data 
				
Creates a new recurring invoice using the given data Parameters
						$varsarray$vars An array of invoice data including: - client_id The client ID the invoice
belongs to - term The term as an integer 1-65535 (optional, default 1) - period
The period, 'day', 'week', 'month', 'year' - duration The number of times this
invoice will recur or null to recur indefinitely - date_renews The date the next
invoice will be created - currency The currency this invoice is created in -
note_public Notes visible to the client - note_private Notes visible only to
staff members - lines A numerically indexed array of line item info including: -
description The line item description - qty The quantity for this line item
(min. 1) - amount The unit cost (cost per quantity) for this line item - tax
Whether or not to tax the line item - delivery A numerically indexed array of
delivery methods
Returns
						integerThe recurring invoice ID, void on error
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			edit( integer $invoice_id, array $vars )
				
Updates an invoice using the given data. If a new line item is added, or the
quantity, unit cost, or tax status of an item is updated the latest tax rules
will be applied to this invoice. 
				
Updates an invoice using the given data. If a new line item is added, or the
quantity, unit cost, or tax status of an item is updated the latest tax rules
will be applied to this invoice. Parameters
						$invoice_idinteger$invoice_id The ID of the invoice to update
$varsarray$vars An array of invoice data (all optional unless noted otherwise) including:
- client_id The client ID the invoice belongs to - date_billed The date the
invoice goes into effect - date_due The date the invoice is due - date_closed
The date the invoice was closed - date_autodebit The date the invoice should be
autodebited - status 'active','draft','proforma', or 'void' - currency The ISO
4217 3-character currency code of the invoice - note_public Notes visible to the
client - note_private Notes visible only to staff members - lines A numerically
indexed array of line item info including: - id The ID for this line item
(required to update, else will add as new) - service_id The service ID attached
to this line item - description The line item description (if empty, along with
amount, will delete line item) - qty The quantity for this line item (min. 1) -
amount The unit cost (cost per quantity) for this line item (if empty, along
with description, will delete line item) - tax Whether or not to tax the line
item - term If editing a draft, the term for the recurring invoice as an integer
1-65535, if blank will not be considered for a recurring invoice - period If
editing a draft, the period for the recurring invoice ('day', 'week', 'month',
'year') - duration If editing a draft, the duration of the recurring invoice
('indefinitely' for forever or 'times' for a set number of times) -
duration_time If editing a draft, the number of times an invoice should recur -
recur_date_billed If editing a draft, the date the next invoice will be created
- delivery A numerically indexed array of delivery methods
Returns
						integerThe invoice ID, void on error
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			editRecurring( integer $invoice_recur_id, array $vars )
				
Updates a recurring invoice using the given data. If a new line item is
added, or the quantity, unit cost, or tax status of an item is updated the
latest tax rules will be applied to this invoice. 
				
Updates a recurring invoice using the given data. If a new line item is
added, or the quantity, unit cost, or tax status of an item is updated the
latest tax rules will be applied to this invoice. Parameters
						$invoice_recur_idinteger$invoice_recur_id The ID of the recurring invoice to update
$varsarray$vars An array of invoice data (all optional) including: - client_id The client
ID the recurring invoice belongs to - term The term as an integer 1-65535
(optional, default 1) - period The period, 'day', 'week', 'month', 'year' -
duration The number of times this invoice will recur or null to recur
indefinitely - date_renews The date the next invoice will be created -
date_last_renewed The date the last invoice was created (optional) - not
recommended to overwrite this value - currency The currency this invoice is
created in - note_public Notes visible to the client - note_private Notes
visible only to staff members - lines A numerically indexed array of line item
info including: - id The ID for this line item (required to update, else will
add as new) - description The line item description (if empty, along with
amount, will delete line item) - qty The quantity for this line item (min. 1) -
amount The unit cost (cost per quantity) for this line item (if empty, along
with description, will delete line item) - tax Whether or not to tax the line
item - delivery A numerically indexed array of delivery methods
Returns
						integerThe recurring invoice ID, void on error
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			addFromRecurring( integer $invoice_recur_id, array $client_settings = null )
				
Creates a new invoice if the given recurring invoice is set to be renewed 
				
Creates a new invoice if the given recurring invoice is set to be renewed Parameters
						$invoice_recur_idinteger$invoice_recur_id The recurring invoice ID
$client_settingsarray$client_settings A list of client settings belonging to this invoice's client
(optional)
Returns
						booleanTrue if any invoices were created from this recurring invoice, false otherwise
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			deleteDraft( integer $invoice_id )
				
Permanently deletes a draft invoice 
				
Permanently deletes a draft invoice Parameters
						$invoice_idinteger$invoice_id The invoice ID of the draft invoice to delete
 | 
		
			| 
				 public 
				
				
				 | 
			#
			deleteRecurring( integer $invoice_recur_id )
				
Permanently removes a recurring invoice from the system 
				
Permanently removes a recurring invoice from the system Parameters
						$invoice_recur_idinteger$invoice_recur_id The ID of the recurring invoice to delete
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			createFromServices( integer $client_id, array $service_ids, string $currency, string $due_date, boolean $allow_pro_rata = true, boolean $services_renew = false )
				
Creates an invoice from a set of services 
				
Creates an invoice from a set of services Parameters
						$client_idinteger$client_id The ID of the client to create the invoice for
$service_idsarray$service_ids A numerically-indexed array of service IDs to generate line items
from
$currencystring$currency The currency code to use to generate the invoice
$due_datestring$due_date The date the invoice is to be due
$allow_pro_rataboolean$allow_pro_rata True to allow the services to be priced considering the package
pro rata details, or false otherwise (optional, default true)
$services_renewboolean$services_renew True if all of the given $service_ids are renewing services, or
false if all $service_ids are new services (optional, default false)
Returns
						integer$invoice_id The ID of the invoice generated
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			appendServices( integer $invoice_id, array $service_ids )
				
Edits an invoice to append a set of service IDs as line items 
				
Edits an invoice to append a set of service IDs as line items Parameters
						$invoice_idinteger$invoice_id The ID of the invoice to append to
$service_idsarray$service_ids A numerically-indexed array of service IDs to generate line items
from
Returns
						integer$invoice_id The ID of the invoice updated
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			setClosed( integer $invoice_id )
				
Sets the invoice to closed if the invoice has been paid in full, otherwise
removes any closed status previously set on the invoice. Only invoices with
status of 'active' can be closed. 
				
Sets the invoice to closed if the invoice has been paid in full, otherwise
removes any closed status previously set on the invoice. Only invoices with
status of 'active' can be closed. Parameters
						$invoice_idinteger$invoice_id The ID of the invoice to close or unclose
Returns
						booleanTrue if the invoice was closed, false otherwise
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			get( integer $invoice_id )
				
Fetches the given invoice 
				
Fetches the given invoice Parameters
						$invoice_idinteger$invoice_id The ID of the invoice to fetch
Returns
						mixedA stdClass object containing invoice information, false if no such invoice
exists
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getRecurring( integer $invoice_recur_id )
				
Fetches the given recurring invoice 
				
Fetches the given recurring invoice Parameters
						$invoice_recur_idinteger$invoice_recur_id The ID of the recurring invoice to fetch
Returns
						mixedA stdClass object containing recurring invoice information, false if no such
recurring invoice exists
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getRecurringFromInvoices( integer $invoice_id )
				
Fetches the recurring invoice record that produced the given invoice ID 
				
Fetches the recurring invoice record that produced the given invoice ID Parameters
						$invoice_idinteger$invoice_id The ID of the invoice created by a recurring invoice
Returns
						mixedA stdClass object representing the recurring invoice, false if no such recurring
invoice exists or the invoice was not created from a recurring invoice
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getTaxTotals( float $line_subtotal, array $taxes )
				
Calculates the amount of tax for each tax rule given that applies to the
given line sub total (which is unit cost * quantity). Also returns the line
total including inclusive tax rules as well as the total with all tax rules 
				
Calculates the amount of tax for each tax rule given that applies to the
given line sub total (which is unit cost * quantity). Also returns the line
total including inclusive tax rules as well as the total with all tax rules Parameters
						$line_subtotalfloat$line_subtotal The subtotal (quanity * unit cost) for the line item
$taxesarray$taxes An array of stdClass objects each representing a tax rule to be applied
to the line subtotal
Returns
						arrayAn array containing the following: - tax An array of tax rule applied amounts -
tax_subtotal The tax subtotal (all inclusive taxes applied) - tax_total All
taxes applied (inclusive and exclusive) - line_total The total for the line
including inclusive taxes - line_total_w_tax The total for the line including
all taxes (inclusive and exclusive)
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getLineItems( integer $invoice_id )
				
Fetches all line items belonging to the given invoice 
				
Fetches all line items belonging to the given invoice Parameters
						$invoice_idinteger$invoice_id The ID of the invoice to fetch line items for
Returns
						arrayAn array of stdClass objects each representing a line item
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getRecurringLineItems( integer $invoice_recur_id )
				
Fetches all line items belonging to the given recurring invoice 
				
Fetches all line items belonging to the given recurring invoice Parameters
						$invoice_recur_idinteger$invoice_recur_id The ID of the recurring invoice to fetch line items for
Returns
						arrayAn array of stdClass objects each representing a line item
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getList( integer $client_id = null, string $status = "open", integer $page = 1, array $order_by = array('date_due'=>"ASC") )
				
Fetches a list of invoices for a client 
				
Fetches a list of invoices for a client Parameters
						$client_idinteger$client_id The client ID (optional, default null to get invoices for all
clients)
$statusstring$status The status type of the invoices to fetch (optional, default 'open') one
of the following: - open Fetches all active open invoices - closed Fetches all
closed invoices - past_due Fetches all active past due invoices - draft Fetches
all invoices with a status of "draft" - void Fetches all invoices with a status
of "void" - active Fetches all invoices with a status of "active" - proforma
Fetches all invoices with a status of "proforma" - to_autodebit Fetches all
invoices that are ready to be autodebited now, and which can be with an active
client and payment account to do so - pending_autodebit Fetches all invoice that
are set to be autodebited in the future, and which have an active client and
payment account to do so with - to_print Fetches all paper invoices set to be
printed - printed Fetches all paper invoices that have been set as printed -
pending Fetches all active invoices that have not been billed for yet -
to_deliver Fetches all invoices set to be delivered by a method other than paper
(i.e. deliverable invoices not in the list of those "to_print") - all Fetches
all invoices
$pageinteger$page The page to return results for (optional, default 1)
$order_byarray$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"),
optional)
Returns
						arrayAn array of stdClass objects containing invoice information, or false if no
invoices exist
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getListCount( integer $client_id = null, string $status = "open" )
				
Returns the total number of invoices returned from Invoices::getClientList(),
useful in constructing pagination for the getList() method. 
				
Returns the total number of invoices returned from Invoices::getClientList(),
useful in constructing pagination for the getList() method. Parameters
						$client_idinteger$client_id The client ID (optional, default null to get invoice count for all
clients)
$statusstring$status The status type of the invoices to fetch (optional, default 'open') one
of the following: - open Fetches all active open invoices - closed Fetches all
closed invoices - past_due Fetches all active past due invoices - draft Fetches
all invoices with a status of "draft" - void Fetches all invoices with a status
of "void" - active Fetches all invoices with a status of "active" - proforma
Fetches all invoices with a status of "proforma" - to_autodebit Fetches all
invoices that are ready to be autodebited now, and which can be with an active
client and payment account to do so - pending_autodebit Fetches all invoice that
are set to be autodebited in the future, and which have an active client and
payment account to do so with - to_print Fetches all paper invoices set to be
printed - printed Fetches all paper invoices that have been set as printed -
pending Fetches all active invoices that have not been billed for yet -
to_deliver Fetches all invoices set to be delivered by a method other than paper
(i.e. deliverable invoices not in the list of those "to_print") - all Fetches
all invoices
Returns
						integerThe total number of invoices
 
 See | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAll( integer $client_id = null, string $status = "open", array $order_by = array('date_due'=>"ASC"), string $currency = null )
				
Fetches all invoices for a client 
				
Fetches all invoices for a client Parameters
						$client_idinteger$client_id The client ID (optional, default null to get invoices for all
clients)
$statusstring$status The status type of the invoices to fetch (optional, default 'open') one
of the following: - open Fetches all active open invoices - closed Fetches all
closed invoices - past_due Fetches all active past due invoices - draft Fetches
all invoices with a status of "draft" - void Fetches all invoices with a status
of "void" - active Fetches all invoices with a status of "active" - proforma
Fetches all invoices with a status of "proforma" - to_autodebit Fetches all
invoices that are ready to be autodebited now, and which can be with an active
client and payment account to do so - pending_autodebit Fetches all invoice that
are set to be autodebited in the future, and which have an active client and
payment account to do so with - to_print Fetches all paper invoices set to be
printed - printed Fetches all paper invoices that have been set as printed -
pending Fetches all active invoices that have not been billed for yet -
to_deliver Fetches all invoices set to be delivered by a method other than paper
(i.e. deliverable invoices not in the list of those "to_print") - all Fetches
all invoices
$order_byarray$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"),
optional)
$currencystring$currency The currency code to limit results on (null = any currency)
Returns
						arrayAn array of stdClass objects containing invoice information
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			getAllWithService( integer $service_id, integer $client_id = null, string $status = "open", array $order_by = array('date_due'=>"ASC") )
				
Fetches all invoices that contain the given service 
				
Fetches all invoices that contain the given service Parameters
						$service_idinteger$service_id The ID of the service whose invoices to fetch
$client_idinteger$client_id The client ID (optional, default null to get invoices for all
clients)
$statusstring$status The status type of the invoices to fetch (optional, default 'open') one
of the following: - open Fetches all active open invoices - closed Fetches all
closed invoices - past_due Fetches all active past due invoices - draft Fetches
all invoices with a status of "draft" - void Fetches all invoices with a status
of "void" - active Fetches all invoices with a status of "active" - proforma
Fetches all invoices with a status of "proforma" - to_autodebit Fetches all
invoices that are ready to be autodebited now, and which can be with an active
client and payment account to do so - pending_autodebit Fetches all invoice that
are set to be autodebited in the future, and which have an active client and
payment account to do so with - to_print Fetches all paper invoices set to be
printed - printed Fetches all paper invoices that have been set as printed -
pending Fetches all active invoices that have not been billed for yet -
to_deliver Fetches all invoices set to be delivered by a method other than paper
(i.e. deliverable invoices not in the list of those "to_print") - all Fetches
all invoices
$order_byarray$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"),
optional)
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAllAutodebitableInvoices( integer $client_group_id, boolean $pending = false, string $days = "autodebit_days_before_due" )
				
Fetches all invoices for this company that are autodebitable by their
respective clients 
				
Fetches all invoices for this company that are autodebitable by their
respective clients Parameters
						$client_group_idinteger$client_group_id The client group ID
$pendingboolean$pending True to fetch all invoices that will be ready to autodebit in the
future, or false to fetch all invoices ready to be autodebited (optional,
default false)
$daysstring$days The number of days before invoices are to be autodebited -
autodebit_days_before_due Use the autodebit days before due setting -
notice_pending_autodebit Use the autodebit days before due setting plus the
notice pending autodebit setting
Returns
						arrayAn array of client IDs, each containing an array of stdClass objects
representing invoice information
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			search( string $query, integer $page = 1 )
				
Search invoices Parameters
						$querystring$query The value to search invoices for
$pageinteger$page The page number of results to fetch (optional, default 1)
Returns
						arrayAn array of invoices that match the search criteria
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			getSearchCount( string $query )
				
Return the total number of invoices returned from Invoices::search(), useful
in constructing pagination 
				
Return the total number of invoices returned from Invoices::search(), useful
in constructing pagination Parameters
						$querystring$query The value to search invoices for
See | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAllRecurring( integer $client_id = null )
				
Fetches all recurring invoices for a client 
				
Fetches all recurring invoices for a client Parameters
						$client_idinteger$client_id The client ID (optional, default null to get recurring invoices for
all clients)
Returns
						arrayAn array of stdClass objects containing recurring invoice information
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAllRenewingRecurring( integer $client_group_id )
				
Fetches all renewing recurring invoices. That is, where the date_renews is
<= current date + the maximum invoice days before renewal for the current
client group and the recurring invoice has not already created all invoices to
be created. 
				
Fetches all renewing recurring invoices. That is, where the date_renews is
<= current date + the maximum invoice days before renewal for the current
client group and the recurring invoice has not already created all invoices to
be created. Parameters
						$client_group_idinteger$client_group_id The ID of the client group whose renewing recurring invoices to
fetch
Returns
						arrayAn array of stdClass objects, each representing a recurring invoice
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getRecurringList( integer $client_id = null, integer $page = 1, array $order = array('id'=>"asc") )
				
Fetches a list of recurring invoices for a client 
				
Fetches a list of recurring invoices for a client Parameters
						$client_idinteger$client_id The client ID (optional, default null to get recurring invoices for
all clients)
$pageinteger$page The page to return results for
$orderarray$order The fields and direction to order by. Key/value pairs where key is the
field and value is the direction (asc/desc)
Returns
						arrayAn array of stdClass objects containing recurring invoice information
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getRecurringListCount( integer $client_id )
				
Return the total number of recurring invoices returned from
Invoices::getRecurringList(), useful in constructing pagination for the
getList() method. 
				
Return the total number of recurring invoices returned from
Invoices::getRecurringList(), useful in constructing pagination for the
getList() method. Parameters
						$client_idinteger$client_id The client ID
Returns
						integerThe total number of recurring invoices
 
 See | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getRecurringInfo( integer $invoice_id )
				
Evaluates the given invoice, performs necessary looks ups to determine if the
invoice is for a recurring invoice or service. Returns the term and period for
the recurring invoice or service. 
				
Evaluates the given invoice, performs necessary looks ups to determine if the
invoice is for a recurring invoice or service. Returns the term and period for
the recurring invoice or service. Parameters
						$invoice_idinteger$invoice_id The ID of the invoice
Returns
						mixedboolean false if the invoice is not for a recurring service or invoice,
otherwise an array of recurring info including: - amount The amount to recur -
term The term to recur - period The recurring period (day, week, month, year,
onetime) used in conjunction with term in order to determine the next recurring
payment
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getPricingPeriods( )
				
Retrieves a list of recurring invoice periods 
				
Retrieves a list of recurring invoice periods Returns
						arrayKey=>value pairs of recurring invoice pricing periods
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getAutodebitDate( integer $invoice_id )
				
Retrieves the date that the given invoice should be autodebited. This
considers current client settings and autodebit accounts. 
				
Retrieves the date that the given invoice should be autodebited. This
considers current client settings and autodebit accounts. Parameters
						$invoice_idinteger$invoice_id The ID of the invoice
Returns
						mixedA string representing the UTC date that this invoice will be autodebited, or
false if the invoice cannot be autodebited
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getStatusCount( integer $client_id = null, string $status = "open" )
				
Retrieves the number of invoices given an invoice status for the given
client 
				
Retrieves the number of invoices given an invoice status for the given
client Parameters
						$client_idinteger$client_id The client ID (optional, default null to get invoice count for
company)
$statusstring$status The status type of the invoices to fetch (optional, default 'open') one
of the following: - open Fetches all active open invoices - closed Fetches all
closed invoices - past_due Fetches all active past due invoices - draft Fetches
all invoices with a status of "draft" - void Fetches all invoices with a status
of "void" - active Fetches all invoices with a status of "active" - proforma
Fetches all invoices with a status of "proforma" - to_print Fetches all paper
invoices set to be printed - printed Fetches all paper invoices that have been
set as printed - pending Fetches all active invoices that have not been billed
for yet - to_deliver Fetches all invoices set to be delivered by a method other
than paper (i.e. deliverable invoices not in the list of those "to_print")
Returns
						integerThe number of invoices of type $status for $client_id
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getRecurringCount( integer $client_id = null )
				
Retrieves the number of recurring invoices for the given client 
				
Retrieves the number of recurring invoices for the given client Parameters
						$client_idinteger$client_id The client ID (optional, default null to get recurring invoice count
for company)
Returns
						integerThe number of recurring invoices for $client_id
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getDelivery( integer $invoice_id, boolean $sent = null )
				
Fetches all invoice delivery methods this invoice is assigned 
				
Fetches all invoice delivery methods this invoice is assigned Parameters
						$invoice_idinteger$invoice_id The ID of the invoice
$sentboolean$sent True to get only invoice delivery records that have been sent, or false to
get only delivery records that have not been sent (optional, defaults to fetch
all)
Returns
						arrayAn array of stdClass objects containing invoice delivery log information
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAllDelivery( array $invoice_ids = null, string $delivery_method = null, string $status = "all" )
				
Fetches all invoice delivery records assigned to each of the given invoice
IDs 
				
Fetches all invoice delivery records assigned to each of the given invoice
IDs Parameters
						$invoice_idsarray$invoice_ids A list of invoice IDs (optional)
$delivery_methodstring$delivery_method The delivery method to filter by (e.g. "email"), (optional)
$statusstring$status The delivery status, either "all" for all, "unsent" for deliveries not
marked sent, or "sent" for deliveries marked sent (optional, default "all")
Returns
						arrayAn array of stdClass objects containing invoice delivery log information
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getRecurringDelivery( integer $invoice_recur_id )
				
Fetches all invoice delivery methods this recurring invoice is assigned 
				
Fetches all invoice delivery methods this recurring invoice is assigned Parameters
						$invoice_recur_idinteger$invoice_recur_id The ID of the recurring invoice
Returns
						arrayAn array of stdClass objects containing invoice delivery log information
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			addDelivery( integer $invoice_id, array $vars, integer $client_id )
				
Adds the invoice delivery status for the given invoice 
				
Adds the invoice delivery status for the given invoice Parameters
						$invoice_idinteger$invoice_id The ID of the invoice to update delivery status for
$varsarray$vars An array of invoice delivery information including: - method The delivery
method
$client_idinteger$client_id The ID of the client to add the delivery method under
Returns
						integerThe invoice delivery ID, void on error
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			addRecurringDelivery( integer $invoice_recur_id, array $vars, integer $client_id )
				
Adds the invoice delivery status for the given recurring invoice 
				
Adds the invoice delivery status for the given recurring invoice Parameters
						$invoice_recur_idinteger$invoice_recur_id The ID of the recurring invoice to update delivery status for
$varsarray$vars An array of invoice delivery information including: - method The delivery
method
$client_idinteger$client_id The ID of the client to add the delivery method under
Returns
						integerThe recurring invoice delivery ID, void on error
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			getDeliveryList( string $method = null, integer $page = 1, array $order_by = array('date_sent' => "DESC") )
				
Fetches a list of invoice deliveries for the currently active company 
				
Fetches a list of invoice deliveries for the currently active company Parameters
						$methodstring$method The delivery method to filter by (optional, default null for all)
$pageinteger$page The page to return results for (optional, default 1)
$order_byarray$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"),
optional)
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getDeliveryListCount( string $method = null )
				
Retrieves the total number of invoice deliveries for the currently active
company 
				
Retrieves the total number of invoice deliveries for the currently active
company Parameters
						$methodstring$method The delivery method to filter by (optional, default null for all)
Returns
						integerThe total number of invoice deliveries
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getDeliveryMethods( integer $client_id = null, integer $client_group_id = null, boolean $enabled = true )
				
Fetches all invoice delivery methods that are supported or enabled for this
company 
				
Fetches all invoice delivery methods that are supported or enabled for this
company Parameters
						$client_idinteger$client_id The ID of the client to fetch the delivery methods for
$client_group_idinteger$client_group_id The ID of the client group to fetch the delivery methods for if
$client_id is not given
$enabledboolean$enabled If true, will only return delivery methods that are enabled for this
company, else all supported methods are returned
Returns
						arrayAn array of delivery methods in key/value pairs
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			delivered( integer $invoice_delivery_id, integer $company_id = null )
				
Marks the delivery status as sent 
				
Marks the delivery status as sent Parameters
						$invoice_delivery_idinteger$invoice_delivery_id The ID of the delivery item to mark as sent
$company_idinteger$company_id The ID of the company whose invoice to mark delivered. Invoices not
belonging to the given company will be ignored (optional, default null to not
check the invoice company)
 | 
		
			| 
				 public 
				
				
				 | 
			#
			deleteDelivery( integer $invoice_delivery_id )
				
Removes the invoice delivery record 
				
Removes the invoice delivery record Parameters
						$invoice_delivery_idinteger$invoice_delivery_id The ID of the delivery item to delete
 | 
		
			| 
				 public 
				
				
				 | 
			#
			deleteRecurringDelivery( integer $invoice_delivery_id )
				
Removes the recurring invoice delivery record 
				
Removes the recurring invoice delivery record Parameters
						$invoice_delivery_idinteger$invoice_delivery_id The ID of the recurring delivery item to delete
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			calcLineTotals( integer $client_id, array $vars, array $tax_rules = null, integer $client_group_id = null )
				
Calculate the subtotal, tax, and total of a set of line items 
				
Calculate the subtotal, tax, and total of a set of line items Parameters
						$client_idinteger$client_id The ID of the client to calculate the line totals for
$varsarray$vars An array of invoice info including: - lines A numerically indexed array of
line items including: - qty The quantity of each line item - amount The unit
cost per quantity - tax Whether or not this line items is taxable - currency The
currency to use (optional, defaults to the client's default currency)
$tax_rulesarrayA numerically indexed array of stdClass objects each representing a tax rule to
apply to this client or client group. Must be provided if $client_id not
specified
$client_group_idinteger$client_group_id The ID of the client group to calculate line totals for
Returns
						arrayAn array containing the following keys, void on error: - subtotal - total -
total_w_tax - tax - total_due Optionally set if $vars['amount_paid'] given and
> 0
 
 | 
		
			| 
				 public 
				float
				
				 | 
			#
			amountDue( integer $client_id, string $currency, string $status = "open" )
				
Calculates the client's amount due in the given currency. This sums all
existing open invoices for the given currency. 
				
Calculates the client's amount due in the given currency. This sums all
existing open invoices for the given currency. Parameters
						$client_idinteger$client_id The client ID to calculate on
$currencystring$currency The ISO 4217 3-character currency code
$statusstring$status The status type of the invoices whose amount due to fetch (optional,
default 'open') one of the following: - open Fetches all active open invoices -
closed Fetches all closed invoices - past_due Fetches all active past due
invoices - draft Fetches all invoices with a status of "draft" - void Fetches
all invoices with a status of "void" - active Fetches all invoices with a status
of "active" - proforma Fetches all invoices with a status of "proforma" -
to_autodebit Fetches all invoices that are ready to be autodebited now, and
which can be with an active client and payment account to do so -
pending_autodebit Fetches all invoice that are set to be autodebited in the
future, and which have an active client and payment account to do so with -
to_print Fetches all paper invoices set to be printed - printed Fetches all
paper invoices that have been set as printed - pending Fetches all active
invoices that have not been billed for yet - to_deliver Fetches all invoices set
to be delivered by a method other than paper (i.e. deliverable invoices not in
the list of those "to_print") - all Fetches all invoices
Returns
						floatThe amount due
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			invoicedCurrencies( integer $client_id, string $status = "active" )
				
Returns an array of all currency the given client has been invoiced in 
				
Returns an array of all currency the given client has been invoiced in Parameters
						$client_idinteger$client_id
$statusstring$status The status type of the invoices to fetch (optional, default 'active') -
['open','closed','past_due','draft','proforma','void','active'] (or 'all' for
all active/draft/proforma/void)
Returns
						arrayAn array of stdClass objects, each representing a currency in use
 
 | 
		
			| 
				 public 
				float
				
				 | 
			#
			getSubtotal( integer $invoice_id )
				
Calculates the subtotal of the given invoice ID 
				
Calculates the subtotal of the given invoice ID Parameters
						$invoice_idinteger$invoice_id The ID of the invoice to calculate the subtotal of
Returns
						floatThe subtotal of the invoice
 
 | 
		
			| 
				 public 
				float
				
				 | 
			#
			getTotal( integer $invoice_id )
				
Calculates the total (subtotal + tax) of the given invoice ID 
				
Calculates the total (subtotal + tax) of the given invoice ID Parameters
						$invoice_idinteger$invoice_id The ID of the invoice to calculate the total of
Returns
						floatThe total of the invoice
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			makeLinesFromItems( array $vars )
				
Creates a list of line items from the given set of items, discounts, and
taxes 
				
Creates a list of line items from the given set of items, discounts, and
taxes Parameters
						$varsarray$vars A key/value array, including: - items An array of stdClass items from
which to create the line items, each including: - description The line item
description to set - price The unit price of the line item - qty The line
quantity - discounts An array of stdClass discounts applied to the line,
including: - description The coupon description - amount The amount of discount
- type The type of discount - total The total amount discounted from the line -
taxes An array of stdClass taxes applied to the line, including: - description
The tax description - amount The amount of tax - type The type of tax - total
The total amount taxed from the line
Returns
						arrayAn array of line items, each including: - service_id The ID of the service to
which the line belongs - description The line description - qty The line
quantity - amount The unit price - order The line item order relative to other
line items - tax True or false, whether the item is taxable
 
 See | 
		
			| 
				 public 
				array
				
				 | 
			#
			getItemTotals( array $items, array $discounts = array(), array $taxes = array() )
				
Retrieves a list of items and their totals 
				
Retrieves a list of items and their totals Parameters
						$itemsarray$items An array of items including: - price The unit price of the item - qty The
item quantity (optional, default 1) - description The item description
(optional)
$discountsarray$discounts An array of applicable discounts including (optional): - amount The
discount amount - type The discount type ('amount' or 'percent') - description
The discount description (optional) - apply An array of item indexes to which
the discount applies (optional, defaults to all)
$taxesarray$taxes An array containing arrays of applicable taxes where each array group
represents taxes to cascade on each other; including (optional): - amount The
tax amount - type The tax type ('exclusive' or 'inclusive') - description The
tax description (optional) - apply An array of item indexes to which the tax
applies (optional, defaults to all)
Returns
						arrayAn array containing: - items An array of items and pricing information about
each item - totals An array of pricing information about all items - discounts
An array of discounts - taxes An array of taxes
 
 | 
		
			| 
				 public 
				float
				
				 | 
			#
			getPaid( integer $invoice_id )
				
Calculates the total paid on the given invoice ID 
				
Calculates the total paid on the given invoice ID Parameters
						$invoice_idinteger$invoice_id The ID of the invoice to calculate the total paid on
Returns
						floatThe total paid on the invoice
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getStatuses( )
				
Retrieves a list of invoice statuses and language 
				
Retrieves a list of invoice statuses and language Returns
						arrayA key/value array of statuses and their language
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getTypes( )
				
Fetches the available invoice types 
				
Fetches the available invoice types Returns
						arrayA key/value array of invoice types
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateStatus( string $status )
				
Validates the invoice 'status' field 
				
Validates the invoice 'status' field Parameters
						$statusstring$status The status to check
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateIsDraft( integer $invoice_id )
				
Validates that the given invoice is a draft invoice 
				
Validates that the given invoice is a draft invoice Parameters
						$invoice_idinteger$invoice_id The invoice ID
Returns
						booleanTrue if the given invoice is a draft, and false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateDeliveryMethods( array $methods = null )
				
Validates that the delivery options match the available set 
				
Validates that the delivery options match the available set Parameters
						$methodsarray$methods A key=>value array of delivery methods (e.g. "email"=>true)
Returns
						booleanTrue if at least one delivery method was given, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateAmountApplied( integer $invoice_id )
				
Checks if the given invoice has any payments applied to it 
				
Checks if the given invoice has any payments applied to it Parameters
						$invoice_idinteger$invoice_id The invoice ID to check
Returns
						booleanTrue if the invoice has payments applied to it, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateDateDueAfterDateBilled( string $date_due, string $date_billed )
				
Validates that the given date due is on or after the date billed 
				
Validates that the given date due is on or after the date billed Parameters
						$date_duestring$date_due The date the invoice is due
$date_billedstring$date_billed The date the invoice is billed
Returns
						booleanTrue if the date due is on or after the date billed, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateDuration( mixed $duration )
				
Validates the recurring invoice duration 
				
Validates the recurring invoice duration Parameters
						$durationmixed$duration An integer idenfying the number of the times the recurring invoice
should recur, null for indefinitely
Returns
						booleanTrue if the duration is valid, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validatePeriod( string $period )
				
Validates the recurring invoice period 
				
Validates the recurring invoice period Parameters
						$periodstring$period The period type
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			isInstanceOf( mixed $field, mixed $class )
				
Checks if the given $field is a reference of $class 
				
Checks if the given $field is a reference of $class | 
		
			| 
				 public 
				float
				
				 | 
			#
			primeQuantity( mixed $qty )
				
Converts quantity to a float, if no qty is set, a value of 1 is assumed. 
				
Converts quantity to a float, if no qty is set, a value of 1 is assumed. Parameters
						$qtymixed$qty The quantity to be primed, may be an integer, float, or fractional string
Returns
						floatThe quanity rounded to 4 decimal places
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getTaxRules( integer $client_id )
				
Retrieves all active tax rules that apply to the given client 
				
Retrieves all active tax rules that apply to the given client Parameters
						$client_idinteger$client_id The client ID
Returns
						arrayA numerically indexed array of stdClass objects each representing a tax rule to
apply to this client
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getTaxRulesByLocation( integer $company_id, string $country, string $state )
				
Retrieves all active tax rules that apply to the given company and
location 
				
Retrieves all active tax rules that apply to the given company and
location Parameters
						$company_idinteger$company_id The ID of the company to fetch tax rules on
$countrystring$country The ISO 3166-1 alpha2 country code to fetch tax rules on
$statestring$state 3166-2 alpha-numeric subdivision code to fetch tax rules on
Returns
						arrayA numerically indexed array of stdClass objects each representing a tax rule to
apply to this company and location
 
 | 
		
			| 
				 public 
				string
				
				 | 
			#
			createPayHash( integer $client_id, integer $invoice_id )
				
Creates a Payment Hash that may be used to temporarily authenticate a user's
access to pay an invoice, or invoices 
				
Creates a Payment Hash that may be used to temporarily authenticate a user's
access to pay an invoice, or invoices Parameters
						$client_idinteger$client_id The client ID to create the hash for
$invoice_idinteger$invoice_id The ID of the invoice to create the hash for (if null will allow the
hash to work for any invoice belonging to the client)
Returns
						stringA hash built based upon the parameters provided
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			verifyPayHash( integer $client_id, integer $invoice_id, string $hash )
				
Verifies the Payment Hash is valid 
				
Verifies the Payment Hash is valid Parameters
						$client_idinteger$client_id The client ID to verify the hash for
$invoice_idinteger$invoice_id The ID of the invoice to verify the hash for
$hashstring$hash The original hash to verify against
Returns
						booleanTrue if the hash is valid, false otherwise
 
 |