Retrieve a purchase report.
API returns a link to CSV file that contains the report.
|Parameter name||Description||Possible value||Required|
|reportType||Report type. Possible values are "PURCHASE_BY_PRODUCT", "PURCHASE_BY_PRODUCT_GROUP", "PURCHASE_BY_BRAND", "PURCHASE_BY_SUPPLIER", "PURCHASE_BY_SUPPLIER_GROUP", "PURCHASE_BY_INVOICE", "PURCHASE_BY_INVOICE_ROWS". The last option returns all purchase invoice rows, all others aggregate the data by some parameter.||String||yes|
|dateStart||Date range filter.||ISO date (yyyy-mm-dd)||yes|
|dateEnd||Date range filter.||ISO date (yyyy-mm-dd)||yes|
|currencyCode||Currency code: EUR, USD.|
Setting this parameter will return a report where all sums have been re-calculated into specified currency. In other words, this is NOT a filter (for retrieving EUR, USD, etc. purchase invoices separately). In almost all cases, you will want the report in your account default currency, so it is recommended to omit this parameter.
The specified currency must be defined in Erply. If omitted, or an unknown currency code is provided, API uses your default currency.
|warehouseID||Filter purchase invoices by warehouse (store, location).||Integer|
|productID||Filter the report down to one specific product.||Integer|
|productType||Filter purchased items by product type. Possible values are "ALL" (all products), "STOCK" (stock products), "NON_STOCK" (non-stock products). By default "ALL".||String|
|productGroupID||Filter purchased items by product group. (Items in subgroups are also included.)||Integer|
|categoryID||Filter purchased items by product category.||Integer|
|priorityGroupID||Filter purchased items by product priority group.||Integer|
|supplierID||Filter purchase invoices by supplier.||Integer|
|brandID||Filter purchased items by brand.||Integer|
|includeServices||Set to 1 if you want to include purchased services. By default, the report will only include products.|
To further filter down the report only to items that go into inventory (ie. to exclude non-stock-products, too), set filter
|Integer (0 or 1)|
|getAccountsPayableReport||This setting only makes a difference if you have enabled document types "Purchase invoice-waybill" and "Purchase waybill".|
|Integer (0 or 1)|
|reportLink||String||Link to report file.
The report is a CSV file in "latin1" encoding. Fields are separated by semicolons and quoted with double quotes. The file has a header line (with standard column headers, for identifying which field contains which data) and a footer line (with totals). Here is a sample (this is a report by supplier):
The escape character for literal quote characters is ", like in Microsoft Excel: "This ""word"" is quoted".
First line is a header line. Each column has a specific header identifier and you can use the headers to parse data out of the file. The last line in file is a total line, identified by the word "TOTAL" in line number column.
All reports have the following columns. (Columns are not necessarily in this specific order - here we have adjusted the order for clarity.)
The rest of the columns depend on selected report type (ie. how data is grouped). In PURCHASE_BY_PRODUCT, each report line corresponds to one product. IN PURCHASE_BY_SUPPLIER, each report line corresponds to one supplier.
Report PURCHASE_BY_PRODUCT additionally has the following columns:
In reports PURCHASE_BY_PRODUCT_GROUP, PURCHASE_BY_BRAND, PURCHASE_BY_SUPPLIER, PURCHASE_BY_SUPPLIER_GROUP, the additional columns are:
Report PURCHASE_BY_INVOICE has the following additional columns:
Report PURCHASE_BY_INVOICE_ROWS has the following additional columns: