getCostOfGoodsSold

This call is deprecated. We recommend to use the Reports API instead.

The corresponding new call is: GET /v1/generated-reports/cogs-invoice-rows.

Get the cost of goods sold for a given period. API returns an array of all sales document rows in the selected period, and the cost for each row.

Erply calculates cost according to FIFO principle.

Usage guidelines: Note that the COGS of any sale may change at any time — Erply does not freeze cost at the moment when sale takes place. Many kinds of operations may adjust it, eg. entering or correcting a purchase invoice at a later date, adding freight costs, deleting other documents etc. Find out what are the accounting principles in your company and pull COGS only when all adjustments for the given period are done — eg. at the end of month.

Input parameters

Parameter name Description Possible value Required
dateFrom Note that API output capacity may be limited. If you experience errors, subdivide your period into smaller chunks and request separately. ISO date (yyyy-mm-dd)
dateTo ISO date (yyyy-mm-dd)

Response

Field name Type Description
date string Format: yyyy-mm-dd. Sales document date, eg. 2010-01-29.
invID integer Sales document ID.
invNo string Sales document number.
wrhID integer ID of the warehouse from which goods are sold.
prodID integer ID of the product.
amount number Sold amount.
price number Net sales total. Does not include VAT / sales tax.
cost number The cost of goods sold.