Payroll Calculation Functions
Path: Administration / Payroll Calculation Functions
This document provides a detailed description of all payroll calculation functions used in payroll element and report configuration in the SMART Payroll system. Each function has a unique number and performs a specific calculation operation during payroll document processing.
How to Read This Document
Each function is described using a consistent structure:
- What it does — general description of the function's purpose
- Parameters — what data the function accepts and from which tables
- Result — what the function returns and which Payroll Document Line fields it updates
- Calculation logic — step-by-step algorithm
*[AE]: Average Earnings *[SSC]: Social Security Contribution *[YTD]: Year-to-Date *[LCY]: Local Currency *[MROT]: Minimum Wage (system code) *[PIT]: Personal Income Tax
Function Groups
| Number Range | Description | Codeunit |
|---|---|---|
| 100–550 | Time & calendar, limits, base amounts, ranges, allocation, salaries | SMA Payroll Document Calculate |
| 2002–2301 | Taxation, withholding, YTD amounts, salaries by period, service, advances | SMA Payroll Document Calculate |
| 21094000–21094050 | Salaries by date, sick leave, indexation, currency, accruals by period | SMA Payroll Document Calculate |
| 21094051–21094112 | Leave & reserves, data validations, balances, net pay calculation | SMA Payroll Document Calculate |
| 21094900–21094924 | Ranges, service, base amounts, action dates, positions | SMA Payroll Document Calculate |
| 21094500–21094518 | Report functions: statistics, amounts | SMA Payroll Report Calculation |
Note: Functions marked DEPRECATED are kept for backward compatibility. For new configurations, use the recommended replacements.
Payroll Calculation Functions (Part 1): Time, Limits, Base Amounts, Salaries, Advances (100–550, 2002–2301)
This section contains functions for time and calendar, limits, base amounts, ranges, salaries, taxation, and advances. Each function is used in payroll element calculation lines and is invoked during Payroll Document computation.
Time, Calendar, Limits, Base Amounts, Allocation, Salaries (100–550)
Function 100 — Calculate Time Measure (CalcTimeMeasure)
What it does: A universal configurable function that returns planned or actual days or hours for a selected period. Depending on parameters, it can query the production calendar (planned values) or the timesheet (actual values).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Parameter Code | Calculation Line (Parameter Code) | Required. Identifies the function parameter set in the "Calculation Function Parameters" table |
| Time Measure Type | Calculation Function Parameter (Time Measure Type) | Required. Determines which value to return. Possible values: Planned Calendar Days, Planned Working Days, Planned Weekend Days, Planned Working Hours, Planned Night Hours, Planned Evening Hours, Planned Holiday Hours, Official versions of the same indicators, Actual Calendar Days, Actual Hours, Actual Working Days, Actual Calendar Days Without Holidays, Planned Working Days (by Timesheet) |
| Period Filter | Calculation Function Parameter (Period Filter) | Required. Determines the date range. Possible values: By Action Dates, By Pay Period, By Wage Period Code, By Period Code, By Bonus Period, By Intersection Dates, In Current Year, By Average Earnings Period |
| Use Dimensions Filter | Calculation Function Parameter (Use Dimensions Filter) | Optional. When enabled, filters timesheet data by dimensions (Shortcut Dimension 1 Code, Shortcut Dimension 2 Code) of the Payroll Document Line |
| Time Activity Group | Calculation Line (Time Activity Group) | Used to filter timesheet data by time activity group |
Result:
- Returns: Decimal -- number of days or hours according to the selected time measure type
- Updates Payroll Document Line fields: --
Calculation logic:
- Loads the function parameter by parameter code from the calculation line.
- Validates required fields "Time Measure Type" and "Period Filter".
- Determines the date range (FromDate, ToDate) based on the period filter:
- "By Action Dates" -- takes action dates from the document line.
- "By Pay Period" -- takes the start and end of the document's pay period.
- "By Wage Period Code" -- takes the wage period dates.
- "By Period Code" -- takes the current payroll period dates.
- "By Bonus Period" -- takes the bonus period dates.
- "By Intersection Dates" -- takes the intersection of action dates with period dates.
- "In Current Year" -- from the start of the first period of the year to the end of the year.
- "By Average Earnings Period" -- takes the average earnings period dates.
- Depending on the time measure type:
- For planned values -- calls CalendarMgt.GetPeriodInfo() with the employee's calendar or the official calendar (for "Off." types).
- For actual values -- calls TimesheetMgt.GetTimesheetInfo() or TimesheetMgt.GetTimesheetInfoWithDimension() (if dimensions filter is enabled).
- Returns the resulting numeric value.
Function 150 — Get Payroll Limit (GetPayrollLimit)
What it does: Returns the payroll limit value from the "Payroll Limits" table for the specified limit type and period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Parameter Code | Calculation Line (Parameter Code) | Required. Identifies the function settings |
| Payroll Limit Type | Calculation Function Parameter (Payroll Limit Type) | Determines which limit to return. Possible values: Minimum Wage, SSC Limit, Indexation Threshold, Subsistence Minimum, Minimum Wage Hourly, Compensation Coefficient, Per Diem Allowance, Per Diem Allowance Abroad |
| Period Filter | Calculation Function Parameter (Period Filter) | Required. Determines which period to use for the limit lookup. Possible values: By Period Code, By Wage Period Code, By Pay Period, In Current Year, By Action Dates, By Intersection Dates, By Bonus Period |
Result:
- Returns: Decimal -- limit amount from the "Payroll Limits" table
- Updates Payroll Document Line fields: --
Calculation logic:
- Loads the function parameter and validates the required period filter.
- Determines the period code based on the filter:
- "By Period Code" -- takes the Period Code from the document line.
- "By Wage Period Code" -- takes Wage Period From.
- "By Pay Period" -- takes the document's pay period.
- "In Current Year" -- takes the first period code of the year.
- "By Action Dates" -- finds the period by the action start date.
- "By Intersection Dates" -- finds the period by the document start date.
- "By Bonus Period" -- takes the bonus period code.
- Searches the "Payroll Limits" table for the last entry with the limit type and period code
<=the determined one. - Returns the Amount field of the found record, or 0 if no record is found.
Function 220 — Base Amount from Current Document (BaseAmount)
What it does: Sums amounts from lines of the current payroll document according to the "Base Amount" table settings. This is the primary function for determining the accrual or deduction base.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Base Amount Code | Calculation Line (Base Amount Code) | Required. Identifies the filter set in the "Base Amount" table |
Filter settings in the "Base Amount" table:
| Parameter | Description |
|---|---|
| Employee Filter | By Employee / By Person / By Other Employees |
| Period Filter | By Period Code / By Wage Period Code / By Bonus Period / By Action Dates / By Intersection Dates / By Pay Period |
| Amount Type | Payroll Amount / Corr. Amount / Taxable Amount / Tax Deduction and others |
| Element Code Filter | Filter by payroll element code |
| Element Type Filter | Filter by element type |
| Element Group Filter | Filter by element group |
| Income Tax Base Filter | Filter by income tax base |
| SSC Base Filter | Filter by SSC base |
Result:
- Returns: Decimal -- amount according to the configured amount type
- Updates Payroll Document Line fields: --
Calculation logic:
- Loads base amount settings by element code and base amount code.
- Validates the required "Amount Type" field.
- Determines the employee filter:
- "By Employee" -- filters by document number of the current line.
- "By Person" -- filters by person code across all documents. If the calculation group has type "Between" (interperiod), additionally aggregates data from posted documents of other calculation groups.
- "By Other Employees" -- filters by person code, excluding the current employee.
- Sets base amount filters (element codes, types, groups, etc.).
- Sets the period filter according to the setting.
- Sums the corresponding amount type from filtered document lines.
- Returns the result.
Function 230 — Detailed Base Amount (DetailedBaseAmount)
What it does: Returns a detailed base amount for taxes. Unlike Function 220, it works with the "Detailed Tax Base" table and creates entries for subsequent distribution of the tax amount among sources.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Base Amount Code | Calculation Line (Base Amount Code) | Required. Identifies the filters in the "Base Amount" table |
Result:
- Returns: Decimal -- detailed base amount according to the amount type (Payroll Amount, Corr. Amount, or Tax Deduction)
- Updates Payroll Document Line fields: --
Calculation logic:
- Loads the base amount settings and validates the required amount type.
- Filters the "Detailed Tax Base" table by base document number and tax document number.
- Sets the filter by payroll element code and tax element code.
- Depending on the amount type, sums the corresponding field (Corr. Amount, Payroll Amount, or Deduction Amount).
- Returns the total.
Function 247 — Base Balance from Ledger Entries (BaseBalance)
What it does: Returns an amount from posted payroll entries (the "Payroll Ledger Entry" table). Unlike Function 220, which works with the current document, this function reads data from already posted documents.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Base Amount Code | Calculation Line (Base Amount Code) | Required. Identifies the filters in the "Base Amount" table |
Filters are analogous to Function 220, but applied to the "Payroll Ledger Entry" table.
Result:
- Returns: Decimal -- amount from posted payroll entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Loads the base amount settings and validates the required amount type.
- Sets the base amount filters on the "Payroll Ledger Entry" table.
- Determines the employee filter (By Employee / By Person / By Other Employees).
- Determines the period filter:
- "By Period Code" -- can use the previous period (if the "Use Previous Period" flag is enabled).
- "By Wage Period Code" -- filters by Wage Period From.
- Other filters are analogous to Function 220.
- Sums the corresponding amount type from filtered entries.
- Returns the result.
Function 249 — Range-Based Deduction (Deduction)
What it does: Calculates a deduction amount based on range lines (scale). The function is used for deductions that depend on the amount and have a progressive or tabular structure.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Range Header | Determined automatically (GetRangeHeader) | Loaded by element code, range type, and range code from the calculation line |
| Range Type | Calculation Line (Range Type) | Payroll range type |
| Range Code | Calculation Line (Range Code) | Specific range code |
Result:
- Returns: Decimal -- deduction amount calculated from range lines
- Updates Payroll Document Line fields: --
Calculation logic:
- Retrieves the number of exemptions from the Employee Payroll Element Ledger Entry.
- Filters range lines by element code, range code, and period code.
- Additionally filters by employee gender (if allowed in the header), date of birth, and disability status.
- Iterates through range lines (from highest to lowest):
- If the line contains "Amount Over" -- checks whether this threshold is exceeded.
- Calculates the deduction amount = Amount + (Annual Base * Percentage / 100).
- If "Per Exemption" is enabled -- multiplies by the number of exemptions.
- Checks the minimum and maximum amounts of the line.
- Converts the result to a monthly value (divides by 12).
- Returns the total deduction amount.
Function 250 — Year-to-Date Base Amount (YTDBaseAmount)
What it does: Returns an amount from the Payroll Ledger Entry (posted documents) from the beginning of the calendar year. Uses the same base amount filters as Function 220, but reads from posted data starting from the first period of the year.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Base Amount Code | Calculation Line (Base Amount Code) | Required. Identifies the filters in the "Base Amount" table |
Result:
- Returns: Decimal -- year-to-date amount from the Payroll Ledger Entry
- Updates Payroll Document Line fields: --
Calculation logic:
- Loads the base amount settings and validates the amount type.
- Sets the base amount filters on the "Payroll Ledger Entry" table.
- Determines the employee filter (By Employee / By Person / By Other Employees).
- Determines the period filter:
- "By Period Code" -- from the first period of the year to the current (or previous, if enabled).
- "By Wage Period Code" -- analogously.
- "By Bonus Period" -- filters by the bonus period.
- "By Action Dates" -- by the action date range.
- "By Intersection Dates" -- by intersection dates.
- "By Pay Period" -- from the first period of the year to the pay period.
- Sums the corresponding amount type and returns the result.
Function 252 — Range Minimum Value (Brackets Min)
What it does: Returns the minimum amount from the first matching payroll range line. Used to retrieve threshold values from the range reference.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Range Header | Determined automatically (GetRangeHeader) | Loaded by element code, type, and range code |
| Range Type | Calculation Line (Range Type) | Range type |
| Range Code | Calculation Line (Range Code) | Range code |
Result:
- Returns: Decimal -- value of the "Min Amount" field from the first matching range line
- Updates Payroll Document Line fields: --
Calculation logic:
- Retrieves the Range Header (GetRangeHeader).
- Filters range lines by range code, element code, and period code.
- Additionally filters by gender (if allowed) and employee's date of birth.
- Finds the first line and returns the "Min Amount" field value.
- If no line is found, returns 0.
Function 253 — Range Maximum Value (Brackets Max)
What it does: Returns the maximum amount from the first matching payroll range line. Analogous to Function 252, but returns a different field.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Range Header | Determined automatically (GetRangeHeader) | Loaded by element code, type, and range code |
| Range Type | Calculation Line (Range Type) | Range type |
| Range Code | Calculation Line (Range Code) | Range code |
Result:
- Returns: Decimal -- value of the "Max Amount" field from the first matching range line
- Updates Payroll Document Line fields: --
Calculation logic:
- Retrieves the Range Header (GetRangeHeader).
- Filters range lines by range code, element code, and period code.
- Additionally filters by gender and employee's date of birth.
- Finds the first line and returns the "Max Amount" field value.
- If no line is found, returns 0.
Function 255 — Range Quantity (Brackets Quantity)
What it does: Returns the "Quantity" field value from the first matching payroll range line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Range Header | Determined automatically (GetRangeHeader) | Loaded by element code, type, and range code |
| Range Type | Calculation Line (Range Type) | Range type |
| Range Code | Calculation Line (Range Code) | Range code |
Result:
- Returns: Decimal -- value of the "Quantity" field from the first matching range line
- Updates Payroll Document Line fields: --
Calculation logic:
- Retrieves the Range Header (GetRangeHeader).
- Filters range lines analogously to Functions 252/253.
- Finds the first line and returns the "Quantity" field value.
- If no line is found, returns 0.
Function 261 — Balance to Date (BalanceToDate)
What it does: Returns the sum of payroll accruals from the Payroll Ledger Entry for the employee and element from the beginning of the year through the current period inclusive.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically from current line |
| Element Type | Payroll Document Line (Element Type) | Automatically from current line |
| Element Code | Payroll Document Line (Element Code) | Automatically from current line |
| Period Code | Payroll Document Line (Period Code) | Automatically from current line |
Result:
- Returns: Decimal -- Payroll Amount from the ledger entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters the ledger entries by employee code, element type, and element code.
- Sets the period filter from the first period of the year to the current period of the line.
- Uses the FlowField "SMA Payroll Amount" on the Employee Card for summing.
- Returns the total amount.
Function 263 — Year-to-Date Taxable Income Tax (YTDTaxableIncomeTax)
What it does: Returns the taxable income amount (Taxable Amount) from the Payroll Ledger Entry for the employee, element, and posting type from the beginning of the year through the current period inclusive.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically from current line |
| Element Type | Payroll Document Line (Element Type) | Automatically |
| Posting Type | Payroll Document Line (Posting Type) | Automatically |
| Element Code | Payroll Document Line (Element Code) | Automatically |
| Period Code | Payroll Document Line (Period Code) | Automatically |
Result:
- Returns: Decimal -- taxable amount year-to-date
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters the ledger entries by employee, element type, posting type, and element code.
- Sets the period filter from the first period of the year to the current period of the line (inclusive).
- Uses the FlowField "SMA Taxable Amount" for summing.
- Returns the taxable income amount.
Function 270 — Get Minimum Wage Limit (GetFSILimit MROT)
DEPRECATED. Replaced by Function 150 (GetPayrollLimit) with the corresponding limit type.
What it does: Returns the minimum wage value from the "Payroll Limits" table for the current period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Period Code | Payroll Document Line (Period Code) | Automatically from current line |
Result:
- Returns: Decimal -- minimum wage value
- Updates Payroll Document Line fields: --
Calculation logic:
- Searches the "Payroll Limits" table for an entry with type MROT and period code
<=current. - Returns the Amount field or 0.
Function 271 — Get SSC Limit (GetFSILimit SSC)
DEPRECATED. Replaced by Function 150 (GetPayrollLimit) with the corresponding limit type.
What it does: Returns the SSC (Social Security Contribution) base limit value from the "Payroll Limits" table.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Period Code | Payroll Document Line (Period Code) | Automatically from current line |
Result:
- Returns: Decimal -- SSC limit amount
- Updates Payroll Document Line fields: --
Calculation logic:
- Searches the "Payroll Limits" table for an entry with type SSC Limit and period code
<=current. - Returns the Amount field or 0.
Function 280 — Update Payroll Element Code (UpdatePayrollElementCode)
What it does: Replaces the payroll element code, base amount code, and time activity group on the Payroll Document Line. New values are taken from the base amount settings and the time activity group of the function parameter.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Base Amount Code | Calculation Line (Base Amount Code) | Determines the new element code through the base amount element code filter |
| Time Activity Group | Calculation Line (Time Activity Group) | Determines the new time activity |
Result:
- Returns: Integer (0)
- Updates Payroll Document Line fields: Element Code, Time Activity Code
Calculation logic:
- Loads the base amount settings by element code and base amount code.
- Determines the new element code from the base amount element code filter (takes the first value before the "|" character).
- Determines the new time activity from the time activity group filter.
- If the element code differs from the current one -- updates it via Validate.
- If the time activity code differs -- updates it.
- Updates timesheet records, replacing the time activity code in timesheet details.
Function 290 — Create Attention Message (CreateAttention)
What it does: Creates an attention (notification) record in the Payroll Document FactBox. The message text is taken from the "Attention Text" field of the calculation line. Typically used after an IF operator to warn about special conditions.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Attention Text | Payroll Calculation Line (Attention Text) | Text to be displayed in the FactBox. Supports substitution of element code and line number |
Result:
- Returns: Integer (0)
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the current element calculation line with the attention text.
- Checks whether an identical attention already exists for this document line.
- If the message does not yet exist, creates a new record in the "Document Attention" table with the formatted text.
Function 300 — Disability Group (GetPersonGroupDisability)
What it does: Returns the employee's disability group number (1, 2, or 3) as of a specified date. If the employee has no disability, returns 0.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Parameter Code | Calculation Line (Parameter Code) | Required. Determines which date to use for the disability check |
| Period Filter | Calculation Function Parameter (Period Filter) | Determines the check date: By Wage Period Code, By Period Code, By Pay Period, In Current Year, or By Action Dates |
Result:
- Returns: Integer -- disability group number (1, 2, 3) or 0
- Updates Payroll Document Line fields: --
Calculation logic:
- Loads the function parameter and determines the check date based on the period filter.
- Searches the "Person Medical Information" table for a record with type "Disability".
- Filters by person code, start date
<=current date, end date>=current date (or blank). - Filters for non-empty disability group.
- Returns the disability group number or 0.
Function 310 — Recalculate Line (RecalculateLine)
What it does: Recalculates other lines in the current document. Used when a change to one element requires recalculation of other dependent elements.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Base Amount Code | Calculation Line (Base Amount Code) | Required. Determines which document lines to recalculate through the base amount filters |
Result:
- Returns: Integer (0)
- Updates Payroll Document Line fields: Recalculates dependent lines (zeroes out and recalculates their amounts)
Calculation logic:
- Saves the current document line (Modify).
- Loads the base amount settings.
- Finds document lines matching the base amount filters that have a line number less than the current one.
- For each found line:
- Deletes related average earnings and insurance service records.
- Zeroes out all amounts and time indicators on the line.
- Runs a full recalculation of the line through the "SMA Payroll Document Calculate" codeunit.
- Saves the recalculated line.
Function 320 — Net Amount (GetNetAmount)
What it does: Returns an indicator of whether the line is a net amount (net pay amount). Effectively checks the "Net Amount" flag on the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| -- | Payroll Document Line | Automatically |
Result:
- Returns: Integer -- 1 if the line has the "Net Amount" flag, 0 otherwise
- Updates Payroll Document Line fields: --
Calculation logic:
- Checks the "Net Amount" field of the document line.
- If true, returns 1; otherwise returns 0.
Function 330 — Amounts from Posted Interperiod Payroll Documents (GetAmountsFromPostedInterperiodPayrollDocuments)
What it does: Returns amounts from posted interperiod payroll documents that have a created payment. Used to account for amounts accrued in other calculation groups of type "Between".
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Base Amount Code | Calculation Line (Base Amount Code) | Required. Identifies the filters |
Result:
- Returns: Decimal -- amount from posted interperiod documents
- Updates Payroll Document Line fields: --
Calculation logic:
- Loads the base amount settings.
- Finds all posted documents with calculation groups of type "Between" (interperiod).
- Filters by employee, period code, and payment created flag.
- Excludes correction and reversal documents.
- Filters posted document lines by base amount settings and period filter.
- Sums the corresponding amount type and returns the result.
Function 340 — Norm Hours for Current Month (SumOfNormHours current month)
What it does: Returns the standard working hours for the current month from the normative calendar. Used for summarized working time accounting.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Action Ending Date | Payroll Document Line (Action Ending Date) | Determines the current month |
Result:
- Returns: Decimal -- standard working hours from the normative calendar
- Updates Payroll Document Line fields: --
Calculation logic:
- Retrieves the employee's calendar as of the action ending date.
- Checks whether summarized working time accounting is enabled.
- Determines the date range according to the accounting period type (month, quarter, half-year, year, week).
- Calculates the norm hours from the normative calendar using CalendarMgt.GetPeriodInfo (working hours).
- Returns the norm hours without averaging.
Function 345 — Norm Hours for Entire Year (SumOfNormHours entire year)
What it does: Analogous to Function 340, but returns the average monthly norm hours for the accounting period. Uses the same summarized working time accounting mechanism.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Action Ending Date | Payroll Document Line (Action Ending Date) | Determines the current month |
Result:
- Returns: Decimal -- average monthly norm hours for the accounting period
- Updates Payroll Document Line fields: --
Calculation logic:
- Performs steps 1--4 of Function 340.
- Additionally divides the result by the number of months in the accounting period (3 for quarter, 6 for half-year, 12 for year).
- Returns the rounded average monthly norm.
Function 400 — Posting Entry Payroll Amount Allocation (AllocatePEPayrollAmount)
What it does: Distributes the payroll accrual amount by posting dimensions. Creates allocation lines for subsequent posting according to the employee's allocation group.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Base Amount Code | Calculation Line (Base Amount Code) | Optional. If specified, determines the element filter through the base amount |
Result:
- Returns: Integer (0)
- Updates Payroll Document Line fields: Creates entries in the "Payroll Doc. Line PE Alloc." table (SMA Payroll Doc. Line PE Alloc)
Calculation logic:
- Deletes existing allocation lines for this document line.
- Retrieves the allocation group code from the Employee Card.
- If no group is set -- exits without action.
- Finds the allocation group type by element code and period.
- For each allocation group line, creates an allocation entry with percentage, posting group, and dimension set.
Function 500 — Average Employee Salary by Date (Hourly) (GetAESalaryByDate hourly)
What it does: Returns the employee's base salary as of a given date, converted to an hourly rate.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Action Starting Date | Payroll Document Line (Action Starting Date) | Date for which the salary is determined |
Result:
- Returns: Decimal -- hourly rate of the base salary
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the latest salary record in the Payroll Element Ledger Entry effective as of the given date.
- Uses the salary element filter from HR Setup (Daily Rate Element Code, Hourly Rate Element Code, Flat Rate Element Code).
- Divides the salary amount by the number of working hours per month from the employee's calendar.
- For an hourly rate element, multiplies by the number of hours from the official calendar.
- For a daily rate element, multiplies by the number of days from the official calendar.
- Returns the hourly rate.
Function 501 — Average Employee Extra Salary by Date (Hourly) (GetAEExtraSalaryByDate hourly)
What it does: Returns the amount of additional payments (supplements) that depend on the base salary, converted to an hourly rate.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Action Starting Date | Payroll Document Line (Action Starting Date) | Date for which supplements are determined |
Result:
- Returns: Decimal -- hourly rate of additional payments
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds all payroll elements where the "Depends on Salary Element" field references the salary element.
- For each such element, finds the effective record in the ledger entries as of the given date.
- Divides the amount of each element by the number of working hours per month from the calendar.
- Sums and returns the total hourly rate of supplements.
Function 502 — Total Earnings by Date (Hourly) (Sum of 500+501)
What it does: Returns the total earnings (base salary + additional payments) as an hourly rate. This is the sum of the results of Functions 500 and 501.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Action Starting Date | Payroll Document Line (Action Starting Date) | Date |
Result:
- Returns: Decimal -- sum of salary and supplement hourly rates
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls GetAESalaryByDate (with ByHours = true flag) -- obtains the salary hourly rate.
- Calls GetAEExtraSalaryByDate (with ByHours = true flag) -- obtains the supplement hourly rate.
- Returns the sum of the two values.
Function 550 — Base Salary by Date in LCY (GetSalaryByDateLCY)
What it does: Returns the employee's base salary as of a given date, converted to local currency (LCY). Supports salaries in foreign currencies with automatic exchange rate conversion.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Document Starting Date | Payroll Document Line (Document Starting Date) | Date for which the salary is determined |
| Posting Date | Payroll Document Line (Posting Date) | Date for currency conversion |
Result:
- Returns: Decimal -- salary amount in local currency
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the effective salary record in the Payroll Element Ledger Entry as of the given date.
- If the salary is in a foreign currency -- converts using the exchange rate as of the posting date.
- For an hourly rate element -- multiplies by the number of working hours from the official calendar for the month.
- For a daily rate element -- multiplies by the number of working days from the official calendar for the month.
- Returns the amount in local currency.
Taxation, Withholding, Salaries by Period, Service, Advances (2002–2301)
Function 2002 — Tax Withholding by Scale (Withholding)
What it does: Calculates the tax withholding amount using a progressive scale (payroll range lines). The primary function for calculating income tax and other taxes that use a rate scale.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Range Header | Determined automatically (GetRangeHeader) | Loaded by element code, type, and range code |
| Range Type | Calculation Line (Range Type) | Range type |
| Range Code | Calculation Line (Range Code) | Range code |
| Taxable Base | Payroll Document Line (Corr. Amount) | Adjusted amount for tax calculation |
Result:
- Returns: Decimal -- withholding amount (returned with a negative sign; the function call inverts the sign)
- Updates Payroll Document Line fields: Directory Code -- if the range line contains a directory code
Calculation logic:
- Determines the sign of the taxable base (positive or negative).
- Checks whether the element is of type "Fund" (SSC) -- affects the sort order.
- Filters range lines by element code, range code, and period code.
- Additionally filters by:
- Employee gender (if allowed in the Range Header).
- Date of birth (if age filter is allowed).
- Disability status as of the action start date.
- Finds the last line where "Amount Over" is less than the absolute value of the base.
- If no line is found for disabled employees -- removes the disability filter and searches again.
- If no line is found at all -- returns 0.
- Formula: Tax Amount = Fixed Tax Amount + (Taxable Base - Sign * Amount Over) * Tax Percentage / 100
- If the result < 0 and the document is not a correction -- returns 0.
- If a maximum withholding is set and the result exceeds it -- caps the result.
- If the range line has a directory code -- updates the "Directory Code" field on the document line.
- Returns the withholding amount.
Function 2003 — Year-to-Date Taxable Amount (YTDTaxableAmount)
What it does: Returns the taxable amount (Taxable Amount) from the Payroll Ledger Entry for the period from the first period of the year to the previous period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Element Type | Payroll Document Line (Element Type) | Automatically |
| Posting Type | Payroll Document Line (Posting Type) | Automatically |
| Element Code | Payroll Document Line (Element Code) | Automatically |
Result:
- Returns: Decimal -- taxable amount from the beginning of the year to the previous period
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters the ledger entries by employee, element type, posting type, and element code.
- Sets the payroll period filter from the first period of the year to the previous period (not including the current one).
- Uses the FlowField "SMA Taxable Amount" for summing.
- Returns the result.
Function 2005 — Year-to-Date Payroll Amount (YTDPayrollAmount)
What it does: Returns the payroll accrual amount (Payroll Amount) from the ledger entries for the period from the first period of the year to the previous period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Element Type | Payroll Document Line (Element Type) | Automatically |
| Posting Type | Payroll Document Line (Posting Type) | Automatically |
| Element Code | Payroll Document Line (Element Code) | Automatically |
Result:
- Returns: Decimal -- payroll amount from the beginning of the year to the previous period
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters the ledger entries by employee, element type, posting type, and element code.
- Sets the payroll period filter from the first period of the year to the previous period.
- Uses the FlowField "SMA Payroll Amount" for summing.
- Returns the result.
Function 2036 — Adjusted Amount for Previous Period (YTDTypeAmount)
What it does: Returns the correction amount (Corr. Amount) from the Payroll Ledger Entry for the previous period. Used to retrieve correction amounts that need to be carried forward to the current period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Element Type | Payroll Document Line (Element Type) | Automatically |
| Element Code | Payroll Document Line (Element Code) | Automatically |
Result:
- Returns: Decimal -- correction amount for the previous period
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters the ledger entries by employee, element type, and element code.
- Sets the payroll period filter to exactly the previous period.
- Uses the FlowField "SMA Corr. Amount" for summing.
- Returns the result.
Function 2070 — Starting Balance (GetStartingBalance)
What it does: Returns the closing balance of the previous month, representing the employee's outstanding debt or overpayment. Used for tracking employee debt/advance.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
Result:
- Returns: Decimal -- starting balance (with inverted sign)
- Updates Payroll Document Line fields: --
Calculation logic:
- Retrieves the Employee Card.
- Sets the date filter from the beginning to the day before the start of the current payroll period.
- Calculates the FlowField "SMA Net Change (LCY)" (net balance in local currency).
- Returns the negative value of the balance (inverts the sign): -Employee."SMA Net Change (LCY)".
Function 2100 — Timesheet Hours by Time Activity Group (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Actual Hours".
What it does: Returns the number of hours from the timesheet for the specified time activity group by period code.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Time Activity Group | Calculation Line (Time Activity Group) | Group for filtering |
Result:
- Returns: Decimal -- number of hours from the timesheet
- Updates Payroll Document Line fields: --
Function 2101 — Timesheet Days by Time Activity Group (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Actual Working Days".
What it does: Returns the number of days from the timesheet for the specified time activity group by period code.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Time Activity Group | Calculation Line (Time Activity Group) | Group for filtering |
Result:
- Returns: Decimal -- number of days from the timesheet
- Updates Payroll Document Line fields: --
Function 2102 — Calendar Days in Period (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Planned Calendar Days" and filter "By Period Code".
What it does: Returns the number of calendar days in the payroll period from the production calendar.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| -- | Automatically | Uses the employee's calendar and payroll period dates |
Result:
- Returns: Decimal -- number of calendar days in the period
- Updates Payroll Document Line fields: --
Function 2103 — Working Days in Year (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Planned Working Days" and filter "In Current Year".
What it does: Returns the number of working days from the production calendar for the entire year.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| -- | Automatically | Uses the employee's calendar, dates from the first period of the year to the end of the year |
Result:
- Returns: Decimal -- number of working days in the year
- Updates Payroll Document Line fields: --
Function 2104 — Working Days in Period (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Planned Working Days" and filter "By Period Code".
What it does: Returns the number of working days from the production calendar for the payroll period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| -- | Automatically | Uses the employee's calendar and payroll period dates |
Result:
- Returns: Decimal -- number of working days in the period
- Updates Payroll Document Line fields: --
Function 2105 — Working Hours in Period (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Planned Working Hours" and filter "By Period Code".
What it does: Returns the number of working hours from the production calendar for the payroll period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| -- | Automatically | Uses the employee's calendar and payroll period dates |
Result:
- Returns: Decimal -- number of working hours in the period
- Updates Payroll Document Line fields: --
Function 2106 — Working Hours in Year (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Planned Working Hours" and filter "In Current Year".
What it does: Returns the number of working hours from the production calendar for the entire year.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| -- | Automatically | Uses the employee's calendar, dates from the first period of the year to the end of the year |
Result:
- Returns: Decimal -- number of working hours in the year
- Updates Payroll Document Line fields: --
Function 2107 — Calendar Days at Intersection of Action Dates and Period (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Planned Calendar Days" and filter "By Intersection Dates".
What it does: Returns the number of calendar days at the intersection of the document line's action dates and the payroll period dates.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Action Starting Date | Payroll Document Line (Action Starting Date) | Automatically |
| Action Ending Date | Payroll Document Line (Action Ending Date) | Automatically |
Result:
- Returns: Decimal -- number of calendar days at the intersection
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the start date as the maximum of the action start date and the period start.
- Determines the end date as the minimum of the action end date and the period end.
- Returns the number of calendar days for this range.
Function 2108 — Working Hours at Intersection of Action Dates and Period (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Planned Working Hours" and filter "By Intersection Dates".
What it does: Returns the number of working hours at the intersection of the document line's action dates and the payroll period dates.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Action Starting Date | Payroll Document Line (Action Starting Date) | Automatically |
| Action Ending Date | Payroll Document Line (Action Ending Date) | Automatically |
Result:
- Returns: Decimal -- number of working hours at the intersection
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the start date as the maximum of the action start date and the period start.
- Determines the end date as the minimum of the action end date and the period end.
- Returns the number of working hours for this range (CalendarMgt.GetPeriodInfo, What=3).
Function 2110 — Fill Average Earnings Data (FillDocLineAEData)
What it does: The main entry point for average earnings calculation. Populates the "Payroll Document Line Average Earnings" and "Payroll Average Earnings Period" tables. Determines the average earnings calculation setup depending on the document type (vacation, sick leave, business trip, etc.).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| AE Setup Code | Calculation Line (AE Setup Code) | Optional. Code of the specific AE setup. If not specified, determined automatically by document type |
Result:
- Returns: Decimal -- calculated average earnings
- Updates Payroll Document Line fields: Average earnings data (AE Daily Earnings, AE Hourly Earnings), AE Period (AE Period From, AE Period To)
Calculation logic:
- Validates the required action start date and element code.
- Deletes previous average earnings records and AE periods for this line.
- Determines the AE calculation type by document type:
- Vacation -- "Vacation" (or "Vacation Compensation" for compensation).
- Sick leave -- "Sick Leave", "Child Care 1", "Child Care 2", or "Pregnancy Leave" depending on the sick leave type.
- Other absence or business trip -- "Others".
- Finds the latest applicable AE setup by type and period.
- Populates the periods and average earnings amounts according to the settings.
- Returns the calculated average earnings.
Function 2111 — Maximum Sick Leave Daily Payment (GetMaxDailyPayment)
What it does: Returns the maximum daily average earnings value for sick leave calculation. The value is taken from the sick leave settings.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Automatically | Uses the sick leave type and action start date |
Result:
- Returns: Decimal -- maximum average earnings
- Updates Payroll Document Line fields: --
Calculation logic:
- Searches the "Sick Leave Setup" table for entries with type "Salary Limits".
- Filters by sick leave type and action start date.
- Returns the "Maximal Average Earning" field value.
Function 2112 — Minimum Sick Leave Wage Amount (GetMinWageAmount)
What it does: Returns the maximum accrual amount for sick leave based on the employee's insurance service length. The value is taken from the sick leave settings.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Automatically | Uses the sick leave type and service length |
Result:
- Returns: Decimal -- maximum (capping) accrual amount
- Updates Payroll Document Line fields: --
Calculation logic:
- Searches the "Sick Leave Setup" table for the corresponding record.
- Takes the employee's insurance service length into account to determine the threshold.
- Returns the "Maximal Wage Amount" field value (maximum payroll amount for sick leave).
Function 2113 — Salary for Previous Period (GetSalaryPrevPeriod)
What it does: Returns the accrual amount for salary elements from the previous payroll period. Used for comparison or indexation calculation.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
Result:
- Returns: Decimal -- salary amount for the previous period
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the previous payroll period (offset -1 from the current).
- Filters the ledger entries by employee, previous period, and salary element filter.
- The element filter is composed from HR Setup: "Daily Rate Element Code" + "Hourly Rate Element Code" + "Flat Rate Element Code" + "Hourly Wage Element Code" + "Daily Wage Element Code".
- Uses the FlowField "SMA Payroll Amount" for summing.
- Returns the amount. If the previous period does not exist, returns 0.
Function 2114 — Calendar Days in Wage Period (DEPRECATED)
DEPRECATED. Replaced by Function 100 (CalcTimeMeasure) with type "Planned Calendar Days" and filter "By Wage Period Code".
What it does: Returns the number of calendar days in the wage period from the production calendar.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| -- | Automatically | Uses the employee's calendar and wage period dates |
Result:
- Returns: Decimal -- number of calendar days in the wage period
- Updates Payroll Document Line fields: --
Function 2220 — Base Salary for Period (GetBaseSalary)
What it does: Returns the weighted average base salary of the employee for the payroll period, accounting for rate changes during the period. If the salary changed within the period, it is calculated proportionally by working days.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Payroll Period | System variable (PayrollPeriod) | Current payroll period |
Result:
- Returns: Decimal -- weighted average salary for the period
- Updates Payroll Document Line fields: --
Calculation logic:
- Builds the salary element filter from HR Setup: "Daily Rate Element Code", "Hourly Rate Element Code", "Flat Rate Element Code".
- Finds all Payroll Element Ledger Entry records effective during the period.
- For each record, determines the actual date range within the period (takes the maximum of the action start date and the period start; minimum of the action end date and the period end).
- Calculates the number of working days for each record (CalendarMgt.GetPeriodInfo, What=2).
- Sums the total number of working days.
- Formula: Salary = Sum(Record Amount * Record Working Days / Total Working Days)
- Returns the weighted average salary amount.
Function 2221 — Extra Salary for Period (GetExtraSalary)
What it does: Returns the weighted average amount of additional payments (supplements) that depend on the salary element, for the payroll period. Analogous to Function 2220, but for elements with the "Depends on Salary Element" field.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
| Payroll Period | System variable (PayrollPeriod) | Current payroll period |
Result:
- Returns: Decimal -- weighted average supplement amount for the period
- Updates Payroll Document Line fields: --
Calculation logic:
- Builds the salary element filter (analogous to Function 2220).
- Finds all payroll elements where the "Depends on Salary Element" field references one of the salary elements.
- For each found supplement element, searches for effective records in the ledger entries.
- Calculates the weighted average amount by working days analogous to Function 2220.
- Returns the result.
Function 2230 — Salary Pay by Hours (GetSalaryPay by Hours)
What it does: Calculates the accrual amount as the monthly salary multiplied by the ratio of actually worked hours to planned hours. The primary function for hourly payroll calculation.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Time Activity Group | Calculation Line (Time Activity Group) | Group for determining actual hours from the timesheet |
| Parameter Code | Calculation Line (Parameter Code) | Optional. If specified, can enable dimension filtering |
Result:
- Returns: Decimal -- accrual amount = Salary * Actual Hours / Planned Hours
- Updates Payroll Document Line fields: Planned Hours, Actual Hours
Calculation logic:
- Retrieves the salary amount from the Payroll Element Ledger Entry by the line's entry number.
- Calculates planned hours from the production calendar for the period (CalendarMgt.GetPeriodInfo, What=3).
- Calculates actual hours from the timesheet by time activity group and by the line's action dates:
- If dimension filtering is enabled (Use Dimensions Filter) -- filters by shortcut dimensions.
- Writes planned and actual hours to the document line.
- Formula: Result = Salary Amount * Actual Hours / Planned Hours
- Returns the calculated amount.
Function 2232 — Advance Pay by Hours (GetAdvancePay by Hours)
What it does: Calculates the advance amount as salary multiplied by the ratio of actual hours to planned hours, but only up to the advance date. Differs from Function 2230 in that it uses the advance date as the upper boundary.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Time Activity Group | Calculation Line (Time Activity Group) | Group for determining actual hours from the timesheet |
Result:
- Returns: Decimal -- advance amount = Salary * Actual Hours / Planned Hours
- Updates Payroll Document Line fields: Action Starting Date, Action Ending Date, Actual Days, Actual Hours
Calculation logic:
- Builds the hourly salary element filter from HR Setup.
- Finds all salary records effective during the payroll period.
- Checks for the presence of an advance date in the period (Advance Date).
- For each record, determines the date range from the action start (or period start) to the advance date (or action end date).
- Calculates actual hours from the timesheet for this range.
- Calculates planned hours from the calendar for the full period.
- Formula: Advance = Sum(Salary Amount * Actual Hours / Planned Hours)
- Updates the action dates and actual time indicators on the document line.
- Returns the advance amount.
Function 2239 — Salary Pro Rata Calendar (SalaryProRataCalendar)
What it does: Calculates the accrual amount accounting for rate changes during the period, proportional to calendar hours. Handles overlapping salary records by adjusting end dates.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| -- | Automatically | Uses element code, employee code, and payroll period dates |
Result:
- Returns: Decimal -- accrual amount distributed by calendar hours
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds all salary records from the Payroll Element Ledger Entry effective during the period.
- Handles overlapping records: if a previous record has an end date
>=the start date of the next, adjusts the end date to the day before the next record's start. - Calculates the total working hours for the period from the production calendar (HoursWork).
- For each record in the temporary set:
- Determines the date range within the period.
- Calculates the calendar hours for this range (CalendarHours).
- Formula: Portion = (Record Amount / Total Hours) * Record Calendar Hours.
- Sums all portions and returns the result.
Function 2240 — Salary Pay by Days (GetSalaryPay by Days)
What it does: Calculates the accrual amount as the monthly salary multiplied by the ratio of actually worked days to planned days. Analogous to Function 2230, but uses days instead of hours.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Time Activity Group | Calculation Line (Time Activity Group) | Group for determining actual days from the timesheet |
| Parameter Code | Calculation Line (Parameter Code) | Optional. Can enable dimension filtering |
Result:
- Returns: Decimal -- accrual amount = Salary * Actual Days / Planned Days
- Updates Payroll Document Line fields: Planned Days, Actual Days
Calculation logic:
- Retrieves the salary amount from the ledger entries.
- Calculates planned days from the production calendar (CalendarMgt.GetPeriodInfo, What=2).
- Calculates actual days from the timesheet by time activity group and by action dates:
- If dimension filtering is enabled -- filters by shortcut dimensions.
- Writes planned and actual days to the document line.
- Formula: Result = Salary Amount * Actual Days / Planned Days
- Returns the calculated amount.
Function 2241 — Extra Pay by Time Activity Group (GetExtraPay)
What it does: Calculates the surcharge amount based on the salary rate and actually worked hours in the specified time activity group. Used for night, evening, holiday, and other surcharges.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Time Activity Group | Calculation Line (Time Activity Group) | Group for determining actual hours (e.g., night hours) |
Result:
- Returns: Decimal -- surcharge amount = Salary * Actual Group Hours / Total Planned Hours
- Updates Payroll Document Line fields: Planned Hours, Actual Hours
Calculation logic:
- Calculates total planned hours from the timesheet by the work time group from HR Setup (Work Time Group Code).
- Writes planned hours to the document line.
- For each salary record effective during the period:
- Determines the date range within the period.
- Calculates actual hours from the timesheet for the specified time activity group (e.g., night hours).
- Formula: Surcharge += Salary Amount * Actual Group Hours / Planned Hours.
- Accumulates actual group hours.
- Writes actual hours to the document line.
- Returns the total surcharge amount.
Function 2242 — Advance Pay by Days (GetAdvancePay by Days)
What it does: Calculates the advance amount proportional to actually worked days up to the advance date. Analogous to Function 2232, but uses days instead of hours.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Time Activity Group | Calculation Line (Time Activity Group) | Group for determining actual days from the timesheet |
Result:
- Returns: Decimal -- advance amount = Salary * Actual Days / Planned Days
- Updates Payroll Document Line fields: Action Starting Date, Action Ending Date, Actual Days, Actual Hours
Calculation logic:
- Builds the daily salary element filter from HR Setup.
- Finds all salary records effective during the payroll period.
- For each record, determines the date range from the start to the advance date.
- Calculates actual days from the timesheet for this range.
- Calculates planned days from the calendar for the full period.
- Formula: Advance = Sum(Salary Amount * Actual Days / Planned Days)
- Updates the action dates and actual time indicators on the document line.
- Returns the advance amount.
Function 2300 — Service Years (ServiceYears)
What it does: Returns the number of full years of employee service from the employment date to the work date. If service is less than 5 years, returns 0.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
Result:
- Returns: Decimal -- number of full years of service (or 0 if less than 5 years)
- Updates Payroll Document Line fields: --
Calculation logic:
- Retrieves the Employee Card and checks for the presence of Employment Date.
- Calculates the difference between WorkDate and Employment Date:
- Years = Year of WorkDate - Year of Employment Date.
- Months = Month of WorkDate - Month of Employment Date.
- Days = Day of WorkDate - Day of Employment Date.
- Adjusts for negative month and day values (with carry to the previous unit).
- If the number of full years < 5 -- returns 0.
- Otherwise returns the number of full years.
Function 2301 — Labor Contract Type (LaborContractType)
What it does: Checks the employee's labor contract type. Returns 1 for a civil contract (Civil Law Agreement) or 0 for a standard labor contract.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line (Employee No.) | Automatically |
Result:
- Returns: Decimal -- 1 if the contract type is "Civil Contract"; 0 if it is a standard labor contract
- Updates Payroll Document Line fields: --
Calculation logic:
- Retrieves the Employee Card and reads the Contract No.
- Finds the labor contract record.
- Checks the "Contract Type" field.
- If type = "Civil Contract" -- returns 1.
- Otherwise returns 0.
Payroll Calculation Functions (Part 2): Salaries by Date, Sick Leave, Indexation, Currency (21094000–21094050)
Functions for salary lookup by date, sick leave calculation, indexation coefficients, and currency operations.
Codeunit: PayrollDocumentCalculate Number range: 21094000 – 21094050
Function 21094000 -- Salary as of Date
What it does: Returns the employee's monthly salary amount effective as of the document starting date. Finds the active record in the Payroll Element Ledger Entry for salary elements defined in HR Setup.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line: "Employee No." | Employee code for whom the salary is looked up |
| Starting Date | Payroll Document Line: "Document Starting Date" | Date on which the effective salary is determined |
Result:
- Returns: Salary amount (Decimal). For hourly rate -- the amount multiplied by planned hours per month. For daily rate -- the amount multiplied by working days per month.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads HR Setup.
- In the Payroll Element Ledger Entry table, searches for an entry for the employee filtered by salary element codes (daily salary element code / hourly salary element code / lump-sum / hourly rate / daily rate from HR Setup).
- Filters entries: "Starting Date"
<=parameter date, "Ending Date">=parameter date or is blank. - Returns the "Amount" field from the found entry.
- If the element is an hourly rate, multiplies the amount by the planned working hours of the month from the Official Calendar.
- If the element is a daily rate, multiplies the amount by the working days of the month from the Official Calendar.
Function 21094001 -- Average Salary for Period
What it does: Calculates the average salary over a specified date range. For each working day according to the payroll calendar, calls GetSalaryByDate and computes the arithmetic mean.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line: "Employee No." | Employee code |
| Starting Date | Payroll Document Line: "Action Starting Date" | Start of the date range |
| Ending Date | Payroll Document Line: "Action Ending Date" | End of the date range |
Result:
- Returns: Average salary for the period (Decimal). Formula: sum of salaries for all working days / number of working days.
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the employee's payroll calendar via the Employee Job Entry table.
- Filters payroll calendar lines (Payroll Calendar Line) within the date range, working days only (Nonworking = false).
- For each working day, calls GetSalaryByDate (function 21094000) and totals the salary amounts.
- If working days = 0, returns 0.
- Returns: total amount / number of working days.
Function 21094002 -- Average Daily Salary as of Date (for Average Earnings)
What it does: Returns the average daily salary as of the specified date for average earnings calculation. Divides the monthly salary by the number of working days in the month according to the employee's payroll calendar.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line: "Employee No." | Employee code |
| Starting Date | Payroll Document Line: "Action Starting Date" | Date on which the average daily salary is calculated |
Result:
- Returns: Average daily salary (Decimal). Formula: Salary Amount / Number of working days in the month per employee calendar.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads HR Setup and finds the effective salary record from the Payroll Element Ledger Entry.
- Divides the salary amount by the number of working days in the month according to the employee's payroll calendar (CalendarMgt.GetPeriodInfo with type 2 -- working days).
- For hourly rate: multiplies the result by the planned hours from the Official Calendar.
- For daily rate: multiplies the result by the working days from the Official Calendar.
Function 21094003 -- Average Additional Salary as of Date
What it does: Returns the amount of average daily supplementary payments (allowances) that depend on the base salary, as of the specified date. Used for average earnings calculation.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line: "Employee No." | Employee code |
| Starting Date | Payroll Document Line: "Action Starting Date" | Date on which allowances are determined |
Result:
- Returns: Sum of supplementary payments (allowances) per working day (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads HR Setup and builds a salary element filter.
- In the Payroll Element table, finds all elements where "Depends on Salary Element" is populated with salary element codes.
- Builds a filter from the found element codes.
- In the Payroll Element Ledger Entry table, finds active entries for these elements as of the date.
- For each found entry: divides the amount by the number of working days in the month per payroll calendar.
- Totals all average daily amounts and returns the result.
Function 21094004 -- Earnings as of Date
What it does: Returns the total average daily earnings as of the specified date -- the sum of average salary and average supplementary payments. Equivalent to the sum of functions 21094002 + 21094003.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line: "Employee No." | Employee code |
| Starting Date | Payroll Document Line: "Action Starting Date" | Date on which earnings are determined |
Result:
- Returns: Total average daily earnings (Decimal) = average daily salary + average daily allowances.
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls GetAESalaryByDate (function 21094002) to obtain the average daily salary.
- Calls GetAEExtraSalaryByDate (function 21094003) to obtain the average daily allowances.
- Returns the sum of the two values.
Function 21094005 -- Planned Working Days
What it does: Calculates the number of planned working days for a specified period, taking into account the employee's employment periods.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line: "Employee No." | Employee code |
| Starting Date | Payroll Document Line: "Action Starting Date" | Start of the date range |
| Ending Date | Payroll Document Line: "Action Ending Date" | End of the date range |
Result:
- Returns: Number of planned working days (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- In the Employee Job Entry table, searches for entries for the employee filtered by "Position Changed" = true.
- Filters by dates: "Starting Date"
<=end of range, "Ending Date">=start of range or is blank. - For each found entry, determines the date intersection with the specified range.
- Reads the number of working days from the payroll calendar (CalendarMgt.GetPeriodInfo, type 2) for each intersection.
- Totals and returns the overall number of working days.
Function 21094006 -- Average Monthly Calendar Days
What it does: Returns the "Average Calendar Days per Month" value from the Sick Leave Setup table. Used in sick leave calculations.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses "Action Starting Date" to find the effective setup |
Result:
- Returns: Average calendar days per month (Decimal), e.g. 30.44.
- Updates Payroll Document Line fields: --
Calculation logic:
- In the Sick Leave Setup table, filters entries: Type = "Salary Limits", "Sick Leave Type" = All.
- Filters by "Starting Date"
<="Action Starting Date" from the document line. - Finds the last effective record.
- Returns the "Average Calendar Days" field value.
Function 21094007 -- Minimum Wage by Document Date (DEPRECATED)
Note: This function is DEPRECATED. It is recommended to use function 150 with the appropriate parameter.
What it does: Returns the minimum wage (MROT) amount from the Payroll Limit table as of the document starting date.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Period Code | Determined automatically from Document Starting Date | Payroll period code used to look up the limit |
| Limit Type | Fixed: MROT | Payroll limit type |
Result:
- Returns: Minimum wage amount (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the payroll period code from the document starting date in the line.
- In the Payroll Limit table, filters entries: Type = MROT, "Payroll Period"
<=period code. - Finds the last effective record and returns the "Amount" field.
Function 21094008 -- Maximum Average Earnings for Sick Leave
What it does: Returns the maximum average earnings amount for sick leave from the Sick Leave Setup table, taking into account the sick leave type.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses "Payroll Elem. Ledger Entry No." to determine the sick leave type and document starting date |
Result:
- Returns: Maximum average earnings (Decimal) from the "Maximal Average Earning" field.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the entry from the Payroll Element Ledger Entry by the entry number from the document line.
- In the Sick Leave Setup table, filters: Type = "Salary Limits", "Sick Leave Type" = type from the entry, "Starting Date"
<=document starting date from the entry. - Finds the last effective record and returns "Maximal Average Earning".
- If not found for the specific sick leave type, searches with "Sick Leave Type" = All.
Function 21094009 -- Maximum Accrual Amount by Length of Service
What it does: Returns the maximum accrual amount for sick leave from the Sick Leave Setup table, taking into account the sick leave type and the employee's insured length of service.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses "Payroll Elem. Ledger Entry No.", "Employee No." |
Result:
- Returns: Maximum accrual amount (Decimal) from the "Maximal Wage Amount" field.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the entry from the Payroll Element Ledger Entry by the entry number from the document line.
- Determines the Employee Job Entry and calculates the employee's insured length of service as of the document starting date from the entry (via CalcEmplInsuredService).
- If years of service = 0, takes months of service / 12.
- In the Sick Leave Setup table, filters: Type = "Salary Limits", "Sick Leave Type" = type from the entry, "Starting Date"
<=date, "Insured Service (Years)"<=calculated service. - Finds the last record and returns "Maximal Wage Amount".
- If not found for the specific sick leave type, searches with "Sick Leave Type" = All.
Function 21094010 -- Insured Service in Months
What it does: Calculates the number of months of insured service over the last 12 months prior to the document starting date. Used to determine the sick leave payment percentage.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses "Employee No.", "Document Starting Date" |
Result:
- Returns: Number of months of insured service (Decimal), maximum 12, rounded down to a whole number.
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the calculation range: from the beginning of the month 13 months prior to the document starting date, to the last day of the month preceding the document starting date month.
- If the employee has the "Use Data for Insured Service Calculation" flag set, calls CalcEmplInsServInsByInsPeriod (calculation using the Data on Insurance Period table).
- Otherwise, calls CalcEmplInsServByPeriod (calculation based on the employment record book).
- Additionally calls CalcEmplInsServInsData for the total service from the start to the document date.
- Caps the result: no more than 12 months.
- If the calculated 12-month service exceeds the total service, uses the total service.
- Rounds the result down to a whole number (Round,
<).
Function 21094011 -- 31 for Sick Leave
What it does: Returns 31 if the action ending date falls on the 31st day of the month, otherwise returns 0. Used in average daily earnings calculation for sick leave (month length adjustment).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses "Action Ending Date" |
Result:
- Returns: 31 or 0 (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Checks whether the day of the month in the "Action Ending Date" field equals 31.
- If yes -- returns 31.
- If no -- returns 0.
Function 21094012 -- Indexation Coefficient (by Salary Change)
What it does: Calculates the weighted average indexation coefficient for a period, taking into account salary changes under the labor contract. Finds labor contract lines of type "Transfer" and calculates the coefficient based on the salary change.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No.", "Document Starting Date", "Action Ending Date" |
Result:
- Returns: Weighted average indexation coefficient (Decimal). Default = 1 (no indexation).
- Updates Payroll Document Line fields: --
Calculation logic:
- Initial coefficient value = 1.
- Finds the employee's labor contract.
- Searches for labor contract lines with status "Approved" in the range from document starting date to action ending date.
- If the last line has operation type "Transfer":
- Finds contract terms (Labor Contract Terms) for salary elements.
- If the raise coefficient limitation is enabled and the coefficient value = 0, returns 1.
- If the coefficient value is populated, uses it directly.
- Otherwise, calculates the indexation coefficient using the salary change formula.
- Calculates the weighted average coefficient for the period: ((days before change) + (days after change * coefficient)) / (total days in period).
Function 21094013 -- Currency Exchange Rate
What it does: Returns the currency exchange rate from the Payroll Element Ledger Entry as of the action ending date of the payroll document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Payroll Elem. Ledger Entry No.", "Action Ending Date" |
Result:
- Returns: Currency exchange rate (Decimal). If the entry is not found, returns 1.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the entry from the Payroll Element Ledger Entry by the entry number from the document line.
- If the entry is not found, returns 1 (no conversion).
- Returns the currency exchange rate (ExchangeRate) as of the "Action Ending Date" for the currency from the entry.
Function 21094014 -- Salary for Wage Period (Hourly)
What it does: Calculates the salary amount proportional to the hours worked. Similar to function 2230, but uses Wage Period dates instead of Period Code. Updates planned and actual hours on the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Wage Period From", "Employee No.", "Payroll Elem. Ledger Entry No." |
| Time Activity Group | Payroll Document Line Calc: "Time Activity Group" | Time activity filter for the timesheet |
Result:
- Returns: Salary amount proportional to hours worked (Decimal). Formula: Amount * Actual Hours / Planned Hours.
- Updates Payroll Document Line fields: "Planned Hours", "Actual Hours".
Calculation logic:
- Determines the start and end dates of the Wage Period by the Wage Period From code.
- Reads the entry from the Payroll Element Ledger Entry by the entry number.
- Planned Hours = working hours from the payroll calendar in the Wage Period.
- Actual Hours = hours from the timesheet filtered by time activity group within the action date range.
- Writes "Planned Hours" and "Actual Hours" values to the document line.
- If planned hours = 0, raises an error.
- Reads the amount from the original payroll ledger entry (Orig. Payroll Ledger Entry No.) and returns: Amount * Actual Hours / Planned Hours.
Function 21094015 -- Salary for Wage Period (Daily)
What it does: Calculates the salary amount proportional to the days worked. Similar to function 2240, but uses Wage Period dates instead of Period Code. Updates planned and actual days on the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Wage Period From", "Employee No.", "Payroll Elem. Ledger Entry No." |
| Time Activity Group | Payroll Document Line Calc: "Time Activity Group" | Time activity filter for the timesheet |
Result:
- Returns: Salary amount proportional to days worked (Decimal). Formula: Amount * Actual Days / Planned Days.
- Updates Payroll Document Line fields: "Planned Days", "Actual Days".
Calculation logic:
- Determines the start and end dates of the Wage Period by the Wage Period From code.
- Reads the entry from the Payroll Element Ledger Entry by the entry number.
- Planned Days = working days from the payroll calendar in the Wage Period.
- Actual Days = days from the timesheet filtered by time activity group within the action date range.
- Writes "Planned Days" and "Actual Days" values to the document line.
- If planned days = 0, raises an error.
- Reads the amount from the original payroll ledger entry and returns: Amount * Actual Days / Planned Days.
Function 21094016 -- Hours from Timesheet for Wage Period (DEPRECATED)
Note: This function is DEPRECATED. Replaced by function 100 with the appropriate parameter code.
What it does: Returns the number of hours from the timesheet filtered by time activity group within the Wage Period date range.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses Wage Period dates |
| Time Activity Group | Payroll Document Line Calc: "Time Activity Group" | Time activity filter |
Result:
- Returns: Number of hours from the timesheet (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls TimesheetMgt.GetTimeSheetData with parameters: document line, type = 1 (hours), time activity group, use Wage Period = true.
Function 21094017 -- Days from Timesheet for Wage Period (DEPRECATED)
Note: This function is DEPRECATED. Replaced by function 100 with the appropriate parameter code.
What it does: Returns the number of days from the timesheet filtered by time activity group within the Wage Period date range.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses Wage Period dates |
| Time Activity Group | Payroll Document Line Calc: "Time Activity Group" | Time activity filter |
Result:
- Returns: Number of days from the timesheet (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls TimesheetMgt.GetTimeSheetData with parameters: document line, type = 0 (days), time activity group, use Wage Period = true.
Function 21094018 -- Taxable Amount YTD by Wage Period
What it does: Returns the accumulated taxable amount (Taxable Amount) from the beginning of the year for the specified element. Uses Wage Period for filtering. Can calculate for either an employee or a person.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No.", "Element Type", "Posting Type", "Element Code", "Wage Period From" |
Result:
- Returns: Taxable amount (Decimal) from the Payroll Ledger Entry year-to-date.
- Updates Payroll Document Line fields: --
Calculation logic:
- On the Employee table, sets filters: by employee code (or "Person No." for person-level calculation), element type, posting type, element code.
- Sets the "Wage Period Filter" = Wage Period From value from the document line.
- Calculates the FlowField "Taxable Amount" and returns the result.
Function 21094019 -- Payroll Amount YTD by Wage Period
What it does: Returns the accumulated payroll amount (Payroll Amount) from the beginning of the year for the specified element. Uses Wage Period for filtering.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No.", "Element Type", "Posting Type", "Element Code", "Wage Period From" |
Result:
- Returns: Payroll amount (Decimal) from the Payroll Ledger Entry year-to-date.
- Updates Payroll Document Line fields: --
Calculation logic:
- On the Employee table, sets filters: by employee code, element type, posting type, element code.
- Sets the "Wage Period Filter" = Wage Period From value from the document line.
- Calculates the FlowField "Payroll Amount" and returns the result.
Function 21094020 -- Scale-Based Deduction by Period Code
What it does: Calculates the deduction (tax) amount using a payroll range scale, using Period Code to find the range header. Extended version of function 2002 with period code-based range lookup.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Element Code", "Corr. Amount", "Employee No.", "Period Code" |
| Range Header | Determined automatically | Payroll range header by element code and period |
Result:
- Returns: Deduction amount with a negative sign (Decimal). Formula: -(Tax Amount + (Corr. Amount - Over Amount) * Tax Rate / 100).
- Updates Payroll Document Line fields: "Rate" = tax rate %, "Directory Code", "Dimension Set ID" -- merged with dimensions from the range line.
Calculation logic:
- Finds the payroll range header (Range Header) by element code and period code.
- Filters range lines (Range Line) by element code, range code, period code from the header.
- Based on header settings, additionally filters: by employee gender, by date of birth, by disability status as of the wage period ending date.
- Filters "Over Amount" < absolute value of Corr. Amount from the document line.
- If not found -- sequentially clears filters by disability and "Over Amount".
- Calculates: Tax Amount + (Corr. Amount - Sign * Over Amount) * Tax Rate / 100.
- If there is a "Max Deduction" and the result exceeds it -- caps the result.
- Writes the rate to the "Rate" field of the document line.
- If the range line has a "Directory Code" populated, updates the field on the document line.
- If the range line has a dimension set, merges it with the document line's dimension set.
- Returns the result with a negative sign.
Function 21094021 -- Scale-Based Deduction by Wage Period
What it does: Same as function 21094020, but uses the Wage Period code (Wage Period From) instead of Period Code to find the payroll range header.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Element Code", "Corr. Amount", "Employee No.", "Wage Period From" |
Result:
- Returns: Deduction amount with a negative sign (Decimal).
- Updates Payroll Document Line fields: "Rate", "Directory Code", "Dimension Set ID".
Calculation logic:
- Same as function 21094020, but the range header is filtered by "Period Code" in the range from the first payroll period to Wage Period From from the document line.
Function 21094022 -- Amount from Range by Period Code
What it does: Returns the amount from a payroll range line filtered by period code. Unlike the deduction functions (21094020/21094021), simply returns the "Amount" field from the found range line without calculating the tax formula.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Element Code", "Period Code", "Employee No." |
| Parameter Code | Payroll Document Line Calc: "Parameter Code" | Determines the period filter type (by period code, by wage period, by payment period) |
Result:
- Returns: Amount from the range line (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the payroll range header (Range Header) by element code.
- If "Parameter Code" is specified, determines the period filter type from the Calc. Function Parameter table:
- By Period Code
- By Wage Period Code
- By Payment Period
- Finds the last effective range header.
- Filters range lines by employee gender, date of birth, and disability status.
- Finds the last line and returns the "Amount" field.
Function 21094023 -- Amount from Range by Wage Period
What it does: Same as function 21094022, but uses Wage Period (Wage Period From) to filter the range header.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Element Code", "Wage Period From", "Employee No." |
| Parameter Code | Payroll Document Line Calc: "Parameter Code" | Determines the period filter type |
Result:
- Returns: Amount from the range line (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Same as function 21094022, but the range header is filtered by "Period Code" in the range from the first payroll period to Wage Period From from the document line.
Function 21094024 -- Taxable Amount from Document (DEPRECATED)
Note: This function is DEPRECATED. It is recommended to use function 220 or 21094030.
What it does: Returns the base amount (taxable) from the current payroll document lines according to the base amount settings.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Element Code", "Document No." |
| Base Amount Code | Payroll Document Line Calc: "Base Amount Code" | Code for lookup in the Payroll Base Amount table |
Result:
- Returns: Amount from the current document lines (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls the standard BaseAmount function with parameters: document line, base amount code.
- Filters are applied based on the Payroll Base Amount table settings.
Function 21094025 -- Set FSI Payment Source
What it does: Sets the "Payment Source" field to "FSI" (Fund of Social Insurance) on the payroll document line. This is a side-effect function that always returns 0.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | The "Payment Source" field is modified |
Result:
- Returns: 0 (always).
- Updates Payroll Document Line fields: "Payment Source" = FSI.
Calculation logic:
- Sets PayrollDocLine."Payment Source" := FSI.
- Returns 0.
Function 21094026 -- Minimum Wage by Wage Period (DEPRECATED)
Note: This function is DEPRECATED. It is recommended to use function 150 with the appropriate parameter.
What it does: Returns the minimum wage (MROT) amount from the Payroll Limit table by the Wage Period code.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Wage Period | Payroll Document Line: "Wage Period From" | Wage Period code for filtering |
| Limit Type | Fixed: MROT | Payroll limit type |
Result:
- Returns: Minimum wage amount (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- In the Payroll Limit table, filters entries: Type = MROT, "Payroll Period"
<=Wage Period From. - Finds the last effective record and returns the "Amount" field.
Function 21094027 -- SSC Limit by Wage Period (DEPRECATED)
Note: This function is DEPRECATED. It is recommended to use function 150 with the appropriate parameter.
What it does: Returns the maximum SSC (Social Security Contribution) assessment base from the Payroll Limit table by the Wage Period code.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Wage Period | Payroll Document Line: "Wage Period From" | Wage Period code for filtering |
| Limit Type | Fixed: SSC Limit | Payroll limit type |
Result:
- Returns: SSC limit amount (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- In the Payroll Limit table, filters entries: Type = "SSC Limit", "Payroll Period"
<=Wage Period From. - Finds the last effective record and returns the "Amount" field.
Function 21094028 -- Salary Change
What it does: Calculates the difference between the current and previous salary (including allowances that depend on the salary) from labor contract lines. Used for indexation accrual.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Element Code | Payroll Document Line: "Element Code" | Payroll element code |
| Base Amount Code | Payroll Document Line Calc: "Base Amount Code" | Used to determine the date filter |
| Employee No. | Payroll Document Line: "Employee No." | Employee code |
| Starting Date | Payroll Document Line: "Action Starting Date" | Date for finding the contract line |
| Period Code | Payroll Document Line: "Period Code" | Period code |
Result:
- Returns: Salary increase amount (Decimal) = Current Salary - Previous Salary. If there is a decrease or a position change -- returns 0.
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the employee's labor contract.
- Searches for labor contract lines with type "Hire" or "Transfer", status = "Approved".
- Filters by the effective date (determined via base amount and period code).
- For the found line, determines the current position.
- Finds labor contract terms (Contract Terms) for salary elements -- obtains the current salary, divides by position rate.
- For hourly/daily rate, converts to the monthly equivalent.
- Adds allowance amounts from the Payroll Element Ledger Entry that depend on the salary.
- Moves to the previous contract line (previous assignment).
- Compares positions: if the date
>=01.12.2015 and the Job Title Code has changed, returns 0. - Calculates the previous salary in the same way as steps 5-7.
- If the previous salary < the current salary, returns the difference. Otherwise returns 0.
Function 21094029 -- Indexation Coefficient
What it does: Returns the indexation percentage from the Indexation Indices table. Finds a record by Wage Period and the indexation base month from the linked payroll element entry.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Payroll Elem. Ledger Entry No." |
| Wage Period | Payroll Document Line: "Wage Period From" | Wage Period code for looking up the index |
Result:
- Returns: Indexation percentage (Decimal), rounded to 0.1.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the entry from the Payroll Element Ledger Entry by the entry number from the document line.
- Determines the "Indexation Base Month" from the entry.
- In the Indexation Indices (Indexes) table, finds a record by the Wage Period code and the base month.
- Returns the "Percent" field value, rounded to 0.1.
Function 21094030 -- Base Amount with Detail
What it does: Similar to function 220 (BaseAmount), but additionally creates detail records in the Detailed Base for Tax table. Used for tax calculations where it is necessary to know which specific lines (elements) formed the base.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Element Code", "Document No.", "Wage Period From" |
| Base Amount Code | Payroll Document Line Calc: "Base Amount Code" | Code for lookup in the Payroll Base Amount table. Required field. |
Result:
- Returns: Base amount (Decimal) from the current document lines.
- Updates Payroll Document Line fields: --
- Creates records: in the Detailed Base for Tax table for each line included in the base.
Calculation logic:
- Checks that "Base Amount Code" is mandatory.
- Filters the current document lines by Payroll Base Amount settings: element type filter, element code filter, PIT base filter, SSC base filter.
- By "Period Filter" from the base amount:
- By Period Code -- filters by Period Code.
- By Wage Period Code -- filters by Wage Period From.
- By Action Dates / By Fit Dates -- filters by action dates.
- For each found document line:
- Checks that the line is not fully paid (Payroll Amount - Paid Amount > 0).
- Checks that the PIT/SSC base corresponds to the Wage Period.
- Adds the amount to the result.
- Creates a record in the Detailed Base for Tax table with information about the base document, element code, tax type, and amount.
Function 21094031 -- Update Tax Deduction Code
What it does: Similar to function 21094030, but additionally updates the "Tax Deduction Code" field on the payroll document line, taking the value from the first found base line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | The "Tax Deduction Code" field is modified |
| Base Amount Code | Payroll Document Line Calc: "Base Amount Code" | Code for lookup in the Payroll Base Amount table. Required field. |
Result:
- Returns: -- (procedure with no return value).
- Updates Payroll Document Line fields: "Tax Deduction Code" = "Directory Code" value from the first base line.
Calculation logic:
- Checks that "Base Amount Code" is mandatory.
- Filters the current document lines by Payroll Base Amount settings (same as function 21094030).
- Finds the first line matching the filters.
- Writes the "Directory Code" field value from that line to the "Tax Deduction Code" field of the payroll document line.
Function 21094032 -- Distribute Tax Amount (Payroll Amount)
What it does: Distributes the payroll amount (Payroll Amount) from the payroll document line proportionally across the Detailed Base for Tax records. Used after tax calculation (by functions 21094020/21094021) to determine what portion of the tax corresponds to each base line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Document No.", "Line No.", "Payroll Amount" |
Result:
- Returns: 0 (always).
- Updates Payroll Document Line fields: --
- Updates records: in the Detailed Base for Tax table -- the "Deduction Amount" field.
Calculation logic:
- Finds all Detailed Base for Tax records for this document line.
- Filters records with a non-zero "Payroll Amount".
- Calculates the total base (WholeBaseForTax) -- the sum of the "Payroll Amount" field across all records.
- If total base = 0, returns 0.
- For each record, calculates: "Deduction Amount" = round(Total Tax Amount * Line Base Amount / Total Base).
- For the last record, assigns the remainder (to avoid rounding errors).
Function 21094033 -- Distribute Corr. Amount
What it does: Similar to function 21094032, but distributes the Corr. Amount instead of the payroll amount.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Document No.", "Line No.", "Corr. Amount" |
Result:
- Returns: 0 (always).
- Updates Payroll Document Line fields: --
- Updates records: in the Detailed Base for Tax table -- the "Corr. Amount" field.
Calculation logic:
- Finds all Detailed Base for Tax records for this document line.
- Calculates the total base.
- For each record: "Corr. Amount" = round(Total Corr. Amount * Line Base Amount / Total Base).
- For the last record, assigns the remainder.
Function 21094034 -- Populate Insured Service Data
What it does: Creates records in the Data on Insurance Period table for subsequent use in insured service calculation and reporting.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No.", "Wage Period From", "Document No.", "Line No.", "Corr. Amount", "Action Starting Date", "Action Ending Date" |
Result:
- Returns: -- (procedure with no return value).
- Updates Payroll Document Line fields: --
- Creates records: in the Data on Insurance Period table.
Calculation logic:
- Checks that the calculation group is not inter-period (type = Between); if so -- exits without action.
- Creates a new record in the Data on Insurance Period table with fields:
- "Employee No.", "Wage Period", "Document No.", "Line No.".
- "Base Amount" = Corr. Amount from the document line.
- "Minimum Wage Amount" = minimum wage for the Wage Period (via GetFSILimit).
- "Period Inclusion Coefficient" = Base Amount / Minimum Wage Amount, rounded to 0.01 (maximum 1).
- "Action Starting Date", "Action Ending Date" from the document line.
- "Calculation" flag = true.
Function 21094035 -- Service with Insurance Data
What it does: Calculates the number of months of insured service for a period (similar to function 21094010), but taking into account inclusion coefficients from the Data on Insurance Period table. Extended version of service calculation.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No.", "Document Starting Date" |
Result:
- Returns: Number of months of insured service (Decimal) with inclusion coefficients taken into account.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the employee record.
- Determines the calculation range: from the beginning of the month one year prior to the document starting date, to the last day of the preceding month.
- Calls RecOfServiceMgt.CalcEmplInsServInsData -- service calculation taking into account the period inclusion factor from the Data on Insurance Period table.
- Returns the calculated service.
Function 21094036 -- Taxable Amount for Person by Wage Period
What it does: Returns the accumulated taxable amount (Taxable Amount) from the beginning of the year for a person (Person No.) instead of an employee. Used when the same individual works in multiple positions and the total amount across all positions is needed.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Person No.", "Element Type", "Posting Type", "Element Code", "Wage Period From" |
Result:
- Returns: Taxable amount for the person (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Same as function 21094018, but instead of filtering by "Employee No.", sets a filter by "Person No." (Person No. Filter).
- This means the result includes amounts across all positions held by the person.
Function 21094037 -- Service by Insurance Period Data (DEPRECATED)
Note: This function is DEPRECATED. It is recommended to use function 21094035.
What it does: Returns the YTD base amount from the current document.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Payroll document line |
| Base Amount Code | Payroll Document Line Calc: "Base Amount Code" | Code for filtering |
Result:
- Returns: Amount (Decimal).
- Updates Payroll Document Line fields: --
Function 21094038 -- Employment Date Check
What it does: Checks whether the employee's hire date falls within the specified period (and whether the employee was not dismissed before the end of the period). Returns 1 or 0. The period filter type is determined by the function parameter.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No." |
| Parameter Code | Payroll Document Line Calc: "Parameter Code" | Determines the period filter type (by wage period, by period code, by action dates, by fit date, by payment period, by bonus period, in current year) |
Result:
- Returns: 1 if the hire date falls within the start of the period, and the dismissal date (or infinity)
>=end of period; 0 -- otherwise. - Updates Payroll Document Line fields: --
Calculation logic:
- Reads the employee record.
- If "Parameter Code" is specified, reads the period filter type from the Calc. Function Parameter table:
- By Period Code: dates from the payroll period (Period Code).
- By Wage Period Code: first and last working day of the Wage Period per payroll calendar.
- By Action Dates: Action Starting Date.
- By Fit Dates: Action Starting Date and Action Starting Date + 1.
- By Payment Period: dates from the document's payment period.
- By Bonus Period: dates from the "Bonus Period" field.
- In Current Year: from the start to the end of the current year.
- If "Parameter Code" is not filled, the Wage Period is used by default.
- If the dismissal date is not filled, sets 31.12.9999.
- Returns 1 if: Starting Date
>=Hire Date, and Ending Date<=Dismissal Date.
Function 21094039 -- Contract Type Check
What it does: Checks whether the employee's labor contract is an employment contract (not a civil law contract) and whether it is the primary position (not a secondary job). Returns 1 or 0.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses "Employee No." |
Result:
- Returns: 1 if "Contract Type" = "Labor Contract" AND "Work Mode" = "Primary Job"; 0 -- otherwise.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the employee record.
- From the labor contract number on the employee card, reads the labor contract.
- Checks two fields:
- "Contract Type" = "Labor Contract".
- "Work Mode" = "Primary Job".
- If both conditions are met, returns 1. Otherwise -- 0.
Function 21094040 -- Medical Information Check
What it does: Checks whether the employee has a disability status as of the wage period ending date. Returns 1 if the employee is NOT disabled, and 0 if disabled. Used to determine the SSC rate.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No.", "Wage Period From" |
Result:
- Returns: 1 if the employee is NOT disabled as of the wage period ending date; 0 if disabled.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the employee record.
- Determines the wage period ending date by the Wage Period From code.
- Checks the disability status as of that date (Employee.SMAIsInvalid).
- If NOT disabled -- returns 1. If disabled -- returns 0.
Function 21094041 -- Corr. Amount for Person YTD (DEPRECATED)
Note: This function is DEPRECATED.
What it does: Returns the amount from the Payroll Ledger Entry year-to-date for a person.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Payroll document line |
| Base Amount Code | Payroll Document Line Calc: "Base Amount Code" | Required field |
Result:
- Returns: Amount from ledger entries (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Checks that "Base Amount Code" is mandatory.
- Calls the YTDBaseAmount function with parameters: document line, base amount code.
Function 21094042 -- Corr. Amount from Document (DEPRECATED)
Note: This function is DEPRECATED. It is recommended to use function 220.
What it does: Returns the base amount from the current payroll document lines according to the base amount settings.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Payroll document line |
| Base Amount Code | Payroll Document Line Calc: "Base Amount Code" | Code for filtering |
Result:
- Returns: Amount from the document lines (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls the standard BaseAmount function with parameters: document line, base amount code.
Function 21094043 -- Period Comparison
What it does: Compares the Wage Period code (Wage Period From) with the Period Code of the document line. Used in conditional constructs (IF) to determine whether the current Wage Period is not later than the posting period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Wage Period From", "Period Code" |
Result:
- Returns: 1 if Wage Period From
<=Period Code; 0 -- otherwise. - Updates Payroll Document Line fields: --
Calculation logic:
- Compares the Wage Period code (Wage Period From) value with the Period Code value.
- If Wage Period
<=Period Code, returns 1. - Otherwise returns 0.
Function 21094044 -- Indexation Threshold (DEPRECATED)
Note: This function is DEPRECATED. It is recommended to use function 150 with the appropriate parameter.
What it does: Returns the indexation threshold (maximum salary amount subject to indexation) from the Payroll Limit table.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Period Code | Payroll Document Line: "Period Code" | Payroll period code |
| Limit Type | Fixed: Indexation Threshold | Payroll limit type |
Result:
- Returns: Indexation threshold amount (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- In the Payroll Limit table, filters entries: Type = "Indexation Threshold", "Payroll Period"
<=Period Code. - Finds the last effective record and returns the "Amount" field.
Function 21094045 -- Subsistence Minimum
What it does: Returns the subsistence minimum amount from the Payroll Limit table by the Wage Period code. Used for calculating minimum guarantees and indexation.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Wage Period | Payroll Document Line: "Wage Period From" | Wage Period code for filtering |
| Limit Type | Fixed: Survival Minimum | Payroll limit type |
Result:
- Returns: Subsistence minimum amount (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- In the Payroll Limit table, filters entries: Type = "Survival Minimum", "Payroll Period"
<=Wage Period From. - Finds the last effective record and returns the "Amount" field.
Function 21094046 -- Position Rate
What it does: Returns the position rate (Position Rate) from the labor contract line effective as of the action date of the payroll document line. The position rate determines the fraction of a full-time position the employee works (1, 0.5, 0.25, etc.).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No.", "Action Starting Date", "Action Ending Date" |
Result:
- Returns: Position rate (Decimal), e.g. 1.0, 0.5, 0.25.
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the employee's labor contract.
- Filters labor contract lines (Labor Contract Line):
- Operation type = "Hire" or "Transfer".
- "Starting Date"
<="Action Ending Date" from the document line. - "Ending Date"
>="Action Starting Date" or is blank.
- Finds the last record and returns the "Position Rate" field.
Function 21094047 -- Indexation Amount (Hourly)
What it does: Calculates a coefficient for proportional indexation accrual based on hours worked. Formula: 100 * Actual Hours / Planned Hours. Updates planned and actual hours fields on the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No.", "Action Starting Date", "Action Ending Date", "Payroll Calendar Code" |
| Time Activity Group | Payroll Document Line Calc: "Time Activity Group" | Time activity filter for the timesheet |
Result:
- Returns: Proportionality coefficient (Decimal). Formula: 100 * Actual Hours / Planned Hours.
- Updates Payroll Document Line fields: --
Calculation logic:
- Checks that "Action Starting Date" and "Action Ending Date" are mandatory.
- Planned Hours = working hours from the payroll calendar of the document line in the current payroll period.
- If planned hours = 0, raises an error.
- Actual Hours = hours from the timesheet filtered by time activity group within the action date range.
- Returns: 100 * Actual Hours / Planned Hours.
Function 21094048 -- Indexation Amount (Daily)
What it does: Calculates a coefficient for proportional indexation accrual based on days worked. Formula: 100 * Actual Days / Planned Days.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Employee No.", "Action Starting Date", "Action Ending Date", "Payroll Calendar Code" |
| Time Activity Group | Payroll Document Line Calc: "Time Activity Group" | Time activity filter for the timesheet |
Result:
- Returns: Proportionality coefficient (Decimal). Formula: 100 * Actual Days / Planned Days.
- Updates Payroll Document Line fields: --
Calculation logic:
- Checks that "Action Starting Date" and "Action Ending Date" are mandatory.
- Planned Days = working days from the payroll calendar of the document line in the current payroll period.
- If planned days = 0, raises an error.
- Actual Days = days from the timesheet filtered by time activity group within the action date range.
- Returns: 100 * Actual Days / Planned Days.
Function 21094049 -- Fixed Indexation Coefficient
What it does: Returns the fixed indexation coefficient from the Indexation Indices table. Unlike function 21094029, additionally checks whether the job title changed during a transfer.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Uses: "Payroll Elem. Ledger Entry No.", "Employee No.", "Element Code" |
Result:
- Returns: Indexation coefficient (Decimal), rounded to 0.1. Returns 0 if the job title changed.
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the entry from the Payroll Element Ledger Entry by the entry number.
- Finds the labor contract line (Labor Contract Line) for this contract number with type "Hire" or "Transfer", status = "Approved", with starting date = the entry's action starting date.
- Determines the current position from the contract line.
- Moves to the previous labor contract line.
- Determines the previous position.
- If the date
>=01.12.2015 and the Job Title Code of the current position does not equal the Job Title Code of the previous position, returns 0 (indexation does not apply when the job title changes). - Finds the previous payroll element entry (with a smaller Entry No.).
- In the Indexation Indices table, finds a record by the entry's period code and the indexation base month of the previous entry.
- Returns the "Percent" value, rounded to 0.1.
Function 21094050 -- Salary at Period End
What it does: Similar to function 21094000, but returns the salary as of the payroll period ending date instead of the document starting date.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line: "Employee No." | Employee code |
| Date | Payroll period ending date determined by "Period Code" from the document line | Date on which the salary is determined |
Result:
- Returns: Salary amount as of the payroll period end date (Decimal).
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the payroll period ending date by the period code from the document line (PayrollPeriod.PeriodEndDateByPeriodCode).
- Calls GetSalaryByDate (function 21094000) with this date.
- Returns the result.
Payroll Calculation Functions (Part 3): Leave, Reserves, Validations, Balances (21094051–21094112)
Detailed description of functions for leave calculation, reserves, employee data validations, and balances.
Path: Administration / Payroll Calculation Function
Function 21094051 -- GetFSILimit (Subsistence Minimum)
What it does: Returns the subsistence minimum value from the payroll limits table, linked to the period of the payroll element ledger entry.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Used to obtain the payroll element ledger entry number |
| Entry No. | Payroll Elem. Ledger Entry No. | Entry number from the payroll element ledger entry from which the period code is taken |
Result:
- Returns: Decimal -- subsistence minimum amount effective for the entry period
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the payroll element ledger entry by the entry number from the document line.
- Searches the Payroll Limit table for a record with the type "Survival Minimum" and a payroll period filter up to and including the period code of the found entry.
- Returns the Amount of the last found record, i.e., the current subsistence minimum value.
- If no record is found, returns 0.
Note: A prerequisite is that the payroll element ledger entry exists (Payroll Elem. Ledger Entry No. must be populated on the document line).
Function 21094052 -- BaseAmount (Corr. Amount by Person)
DEPRECATED
What it does: Returns the amount from the current payroll document lines for the person. Filters are applied according to the Payroll Base Amount table settings.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Current payroll document line |
| Base Amount Code | Base Amount Code from calculation line | Base amount code for obtaining filter settings |
Result:
- Returns: Decimal -- amount from document lines matching the base amount filters
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the base amount settings (Payroll Base Amount) by element code and base amount code.
- Depending on the employee filter (Employee Filter):
- "By Employee" -- filters lines of the current document.
- "By Person" or "For Other Employees" -- searches lines by person code in other documents of the current calculation, including posted interperiod documents.
- Applies period filters (period code, wage period, bonus period, action dates, inclusion dates, or payment period).
- Returns the amount according to the configured amount type (Payroll Amount, Taxable Amount, Corr. Amount, etc.).
Function 21094053 -- CalcByLedger Tax (Tax Amount from Ledger Entries)
What it does: Returns the payroll amount (Payroll Amount) from payroll ledger entries associated with a specific payroll element ledger entry.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, element code, entry number |
| Amount Type | Fixed = 1 (Taxable) | Internal parameter AmountType = Payroll (returns Payroll Amount) |
| Period Code | Fixed = '' (empty) | Not filtered by period code |
Result:
- Returns: Decimal -- amount from the Payroll Amount field of payroll ledger entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters the Payroll Ledger Entry table by:
- Payroll Elem. Ledger Entry No.
- Employee No.
- Element Code.
- Since the period code is not passed (empty string), no period filter is applied.
- Sums and returns the Payroll Amount field value from all found records.
Function 21094054 -- GetTimesheetActionData Hours (Hours from Timesheet by Action Date)
DEPRECATED
What it does: Returns the number of hours from the timesheet, filtered by time activity group and action dates of the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code and action dates |
| Time Activity Group | Time Activity Group from calculation line | Time activity group code for filtering |
| Data Type | Fixed = 3 | Hours |
Result:
- Returns: Decimal -- number of hours from the timesheet
- Updates Payroll Document Line fields: --
Calculation logic:
- Delegates the call to TimesheetMgt.GetTimesheetActionData.
- Filters timesheet records by employee code and time activity group.
- Uses the action dates of the line (Action Starting Date, Action Ending Date) to determine the range.
- Returns the sum of hours (What = 3).
Function 21094055 -- GetAdvancePay Hourly (Advance Pay Hourly Rate)
What it does: Calculates the advance payment amount for hourly pay. Uses the advance date as the cutoff date for calculating worked time. Updates action dates and actual hours on the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, action dates |
| Time Type | Fixed = HourR (Hourly Rate) | Determines the salary element from HR Setup and calculation method |
| Time Activity Group | Time Activity Group from calculation line | Group code for timesheet filtering |
Result:
- Returns: Decimal -- advance payment amount (hourly pay)
- Updates Payroll Document Line fields:
- Action Starting Date -- minimum start date among found entries or period start
- Action Ending Date -- maximum end date among found entries or advance date
- Actual Hours -- actual hours from timesheet for the period up to the advance date
Calculation logic:
- Reads HR Setup to determine the hourly rate element code (Element Code Hourly Rate).
- If the salary amount element code is also configured, adds it to the filter.
- Finds payroll element ledger entries for the employee with filters:
- Element code matches the salary element filter.
- Action Starting Date is before the end of the current payroll period.
- Action Ending Date is from the start of the current payroll period (or empty).
- For each found entry:
- Determines StartDate (maximum of the action start date and period start).
- Determines EndDate (minimum of the action end date and advance date).
- Reads work time from the timesheet (TimesheetMgt) by time activity group for the StartDate..EndDate range.
- PeriodWorkTime = 1 (for HourR type, standard time is not considered).
- Accumulates the amount: Amount * WorkTime / PeriodWorkTime.
- Updates Action Starting Date, Action Ending Date, and Actual Hours on the document line.
- Returns the total advance amount.
Note: A prerequisite is that the advance date (Advance Date) must be populated in the payroll period.
Function 21094056 -- CalcIndexationFactor (Increase Coefficient for Average Earnings)
What it does: Calculates the salary increase (indexation) coefficient for adjusting average earnings. This is the most complex function -- it iterates through payroll periods, accounts for salary changes, and proportionally distributes the coefficient when salary changes occur within a period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, document type, document dates, and action dates |
| AE Setup Code | AE Setup Code from calculation line | Average earnings calculation setup code |
Result:
- Returns: Decimal -- increase coefficient (
>=1.0; default = 1.0) - Updates Payroll Document Line fields: --
Calculation logic:
- Initializes Result = 1.
- Determines the average earnings calculation type based on document type:
- Vacation -- AE Calc Type = Vacation.
- Sick Leave -- depends on sick leave type (Sick Leave, Child Care 1.5, Child Care 3, Pregnancy Leave).
- Business Trip or Other Absence -- AE Calc Type = Others.
- Finds the current AE Calculation Setup with type "Calculation", filtered by period code up to current, and optionally by AE setup code.
- If the "Use Increase Coefficient" flag is not enabled in the setup, returns 1 and exits.
- Sets the indexation mode through PayrollStatus.
- Iterates through payroll periods from the document start date to the action end date:
- For each period, gets the PayrollStatus for the employee.
- Searches for salary indexation (FindSalaryIndexation) -- finds a labor contract line with an increase.
- If found and the contract line start date
<=action end date:- If indexation limitation is enabled (LimitSalaryIndexation) -- Result = 1.
- If a direct coefficient is specified (IndexationFactor
<>0) -- Result *= IndexationFactor. - Otherwise -- calculates the coefficient via PayrollStatus.CalcIndexationFactor.
- Constraint: if Result < 1, sets Result = 1.
- If the contract line start date > action start date (salary change within the period):
- Proportionally adjusts the coefficient: (Result - 1) * (working days after change / total working days) + 1.
- Returns the calculated coefficient.
Note: The function considers the document type to select the correct AE setup. Proportional recalculation when a change occurs within a period is based on working days from the production calendar.
Function 21094057 -- CalcPaymDaysFromAbsenceOrder (Payment Days from Absence Order)
What it does: Recalculates the number of payment days from the absence order line and writes the result to the Payment Days field of the payroll document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain document type, entry number, element code, action dates |
Result:
- Returns: Integer -- number of payment days
- Updates Payroll Document Line fields:
- Payment Days -- payment days from the absence order (with a negative sign for corrections)
Calculation logic:
- Checks the document type: the function only works for Travel and Other Absence types. For other types, returns 0.
- Finds the posted payroll element ledger entry by entry number from the line.
- Searches for the posted absence order line (Posted Absence Line) by:
- Document number from the entry.
- Element code from the document line.
- Document type (Travel or Other Absence).
- Creates a temporary absence order line and populates it:
- Transfers dates from the payroll document line (Action Starting Date, Action Ending Date).
- Calls CalcDays() to recalculate the number of payment days.
- If the line is a correction (Correction = true), the Payment Days value is written with a minus sign.
Function 21094058 -- RateTime Hours (Standard Hours)
What it does: Returns the standard number of working hours from the official (production) calendar for the wage period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain the wage period code (Wage Period From) |
| Time Type | Fixed = 0 (Hours) | Determines that hours are returned |
Result:
- Returns: Decimal -- number of standard working hours
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads HR Setup to obtain the official (production) calendar code (Official Calendar Code).
- Determines the start date and end date of the wage period (Wage Period From).
- Calls CalendarMgt.GetPeriodInfo with parameter What = 3 (working hours) for the official calendar and period dates.
- Returns the number of working hours.
Function 21094059 -- RateTime Days (Standard Days)
What it does: Returns the standard number of working days from the official (production) calendar for the wage period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain the wage period code (Wage Period From) |
| Time Type | Fixed = 1 (Days) | Determines that days are returned |
Result:
- Returns: Decimal -- number of standard working days
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads HR Setup to obtain the official (production) calendar code (Official Calendar Code).
- Determines the start date and end date of the wage period (Wage Period From).
- Calls CalendarMgt.GetPeriodInfo with parameter What = 2 (working days) for the official calendar and period dates.
- Returns the number of working days.
Function 21094060 -- JobBalance (Job Balance)
What it does: Returns the amount from job ledger entries for the corresponding employee resource within the specified period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code and action dates |
| Data Set Code | Data Set Code from calculation line | Payroll data set code (Payroll Data Sets) for obtaining job filters |
Result:
- Returns: Decimal -- sum of Line Amount from job ledger entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the data set configuration (Payroll Data Sets) by element code and data set code.
- Gets the resource number (Resource No.) from the employee card.
- Filters job ledger entries:
- No. = employee resource number.
- Entry Type = entry type from the data set.
- Posting Date = range from Action Starting Date to Action Ending Date.
- If Job No. or Job Task No. is specified in the data set, adds the corresponding filters.
- Sums and returns the Line Amount field.
Function 21094061 -- FillVacResAEPeriods "+1" (Fill AE Periods for Vacation Reserve)
What it does: Fills the average earnings (AE) periods for vacation reserve calculation. Calculates the AE period as of the date equal to "end of current period + 1 day" (i.e., the first day of the next month), which provides an additional period compared to the standard calculation.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain period code, employee code |
| Time Activity Group | Time Activity Group from calculation line | To determine time activity filters |
Result:
- Returns: -- (the function does not return a numeric value)
- Updates Payroll Document Line fields:
- AE Period From -- AE period start
- AE Period To -- AE period end
- Action Starting Date -- date = end of current period + 1 day
- Action Ending Date -- date = end of current period + 1 day
- Document Starting Date -- same
- Document Ending Date -- same
- Document Type -- Vacation
- Time Activity Code -- activity code from the time activity group
- Wage Period From -- period by action date
- Wage Period To -- period by action date
Calculation logic:
- Creates a temporary absence order line (Absence Line) with type "Vacation".
- Sets the start date = end of current payroll period + 1 day.
- Calls AEMgt.FillAbsenceLineAEDates for automatic calculation of AE periods.
- Transfers the calculated dates and AE periods to the payroll document line.
- Fills the time activity code and wage period.
- If the calculated wage period differs from the current one, initializes the payroll period.
Function 21094062 -- CalcVacDays (Vacation Days for Reserve)
What it does: Calculates the vacation days balance (remaining days) for vacation reserve accrual. Formula: Accrued Days - Used Days - Compensated Days + Adjustment Days.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, period code |
| Time Activity Group | Time Activity Group from calculation line | To filter by vacation type |
| Future Usage | Fixed = false | Do not consider future usage |
Result:
- Returns: Decimal -- vacation days balance (remaining days)
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the calculation date: end of current payroll period + 1 day.
- Gets the time activity filter by group and date.
- Finds employee absence entries for the employee:
- Entry Type = Accrual.
- Starting Date < calculation date.
- Time Activity Code matches the filter.
- For each accrual entry:
- Counts accrued days via VacationDaysCalculation.CalcVacDays.
- Finds usage entries: subtracts calendar days.
- Finds compensation entries: subtracts calendar days.
- Finds adjustment entries: adds calendar days.
- Returns the total balance.
Note: The FutureUsedDays = false parameter means that all usage entries are considered regardless of their date.
Function 21094063 -- PrevBaseAmount (Corr. Amount for Previous Period)
What it does: Returns the amount from posted payroll document lines for the previous or current period. Uses base amount settings for filtering.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, person code, period code |
| Base Amount Code | Base Amount Code from calculation line (required) | Base amount code for obtaining filters |
| Calculate by Document | Fixed = false | Does not limit search to a single document |
Result:
- Returns: Decimal -- amount from posted payroll document lines
- Updates Payroll Document Line fields: --
Calculation logic:
- Validates the base amount code is not empty (TestField).
- Reads the base amount settings.
- Depending on the employee filter, filters posted lines by:
- Employee and person (By Employee).
- Person (By Person).
- Person, excluding the current employee (For Other Employees).
- Applies period filters according to settings:
- "By Period Code" -- if "Use Previous Period" = Yes, searches by the previous period code; otherwise by the current one.
- "By Wage Period" -- analogous.
- "By Bonus Period", "By Action Dates", "By Inclusion Dates", "By Payment Period".
- Sums the amount by the configured amount type, considering Income Tax Base and SSC Base (Impose) filters.
Function 21094064 -- UpdateTypeOfCharges (Update Charge Type Code)
What it does: Updates the Type Code of Charges on the payroll document line. The function does not return a numeric value but has a side effect -- it modifies the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Line on which the charge type code is updated |
Result:
- Returns: -- (the function does not return a value)
- Updates Payroll Document Line fields:
- Type Code of Charges -- set to '14' if conditions are met
Calculation logic:
- Checks the condition: wage period (Wage Period From) is less than the period code (Period Code) and payroll amount (Payroll Amount) is greater than 0.
- If both conditions are met, sets the charge type code = '14' (charge for a previous period).
- If conditions are not met, the value remains unchanged.
Function 21094065 -- FillVacResAEPeriodsOnDate (Fill AE Periods as of Date)
What it does: Fills the average earnings periods for vacation reserve calculation as of the end of the current payroll period (without the additional "+1" day, unlike function 21094061).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain period code, employee code |
| Time Activity Group | Time Activity Group from calculation line | To determine time activity filters |
Result:
- Returns: -- (the function does not return a numeric value)
- Updates Payroll Document Line fields:
- AE Period From -- AE period start
- AE Period To -- AE period end
- Action Starting Date -- end date of the current period
- Action Ending Date -- end date of the current period
- Document Starting Date -- same
- Document Ending Date -- same
- Document Type -- Vacation
- Time Activity Code -- activity code from the time activity group
- Wage Period From -- period by action date
- Wage Period To -- period by action date
Calculation logic:
- Creates a temporary absence order line with type "Vacation".
- Sets the start date = last day of the current payroll period (without "+1", unlike 21094061).
- Calls AEMgt.FillAbsenceLineAEDates for automatic calculation of AE periods.
- Transfers the calculated values to the payroll document line.
Note: The key difference from function 21094061 is that the calculation date = end of the current period (not +1 day), which does not add an extra month to the AE period.
Function 21094066 -- CalcVacDaysByWagePeriod (Vacation Days by Wage Period)
What it does: Calculates the vacation days balance, similar to function 21094062, but filters by a specific wage period and accounts for employment/termination dates.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, wage period |
| Time Activity Group | Time Activity Group from calculation line | To filter by vacation type |
Result:
- Returns: Decimal -- vacation days balance for the wage period
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the date range by wage period (Wage Period From).
- Adjusts the range based on employment and termination dates:
- If the hire date is later than the period start -- uses the hire date.
- If the termination date is earlier than the period end -- uses the termination date.
- Finds employee absence accrual entries with filters:
- Starting Date
<=period end. - Ending Date
>=period start or empty. - Entry Type = Accrual.
- Time Activity Code matching the filter.
- Starting Date
- For each accrual entry, counts the balance via VacationDaysCalculation.CalcVacDays.
- Returns the total balance.
Function 21094067 -- IsInvalid (Disability Status)
What it does: Checks whether the employee has a disability status as of the end date of the current payroll period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain person code and wage period |
Result:
- Returns: Integer -- 1 if the employee has a disability; 0 -- if not
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the check date -- end of the wage period (PeriodEndDate by Wage Period From).
- Filters person medical information records (Person Medical Info):
- Person No. = person code from the line.
- Type = Disability.
- Starting Date
<=check date. - Ending Date
>=check date or empty. - Disability Group
<>0 (disability group is set).
- If at least one record is found -- returns 1.
- If no records found -- returns 0.
Function 21094068 -- IsDisabled (Position for Disabled Persons)
What it does: Checks whether the employee's position is marked as "Position for Disabled Person".
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee Code | Employee No. from the document line | To find the position |
Result:
- Returns: Integer -- 1 if the position is designated for disabled persons; 0 -- if not
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the employee card by code.
- Finds the position (Position) by the position code from the employee card.
- Checks the "Position for Disabled Person" flag on the position.
- If the flag is set -- returns 1, otherwise -- 0.
Function 21094069 -- CheckTerminationDate (Termination Date Check)
What it does: Checks whether the employee's termination date falls within the current payroll period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code and period code |
Result:
- Returns: Integer -- 1 if the termination date falls within the current period; 0 -- if not (or if the termination date is empty)
- Updates Payroll Document Line fields: --
Calculation logic:
- Validates that mandatory fields are populated: Employee No. and Period Code.
- Finds the employee card and payroll period.
- If Termination Date is populated:
- Checks whether it falls within the [Starting Date..Ending Date] range of the payroll period.
- If yes -- returns 1.
- If Termination Date is empty or does not fall within the period -- returns 0.
Function 21094070 -- CalcPaymentsOnPeriod (Calculate Payments for Period)
What it does: Returns the sum of payments from employee ledger entries for the current period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code and period code |
| Base Amount Code | Base Amount Code from calculation line | Used as a filter by calculation group code (if populated) |
Result:
- Returns: Decimal -- total payment amount for the period
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters employee ledger entries:
- Document Type = Payment.
- Employee No. = employee code from the line.
- Open = true (open entries only).
- Payroll Period Code = period code from the line.
- If the base amount code is not empty -- Calc Group Code = base amount code.
- For each found entry, sums Amount (LCY).
- Returns the total payment amount.
Function 21094072 -- CalcPaymentForOriginPayrollLedgerEntry (Payment by Entry)
What it does: Returns the payroll amount from posted and unposted documents linked to a specific payroll element ledger entry via the "Orig. Payroll Ledger Entry No." field.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain the original entry number (Orig. Payroll Ledger Entry No.) |
Result:
- Returns: Decimal -- payroll amount (Payroll Amount) from all related lines
- Updates Payroll Document Line fields: --
Calculation logic:
- If Orig. Payroll Ledger Entry No. = 0, returns 0.
- Finds payroll document lines with the same original entry number:
- Sums Payroll Amount.
- Finds posted payroll document lines with the same original entry number:
- Sums Payroll Amount.
- Returns the total amount from both tables.
Function 21094073 -- GetTaxAmtPrevPeriod (Taxable Amount for Previous Period)
What it does: Returns the taxable amount (Taxable Amount) for the previous payroll period, filtered by employee, element type, posting type, and element code.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, element type, posting type, element code |
Result:
- Returns: Decimal -- taxable amount for the previous period
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters the Employee table (with FlowField) by:
- Employee No. Filter = employee code.
- Element Type Filter = element type from the line.
- Posting Type Filter = posting type from the line.
- Element Code Filter = element code from the line.
- Payroll Period Filter = previous payroll period code.
- Calculates the FlowField "SMA Taxable Amount".
- Returns the calculated amount.
Function 21094074 -- DocumentLineExistBase (Check Line Existence)
What it does: Checks whether at least one line exists in the current payroll document that matches the base amount filters.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To determine the document and filters |
| Base Amount Code | Base Amount Code from calculation line (required) | Filter settings for the search |
Result:
- Returns: Decimal -- 1 if a line is found, 0 if not found
- Updates Payroll Document Line fields: --
Calculation logic:
- Validates that the base amount code is not empty (TestField).
- Filters lines of the current document (Payroll Document Line) by document.
- Applies filters from the base amount settings (element, type, group, etc.).
- Additionally filters by period according to settings:
- "By Period Code" -- filter by Period Code.
- "By Wage Period" -- filter by Wage Period From.
- "By Action Dates" -- filter by Action Starting Date / Action Ending Date.
- "By Inclusion Dates" -- reverse date filter.
- If at least one line is found -- returns 1, otherwise -- 0.
Function 21094075 -- GetFSILimit for First Year Period (Subsistence Minimum for First Year Period)
DEPRECATED
What it does: Returns the subsistence minimum value for the first payroll period of the current year.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To determine the current period code |
Result:
- Returns: Decimal -- subsistence minimum amount for the first year period
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the first payroll period of the year by the period code from the line (GetFirstYearPeriod).
- Searches the Payroll Limit table for a record with the type "Survival Minimum" by the first year period code.
- Returns the amount of the found limit.
Function 21094076 -- CalcVacDays Future (Vacation Balance for Reserve with Future Periods)
What it does: Calculates the vacation days balance similar to function 21094062, but with future usage consideration -- usage entries with a date after the calculation date are included only if their period <= the current period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, period code |
| Time Activity Group | Time Activity Group from calculation line | To filter by vacation type |
| Future Usage | Fixed = true | Consider future usage with restrictions |
Result:
- Returns: Decimal -- vacation days balance considering future periods
- Updates Payroll Document Line fields: --
Calculation logic:
- Logic is similar to function 21094062 (CalcVacDays).
- Key difference: for usage entries with a date
>=calculation date:- Searches for the posted vacation absence order header.
- If the order's period code
<=the current period code of the document line -- usage is counted (subtracted). - If the order's period code > the current period -- usage is not counted.
- Usage entries with a date < the calculation date are always counted.
Function 21094077 -- CreateVacationReserveLine (Create Vacation Reserve Line)
What it does: Creates a copy of the current payroll document line with a different element code taken from the base amount settings. Used to generate additional vacation reserve lines (e.g., SSC accrual on the reserve).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Current source line for copying |
| Base Amount Code | Base Amount Code from calculation line | Base amount code from which the element code for the new line is taken |
Result:
- Returns: Decimal -- 0 (function has a side effect)
- Updates Payroll Document Line fields: -- (creates a new line in the document)
Calculation logic:
- Finds the base amount settings (Payroll Base Amount) by element code and base amount code.
- Copies the current document line.
- Sets the line number = current number + 1.
- Changes the Element Code to the value from the element code filter in the base amount (Element Code Filter).
- Inserts the new line into the table.
Note: The function is a side effect -- the main result is creating a new line in the document, not a numeric value.
Function 21094078 -- CalcWithdrawalDebt (Deduction Debt)
What it does: Calculates the deduction debt by comparing expected amounts with amounts actually deducted in previous periods.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain entry number, period code |
Result:
- Returns: Decimal -- deduction debt amount
- Updates Payroll Document Line fields: --
Calculation logic:
- If Payroll Elem. Ledger Entry No. = 0, returns 0.
- Finds the payroll element ledger entry.
- Finds the current payroll period.
- If the entry's action start date is earlier than the current period start date (i.e., the deduction started earlier):
- Finds all payroll periods from the month of the action start date to the previous month.
- For each period:
- Sums the actually deducted amounts (Payroll Amount) from the payroll ledger (filter: not reversed, not corrections).
- Calculates the debt: (Number of periods * Entry amount) + Actually deducted amount.
- If the action start date
>=current period start date, returns 0.
Function 21094079 -- BaseBalance Corr by Prev Wage Period (Corr. Amount by Previous Wage Period)
DEPRECATED
What it does: Returns the amount from payroll ledger entries using base amount filters. Delegates the call to the BaseBalance function.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, periods |
| Base Amount Code | Base Amount Code from calculation line | Filter settings |
Result:
- Returns: Decimal -- amount from payroll ledger entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Delegates the call to BaseBalance(PayrollDocLine, BaseAmountCode).
- BaseBalance filters payroll ledger entries by base amount settings: employee filters, period filters, amount type filters.
- Sums and returns the amount of the corresponding type.
Function 21094080 -- CalcByLedger Corr (Corr. Amount from Ledger Entries)
What it does: Returns the correction amount (Corr. Amount) from payroll ledger entries for a specific payroll element ledger entry for the current period code.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, element code, entry number, period code |
| Amount Type | Fixed = 0 (Payroll) | Internal AmountType parameter |
| Period Code | Period Code from the line | Filter by period code |
Result:
- Returns: Decimal -- correction amount (Corr. Amount) from ledger entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters payroll ledger entries by:
- Payroll Elem. Ledger Entry No. = entry number from the line.
- Employee No. = employee code.
- Element Code = element code.
- Period Code = period code from the line.
- Sums and returns Corr. Amount (AmountType = 0 corresponds to Corr in the CalcByLedger(PayrollDocLine, 0, PayrollDocLine."Period Code") call).
Clarification: The CalcByLedger call passes AmountType = 0, which corresponds to the Payroll option in the signature, but code analysis shows that this actually returns Corr (option order: Payroll, Taxable, Corr = 0, 1, 2). Verify: AmountType=0 actually returns Corr.Amount through the case block.
Function 21094081 -- CalcByLedger Taxable (Taxable Amount from Ledger Entries)
What it does: Returns the taxable amount (Taxable Amount) from payroll ledger entries for a specific entry for the current period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, element code, entry number, period code |
| Amount Type | Fixed = 2 (Corr) | Internal AmountType parameter |
| Period Code | Period Code from the line | Filter by period code |
Result:
- Returns: Decimal -- taxable amount (Taxable Amount)
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters payroll ledger entries by:
- Payroll Elem. Ledger Entry No. = entry number from the line.
- Employee No. = employee code.
- Element Code = element code.
- Period Code = period code from the line.
- Sums and returns Taxable Amount (AmountType = 2).
Function 21094082 -- GetSalaryByDateFSILim (Salary by Date Limited by Minimum Wage)
What it does: Returns the salary as of a date, but not less than the minimum wage (MROT) multiplied by the position rate.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee Code | Employee No. from the line | To search for salary entries |
| Starting Date | Document Starting Date from the line | Date for which the salary is searched |
| Posting Date | Posting Date from the line (CalcFields) | For currency conversion |
Result:
- Returns: Decimal -- MAX(Salary by date, Minimum Wage * Position Rate)
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads HR Setup for the salary element filter.
- Finds the current payroll element ledger entry (salary) for the employee as of the specified date.
- Converts the amount to local currency at the exchange rate on the posting date.
- If the element is an hourly rate, multiplies by the number of standard hours from the official calendar.
- If the element is a daily rate, multiplies by the number of standard working days.
- Gets the minimum wage from the payroll limits table for the corresponding period.
- Multiplies the minimum wage by the Position Rate from the labor contract.
- Returns the greater of the two values: salary or minimum wage * rate.
Function 21094083 -- GetAESalaryByDateWithFSILimit (AE Salary Limited by Minimum Wage)
What it does: Returns the salary for average earnings calculation as of a date, but not less than the minimum wage multiplied by the position rate.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee Code | Employee No. from the line | To search for the salary |
| Action Starting Date | Action Starting Date from the line | Date for which the AE salary is searched |
Result:
- Returns: Decimal -- MAX(AE Salary + AE Extra Amount, Minimum Wage * Position Rate)
- Updates Payroll Document Line fields: --
Calculation logic:
- Calculates the salary for average earnings: GetAESalaryByDate + GetAEExtraSalaryByDate.
- Gets the minimum wage from the limits table for the corresponding period.
- Finds the position rate (Position Rate) from the labor contract as of the date.
- Multiplies the minimum wage by the position rate.
- If Minimum Wage * rate > AE salary, returns Minimum Wage * rate.
- Otherwise, returns the AE salary.
Function 21094084 -- FillTypeOfChargeCodeOnLine (Fill Charge Type Code)
What it does: Sets the Type Code of Charges on the payroll document line if the corresponding code exists in the payroll directory.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Line to update |
| Base Amount Code | Base Amount Code from calculation line | Code to be used as the charge type code |
Result:
- Returns: -- (the function does not return a value)
- Updates Payroll Document Line fields:
- Type Code of Charges -- set to the base amount code value if it exists in the directory
Calculation logic:
- If the base amount code is empty -- exits without action.
- Searches the payroll directory (Payroll Directory) for a record with type "Type code of charges" and code = base amount code.
- If found -- sets the charge type code on the document line = base amount code.
- If not found -- no changes are made.
Function 21094085 -- CheckIsTheActualCalcGroup (Check Actual Calculation Group)
What it does: Checks whether the calculation group of the current document is the actual one (the one currently assigned to the employee).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Document No. | Document No. from the line | To obtain the document header |
Result:
- Returns: Decimal -- 1 if the document's calculation group = the employee's actual group; 0 -- if not
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the payroll document header by number.
- Finds the employee card.
- Compares "Payroll Calc Group" from the employee card with "Calc Group Code" from the document header.
- If they match -- returns 1.
- If they differ -- returns 0.
Function 21094086 -- GetFSILimit MROT Hour by Wage Period (Minimum Hourly Rate by Wage Period)
DEPRECATED
What it does: Returns the minimum hourly rate (MROT Hour) value from the payroll limits table for the wage period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Wage Period | Wage Period From from the line | Period code for filtering |
Result:
- Returns: Decimal -- minimum hourly rate value
- Updates Payroll Document Line fields: --
Calculation logic:
- Searches the Payroll Limit table for a record with the type "MROT Hour" for the wage period.
- Returns the amount of the found limit.
Function 21094087 -- YTDBaseAmount Corr for Person in Year (Corr. Amount for Person Year-to-Date)
DEPRECATED
What it does: Returns the amount from payroll ledger entries year-to-date using base amount filters. Delegates the call to YTDBaseAmount.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, periods |
| Base Amount Code | Base Amount Code from calculation line | Filter settings |
Result:
- Returns: Decimal -- year-to-date amount from ledger entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Delegates the call to YTDBaseAmount(PayrollDocLine, BaseAmountCode).
- YTDBaseAmount filters ledger entries from the first period of the current year to the current period, or by the period settings from the base amount.
Function 21094088 -- CheckSickLeaveOnlySalary (Check Sick Leave Salary Only)
What it does: Checks whether only salary data should be used for sick leave calculation. Returns the average daily earnings or 0 depending on the presence of non-salary sources in the AE periods.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain document type, AE data |
| Time Activity Group | Time Activity Group from calculation line | To calculate working days from the timesheet |
Result:
- Returns: Decimal -- AE Daily Earnings (average daily earnings) or 0
- Updates Payroll Document Line fields: --
Calculation logic:
- If the document type is not "Sick Leave" -- returns AE Daily Earnings without verification.
- Calculates the total AE days (AE Total Days).
- If the AE period is populated, reads the number of working days from the timesheet by time activity group and AE period (AE Period From .. AE Period To).
- Compares the calendar days from the timesheet with the AE days count:
- If they are equal (i.e., all days = working days):
- Checks AE lines (Payroll Document Line AE): whether there are sources other than "Salary".
- If all sources are salary only -- returns 0 (indicator of "salary only").
- If there are other sources -- returns AE Daily Earnings.
- If they differ -- returns AE Daily Earnings.
- If they are equal (i.e., all days = working days):
Function 21094089 -- CalcLCYBasedOnOCY (Calculate LCY Amount from Foreign Currency)
What it does: Converts the payroll amount from the original currency (OCY) to local currency (LCY) and updates the Payroll Amount field on the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Line with the foreign currency amount |
Result:
- Returns: Decimal -- amount in local currency (or 0 if no currency is specified)
- Updates Payroll Document Line fields:
- Payroll Amount -- payroll amount in local currency (LCY)
Calculation logic:
- If the currency code (Currency Code) is empty -- exits without changes.
- Converts the amount from original currency (Payroll Amount (OCY)) to local currency via CurrExchRate.ExchangeAmtFCYToLCY:
- Date = Posting Date.
- Currency Code = Currency Code.
- Currency Factor = Currency Factor.
- Rounds the result.
- Writes the result to the Payroll Amount field.
Function 21094090 -- CalcOCYBasedOnLCY (Calculate Foreign Currency Amount from LCY)
What it does: Converts the payroll amount from local currency (LCY) to original currency (OCY) and updates the Payroll Amount (OCY) field on the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Line with the amount in local currency |
Result:
- Returns: Decimal -- amount in original currency (or 0 if no currency is specified)
- Updates Payroll Document Line fields:
- Payroll Amount (OCY) -- payroll amount in original currency
Calculation logic:
- If the currency code (Currency Code) is empty -- exits without changes.
- Reads the rounding precision settings for the currency.
- Converts the amount from local currency (Payroll Amount) to original currency via CurrExchRate.ExchangeAmtLCYToFCY:
- Date = Posting Date.
- Currency Code = Currency Code.
- Currency Factor = Currency Factor.
- Rounds the result with currency precision (Amount Rounding Precision).
- Writes the result to the Payroll Amount (OCY) field.
Function 21094091 -- CopyCurrByElementFilter (Copy Currency by Element Filter)
What it does: Copies the currency code, currency factor, and the use original currency flag from another document line found by the base amount filter.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Recipient line for currency data |
| Base Amount Code | Base Amount Code from calculation line | To determine the element filter |
Result:
- Returns: Decimal -- 0 (function has a side effect)
- Updates Payroll Document Line fields:
- Currency Code -- currency code from the found line
- Currency Factor -- currency factor
- Use Original Currency -- use original currency flag
Calculation logic:
- Reads the base amount settings to obtain the element code filter and element type filter.
- Searches for another line in the current document with filters:
- Line No.
<>current line number. - Element Type by base amount filter.
- Element Code by base amount filter.
- Currency Code
<>'' (currency lines only). - Use Original Currency = true.
- Line No.
- If found -- copies the currency data and saves the line (Modify).
Function 21094092 -- CalendarMgt Working Hours in Wage Period (Working Hours by Production Calendar)
DEPRECATED
What it does: Returns the number of working hours from the document line's calendar for the wage period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Calendar Code | Calendar Code from the document line | Production calendar code |
| Payroll Period | WagePayrollPeriod (global variable) | Period start and end dates |
Result:
- Returns: Decimal -- number of working hours
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls CalendarMgt.GetPeriodInfo with parameters:
- Calendar Code = calendar code from the line.
- Starting Date and Ending Date = wage period dates.
- What = 3 (working hours).
Function 21094093 -- TimesheetMgt Hours from Timesheet (Hours from Timesheet)
DEPRECATED
What it does: Returns the number of hours from the timesheet for the wage period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee Code | Employee No. from the line | To search for timesheet records |
| Time Activity Group | Time Activity Group from calculation line | Activity type filter |
| Payroll Period | WagePayrollPeriod (global variable) | Start and end dates |
Result:
- Returns: Decimal -- number of hours from the timesheet
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls TimesheetMgt.GetTimesheetInfo with parameters:
- Employee No. = employee code.
- Time Activity Group = time activity group.
- Starting Date and Ending Date = payroll period dates.
- What = 3 (hours).
Function 21094094 -- GetSalaryByPeriod by Employee Calendar (Average Salary by Employee Calendar)
What it does: Returns the average salary for the action date range using the employee's calendar (not the official production calendar). Similar to function 21094001, but with a different calendar.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee Code | Employee No. from the line | To search for salary and calendar |
| Starting Date | Action Starting Date from the line | Range start |
| Ending Date | Action Ending Date from the line | Range end |
| Official Calendar | Fixed = false | Use employee calendar |
Result:
- Returns: Decimal -- average salary for working days in the period
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the current employee job entry to determine the employee's calendar.
- Filters working days (Nonworking = false) by the employee's calendar within the date range.
- For each working day, reads the salary as of that date (GetSalaryByDate with parameter UseOfficialCalendar = false).
- Sums the salaries for all working days.
- Divides the sum by the number of working days.
- Returns the average salary.
Function 21094095 -- CalendarMgt Working Hours by Action Dates (Working Hours by Action Dates)
DEPRECATED
What it does: Returns the number of working hours from the line's calendar for the action date range.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Calendar Code | Calendar Code from the line | Production calendar code |
| Starting Date | Action Starting Date from the line | Range start |
| Ending Date | Action Ending Date from the line | Range end |
Result:
- Returns: Decimal -- number of working hours for the date range
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls CalendarMgt.GetPeriodInfo with What = 3 (hours) for the line's calendar and action dates.
Function 21094096 -- BaseBalance (Base Balance from Ledger Entries)
DEPRECATED
What it does: Returns the amount from payroll ledger entries using base amount filters. Delegates the call to BaseBalance.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, periods |
| Base Amount Code | Base Amount Code from calculation line | Filter settings |
Result:
- Returns: Decimal -- amount from ledger entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Delegates the call to BaseBalance(PayrollDocLine, BaseAmountCode).
Function 21094097 -- GetFSILimit FSI by Payment Period (SSC Limit by Payment Period)
DEPRECATED
What it does: Returns the SSC limit (SSC Limit) from the payroll limits table for the document's payment period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To determine the payment period from the document header |
Result:
- Returns: Decimal -- SSC limit value
- Updates Payroll Document Line fields: --
Calculation logic:
- Determines the payment period code from the payroll document header (Payment Period Code).
- Searches the Payroll Limit table for a record with the type "SSC Limit" for that period.
- Returns the amount of the found limit.
Function 21094098 -- YTDBaseAmount Corr (Corr. Amount Year-to-Date)
DEPRECATED
What it does: Returns the amount from payroll ledger entries from the start of the current year. Delegates the call to YTDBaseAmount.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, periods |
| Base Amount Code | Base Amount Code from calculation line | Filter settings |
Result:
- Returns: Decimal -- year-to-date amount
- Updates Payroll Document Line fields: --
Calculation logic:
- Delegates the call to YTDBaseAmount(PayrollDocLine, BaseAmountCode).
Function 21094099 -- YTDExternalIncome (External Income Year-to-Date)
What it does: Returns the sum of external income for the person from the start of the current year to the current period. Reads data from the Person Income FSI table.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain person code and period |
| Base Amount Code | Base Amount Code from calculation line | To obtain element, type, Income Tax Base, SSC Base filters |
Result:
- Returns: Decimal -- external income amount year-to-date
- Updates Payroll Document Line fields: --
Calculation logic:
- Filters the Person Income FSI table by person code.
- Reads the base amount settings and applies filters:
- Element Code, Element Type from the base amount.
- Income Tax Base: Impose / Not Impose.
- SSC Base: Impose / Not Impose.
- Depending on the period filter in the base amount, determines the range:
- "By Payment Period" -- from the first year period to the document payment period.
- "By Period Code" -- from the first year period to the line's period code.
- "By Wage Period" -- from the first year period to the line's wage period.
- Sums the Amount field and returns the result.
Function 21094100 -- CalcPostedTaxAmountGE (Posted Tax Amount, Georgia)
What it does: Calculates the already posted tax amount from person income entries (Person Income Entry). Originally designed for Georgia but can be used in other configurations.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain entry number and period code |
Result:
- Returns: Decimal -- amount from person income entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Delegates the call to codeunit HRPGEFunctions.CalcPostedTaxAmountGE.
- If the payroll element ledger entry number = 0, returns 0.
- Filters person income entries (Person Income Entry) by:
- Payroll Elem. Ledger Entry No. = entry number from the line.
- Period Code = period code from the line.
- Sums the Amount and returns the result.
Function 21094101 -- YTDTaxDedAmount (Tax Deduction Year-to-Date)
What it does: Returns the tax deductible amount from payroll ledger entries from the start of the current calendar year.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code, posting date |
| Base Amount Code | Base Amount Code from calculation line | To obtain element code, type, and group filters |
Result:
- Returns: Decimal -- tax deduction amount year-to-date
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the Posting Date of the line.
- Filters payroll ledger entries by:
- Employee No. = employee code.
- Element Code = element code filter from the base amount.
- Element Type = element type filter from the base amount.
- Element Group = element group filter from the base amount.
- Determines the period range: from the first period of the year (by posting date) to the last period ending before December 31 of the same year.
- Sums the Tax Deductible Amount field and returns the result.
Function 21094102 -- CalcAmountForNettoBaseDetail (Amount for Netto Base Detail)
What it does: Calculates the amount for net payment distribution: sums undistributed amounts from document lines and amounts from the detailed tax base. Used to form net payment lines.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | Current net payment line |
| Base Amount Code | Base Amount Code from calculation line | Filter settings for finding source lines |
Result:
- Returns: Decimal -- amount for net payment
- Updates Payroll Document Line fields:
- Posting Group -- may be updated from another document line
Calculation logic:
- Filters lines of the current document by base amount settings and directory code (Directory Code).
- For each found line where (Payroll Amount - Paid Amount)
<>0:- Adds to the result: Payroll Amount - Paid Amount.
- Finds detailed base for tax entries (Detailed Base for Tax) for this line.
- Filters by types: Deduction, Income Tax, Pension Deduction.
- Adds the deduction amount (Deduction Amount) to the result.
- Updates the Netto Document Line No. to link with the net line.
- Processes tax deduction lines (Tax Deduction) with posting type "Do Not Post" -- distributes the deduction amount across the base.
- May update the net line's Posting Group from the source line.
Function 21094103 -- CalcNettoAmountForSpecialElement (Netto Amount for Special Element)
What it does: Calculates the net amount for a special element by delegating the call to codeunit PostTaxesWithPaymentMgt. Used to determine the payment amount via the payment statement.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain line data |
| Base Amount Code | Base Amount Code from calculation line | To determine filters |
Result:
- Returns: Decimal -- amount from the payment statement line (Payment Statement Line)
- Updates Payroll Document Line fields: --
Calculation logic:
- Delegates the call to PostTaxesWithPaymentMgt.CalcNettoAmountForSpecialElement.
- Checks: if Add. Amount 2
<>0 and Payroll Amount<>Add. Amount 2, exits without a result. - Finds the document line by base amount filters and directory code.
- Creates a temporary payment statement line and checks whether the line amount
>=document amount. - If the amount < document amount -- validates the change and returns the amount from the payment statement.
Function 21094104 -- CalcPostedAdvanceAmount (Posted Advance Amount)
What it does: Returns the already posted advance amount from person income entries associated with the current element.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain period code, employee code |
| Base Amount Code | Base Amount Code from calculation line | To obtain element filters |
Result:
- Returns: Decimal -- advance amount from income entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Delegates the call to PostTaxesWithPaymentMgt.CalcPostedAdvanceAmount.
- Filters person income entries (Person Income Entry) by:
- Period Code = period code.
- Employee No. = employee code.
- Element Code, Element Type -- by filters from the first base amount record.
- Sums and returns the Amount.
Function 21094105 -- CheckBetweenCalcGroup (Check Interperiod Calculation Group)
What it does: Checks whether the current calculation group is of type "Between" -- i.e., whether this is an interperiod calculation.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain the calculation group code |
Result:
- Returns: Decimal -- 1 if the calculation group is of type "Between" (interperiod); 0 -- if not
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the calculation group (Payroll Calc Group) by the code from the line.
- Checks whether the group type = "Between".
- If yes -- returns 1, otherwise -- 0.
Function 21094106 -- PostedBaseAmount (Posted Base Amount)
What it does: Returns the amount from posted payroll document lines of the document that is the original (source) for the current document. Calculates the difference between the payroll amount and the already posted amount.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain element code |
| Document Header | Payroll Document Header | To obtain the original document number (Original Payroll Document No.) |
| Base Amount Code | Base Amount Code from calculation line | To obtain filters |
Result:
- Returns: Decimal -- amount (Payroll Amount - Posted Amount) from posted lines
- Updates Payroll Document Line fields: --
Calculation logic:
- Finds the payroll document header to obtain the original document number.
- If the original document number is empty -- returns 0.
- Filters posted lines by:
- Document No. = original document number.
- Filters from the base amount settings.
- For each found line, sums: Payroll Amount - Posted Amount (difference between the accrued and already posted amount).
- Returns the total amount.
Function 21094107 -- CalendarMgt Working Days in Wage Period (Working Days by Calendar for Period)
DEPRECATED
What it does: Returns the number of working days from the document line's calendar for the wage period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Calendar Code | Calendar Code from the document line | Production calendar code |
| Payroll Period | WagePayrollPeriod (global variable) | Start and end dates |
Result:
- Returns: Decimal -- number of working days
- Updates Payroll Document Line fields: --
Calculation logic:
- Calls CalendarMgt.GetPeriodInfo with parameters:
- Calendar Code = calendar code from the line.
- Starting Date and Ending Date = wage period dates.
- What = 2 (working days).
Function 21094108 -- CalcMonthQtyBetweenPeriod (Number of Months Between Periods)
What it does: Returns the number of months between the start and end average earnings (AE) periods. Used to calculate the number of months considered when computing average earnings.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| AE Period Start | AE Period From from the line | Start period code |
| AE Period End | AE Period To from the line | End period code |
Result:
- Returns: Integer -- number of months between periods (inclusive)
- Updates Payroll Document Line fields: --
Calculation logic:
- If either period is empty -- returns 0.
- Finds the payroll period records by codes.
- Calculates: Month(End period ending date) - Month(Start period ending date) + 1.
- Returns the result.
Note: The formula works correctly only within a single calendar year. For cross-year ranges, the result may be incorrect.
Function 21094109 -- CheckBaseEmployeePositionElementCode (Check Base Position Element Code)
What it does: Checks whether the base salary element code on the employee's position matches the element code filter from the base amount settings.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain employee code and element code |
| Base Amount Code | Base Amount Code from calculation line | To obtain the element code filter |
Result:
- Returns: Integer -- 1 if the position's base element matches the filter; 0 -- if not
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads the base amount settings (Payroll Base Amount).
- Finds the employee card, gets the position code.
- Filters the Position table by:
- No. = employee's position code.
- Base Salary Element Code = element code filter from the base amount.
- If found -- returns 1, otherwise -- 0.
Function 21094111 -- GetSalaryAmountByDate (Salary Amount by Date)
What it does: Returns the salary amount from the payroll element ledger entries as of the specified date. Unlike function 21094000, it uses FindLast (not FindFirst) and does not convert hourly/daily rates.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee Code | Employee No. from the line | To search for salary entries |
| Action Starting Date | Action Starting Date from the line | Date for which the salary is searched |
Result:
- Returns: Decimal -- salary amount from payroll element ledger entries
- Updates Payroll Document Line fields: --
Calculation logic:
- Reads HR Setup to obtain the salary element filter (Element Code Salary Days, Hours, Amount, Hourly Rate, Daily Rate).
- Filters payroll element ledger entries:
- Employee No. = employee code.
- Element Code = salary element filter.
- Action Starting Date
<=specified date. - Action Ending Date
>=specified date or empty.
- Finds the last record (FindLast).
- Returns the Amount field of the found record.
Note: Unlike GetSalaryByDate (21094000/21094050), this function does not multiply the amount by the number of hours/days for hourly/daily rates -- it returns the raw amount from the entry.
Function 21094112 -- GetValorizationIndex (Valorization Index)
What it does: Returns the valorization index (consumer index) from the corresponding table. Used for pension and indexation calculations.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Payroll Document Line | Payroll Document Line | To obtain the order number (HR Order No.) and document type |
Result:
- Returns: Decimal -- consumer index value (Customer's Index)
- Updates Payroll Document Line fields: --
Calculation logic:
- If the order number (HR Order No.) is empty -- returns 0.
- Converts the document line type to the absence order document type.
- Recursively searches for the first (oldest) absence order in the chain:
- Finds the posted absence order line (Posted Absence Line) by document number and type.
- If the found line has a "Previous Document No.", navigates to it.
- Repeats until a line without a previous document is found.
- Determines the start date from the first order in the chain.
- Searches for the consumer index (Consumer Index) in the SMA Consumer Indexes table for the period up to the start date period.
- Returns the "Customer's Index" value from the last found record.
Note: The function traverses the absence order chain, going to the very first order to determine the initial date. This is important for correctly determining the base index when an absence is extended.
Summary Table
| No. | Name | Returns | Side Effects | Status |
|---|---|---|---|---|
| 21094051 | GetFSILimit (Subsistence Minimum) | Decimal | -- | Active |
| 21094052 | BaseAmount (Corr. Amount by Person) | Decimal | -- | DEPRECATED |
| 21094053 | CalcByLedger Tax | Decimal | -- | Active |
| 21094054 | GetTimesheetActionData Hours | Decimal | -- | DEPRECATED |
| 21094055 | GetAdvancePay Hourly | Decimal | Updates action dates, hours | Active |
| 21094056 | CalcIndexationFactor | Decimal | -- | Active |
| 21094057 | CalcPaymDaysFromAbsenceOrder | Integer | Updates Payment Days | Active |
| 21094058 | RateTime Hours | Decimal | -- | Active |
| 21094059 | RateTime Days | Decimal | -- | Active |
| 21094060 | JobBalance | Decimal | -- | Active |
| 21094061 | FillVacResAEPeriods "+1" | -- | Updates AE dates, document type | Active |
| 21094062 | CalcVacDays | Decimal | -- | Active |
| 21094063 | PrevBaseAmount | Decimal | -- | Active |
| 21094064 | UpdateTypeOfCharges | -- | Updates Type Code of Charges | Active |
| 21094065 | FillVacResAEPeriodsOnDate | -- | Updates AE dates, document type | Active |
| 21094066 | CalcVacDaysByWagePeriod | Decimal | -- | Active |
| 21094067 | IsInvalid | Integer (0/1) | -- | Active |
| 21094068 | IsDisabled | Integer (0/1) | -- | Active |
| 21094069 | CheckTerminationDate | Integer (0/1) | -- | Active |
| 21094070 | CalcPaymentsOnPeriod | Decimal | -- | Active |
| 21094072 | CalcPaymentForOriginPayrollLedgerEntry | Decimal | -- | Active |
| 21094073 | GetTaxAmtPrevPeriod | Decimal | -- | Active |
| 21094074 | DocumentLineExistBase | Decimal (0/1) | -- | Active |
| 21094075 | GetFSILimit (1st Year Period) | Decimal | -- | DEPRECATED |
| 21094076 | CalcVacDays Future | Decimal | -- | Active |
| 21094077 | CreateVacationReserveLine | Decimal | Creates new line | Active |
| 21094078 | CalcWithdrawalDebt | Decimal | -- | Active |
| 21094079 | BaseBalance Corr | Decimal | -- | DEPRECATED |
| 21094080 | CalcByLedger Corr | Decimal | -- | Active |
| 21094081 | CalcByLedger Taxable | Decimal | -- | Active |
| 21094082 | GetSalaryByDateFSILim | Decimal | -- | Active |
| 21094083 | GetAESalaryByDateWithFSILimit | Decimal | -- | Active |
| 21094084 | FillTypeOfChargeCodeOnLine | -- | Updates Type Code of Charges | Active |
| 21094085 | CheckIsTheActualCalcGroup | Decimal (0/1) | -- | Active |
| 21094086 | GetFSILimit MROT Hour | Decimal | -- | DEPRECATED |
| 21094087 | YTDBaseAmount Corr Person | Decimal | -- | DEPRECATED |
| 21094088 | CheckSickLeaveOnlySalary | Decimal | -- | Active |
| 21094089 | CalcLCYBasedOnOCY | Decimal | Updates Payroll Amount | Active |
| 21094090 | CalcOCYBasedOnLCY | Decimal | Updates Payroll Amount (OCY) | Active |
| 21094091 | CopyCurrByElementFilter | Decimal | Updates Currency Code, Factor | Active |
| 21094092 | CalendarMgt Working Hours | Decimal | -- | DEPRECATED |
| 21094093 | TimesheetMgt Hours | Decimal | -- | DEPRECATED |
| 21094094 | GetSalaryByPeriod (Employee Calendar) | Decimal | -- | Active |
| 21094095 | CalendarMgt Working Hours (Action Dates) | Decimal | -- | DEPRECATED |
| 21094096 | BaseBalance | Decimal | -- | DEPRECATED |
| 21094097 | GetFSILimit FSI (Payment Period) | Decimal | -- | DEPRECATED |
| 21094098 | YTDBaseAmount Corr | Decimal | -- | DEPRECATED |
| 21094099 | YTDExternalIncome | Decimal | -- | Active |
| 21094100 | CalcPostedTaxAmountGE | Decimal | -- | Active |
| 21094101 | YTDTaxDedAmount | Decimal | -- | Active |
| 21094102 | CalcAmountForNettoBaseDetail | Decimal | Updates Posting Group | Active |
| 21094103 | CalcNettoAmountForSpecialElement | Decimal | -- | Active |
| 21094104 | CalcPostedAdvanceAmount | Decimal | -- | Active |
| 21094105 | CheckBetweenCalcGroup | Decimal (0/1) | -- | Active |
| 21094106 | PostedBaseAmount | Decimal | -- | Active |
| 21094107 | CalendarMgt Working Days | Decimal | -- | DEPRECATED |
| 21094108 | CalcMonthQtyBetweenPeriod | Integer | -- | Active |
| 21094109 | CheckBaseEmployeePositionElementCode | Integer (0/1) | -- | Active |
| 21094111 | GetSalaryAmountByDate | Decimal | -- | Active |
| 21094112 | GetValorizationIndex | Decimal | -- | Active |
Payroll Calculation Functions (Part 4): Ranges, Service, Base Amounts, Reports (21094900–21094924, 21094500–21094518)
This section describes functions for ranges, service, base amounts, and action dates (21094900–21094924), as well as report functions (21094500–21094518).
Calculation Functions: Ranges, Service, Base Amounts (21094900–21094924)
Codeunit: SMA Payroll Document Calculate (70950596)
Function 21094900 --- Brackets Max Amount AZ (AZ Range Maximum)
What it does: Returns the maximum amount from a Range Line for the payroll period. Used to determine the upper limit in range-based calculations.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| PayrollDocLineCalc | Calculation Line | Calculation parameters containing the range code |
| Wage Period From | Payroll Document Line | Start of the payroll period used to look up the range header |
Result:
- Returns: Decimal --- maximum amount (Max Amount) from the range line for the corresponding period
- Updates Payroll Document Line fields: ---
Calculation logic:
- Finds the Range Header for the payroll period (Wage Period From) using the
GetRangeHdrByPeriodfunction. - If a header is found, calls the
Bracketsfunction with theBracket::MaxAmountparameter, which returns the maximum amount from the corresponding range line. - If no range header is found, returns 0.
Function 21094901 --- GetSalaryByPeriodAZ hourly (AZ Average Hourly Earnings)
What it does: Calculates the average hourly earnings using the Azerbaijan methodology. For each working day in the calendar within the specified period, retrieves the salary and divides it by the number of working hours in the month.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line | Employee code |
| Action Starting Date | Payroll Document Line | Action start date --- start of the calculation period |
| Action Ending Date | Payroll Document Line | Action end date --- end of the calculation period |
| UseHourlyRate | Constant (true) | Flag indicating to use the hourly rate |
| DaysType | Constant (0 --- Calendar Days) | Days type (has no effect when UseHourlyRate = true) |
| UseDaysAmount | Constant (true) | Flag enabling division by the number of hours |
Result:
- Returns: Decimal --- accumulated hourly earnings amount for the period (NOT averaged by the number of days)
- Updates Payroll Document Line fields: ---
Calculation logic:
- Retrieves the Employee Job Entry record to determine the calendar code.
- Selects working days (Nonworking = false) from the calendar for the period from
Action Starting DatetoAction Ending Date. - For each working day:
- Finds the Payroll Element Ledger Entry with the salary element code effective on that date.
- Retrieves the salary amount. If the element is an hourly or daily rate, converts the amount to a monthly salary by multiplying by the corresponding number of hours/days from the official calendar.
- Divides the resulting amount by the number of working hours in the month (according to the employee's calendar).
- The result is the sum across all days (accumulated
ResultAmount), returned without dividing by the number of days (sinceUseHourlyRate = true).
Function 21094902 --- GetSalaryByPeriodAZ daily (AZ Average Daily Earnings)
What it does: Calculates the average daily earnings using the Azerbaijan methodology. For each working day in the calendar within the specified period, retrieves the salary and divides it by the number of working days in the month.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line | Employee code |
| Action Starting Date | Payroll Document Line | Action start date |
| Action Ending Date | Payroll Document Line | Action end date |
| UseHourlyRate | Constant (false) | Do not use the hourly rate |
| DaysType | Constant (1 --- Working Days) | Days type --- working days |
| UseDaysAmount | Constant (true) | Flag enabling division by the number of days |
Result:
- Returns: Decimal --- average daily earnings (total amount / number of working days in the selected period)
- Updates Payroll Document Line fields: ---
Calculation logic:
- Retrieves the Employee Job Entry record to determine the calendar code.
- Selects working days from the calendar for the period.
- For each working day:
- Finds the effective Payroll Element Ledger Entry with the salary element code.
- Retrieves the salary amount. If the element is an hourly or daily rate, converts it to a monthly salary.
- Divides the amount by the number of working days in the month according to the employee's calendar.
- Returns the total accumulated amount divided by the number of working days in the selected period (
ResultAmount / PayrollCalendarLine.Count()).
Function 21094903 --- YTDBaseAmount Payroll for Person (Year-to-Date Payroll Amount for Person)
DEPRECATED
What it does: Returns the year-to-date payroll amount for a person based on base amount filters. Uses data from the Payroll Ledger Entry.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Base Amount Code | Calculation Line | Base amount code for determining filters |
Result:
- Returns: Decimal --- year-to-date payroll amount
- Updates Payroll Document Line fields: ---
Calculation logic:
- Retrieves the Payroll Base Amount record by element code and base amount code.
- Sets the employee filter depending on the base amount settings (by employee, by person, or for other employees).
- Sets the period filter: from the start of the year (FirstYearPayrollPeriod.Code) to the current period.
- Returns the corresponding amount type (Payroll Amount, Taxable Amount, etc.) from the Payroll Ledger Entries.
Function 21094904 --- YTDBaseAmount Taxable for Person (Year-to-Date Taxable Amount for Person)
DEPRECATED
What it does: Returns the year-to-date taxable income amount for a person. Logic is identical to function 21094903, but intended for taxable amounts.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Base Amount Code | Calculation Line | Base amount code |
Result:
- Returns: Decimal --- year-to-date taxable amount
- Updates Payroll Document Line fields: ---
Calculation logic:
- Calls the same
YTDBaseAmountfunction as function 21094903. - Filtering by amount type (Taxable Amount) is determined by the base amount settings.
Function 21094905 --- TimesheetMgt Working Days by Action Date (Timesheet Working Days by Action Date)
DEPRECATED
What it does: Returns the number of working days from the timesheet, filtered by the time activity group and the action dates of the payroll document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line (contains Employee No., Action Starting Date, Action Ending Date) |
| Time Activity Group | Calculation Line | Time activity group code |
Result:
- Returns: Decimal --- number of working days
- Updates Payroll Document Line fields: ---
Calculation logic:
- Calls
TimesheetMgt.GetTimesheetActionDatawith data type parameter 4 (working days). - Data is filtered by employee, time activity group, and action dates from the payroll document line.
Function 21094906 --- GetTaxDeductions (Maximum Tax Deduction)
What it does: Determines the maximum tax deduction amount by cross-referencing a person's tax deductions with range lines. Updates the directory code on the payroll document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| PayrollDocLineCalc | Calculation Line | Calculation parameters (Base Amount Code, range code) |
Result:
- Returns: Decimal --- maximum deduction amount
- Updates Payroll Document Line fields: Directory Code
Calculation logic:
- Retrieves the base amount record to determine the period filter.
- Finds the Range Header by period: by Period Code or by Wage Period From (depending on base amount settings).
- Selects the person's tax deductions (Person Tax Deduction) from the
SMA Person Tax Deductiontable, filtered by:- Person No. from the document line.
- Effective period: Starting Period
<=current period, Ending Period>=current period or empty.
- For each deduction, searches for a Range Line with a directory code matching the deduction code.
- If the found range line amount exceeds the current maximum, updates the result and populates
PayrollDocLine."Directory Code"with the directory code from the range line. - Returns the highest deduction amount found.
Function 21094907 --- GetServiceYears (Service Years)
What it does: Returns the total insured service years of an employee as a decimal number (years + months/12 + days/365).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Employee No. | Payroll Document Line | Employee code |
| Action Ending Date | Payroll Document Line | Date for which service years are calculated |
Result:
- Returns: Decimal --- service years (decimal number)
- Updates Payroll Document Line fields: ---
Calculation logic:
- Retrieves the employee card by
Employee No.. - Calls
RecOfServiceMgt.CalcEmplInsuredService(Employee, Action Ending Date, CommService), which populates theCommServicearray:CommService[1]--- days.CommService[2]--- months.CommService[3]--- years.
- Returns:
CommService[3] + CommService[2] / 12 + CommService[1] / 365.
Function 21094908 --- GetPercentAmountFromRange (Percent and Amount from Range)
What it does: Finds the range line by the Quantity value of the payroll document line and populates the Amount and Payment Percent fields on the document line.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line (uses Quantity) |
| RangeHeader | Internal variable | Range header found during the previous calculation step |
Result:
- Returns: Decimal --- amount from the range line (effectively unused since values are written directly to the document line)
- Updates Payroll Document Line fields: Amount, Payment Percent
Calculation logic:
- Sets filters on Range Lines by element code, range code, and period.
- If
Allow Employee Genderis enabled in the range header, filters by the employee's gender. - If
Allow Employee Ageis enabled, filters by the employee's date of birth. - Filters by the employee's disability status (Disabled Person).
- Searches for a range line where
Min Amount <= PayrollDocLine.Quantity <= Max Amount. - If a line is found, populates:
PayrollDocLine.Amount := RangeLine.Amount.PayrollDocLine."Payment Percent" := RangeLine.Percent.
Function 21094909 --- FillActionDatesbyWagePeriod (Action Dates by Wage Period)
What it does: Sets the action dates of the payroll document line equal to the start and end dates of the wage period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Wage Period From | Payroll Document Line | Wage period code |
Result:
- Returns: Decimal --- 0 (not used)
- Updates Payroll Document Line fields: Action Starting Date, Action Ending Date
Calculation logic:
- Determines the start and end dates of the wage period by
Wage Period Fromcode. - Sets:
PayrollDocLine."Action Starting Date":= wage period start date.PayrollDocLine."Action Ending Date":= wage period end date.
Function 21094910 --- FillActionDatesbyAdvance (Action Dates by Advance)
What it does: Sets the action dates of the payroll document line from the period start to the advance date. If the advance date is not specified, exits without changes.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Wage Period From | Payroll Document Line | Wage period code |
Result:
- Returns: Decimal --- 0 (the return value is not explicitly used, but if the advance date is missing the function does not change the dates)
- Updates Payroll Document Line fields: Action Starting Date, Action Ending Date
Calculation logic:
- Retrieves the wage period record by
Wage Period Fromcode. - Checks whether the advance date (
Advance Date) exists in the period. - If the advance date = 0D (empty), exits without changes.
- If the advance date exists, sets:
PayrollDocLine."Action Starting Date":= period start date (Starting Date).PayrollDocLine."Action Ending Date":= advance date (Advance Date).
Function 21094911 --- BaseSalary (Salary by Base Amounts)
What it does: Calculates the salary amount from Payroll Element Ledger Entries filtered by the base amount code and action dates.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Base Amount Code | Calculation Line | Base amount code |
Result:
- Returns: Decimal --- salary amount from payroll element ledger entries
- Updates Payroll Document Line fields: ---
Calculation logic:
- Filters Payroll Element Ledger Entries by:
- Employee No. from the document line.
- Action dates: Action Starting Date
<=document Action Ending Date, Action Ending Date>=document Action Starting Date (or 0D).
- Retrieves base amount records by element code and base amount code.
- For each base amount record with a non-empty element code filter:
- Sets the element code filter on the entries.
- Sets the period filter: by Period Code or by Wage Period From.
- Sets the payment source filter (Payment Source): Employer or FSI.
- Sums the amounts (Amount) from all found entries.
- Returns the total amount.
Function 21094912 --- ServiceOnCurrentPosition (Service on Current Position)
What it does: Returns the number of years of service on the employee's current position.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line | Employee code |
| Action Ending Date | Payroll Document Line | Date for which service is calculated |
Result:
- Returns: Decimal --- service on current position (in years, decimal number)
- Updates Payroll Document Line fields: ---
Calculation logic:
- Calls
RecOfServiceMgt.CalcEmplTotServiceOnCurrentPosition(Employee No., Action Ending Date). - Returns the result --- the number of years of service on the employee's current position.
Function 21094913 --- FillAdvanceDatesbyAdvance (Limit Ending Date by Advance)
What it does: Limits the action ending date of the payroll document line to the advance date, if the advance date exists and is earlier than the current action ending date.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Wage Period From | Payroll Document Line | Wage period code |
Result:
- Returns: Decimal --- 1 if the advance date exists; 0 if the advance date is absent
- Updates Payroll Document Line fields: Action Ending Date (truncated to the advance date if necessary)
Calculation logic:
- Retrieves the wage period record by
Wage Period Fromcode. - If the advance date (
Advance Date) = 0D, returns 0. - If the advance date < current value of
PayrollDocLine."Action Ending Date":- Replaces
PayrollDocLine."Action Ending Date"with the advance date.
- Replaces
- Returns 1.
Function 21094914 --- CalcEmployeeOutOfStaff (Out-of-Staff Position Check)
What it does: Checks whether the employee's position is an out-of-staff position.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Employee No. | Payroll Document Line | Employee code |
Result:
- Returns: Integer --- 1 if the position is out-of-staff; 0 if it is in-staff
- Updates Payroll Document Line fields: ---
Calculation logic:
- Retrieves the employee card and checks for the presence of a position code (
Position No.). - Retrieves the Position record by the employee's position code.
- Checks the
"Out-of-Staff"field on the position:- If true --- returns 1.
- If false --- returns 0.
Function 21094915 --- BaseAmount Payroll for Person (Current Document Payroll Amount for Person)
DEPRECATED
What it does: Returns the payroll amount from the current payroll document for a person, calculated based on base amount filters.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Base Amount Code | Calculation Line | Base amount code |
Result:
- Returns: Decimal --- payroll amount
- Updates Payroll Document Line fields: ---
Calculation logic:
- Calls the general
BaseAmountfunction, which sums amounts from lines of the current payroll document filtered by base amount parameters. - Supports filtering by employee, by person, or by other employees.
- Supports different amount types: Payroll Amount, Taxable Amount, Corr. Amount, etc.
- Supports filtering by Period Code, Wage Period Code, Bonus Period, Action Dates, Fit Dates.
Function 21094916 --- BaseAmount Taxable for Person (Current Document Taxable Amount for Person)
DEPRECATED
What it does: Returns the taxable amount from the current payroll document for a person. Logic is identical to function 21094915.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Base Amount Code | Calculation Line | Base amount code |
Result:
- Returns: Decimal --- taxable amount
- Updates Payroll Document Line fields: ---
Calculation logic:
- Calls the same
BaseAmountfunction as function 21094915. - Amount type (Taxable Amount) is determined by the base amount settings.
Function 21094918 --- CalcPlannedWorkHours (Planned Working Hours)
What it does: Calculates the planned number of working hours for a period, taking into account employee position changes. Iterates through Employee Job Entries and sums working hours from each position's calendar.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| Employee No. | Payroll Document Line | Employee code |
| Action Starting Date | Payroll Document Line | Period start date |
| Action Ending Date | Payroll Document Line | Period end date |
Result:
- Returns: Decimal --- total number of planned working hours
- Updates Payroll Document Line fields: ---
Calculation logic:
- Selects Employee Job Entries for the employee where:
Position Changed = true(position was changed).Starting Date<=EndingDate (calculation end date).Ending Date>=StartingDate or 0D.
- For each entry, determines the date intersection:
StartDate= MAX(StartingDate, EmployeeJobEntry."Starting Date").EndDate= MIN(EndingDate, EmployeeJobEntry."Ending Date"), if Ending Date<>0D, otherwise EndDate = EndingDate.
- For each intersection, calculates working hours using
CalendarMgt.GetPeriodInfo(Calendar Code, StartDate, EndDate, 3), where parameter 3 = Planned Working Hours. - Sums the hours across all periods.
Function 21094919 --- IsLaborContractPrimaryJob (Primary Job)
What it does: Checks whether the employee's labor contract has the work mode set to "Primary Job".
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Employee No. | Payroll Document Line | Employee code |
Result:
- Returns: Integer --- 1 if the work mode is "Primary Job"; 0 --- otherwise
- Updates Payroll Document Line fields: ---
Calculation logic:
- Retrieves the employee card and reads the labor contract number (
Contract No.). - Retrieves the Labor Contract record.
- Checks the
"Work Mode"field:- If
"Work Mode" = "Primary Job", returns 1. - Otherwise, returns 0.
- If
Function 21094920 --- GetMarketValueOfCarLease (Market Value of Car Lease, Georgia)
What it does: Returns the market value of a car lease from the fixed asset card. Specific function for the Georgian localization.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollElementLedgerEntry | Payroll Element Ledger Entry | Current payroll element ledger entry (uses Vehicle Code) |
Result:
- Returns: Decimal --- market value of the car lease
- Updates Payroll Document Line fields: ---
Calculation logic:
- Searches for the Fixed Asset record by the Vehicle Code from the payroll element ledger entry.
- If found, returns the value of the
"Market value of car lease"field. - If the fixed asset is not found, returns 0.
Function 21094921 --- GetVehicleCapacityType (Vehicle Capacity Type, Georgia)
What it does: Returns the amount from the Payroll Directory for the vehicle capacity type. Specific function for the Georgian localization.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollElementLedgerEntry | Payroll Element Ledger Entry | Current payroll element ledger entry (uses Vehicle Code and Posting Date) |
Result:
- Returns: Decimal --- amount from the Payroll Directory for the corresponding capacity type
- Updates Payroll Document Line fields: ---
Calculation logic:
- Searches for the Fixed Asset record by the Vehicle Code.
- Retrieves the vehicle capacity type code (
Vehicle Capacity Type) from the fixed asset card. - Searches for a record in the Payroll Directory with the corresponding code, type "Vehicle Capacity Type", and a starting date
<=the posting date of the entry. - Returns the Amount from the last found directory record.
Function 21094922 --- GetMonthlySalary (Monthly Salary)
What it does: Returns the monthly salary from the employee's position card.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollElementLedgEntry | Payroll Element Ledger Entry | Current payroll element ledger entry (uses Position No.) |
Result:
- Returns: Decimal --- monthly salary from the position
- Updates Payroll Document Line fields: ---
Calculation logic:
- Verifies that the Payroll Elem. Ledger Entry No. exists (the check is performed at the function call stage).
- Searches for the Position record by the position code from the payroll element ledger entry.
- If the position is found, returns the value of the
"Monthly Salary"field. - If the position is not found, returns 0.
Function 21094923 --- BaseAmountFromLedgEntry (Base Amount from Ledger Entry)
What it does: Calculates the daily rate from Payroll Ledger Entries for the average earnings (AE) period. If no AE period is specified, uses the maximum daily sick leave payment.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Base Amount Code | Calculation Line | Base amount code (required, validated via TestField) |
Result:
- Returns: Decimal --- daily rate or maximum daily sick leave payment
- Updates Payroll Document Line fields: ---
Calculation logic:
- Checks the presence and value of the
"AE Period To"field on the document line. - If
AE Period Tois populated and does not match the Period Code:- Retrieves the Payroll Base Amount record.
- Filters Payroll Ledger Entries by employee, period = AE Period To, and base amount filters.
- Sums the corresponding amount type using
CalculateSumAmountType. - Retrieves the average number of days in a month (
SickLeaveSetup.GetAvgMonthDays). - Divides the amount by the average number of days.
- If
AE Period Tois not populated or matches the Period Code:- Returns the maximum daily sick leave payment:
SickLeaveSetup.GetMaxDailyPaymentByDocDate.
- Returns the maximum daily sick leave payment:
Function 21094924 --- CalcVacHours (Vacation Hours Balance)
What it does: Calculates the vacation balance in HOURS based on the employee's absence entries. Formula: (Accrued Days * 8) - Used Hours - Compensated Hours + Adjustment Hours.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollDocLine | Payroll Document Line | Current payroll document line |
| Time Activity Group | Calculation Line | Time activity group code for filtering vacation types |
| FutureUsedDays | Constant (false) | Flag for accounting of future used days |
Result:
- Returns: Decimal --- vacation balance in hours
- Updates Payroll Document Line fields: ---
Calculation logic:
- Determines the start date (StartDate) = end date of the current period + 1 day.
- Retrieves the Time Activity Filter by group code and date.
- Selects the employee's absence entries (Employee Absence Entry) with Entry Type = "Accrual", where:
- Employee No. = employee code.
- Start Date < StartDate.
- Time Activity Code matches the filter.
- For each accrual entry:
- Calculates the number of accrued vacation days using
VacationDaysCalculation.CalcVacDaysand multiplies by 8 (hours per day). - Finds related usage entries (Entry Type = Usage):
- Subtracts the Working Hours of each usage entry.
- If
FutureUsedDays = trueand the usage date>=StartDate, considers only entries with the corresponding period.
- Finds compensation entries (Entry Type = Compensation) and subtracts their Working Hours.
- Finds adjustment entries (Entry Type = Correction) and adds their Working Hours.
- Calculates the number of accrued vacation days using
- Returns the total balance in hours.
Report Functions: Statistics and Amounts (21094500–21094518)
Codeunit: SMA Payroll Report Calculation (70950609)
These functions are called through the Calculate procedure, which receives parameters from the payroll report setup lines (SMA Payroll Reports Setup Line) and determines the data source (DataSource).
Function 21094500 --- EmployeeBalance (Employee Balance)
What it does: Calculates the sum of positive remaining balances from Employee Ledger Entries for the specified period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Report parameters (posting group, payment source, currency, amount type) |
| PeriodFilter | Period Filter | Payroll periods filter |
| EmployeeFilter | Employee Filter | Employee codes filter |
Result:
- Returns: Decimal --- sum of positive remaining balances
- Updates Payroll Document Line fields: ---
Calculation logic:
- Retrieves the last period by filter to determine the ending date.
- Selects open (Open = true) Employee Ledger Entries with filters:
- Employee No. by EmployeeFilter (if specified).
- Employee Posting Group by the
"Add. Employee Posting Group"field (if specified). - Payment Source by report settings (if specified).
- Currency Code by report settings (if specified).
- Posting Date
<=ending date of the last period.
- For each entry, determines the remaining balance amount:
- If Amount Type = "Payroll Amount":
-Remaining Amt. (LCY). - If Amount Type = "Payroll Amount (OCY)":
-Remaining Amount.
- If Amount Type = "Payroll Amount":
- Adds only positive balances (
TempBalance > 0) to the result.
Function 21094501 --- CalcStaffWorkHours (Staff Work Hours)
What it does: Calculates the total number of hours from the timesheet for all employees matching the filters. Supports filtering by gender, staff status, and work mode.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Report parameters (gender, staff status, work mode, time activity group) |
| PeriodFilter | Period Filter | Payroll periods filter |
| ActualQty | Constant (false) | Consider only employees with non-zero hours |
| ActualQtyOnly | Constant (false) | Return employee count instead of hours |
Result:
- Returns: Decimal --- total number of timesheet working hours
- Updates Payroll Document Line fields: ---
Calculation logic:
- Determines start and end dates from the period filter.
- Builds the employee list with the following filters:
- Gender --- if specified.
- Staff status (Out-of-Staff = false) --- if
In Staffis enabled. - Work Mode Filter.
- For each employee:
- Retrieves hours from the timesheet:
TimesheetMgt.GetTimesheetInfo(Employee No., Time Activity Group Code, StartDate, EndDate, 3), where 3 = Hours. - Adds the hours to the total.
- Retrieves hours from the timesheet:
- Returns the total number of hours.
Function 21094503 --- VendorsWithSalaryDebts (Employees with Salary Debts)
What it does: Counts the number of employees who have a negative remaining balance (debt owed to the company).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Report parameters (posting group) |
| PeriodFilter | Period Filter | Payroll periods filter |
Result:
- Returns: Decimal --- number of employees with a negative balance
- Updates Payroll Document Line fields: ---
Calculation logic:
- Retrieves the last period by filter.
- Selects Employee Ledger Entries with a negative remaining balance:
Remaining Amt. (LCY) < 0. - Filters by Employee Posting Group, if specified.
- Filters by Posting Date
<=period ending date. - Sorts by Employee No. and iterates through unique employees:
- For each unique Employee No., increments the counter by 1.
- Returns the total number of employees with debts.
Function 21094504 --- BaseLedgerBalance (Ledger Balance)
What it does: Main report balance function --- aggregates amounts from the selected data source. Supports various sources: posted payroll ledger entries, payroll document lines, posted payroll documents, and person income entries. Supports Sum/Max/Min calculation methods.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Full set of filtering and aggregation parameters |
| PeriodFilter | Period Filter | Payroll periods filter |
| EmployeeFilter | Employee Filter | Employee codes filter |
| DataSource | Call parameter | Data source: Posted Entries / Payroll Documents / Posted Payroll Documents / Person Income Entry |
Result:
- Returns: Decimal --- aggregated amount according to settings
- Updates Payroll Document Line fields: ---
Calculation logic:
- Depending on the data source (DataSource), delegates the call to the corresponding internal procedure:
- Posted Entries:
BaseLedgerBalance--- works with Payroll Ledger Entry. - Payroll Documents:
BaseDocumentBalance--- works with Payroll Document Line. - Posted Payroll Documents:
BasePostedDocumentBalance--- works with Posted Payroll Document Line. - Person Income Entry:
BasePersonIncomeBalance--- works with Person Income Entry.
- Posted Entries:
- Sets filters based on report parameters:
- Period filter: by Period Code, Payment Period, or Wage Period (depending on "Calculation by").
- Employee filter: by Employee No.
- Element type filter: Element Type Filter.
- Element code filter: Element Code Filter.
- Element group filter: Element Group Filter.
- Staff status: Out-of-Staff = false (if In Staff is enabled).
- Payment source: Payment Source.
- Period type: Future Periods / Current Period.
- Work mode: Work Mode Filter.
- Organizational unit: Org. Unit Code.
- Time activity group: Time Activity Group Code.
- Directory code: Directory Code.
- Calculation group: Calc Group.
- Posting date: Posting Date.
- Currency: Currency Code.
- Type of charges: Type Code of Charges.
- Reversal: Reversed = false.
- Calculates the result using the chosen method (Calculation Method):
- Sum: sums amounts of the selected type. If "ABS By Line" is enabled, takes the absolute value of each line.
- Max: finds the maximum value of the selected type.
- Min: finds the minimum positive value of the selected type.
- Amount types: Payroll Amount, Taxable Amount, Corr. Amount, Payed Days, AE Daily Earnings, Add. Amount, Add. Amount 2, Tax Deductible, Payroll Amount (OCY), Rate.
- If ABS is enabled at the report level, returns the absolute value of the result.
Function 21094505 --- CalcActualCalDays (Actual Calendar Days)
What it does: Calculates the number of actual calendar days from the timesheet, reduced by the number of days for the specified time activity group (e.g., excluding vacation or sick leave days).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Report parameters (time activity group to exclude) |
| PeriodFilter | Period Filter | Payroll periods filter |
| EmployeeFilter | Employee Filter | Employee code |
Result:
- Returns: Decimal --- number of actual calendar days
- Updates Payroll Document Line fields: ---
Calculation logic:
- Determines start and end dates from the period filter.
- Calculates the total number of days from the timesheet:
TimesheetMgt.GetTimesheetInfo(EmployeeFilter, '', StartDate, EndDate, 2), where 2 = Calendar Days. - Subtracts the number of days for the specified time activity group:
TimesheetMgt.GetTimesheetInfo(EmployeeFilter, Time Activity Group Code, StartDate, EndDate, 2). - Returns the difference.
Function 21094506 --- BaseLedgerBalance with SST limit (Ledger Balance with SSC Limit)
What it does: Similar to function 21094504, but limits the result by the maximum SSC (Social Security Contribution) assessment base. Supports the same data sources.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Full set of filtering and aggregation parameters |
| PeriodFilter | Period Filter | Payroll periods filter |
| EmployeeFilter | Employee Filter | Employee codes filter |
| DataSource | Call parameter | Data source |
Result:
- Returns: Decimal --- aggregated amount limited by the SSC cap
- Updates Payroll Document Line fields: ---
Calculation logic:
- Performs the same calculation as function 21094504, but with the
SSTLimit = trueparameter. - After calculating the base amount, checks whether it exceeds the SSC limit:
- Retrieves the SSC limit using
PayrollDocumentCalculate.GetFSILimit(PeriodCode, "SSC Limit"). - If the calculated amount exceeds the limit, returns the limit instead of the calculated amount.
- Retrieves the SSC limit using
Function 21094507 --- PaymentsToEmployee (Payments to Employee)
What it does: Calculates the sum of payments to an employee for the period from Employee Ledger Entries with Document Type = "Payment".
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Report parameters (currency, amount type) |
| PeriodFilter | Period Filter | Payroll periods filter |
| EmployeeFilter | Employee Filter | Employee codes filter |
Result:
- Returns: Decimal --- total payment amount for the period
- Updates Payroll Document Line fields: ---
Calculation logic:
- Determines start and end dates from the period filter.
- Selects Employee Ledger Entries with filters:
- Employee No. by EmployeeFilter.
- Posting Date between the period start and end dates.
- Document Type = Payment.
- Currency Code --- if specified in settings.
- For each entry, sums the amount depending on the type:
- If Amount Type = "Payroll Amount": adds
Amount (LCY). - If Amount Type = "Payroll Amount (OCY)": adds
Amount.
- If Amount Type = "Payroll Amount": adds
Function 21094508 --- AverageHeadcount type 0 (Average Headcount)
What it does: Calculates the average headcount of employees using the Ukrainian methodology (standard method, Include = All).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PeriodFilter | Period Filter | Payroll periods filter |
| Include | Constant (0 --- All) | Include all employees |
Result:
- Returns: Decimal --- average headcount
- Updates Payroll Document Line fields: ---
Calculation logic:
- Delegates the call to
AverageHeadcountCalculation.CalcAvgCountUA(PeriodFilter, 0, '', Employee). - The CalcAvgCountUA function calculates the average headcount for each day of the period:
- Identifies all employees with labor contracts of type "Labor Contract" and work mode "Primary Job".
- Takes into account Employee Job Entries to determine actual working days.
- Calculates the average over the number of calendar days in the period.
- Supports filtering by organizational unit (Org. Unit Code) and AT classifier.
Function 21094509 --- AverageHeadcount type 1 (Average Headcount, Variant 1)
What it does: Calculates the average headcount of employees using an alternative method (Include = DisabledOnly --- employees with disabilities only).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PeriodFilter | Period Filter | Payroll periods filter |
| Include | Constant (1 --- DisabledOnly) | Include only employees with disabilities |
Result:
- Returns: Decimal --- average headcount of employees with disabilities
- Updates Payroll Document Line fields: ---
Calculation logic:
- Delegates the call to
AverageHeadcountCalculation.CalcAvgCountUA(PeriodFilter, 1, '', Employee). - Logic is similar to function 21094508, but additionally filters employees:
- Selects only those who have a record in the Person Medical Info table with type "Disability" and a non-zero disability group.
- Returns the average headcount only for employees with disabilities.
Function 21094510 --- HiredEmployees (Hired Employees)
What it does: Counts the number of employees hired during the reporting period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PeriodFilter | Period Filter | Payroll periods filter |
| Gender | Constant (" ") | Gender --- no filter (all) |
| In Staff | Report Setup Line | Consider only in-staff employees |
| NewlyCreated | Constant (false) | Do not filter by newly created positions |
Result:
- Returns: Decimal --- number of hired employees
- Updates Payroll Document Line fields: ---
Calculation logic:
- Delegates the call to
AverageHeadcountCalculation.HiredEmployeeQty. - Determines start and end dates from the period filter.
- Filters employees by hire date:
Employment Datewithin the period date range. - If
In Staffis enabled, filters:Out-of-Staff = false. - If an organizational unit filter is specified, filters by
Org. Unit Code. - Returns the number of found records (Employee.Count).
Function 21094511 --- HiredFemaleEmployees (Hired Female Employees)
What it does: Counts the number of female employees hired during the reporting period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PeriodFilter | Period Filter | Payroll periods filter |
| Gender | Constant (Female) | Gender --- Female |
| In Staff | Report Setup Line | Consider only in-staff employees |
| NewlyCreated | Constant (false) | Do not filter by newly created positions |
Result:
- Returns: Decimal --- number of hired female employees
- Updates Payroll Document Line fields: ---
Calculation logic:
- Delegates the call to
AverageHeadcountCalculation.HiredEmployeeQtywith parameter Gender = Female. - Logic is identical to function 21094510, but with an additional filter:
Gender = Female.
Function 21094512 --- TerminatedEmployees (Terminated Employees)
What it does: Counts the number of employees terminated during the reporting period. Supports filtering by termination reason.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PeriodFilter | Period Filter | Payroll periods filter |
| Period Type | Report Setup Line | Period type (may offset dates by -1 for "Current Period - 1" type) |
| Gender | Constant (" ") | Gender --- no filter (all) |
| In Staff | Report Setup Line | Consider only in-staff employees |
| Dismissal Reason Filter | Report Setup Line | Filter by termination reason |
Result:
- Returns: Decimal --- number of terminated employees
- Updates Payroll Document Line fields: ---
Calculation logic:
- Delegates the call to
AverageHeadcountCalculation.TerminatedEmployeeQty. - Determines start and end dates from the period filter.
- If period type = "Current Period - 1", offsets dates by -1 day.
- Filters employees by:
Termination Datewithin the date range.- Staff status (if In Staff is enabled).
- Termination reason (Grounds for Term. Code) by filter, if specified.
- Organizational unit (Org. Unit Code), if specified.
- Returns the number of found records.
Function 21094513 --- TerminatedFemaleEmployees (Terminated Female Employees)
What it does: Counts the number of female employees terminated during the reporting period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PeriodFilter | Period Filter | Payroll periods filter |
| Period Type | Report Setup Line | Period type |
| Gender | Constant (Female) | Gender --- Female |
| In Staff | Report Setup Line | Consider only in-staff employees |
| Dismissal Reason Filter | Report Setup Line | Filter by termination reason |
Result:
- Returns: Decimal --- number of terminated female employees
- Updates Payroll Document Line fields: ---
Calculation logic:
- Delegates the call to
AverageHeadcountCalculation.TerminatedEmployeeQtywith parameter Gender = Female. - Logic is identical to function 21094512, but with an additional filter:
Gender = Female.
Function 21094514 --- EmployeesInStaff (Employees in Staff at Period End)
What it does: Counts the number of active employees at the end of the reporting period. Supports an extended set of filters: gender, staff status, work mode, age ranges, contract type, working conditions, medical information, etc.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Full set of filtering parameters |
| PeriodFilter | Period Filter | Payroll periods filter |
| EmployeeFilter | Employee Filter | Employee codes filter |
Result:
- Returns: Integer --- number of employees in staff
- Updates Payroll Document Line fields: ---
Calculation logic:
- Determines the "end of period" date (
OnDate) and the check date (ToDate) from the last period in the filter. - For "Future Periods" period type: ToDate = OnDate + 1.
- Sets base filters on the Employee table:
Employment Date<=OnDate and<>0D.Termination Date>=ToDate or 0D.- Labor contract exists (Contract No.
<>''). Without Labor Contract = false.Labor Contract Type = "Labor Contract".Labor Work Mode = "Primary Job".- Contract type filter (
Contact Type Code Filter).
- Additional filters:
- Age: filter by date of birth according to
Range From. - Work time standard: filter by
Range To(maximum weekly hours). - Gender: Gender (if specified).
- Organizational unit: Org. Unit Code (if specified).
- Age: filter by date of birth according to
- For each employee, performs additional checks:
- Working conditions (Conditions of Work) --- from the job entry at the date.
- Other information (Other Information Code) --- from the additional information record.
- Time activity group --- from absence entries.
- Element code --- from payroll element ledger entries.
- Marks matching employees and returns their count.
Function 21094515 --- FemaleEmployeesInStaff (Female Employees in Staff)
What it does: Counts the number of female employees in staff at the end of the reporting period. Uses the same logic as function 21094514.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Full set of filtering parameters (includes Gender = Female) |
| PeriodFilter | Period Filter | Payroll periods filter |
| EmployeeFilter | Employee Filter | Employee codes filter |
Result:
- Returns: Integer --- number of female employees in staff
- Updates Payroll Document Line fields: ---
Calculation logic:
- Calls the same
CalcEmployeesInStaffprocedure as function 21094514. - Gender filtering (Gender = Female) is determined by the report line settings (
PayrollReportsSetupLines.Gender).
Function 21094516 --- HiredForNewPositions (Hired for New Positions)
What it does: Counts the number of employees hired for newly created work positions during the reporting period.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PeriodFilter | Period Filter | Payroll periods filter |
| Gender | Constant (" ") | Gender --- no filter |
| In Staff | Report Setup Line | Consider only in-staff employees |
| NewlyCreated | Constant (true) | Filter by newly created positions |
Result:
- Returns: Decimal --- number of employees hired for new positions
- Updates Payroll Document Line fields: ---
Calculation logic:
- Delegates the call to
AverageHeadcountCalculation.HiredEmployeeQtywith parameterNewlyCreated = true. - Logic is identical to function 21094510, but with an additional filter:
"NewlyCreated Work Position" = true. - This filter selects only those employees whose positions were created as new work positions.
Function 21094517 --- StaffWorkHours ActualOnly (Work Hours for Active Employees Only)
What it does: Calculates the total number of timesheet working hours, excluding employees with zero hours. Differs from function 21094501 in that it does not count employees with no actual time worked.
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Report parameters (gender, staff status, work mode, time activity group) |
| PeriodFilter | Period Filter | Payroll periods filter |
| ActualQty | Constant (true) | Consider only employees with non-zero hours |
| ActualQtyOnly | Constant (false) | Return hours (not employee count) |
Result:
- Returns: Decimal --- total number of working hours (only for employees with non-zero hours)
- Updates Payroll Document Line fields: ---
Calculation logic:
- Delegates the call to
CalcStaffWorkHourswith parametersActualQty = true, ActualQtyOnly = false. - Logic is identical to function 21094501, but when counting employees, considers only those who have non-zero timesheet hours.
- Returns the sum of hours (not employee count, since
ActualQtyOnly = false).
Function 21094518 --- ActualEmployeeCount (Active Employee Count)
What it does: Counts the number of employees who actually have worked hours in the timesheet (non-zero hours).
Parameters:
| Parameter | Source | Description |
|---|---|---|
| PayrollReportsSetupLines | Report Setup Line | Report parameters (gender, staff status, work mode, time activity group) |
| PeriodFilter | Period Filter | Payroll periods filter |
| ActualQty | Constant (true) | Consider only employees with non-zero hours |
| ActualQtyOnly | Constant (true) | Return employee count (instead of hours) |
Result:
- Returns: Decimal --- number of employees with actual worked hours
- Updates Payroll Document Line fields: ---
Calculation logic:
- Delegates the call to
CalcStaffWorkHourswith parametersActualQty = true, ActualQtyOnly = true. - Iterates through all employees according to filters (gender, staff status, work mode).
- For each employee, checks the number of timesheet hours.
- If the number of hours > 0, increments the employee counter by 1.
- Returns the number of employees (due to
ActualQtyOnly = true), not the sum of hours.