This function prepares Invoice data for export.
There are two stages to the process. In the first stage, the required parameter _ids is passed with a value of 1, along with optional parameters (see below) representing search constraints. This returns a list of IDs of matching items. In the second stage, the client machine retrieves data for items by sending the fields parameter to say what fields are needed, and an _ids parameter to say which items to read. The client machine should make multiple requests such that the _ids array contains at most 100 IDs at a time, to avoid timeouts or closed connections caused by too-high resource usage on the server.
Required Parameters
_ids (required)
Either 1 or an array of ids representing the jobs for which the export data will be retrieved.
fields(required)
Array. The names of the fields for which export data is required. (See list of accepted fields below).
Note: arrays should be JSON encoded.
Optional Parameters
Used to apply constraints to the query.
text. all or part of the invoice customer name.
integer. used to indicate date range.
integer. used to indicate date range.
text. invoice number.
text. all or part of the invoice id, invoice number, or invoice customer name.
integer. invoice status. -1 is draft, 0 is quoted, 1 is invoiced, 2 is paid, 3 is cancelled.
Accepted Fields
The following values can be used in the fields array (required parameter):
varchar(58). customer account number.
integer
date. invoice creation date.
integer
integer. 0 for customer, 1 for asset.
float. invoice discount.
float. invoice tax discount.
varchar(32). invoice document number.
integer. invoice due date in epoch time.
datetime. records when invoice was emailed to customer.
integer. id of associated invoice form.
integer. records when invoice was last edited (in epoch time).
integer
text. invoice notes.
text. invoice number.
varchar(32). invoice order number.
float. amount paid against invoice.
float. postage & packing.
float. tax on postage & packing.
datetime
integer
integer. invoice status. -1 is draft, 0 is quoted, 1 is invoiced, 2 is paid, 3 is cancelled.
integer. tax category id.
decimal(13,4). invoice total amount.
decimal(13,4). invoice total net.
float
integer. invoice type.
The results will include the invoice id and the customer_type, followed by the values for the fields requested, in the sequence requested. Appended to the end of the array will be the customer_type of the associated job.