_getExportData
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.
customer
text. all or part of the invoice customer name.
from
integer. used to indicate date range.
to
integer. used to indicate date range.
inv_no
text. invoice number.
search
text. all or part of the invoice id, invoice number, or invoice customer name.
status
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):
account_number
varchar(58). customer account number.
appointment_id
integer
cdate
date. invoice creation date.
customer_id
integer
customer_type
integer. 0 for customer, 1 for asset.
discount
float. invoice discount.
discount_vat
float. invoice tax discount.
doc_no
varchar(32). invoice document number.
due_date
integer. invoice due date in epoch time.
email_sent
datetime. records when invoice was emailed to customer.
form_id
integer. id of associated invoice form.
last_edited
integer. records when invoice was last edited (in epoch time).
nominal_code
integer
notes
text. invoice notes.
num
text. invoice number.
order_no
varchar(32). invoice order number.
paid
float. amount paid against invoice.
pandp
float. postage & packing.
pandp_vat
float. tax on postage & packing.
published
datetime
quote_id
integer
status
integer. invoice status. -1 is draft, 0 is quoted, 1 is invoiced, 2 is paid, 3 is cancelled.
tax_code_id
integer. tax category id.
total
decimal(13,4). invoice total amount.
total_vat
decimal(13,4). invoice total net.
total_tax
float
type
integer. invoice type.
Example
Result
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.
On Success
Last updated