PurchaseOrders
Return a list of all purchase orders
Select
The 本製品 will use the Xero WorkflowMax API to process WHERE clause conditions built with the following columns and operators. The rest of the filter is executed client-side within the driver. Specifically, the following are processed server-side:
- Id supports the '=' operator.
- JobID supports the '=' operator.
- CreatedDate supports the '<=,<,=,>,>=' operators.
All filterable columns allow multiple values to be specified by using the IN operator.
Response time from the server can be improved by identifying only the rows you want to retrieve.
SELECT * FROM PurchaseOrders WHERE ID = '2512811' SELECT * FROM PurchaseOrders WHERE CreatedDate >= '2000-12-12' AND CreatedDate <= '2020-12-12' SELECT * FROM PurchaseOrders WHERE CreatedDate = '2000-12-12' SELECT * FROM PurchaseOrders WHERE CreatedDate >= '2000-12-12' SELECT * FROM PurchaseOrders WHERE ID IN ('23423', '34534') SELECT * FROM PurchaseOrders WHERE JobID IN ('23423', '34534')
Notes:
-When executing a simple SELECT * query the 本製品 will retrieve only your current PurchaseOrders.
-When specifying CreatedDate the 本製品 will retrieve the current and archived PurchaseOrders.
Insert
To insert into PurchaseOrders you will need to insert temporary at least one PurchaseOrderCost which will serve as items for the PurchaseOrder. You can do that by denoting the table name as PurchaseOrderCosts#TEMP.
After inserting to the temporary table you can execute an insert to PurchaseOrders by setting PurchaseOrderCosts = PurchaseOrderCosts#TEMP as in the query below.
JobID, SupplierUUID, Date, PurchaseOrderCosts are required to insert. The following queries are needed to create a new PurchaseOrder with 2 PurchaseOrderCost items:
INSERT INTO PurchaseOrderCosts#TEMP (Description, Quantity, UnitCost, Code, Note) VALUES ('first', 4, 50, '123', 'note') INSERT INTO PurchaseOrderCosts#TEMP (Description, Quantity, UnitCost, Code, Note) VALUES ('second', 42, 502, '1234', 'note2') INSERT INTO PurchaseOrders (JobID, SupplierUUID, Date, PurchaseOrderCosts) VALUES ('J000002', '9d382fcf-7013-4d97-8dd8-c08e8b26a0b2', '2019-07-17T00:00:00', 'PurchaseOrderCosts#TEMP')
Alternatively you can execute an INSERT operation on PurchaseOrder by setting the value for PurchaseOrderCosts as a xml string of items in the following structure:
<Item> <UnitCost>50</UnitCost> <Description>first</Description> <Quantity>4</Quantity> <Code>123</Code> <Note>note</Note> </Item> <Item> <UnitCost>502</UnitCost> <Description>second</Description> <Quantity>42</Quantity> <Code>1234</Code> <Note>note2</Note> </Item>
Columns
Name | Type | ReadOnly | Description |
ID [KEY] | String | False |
The purchase order identifier. |
Description | String | False |
The description related to the purchase order. |
State | String | False |
The state of the purchase order. |
CreatedDate | Datetime | True |
The date when the purchase order was created. |
DeliveryAddress | String | False |
Delivery address for the purchase order. |
Amount | Float | True |
The amount to pay. |
AmountTax | Float | True |
The tax amount to pay. |
AmountIncludingTax | Float | True |
The total amount to pay including tax. |
SupplierUUID | String | False |
The supplier identifier related to the purchase order. |
SupplierName | String | True |
The supplier name related to the purchase order. |
JobID | String | False |
The job identifier related to the purchase order. |
JobName | String | True |
The job name related to the purchase order. |
PurchaseOrderCosts | String | False |
Lists all purchase orders costs, xml format. |