getCostOfGoodsSold

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's 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 Date 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 Decimal Sold amount.
price Decimal Net sales total. Does not include VAT / sales tax.
cost Decimal The cost of goods sold.