Appearance
After-calculation scripts
Some results need more than one calculation: holiday accruals, holiday pay and pay statistics such as the average hourly pay. Salaxy calculates them with the Finnish rules by default. When a customer has its own rules, you can replace a calculation with a script. For the big picture, see Custom payroll logic.
Beta
In production, scripts run only for customers that Salaxy has turned the feature on for. See Custom payroll logic.
These scripts are not in calc.bleConfigs. Each one is stored in its own place in the company settings, next to the rule it replaces.
| Method | What it returns | Where the script is stored | When Salaxy uses it |
|---|---|---|---|
getAccruals(calculation, calculations, holidayYear, ctx, sxy) | The holiday accruals of a calculation, by month | holiday.holidayAccrualSettings[].script | The holiday year's holiday code is script. |
getHolidayPay(calculations, holidayYear, ctx, sxy) | The holiday pay of a holiday year | holiday.holidayPaySettings[].script | The holiday pay calculation is scriptPay. |
getPayStatsResult(calculations, ctx, sxy) | Pay statistics, such as the average hourly pay | payStats.types[].script | The pay statistics type's kind is script. Only for employments that are paid by the hour. |
calculationsare the calculations of the same employment and period.holidayYearis the employment's holiday year.ctxholds the employment and the company settings.- Return
undefinedto make no change.
Which setting applies
Like the calculation scripts, each setting can be limited to a collective agreement (cbaCode) and an employee group (employeeGroup). Holiday settings can also be limited to holiday years (startYear, endYear). A setting with disabled: true is skipped.
Example
Pay statistics feed the price helpers: sxy.prices.averageHourlyPay() in a row type script reads the average hourly pay that the pay statistics store in the employment.
js
class AverageHourlyPay {
getPayStatsResult(calculations, ctx, sxy) {
// Read the hours and the pay from the rows of the calculations,
// and return the result object of the pay statistics type.
}
}Each script is the source code of one class. Salaxy finds the class with the method it needs, so you do not write metadata for these scripts.

