Skip to main content

Profit - Live stock

Profit Connector - Live Stock This document describes how the Profit connector retrieves and calculates live stock information. This funct...

Updated over a week ago

Profit Connector - Live Stock

This document describes how the Profit connector retrieves and calculates live stock information. This functionality is triggered when a user views item details or validates an order in the App4Sales application.

Activation & Sources

The live stock functionality is implemented in the OptA4SGetStockForItem method within the Profit connector. The data is fetched from the AFAS Profit ERP system using specific "GetConnectors" (web services).

Data Source

GetConnector Name

Description

Live Stock

FbSalesItemStock

Retrieves real-time stock quantities for a given item.

Future Stock (Deliveries)

FbSalesLines

Retrieves planned deliveries for items, used for future stock calculations.

Future Stock (Receipts)

FbPurchaseLines

Retrieves planned receipts of items, used for future stock calculations.

Warehouses

FbWarehouse

Retrieves warehouse information.

Request & Settings

The request to the backoffice contains the item code for which the stock is requested. Several connector settings can influence the behavior of the live stock retrieval:

Setting

Description

Default

Impact on stock

UseItemDimensions

If enabled, the stock is retrieved for a specific item variant (dimension).

false

When enabled, the stock of a specific matrix variant is shown, otherwise the stock of the main item is shown.

GetAllStockValuesFromProfit

If enabled, the connector fetches all stock for all items at once, which can be slow.

false

This setting can cause performance issues and timeouts in large environments.

GetStockPeriod

If enabled, the connector calculates future stock levels for the upcoming weeks.

false

When enabled, the app will show not only the current stock, but also the projected stock for the upcoming weeks.

Calculation Logic

The connector calculates the available stock using the following logic:

App4Sales Field

Source Field (API/Excel/DB)

Logic/Notes

AvailableStock

Voorraad (ShelfStock), Te leveren (ToBeDelivered)

The available stock is calculated with the formula: Voorraad - Te leveren. The result is returned as "Available stock".

Future Stock

FbSalesLines, FbPurchaseLines

If GetStockPeriod is enabled, the connector calculates the stock for the upcoming weeks by aggregating the planned deliveries and receipts. The result is shown as "Week X: Y".

Output & UX

The live stock information is displayed in the App4Sales application on the item detail screen. The user will see the current available stock, and if enabled, the future stock levels. If an error occurs during stock retrieval, a "No backoffice" error is shown.

Error Handling

Scenario

Behavior

User impact

AFAS Profit API is unreachable

The connector will throw an exception.

The user will see a "No backoffice" error message in the app.

Item not found in AFAS Profit

The connector will return an empty result.

The user will see a stock level of 0 in the app.

Did this answer your question?