Sales and Revenue

Sales document types

"Sales document" in Erply is a general term that covers eight different document types.

These document types largely share the same fields and structure, but each one has a different purpose.

Type Purpose
Invoice-waybill This is the default document that should be created when a sales transaction has taken place. An invoice-waybill removes sold goods from inventory, as well as generates revenue.
Receipt Acts identically to an invoice-waybill, but the printout is formatted like a receipt. All sales made from point of sale are saved as receipts.
Quote A (typically non-binding) document to inform customer about pricing, or to make them a sales proposal. A quote does not affect revenue or inventory, but there is a check box on a Quote to place a "reservation" on the listed items (to put them on "layaway") — for example, when expecting that a sale will soon follow, to ensure that there will be enough inventory on hand.
Order A request from a customer to buy certain items. By default, an Order always places a reservation on the listed items; this can be disabled with a check box in Settings → Configuration.
Credit Invoice An Invoice-Waybill with negative quantities. In the user interface, it is possible to invoke the command "Create credit invoice" for an invoice-waybill or a receipt, and thus revert the sale.

Note that regular Invoice-Waybills are also allowed to contain negative quantities. If you need to produce a report of all returned items, you need to inspect other document types, too, besides Credit Invoices.

Prepayment Invoice (Layby, Layaway) Can be issued to a customer ahead of an actual shipment, to collect a partial or full prepayment. Does not generate sales revenue or subtract goods from inventory.
Waybill Moves goods out of the warehouse, but does not generate sales revenue.

A common process (with larger corporate customers) is that goods are delivered to them as often as needed, and each shipment is accompanied by a waybill. At the end of the month, a summarized invoice is issued for all the month's shipments. (In Erply back office, you can select the waybills with check boxes and invoke the command "More..." → "Create invoice from selected waybills".

Invoice Generates sales revenue, but does not affect inventory. See above.

Properties of a sales document

A sales document is associated with a customer and a location. (The sale is made to one specific customer, in one specific location.)

A sales document may be confirmed or unconfirmed. When a document is ready to be issued to the customer, it must be confirmed. Confirming subtracts the sold items from inventory, and restricts further edits that can be done with the document. Erply regards only confirmed sales invoices as sales revenue.

Except for Quotes, sales documents are not even given a number until confirmation.

A sales document contains one or more lines (rows), each line being a specific quantity of some product. Quantity is a decimal value, and can be positive, zero or negative. A product may occur on an invoice multiple times. There may be invoice lines which are not associated with a product, and which have just a free-form description of the sold product or service. These are called "free-text rows".

A document row has a price and a discount percentage. The combination of these expresses the final price that customer has paid, or is supposed to pay for the item.

Discounts can only be applied to document rows. There is no concept of a whole-invoice discount. (Whole-invoice discounts have to be divided proportionally between all lines.)

Behavior of different sales document types

Type Identifier in API Generates revenue? Subtracts inventory? Reserves inventory? Accepts payments?
Invoice-waybill INVWAYBILL Yes Yes N/A Yes
Receipt CASHINVOICE Yes Yes N/A Yes
Quote OFFER No No Optional. Can reserve inventory indefinitely, or until specified date. No
Order ORDER No No Optional, by default on. Yes
Credit Invoice CREDITINVOICE Yes Yes N/A Yes
Prepayment Invoice (Layby, Layaway) PREPAYMENT No No Optional. Can reserve inventory indefinitely, or until specified date. Yes
Waybill WAYBILL No Yes N/A No
Invoice INVOICE Yes No N/A Yes

Which documents make up the sales revenue?

A common requirement is to fetch all the sales documents that make up the company's sales revenue. We strongly recommend to use the getSalesReport API call for that.

However, if it indeed becomes necessary to fetch the documents one by one, with API call getSalesDocuments, please apply the following filters:

  1. confirmed = 1 — Confirmed documents only.
  2. types="INVWAYBILL,CASHINVOICE,CREDITINVOICE,INVOICE" — Revenue-generating types only.
  3. dateFrom and dateTo — Desired range of dates.

Which documents affect inventory?

In other cases, you might be interested in what effect have the sales had on inventory — for example which items are low in stock and should be reordered.

The best choice would again be API call getSalesReport. Set input parameter getCOGS = 1 to retrieve a Cost of Goods Sold report. This report will contain number of items sold, their cost and sales margin.

But if you need to use getSalesDocuments, please apply the following filters:

  1. confirmed = 1 — Confirmed documents only.
  2. types="INVWAYBILL,CASHINVOICE,WAYBILL,CREDITINVOICE" — Inventory-affecting types only.
  3. dateFrom and dateTo — Desired range of dates.