Payroll Formula System

The payroll formula engine lets you calculate pay elements using arithmetic expressions and payroll variables.

Where Formulas Can Be Set

  1. Employee Salary override in Manage Employees - highest priority.
  2. Formula Override in Manage Salary Structure - middle priority.
  3. Default Formula in Manage Pay Elements - fallback priority.

Supported Variables

  • BASIC - base salary for the period.
  • GROSS - current cumulative earnings.
  • DAYS_WORKED - actual worked days from attendance.
  • WORKING_DAYS - calendar working days after weekends and holidays.
  • DAYS_IN_MONTH - compatibility alias for WORKING_DAYS.
  • OVERTIME_HOURS - approved overtime hours.
  • UNPAID_LEAVE_DAYS - unpaid absence days.
  • HOURLY_RATE - BASIC divided by working-days-and-hours logic.

Supported Operators

  • Addition: +
  • Subtraction: -
  • Multiplication: *
  • Division: /
  • Modulo: %
  • Parentheses: ( )

Example Formulas

  • BASIC * 0.10 - ten percent of basic salary.
  • HOURLY_RATE * OVERTIME_HOURS * 1.5 - overtime pay.
  • (BASIC / WORKING_DAYS) * UNPAID_LEAVE_DAYS - absence deduction.
  • GROSS * 0.05 - five percent of the current gross total.

Important Notes

  • GROSS is recalculated as earnings are processed, so Display Order matters.
  • Invalid expressions silently return zero in the current implementation.
  • Test new formulas with Payslip Entry before running a full payroll period.