Ongoing Warehouse logo

Ongoing Warehouse Developer

Stock balances and inventory

Table of contents

Introduction

The inventory describes which articles are in stock. There are several different functions for retrieving the inventory data from the API:

Note that these functions also return the basic article data (such as weight, dimensions and description) for each article. There is no separate function for getting the basic article data. Thus, in order to get the article registry, GetInventory should be used.

The different quantities in GetInventory and GetInventoryByQuery

When you call GetInventory and GetInventoryByQuery, you will receive several different quantities for each article:

NumberOfItemsDecimal

NumberOfItemsDecimal is the total, physical stock stored in the warehouse.

NumberOfBookedItemsDecimal

NumberOfBookedItemsDecimal is the number of items which have been ordered but which have not yet been picked.

AllocatedNumberOfItems

AllocatedNumberOfItems is the number of items which have been allocated to orders but have not yet been picked. Some warehouses use this two-step process of first allocating goods, and then picking them. Other warehouses use a one-step process (directly picking the goods), in which case AllocatedNumberOfItems will always be 0.

NumberOfLockedItems

NumberOfLockedItems counts article items where either:

LockedForSaleNumberOfItems

LockedForSaleNumberOfItems counts article items where either:

ToReceiveNumberOfItems

ToReceiveNumberOfItems has no relationship to the rest of the values. It describes how large a quantity of goods is expected to arrive in the warehouse, that is, how large a quantity exists on a purchase order but is not yet received.

PickedToBeCollectedNumberOfItems

PickedToBeCollectedNumberOfItems is the number of items which have been picked by the warehouse, and which are on orders whose statuses are strictly below "Collected" (< 500). That is to say, this is the number of items which have been picked by the warehouse but where the warehouse does not yet consider the orders to be completely done. This field is generally only used by ERP integrations when running the daily stock comparison.

ReceivedToBeFinishedNumberOfItems

ReceivedToBeFinishedNumberOfItems is the number of items which have been received and which are on inorders whose statuses are strictly below "Received" (< 500). That is to say, this is the number of items which have been received by the warehouse but where the warehouse does not yet consider the inorders to be completely done. This field is generally only used by ERP integrations when running the daily stock comparison.

Venn diagram illustration

The following Venn diagram illustrates the relation between the different quantities.

Venn diagram describing the relationship between the different quantities.

Stock balance formulas

There are various ways to compute the stock balance of a particular article, depending on exactly what kind of stock balance you require.

Physical stock balance

The number of items which are physically present in the warehouse is simply NumberOfItemsDecimal.

Sellable stock balance - basic formula

It is common to want to know how much stock there is in the warehouse which is available for selling. In general this can be achieved by the following formula:

Sellable stock balance = NumberOfItemsDecimal - NumberOfBookedItemsDecimal

Note that this formula can become negative. This formula is suitable for most cases, including web shops.

Sellable stock balance - advanced formula

One issue with the the basic formula is that it considers locked items to be sellable. For instance, if the warehouse has locked some items because they are under investigation for quality reasons, then the basic formula will still consider those items to be sellable.

In most cases, the basic formula is enough. But if you are sure that you don't want to count locked items as sellable when calculating available stock, use the below formula instead:

Sellable stock balance = NumberOfItemsDecimal - NumberOfBookedItemsDecimal - NumberOfLockedItems + AllocatedNumberOfItems

Keep in mind that article items could be locked by standard warehouse activities like stock-taking. This can lead to available stock being zero or negative during the stock-taking activity.

Sellable stock balance - advanced formula - version which takes "locked for sale" into account

This formula is similar to the standard advanced formula above, but it resolves the problem where goods can be counted as non-sellable if they are locked by standard warehouse activities like stock-taking.

Note that this formula is only applicable if the warehouse supports it. The warehouse needs to have a process where they are distinguish between "locking an item for some internal purpose" and "locking an item for sale". You must confirm this with the warehouse before using this formula.

This formula computes the sellable stock balance, but only counts goods as locked if they have been specifically "locked for sale":

Sellable stock balance = NumberOfItemsDecimal - NumberOfBookedItemsDecimal - LockedForSaleNumberOfItems + AllocatedNumberOfItems

ERP daily comparison formula

In integrations with ERP systems, it is common to run a daily comparison between the stock balances in Ongoing and the stock balances in the ERP. In this case, neither the physical stock balance nor the sellable balance is of interest.

What is required here is a formula which takes into account the fact that:

The formula which deals with both of these issues is:

ERP stock balance = NumberOfitems + PickedToBeCollectedNumberOfItems - ReceivedToBeFinishedNumberOfItems

The difference between GetInventory and GetInventoryItems

The fundamental difference between GetInventory and GetInventoryItems is that:

You can use GetInventoryItems to answer questions such as:

As an example, let us say that you have an article called A1 with the following items in stock:

A call to GetInventory will return NumberOfItemsDecimal = 15 for A1. But if you call GetInventoryItems, you will receive two separate InventoryItems tags for A1: