Skip to main content

eAccounting - Item sync

eAccounting Connector - Item Update The Item Update function synchronizes product information from the eAccounting ERP system into t...

Updated over a week ago

eAccounting Connector - Item Update

The Item Update function synchronizes product information from the eAccounting ERP system into the App4Sales internal item database. This process retrieves active articles and their associated VAT percentages, then maps these to App4Sales' internal item structure, calculating stock levels and classifications. Inactive articles in eAccounting are skipped.

Data Source Configuration

Item data is retrieved from the eAccounting API endpoints:

  • Articles: Fetched from /v2/articles. This endpoint provides core item details such as product number, names, prices, stock balances, and associated labels.

  • VAT Percentages: Fetched from /v2/articleaccountcodings. This endpoint provides VAT rate information used for calculating the correct VAT percentage in App4Sales.

Data Mapping Table (App4Sales Item)

App4Sales Field

Source Field (API/Excel/DB)

Logic/Notes

ItemCode

Article.Number

Direct mapping of the eAccounting article number.

Description

Article.Name

Direct mapping of the eAccounting article name.

Description2

Article.NameEnglish

Direct mapping of the eAccounting article English name.

InternalItemCode

Article.Id

The internal identifier from eAccounting.

SalesPrice

Article.NetPrice

The net sales price of the article.

Unit

Article.UnitName

The name of the unit of measure for the article.

VatPercentage

VatPercentage.VatRatePercent (via Article.CodingId)

Looked up from the fetched VAT percentages using Article.CodingId. The VatRatePercent (e.g., 0.12 for 12%) is multiplied by 100 to get the percentage value. Defaults to 0 if no matching VAT percentage is found.

EanCode

Article.Barcodes.FirstOrDefault()?.Barcode

The barcode of the first EAN code associated with the article, if available.

ItemCategories (Gross price)

Article.GrossPrice

A custom item category named "Gross price" is created, with its value set to the Article.GrossPrice formatted to two decimal places.

PurchasePackageSize

Article.ArticleLabels

If an ArticleLabel.Name starts with the prefix defined in the PurchasePackageSizePrefix setting, the remainder of the label name is parsed as an integer and used as the purchase package size. Defaults to 1 if parsing fails or no matching label is found.

LastAvailableStock

Derived

Calculated based on stock values from eAccounting using a configurable stock formula (see "Stock & Availability" section).

StockIndicator

Derived

Determined by the calculated stock values and connector settings (see "Stock & Availability" section).

ItemClasses (Filter)

Article.ArticleLabels

A hardcoded ItemClass named "Filter" is created. Values are derived from ArticleLabels.Name, excluding those used for PurchasePackageSize.

Special Logic & Filters

  • Article Filtering: Only articles where Article.IsActive is true are processed and synchronized to App4Sales. Inactive articles are skipped.

  • Stock Formula Execution: The connector retrieves several stock-related fields from eAccounting articles (StockBalanceReserved, StockBalance, StockBalanceAvailable). These values are then passed to an ExecuteStockFormula method. This method takes these stock fragments and a stock formula (if configured in AdministrationSession.CurrentSession.StockFormula) to calculate the LastAvailableStock. If a custom script for stock calculation exists, it can override this default behavior.

  • Stock Indicator Calculation: The StockIndicator (Red, Orange, Green) for an item is determined by the CalculateStockIndicatorByFormula method, which considers the calculated stock values and several connector settings. This logic can also be overridden by a custom script.

Domain Specifics

Price Logic

  • Net Price: The Article.NetPrice is directly mapped to App4Sales Item.SalesPrice.

  • Gross Price: The Article.GrossPrice is stored as a custom ItemCategory named "Gross price".

  • VAT Percentage: The VAT percentage for an item is derived from the VatPercentage.VatRatePercent corresponding to the Article.CodingId. This value is multiplied by 100 to convert it from a decimal rate (e.g., 0.12) to a percentage (e.g., 12%).

Stock & Availability

  • Stock Data Source: Stock information (StockBalance, StockBalanceReserved, StockBalanceAvailable) is directly sourced from the /v2/articles API endpoint.

  • Last Available Stock Calculation: This value is dynamically calculated. If a StockFormula is defined in the App4Sales administration settings, it processes the raw stock figures (StockBalanceReserved, StockBalance, StockBalanceAvailable) to determine the LastAvailableStock.

  • Stock Indicator: The visual stock indicator (Red, Orange, or Green) is determined by the CalculateStockIndicatorByFormula method based on the calculated stock.

    • If the setting "Get stock indicator by formula" (GetStockIndicatorByFormula) is disabled, the indicator defaults to Orange.

    • If a custom script for CalculateStockIndicatorByFormula is provided and executed, its result is used.

    • Otherwise, a default logic is applied:

      • If "AvailableStock" is not present, it's Orange.

      • If "ShelfStock" and "ToBeDelivered" are present:

        • If (ShelfStock - ToBeDelivered) > 0, the indicator is Green.

        • Otherwise, if "Economic stock on stock indicator" (EconomicStockOnStockIndicator) is enabled and AvailableStock + ToBeReceived > 0, the indicator is Orange.

        • Otherwise, the indicator is Red.

      • If "ShelfStock" and "ToBeDelivered" are not both present:

        • If AvailableStock > 0, the indicator is Green.

        • Otherwise, the indicator is Red.

      • The values QuantityForRed and QuantityForGreen from App4Sales settings can influence the stock indicator calculation if a custom script uses them.

Classification & Attributes

  • Item Categories: A fixed ItemCategory named "Gross price" is added, containing the article's gross price.

  • Item Classes: A fixed ItemClass named "Filter" is created. Its values are populated from the Article.ArticleLabels received from eAccounting. Labels that match the PurchasePackageSizePrefix setting are excluded from becoming item class values.

Related Settings & Prerequisites

  • Purchase Package Size Prefix: (PurchasePackageSizePrefix) A connector setting used to identify article labels that should be interpreted as the item's purchase package size. Example: "PACK_".

  • Stock Formula: (AdministrationSession.CurrentSession.StockFormula) A formula defined in the App4Sales administration settings that dictates how raw stock values from eAccounting are combined to calculate the LastAvailableStock.

  • Get stock indicator by formula: (Session.ConnectorBaseSettings.GetStockIndicatorByFormula) A boolean setting that, if false, causes the stock indicator to default to Orange regardless of calculated stock.

  • Economic stock on stock indicator: (Session.ConnectorBaseSettings.EconomicStockOnStockIndicator) A boolean setting that, if true, considers "ToBeReceived" stock when determining the Orange stock indicator.

  • Quantity for Red: (App4SalesSettings.QuantityForRed) An App4Sales setting defining the threshold for a Red stock indicator. Used if a custom script for stock indicator calculation is implemented.

  • Quantity for Green: (App4SalesSettings.QuantityForGreen) An App4Sales setting defining the threshold for a Green stock indicator. Used if a custom script for stock indicator calculation is implemented.

Did this answer your question?