Returns a list of purchase documents (purchase invoices or orders), according to the supplied filtering parameters.
If you have specified document ID or invoice number, or if the search criteria match a single sales document, or if you have set getRowsForAllInvoices = 1, API returns all documents together with their rows. Otherwise only document headers will be returned.
If you are looking for a way to pull all purchase data for external processing, see getPurchaseReport.
getPurchaseReport can output either detailed data or aggregate it as needed: it can provide totals by products, by product groups, by dates, by locations, etc.
|Parameter name||Description||Possible value||Required|
|id||ID of a specific purchase document||Integer|
|supplierIDs||Multiple supplier IDs, separated by commas, such as: 1,2,3,4,5.||String|
|type||PRCINVOICE, CASHPRCINVOICE, PRCORDER, PRCRETURN, PRCWAYBILL or PRCINVOICEONLY. See explanation below!||String|
|status||PENDING, PARTIALLY_RECEIVED, RECEIVED or READY. See explanation below!||String|
|stateID||Purchase document status ID||Integer|
|dateFrom||Filter by purchase document date field||Date (yyyy-mm-dd)|
|dateTo||Filter by purchase document date field||Date (yyyy-mm-dd)|
|confirmed||0 or 1||Integer|
|paid||0 or 1||Integer|
|number||Number of purchase document.||String|
|referenceNumber||Reference number of purchase document.||String|
|regnumber||Reg. number of purchase document.||String|
|employeeID||ID of the system employee, who is set as the creator of the invoice/order/etc.||Integer|
|shipDateFrom||Filter by the ship date field||Date (yyyy-mm-dd)|
|shipDateTo||Filter by the ship date field||Date (yyyy-mm-dd)|
|getRowsForAllInvoices||Set this field to 1 to retrieve the rows for each returned purchase document.
Not that in some cases, rows are returned anyway — see the specification of the "rows" field below.
|0 or 1|
|getCost||Set this field to 1 to retrieve the inventory cost of each purchased item.
Cost is only a property of purchase invoices (not POs), and only products have a cost (services do not, since services are not taken into inventory). Cost is the sum of purchase price, plus shipping and other costs divided between invoice items.
If set to 1, API will return "unitCost" and "costTotal" for each document row, and "cost" for the whole document.
|0 or 1|
|searchAttributeName||Name of attribute to search from. Both "searchAttributeName" and "searchAttributeValue" have to be specified. Error 1030 will be returned if value is an array.||String|
|searchAttributeValue||Attribute value to search for. Error 1030 will be returned if value is an array.||String|
|orderBy||'documentID', 'dateAndNumber', 'supplierName', or 'lastChanged'. By default 'dateAndNumber'||String|
|orderByDir||Sort direction: 'asc' (ascending order) or 'desc' (descending order). By default, items are sorted in descending order.||String|
|recordsOnPage||Number of records API should return. By default 20, at most 100.||Integer|
|pageNo||API returns at most recordsOnPage items at a time. To retrive the next recordsOnPage items, send a new request with pageNo incremented by one. By default, API returns "page 1".||Integer|
|changedSince||Retrieve only items that have been added or modified since the specified timestamp. Use it to keep a local database in sync with Erply.||Integer (Unix timestamp)|
|id||Integer||Purchase document ID|
|type||String||If your account has configuration setting
If the setting is not enabled, possible types are:
|status||String||The possible statuses are:
|currencyCode||String||Currency code: EUR, USD.|
Exchange rate of the purchase document currency against system's default currency.
|warehouseID||Integer||ID of the warehouse|
|warehouseName||String||Name of the warehouse|
|number||String||Number of purchase document|
|regnumber||String||Reg. number of purchase document|
|inventoryTransactionDate||Date||Inventory transaction date.
This is the date on which the document was confirmed and when the items on this document were added into inventory, or removed from inventory. While "document date" can be edited by users at any time, "inventory transaction date" is always set by Erply and cannot be changed.
Inventory Reports and COGS reports are based on the inventory transaction date.
|supplierGroupID||Integer||ID of supplier's group (see getSupplierGroups).|
|employeeID||Integer||ID of the system employee, who is set as the creator of the invoice/order/etc.|
|paymentDays||Integer||In how many days the purchase document is due.|
|paid||Integer||0 or 1|
|deliveryAddressID||Address ID that has been selected for deliveries||Integer|
|triangularTransaction||Integer||0 or 1|
|reasonID||Integer||Reason ID. See
|confirmed||Integer||0 or 1|
|rounding||Decimal, 2 places|
|netTotalsByTaxRate||Array||List of VAT (tax) rates and purchase document net totals for each rate. Each list element contains the following fields:
|vatTotalsByTaxRate||Array||List of VAT (tax) rates and total VAT (tax) amounts for each rate. Each list element contains the following fields:
|invoiceLink||String||URL pointing to a HTML printout version of the document.
This URL is valid only for 24 hours; if you want to send the purchase invoice / PO by e-mail, you must retrieve the contents of this URL and enclose it as an attachment, instead of sending the URL itself.
|cost||Decimal||Total inventory cost of the purchased products. Cost equals invoice net total, less services and non-stock products (since services are not taken into inventory, they can never have cost) + shipping and handling costs.
Cost is always in account's default currency. This field is returned only if you set
|netTotalForAccounting||Decimal, 2 places|
|totalForAccounting||Decimal, 2 places|
|baseToDocuments||Array||Array of purchase documents that have been made from this document. This element is always present but may be empty if there are no documents.
Array elements have the following attributes:
|baseDocuments||Array||Array of source documents. This element is always present but may be empty if there are no source documents.
Array elements have the following attributes:
|rows||Array||Purchase document rows. Rows are returned only in specific cases (if you searched purchase document by ID or number, or if result set contained just one document, or if you specified
|attributes||Array||Additional attributes for the document. Each array element has the following fields: