Get a sales report.
API returns a link to CSV file that contains the report. Field separator in the CSV is region- and configuration-specific — check getConfParameters, field “csv_field_separator”.
If you want to display sales totals in graph format, and would like to retrieve a simpler data set, see the API calls getSalesTotalsByEmployeeAndDay, getSalesTotalsByEmployeeAndMonth, getSalesTotalsByWarehouseAndDay and getSalesTotalsByWarehouseAndMonth.
|Parameter name||Description||Possible value||Required|
|reportType||Report type. Possible values are "SALES_BY_DATE", "SALES_BY_CUSTOMER", "SALES_BY_CUSTOMER_ACCOUNT_MANAGER", "SALES_BY_CUSTOMER_GROUP", "SALES_BY_BUSINESS_AREA", "SALES_BY_WAREHOUSE", "SALES_BY_POINT_OF_SALE", "SALES_BY_PRODUCT", "SALES_BY_PRODUCT_GROUP", "SALES_BY_PRODUCT_GROUP_WITH_DRILL_DOWN", "SALES_BY_DEPARTMENT", "SALES_BY_DEPARTMENT_WITH_DRILL_DOWN", "SALES_BY_SUPPLIER", "SALES_BY_SUPPLIER_WITH_DRILL_DOWN", "SALES_BY_CATEGORY", "SALES_BY_CATEGORY_WITH_DRILL_DOWN", "SALES_BY_BRAND", "SALES_BY_ALL_PRODUCTS", "SALES_BY_CASHIER", "SALES_BY_INVOICE", "SALES_BY_INVOICE_ROWS", "SALES_BY_WEEKDAY", "SALES_BY_HOUR", "SALES_BY_MATRIX", "SALES_BY_MATRIX_WITH_DRILL_DOWN".||String||yes|
|localNumberFormatting||If set to 1, sales report displays local-formatted numbers. If set to 0 or unset, sales report displays numbers in standard decimal format.||Integer|
|comparisonType||Comparison type. Possible values are "WAREHOUSES-NET_SALES", "WAREHOUSES-SALES_COST", "WAREHOUSES-PROFIT", "WAREHOUSES-UNITS_SOLD", "WAREHOUSES-UNITS_SOLD_AND_NET_SALES", "WAREHOUSES-SALES_AND_STOCK_IN_RETAIL_PRICES", "WAREHOUSES-SALES_AND_STOCK_IN_COST", "PERIODS", "EMPLOYEES-NET_SALES", "EMPLOYEES-UNITS_SOLD", "EMPLOYEES-UNITS_SOLD_AND_NET_SALES".||String|
|comparisonDateStart||ISO date (yyyy-mm-dd)|
|comparisonDateEnd||ISO date (yyyy-mm-dd)|
|getCOGS||If set to 1, sales report shows profits and total cost of sold goods. If set to 0 or unset, sales report shows revenue and taxes.||Integer|
|dateStart||ISO date (yyyy-mm-dd)||yes|
|dateEnd||ISO date (yyyy-mm-dd)||yes|
|currencyCode||Currency code: EUR, USD. Currency must be defined in Erply. If omitted, or an unknown currency code is provided, API uses your default currency instead.||String (3)|
|giftCardsSales||Possible values are "EXCLUDE" - exclude sales of gift cards, "ONLY_GIFT_CARDS" - sales of gift cards only, "BOTH_REGULAR_AND_GIFT_CARD" - both regular and gift card sales. By default "EXCLUDE"||String|
|customerGroupID||Customer group ID.||Integer|
|customerAccountManagerID||Customer account manager ID.||Integer|
|businessAreaID||Customer's business area.||Integer|
|salesManagerID||If set, report will contain only the transactions of a specific cashier / associate / salesperson / sales manager.||Integer|
|pointOfSaleID||Point of sale ID.||Integer|
|productIDs||Filter the report by multiple products. The input parameter must contain a comma-separate list of product IDs, for example: "1,2,3,4,5".||Integer|
|productGroupID||Product group ID.||Integer|
|categoryID||Product category ID.||Integer|
|priorityGroupID||Priority group ID.||Integer|
|userGroupID||User group ID.||Integer|
|showProductsAndServices||Possible values "ALL" - show all sales, "PRODUCTS" - show product revenue only, "SERVICES" - show service and non-stock product revenue only. By default "ALL".||String|
|transactionType||Type of transaction. Possible values are "ALL" - all transactions (sales and returns), "SALES" - sales only, "RETURNS" - returns only. By default "ALL".||String|
|displayBundles||If set to 1, sales report displays sold bundles as bundles. If set to 0 or unset, sales report displays sold bundles by components separately.||Integer|
|reportLink||String||Link to report file.
Note: if you try calling API getSalesReport and the output does not look as described below, your Erply account may need updating. Please contact helpdesk.
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:
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.
There are two basic report types: Sales revenue reports and COGS reports. Revenue reports show revenue and taxes. COGS reports show cost of sold goods and profit. By default, API returns a Sales Report. To get COGS report, use
All Sales Revenue reports have the following columns. (Columns are not necessarily in this specific order - here we have adjusted the order for clarity.)
The following Sales Reports will also show total VAT (total sales tax) for each tax rate:
SALES_BY_SUPPLIER, SALES_BY_CATEGORY, SALES_BY_BRAND, SALES_BY_CUSTOMER, SALES_BY_CUSTOMER_ACCOUNT_MANAGER, SALES_BY_CUSTOMER_GROUP, SALES_BY_BUSINESS_AREA, SALES_BY_DATE, SALES_BY_WAREHOUSE, SALES_BY_POINT_OF_SALE, SALES_BY_CASHIER
A tax column header looks like this:
VAT_TOTAL - ID:2 - 9%
It has three parts, separated by " - ". The first part is keyword "VAT_TOTAL". Second part contains the string "ID:", followed by tax rate ID. (use API call
Since there is a separate column for each tax rate, the number of columns will vary.
All COGS reports have the following columns:
The rest of the columns depend on selected report type (ie. how data is grouped). In SALES_BY_PRODUCT, each report line corresponds to one product. IN SALES_BY_EMPLOYEE, each report line corresponds to one employee.
Reports SALES_BY_PRODUCT, SALES_BY_PRODUCT_GROUP_WITH_DRILL_DOWN, SALES_BY_DEPARTMENT_WITH_DRILL_DOWN, SALES_BY_SUPPLIER_WITH_DRILL_DOWN, SALES_BY_CATEGORY_WITH_DRILL_DOWN, SALES_BY_MATRIX, SALES_BY_MATRIX_WITH_DRILL_DOWN have the following columns:
Reports SALES_BY_PRODUCT_GROUP, SALES_BY_DEPARTMENT, SALES_BY_SUPPLIER, SALES_BY_CATEGORY, SALES_BY_BRAND, SALES_BY_CUSTOMER, SALES_BY_CUSTOMER_ACCOUNT_MANAGER, SALES_BY_CUSTOMER_GROUP, SALES_BY_BUSINESS_AREA, the next columns are:
Report SALES_BY_ALL_PRODUCTS has the following columns:
Report SALES_BY_DATE has the following columns:
Report SALES_BY_WAREHOUSE has the following columns:
Report SALES_BY_POINT_OF_SALE has the following columns:
Report SALES_BY_CASHIER has the following columns:
Report SALES_BY_INVOICE has the following columns:
Report SALES_BY_INVOICE_ROWS has the following columns:
Report SALES_BY_WEEKDAY has the following columns:
Report SALES_BY_HOUR has the following column: