Skip to content

Calculations

This is the configuration instructions for how to setup the automatic calculations.

Lime Admin

In Lime Admin, it is possible to configure several instances of the calculations. The standard case is to add one such instance for the invoice limetype. But it can be used in case the Lime CRM application has several limetypes similar to invoice, where you also want to get the same numbers calculated.

Calculation Configuration

In Lime Admin, go to Settings -> ERP Connector -> Sales trend instances. The following properties have to be configured for each instance. As the standard case is for invoices, this is how things are named to make it easier to understand.

Invoice

Parameter Values Database type Comment Default
limetypeInvoice String limetype Table name of the invoice limetype invoice
propertyInvoiceSum String decimal Property for the sum of the invoice invoice_sum
propertyInvoiceDate String date Property for the date that the calculations are based on invoice_date
propertyConversionrate String decimal Property to convert the sum to the local currency conversionrate
propertyCompany String belongsto Relation property to company company

Company

Parameter Values Database type Comment Default
limetypeCompany String limetype Table name for the company limetype company
propertyYtd String decimal Property to save turnover from invoices this fiscal year erp_turnover_yearnow
propertyLytd String decimal Property to save turnover from invoices the same period last fiscal year erp_turnover_lastyeartodate
propertyLastyear String decimal Property to save turnover from all invoices last year erp_turnover_lastyear
propertyYtdGrowth String decimal Property to save calculated growth: (YTD / LYTD - 1) * 100 erp_ytdgrowth
propertySalestrend String option Property to save calculated trend: YTD/LYTD. Options: empty, increasing, steady, decreasing erp_salestrend

Settings

Parameter Values Comment Default
name String Unique instance name -
fiscalYearFirstMonth String First month of fiscal year (1-12) -
turnoverDecreasingRate decimal Defines the rate for a decreasing sales trend. 0.8 means that a 20% turnover decrease from last year is considered steady, while more than that will turn the sales trend into decreasing. 0.8

Web Component for Table Views

For each limetype where you want to display the calculations, you need to add the following Table view config.

{
    "component": {
        "props": {},
        "name": "lwc-limepkg-erp-connector-sales-trend-table"
    },
    "property": "erp_ytdgrowth",
    "isDefault": true
}

Info

For the limetype company, this is already part of the suggested table view config, provided in the general configuration settings.

Application Config

In order to enable a scheduled task that runs all turnover calculations every night, add the following application config.

For Cloud Customers

Add this snippet to the application config.

limepkg-erp-connector:
    daily_scheduled_job: True

For On-Premise Customers

Add this snippet to the application_config.yaml file and restart the Task Handler service afterwards.

<APPLICATION-NAME>:
  config:
    limepkg-erp-connector:
      daily_scheduled_job: True

Environment Config

For On-Premise Customers

For the scheduled task on-premise customers can overwrite their environment config to change the username, the language and the task schedule. Below you can see the default values:

plugins:
    limepkg_erp_connector:
        sales_trend:
            username: erpsync@lime,
            language: en_us,
            daily_schedule:
                hour: '1'
                minute: '10'

Copy this to the config file of the Task Handler service and adjust the values if necessary. The daily schedule is described as a Crontab and runs at 1:10 AM daily by default. You can find more information on how to configure a Crontab schedule here.