1. Overview
The Payroll module calculates and manages monthly employee pay. It combines:
| Layer | What it covers |
|---|---|
| Configuration | Calculation parameters, formula variables, employee groups, dynamic rules, advance types |
| Employee money | Active salaries, advances and installments, additional deductions, monthly change records |
| Period output | Payslips (generate, review, recalculate, execute/lock) and report APIs |
Payroll does not replace HR master data. Employees, org structure, and career events live in HR. Attendance punches live in Attendance. Payroll consumes an active salary and configured rules to produce a payslip for a date range.
2. Getting started
2.1 Recommended setup order
- Calculation parameters — reusable numeric/formula knobs
- Formula variables — named bridges used inside formulas and built-in tax/advance totals
- Employee groups — optional targeting lists
- Dynamic rules — compensations, grants, deductions
- Advance types — categories for advances
- Salaries — one active salary per employee before any payslip
- Operational data: advances, additional deductions, monthly changes
- Generate payslips → review → Execute to lock
Payslips are generated per employee for a period (no dedicated batch API; the UI may loop employees).
2.2 Main navigation
| Menu | Path | Purpose |
|---|---|---|
| Salaries | /payroll/salaries |
Base fixed salary records |
| Payslips | /payroll/payslips |
Period payslips |
| Payslip detail | /payroll/payslip-detail/:id |
Full review/edit of one payslip |
| Advance types | /payroll/advance-types |
Advance categories |
| Advances | /payroll/advances |
Employee advances |
| Installments | /payroll/installments |
Monthly advance repayments |
| Monthly changes | /payroll/monthly-changes |
Period change records |
| Additional deductions | /payroll/additional-deductions |
Loans and other recurring deductions |
| Dynamic rules | /payroll/dynamic-rules |
Pay additions and deductions rules |
| Employee groups | /payroll/employee-groups |
Grouping for rules/targeting |
| Formula variables | /payroll/formula-variables |
Named formula inputs |
| Calculation parameters | /payroll/calculation-parameters |
Named calculation knobs |
3. Calculation parameters
Reusable named values that formulas and rules can reference.
| Field | Meaning |
|---|---|
| Parameter name | Key used by the system |
| Calculation type | Fixed, Formula, or Employee-based |
| Fixed value / formula / employee field | How the value is obtained |
| Default value | Fallback (often 0) |
| Active | Included when resolving values |
Dynamic rules can reference parameters via parameter references. At runtime the engine resolves the current value for the employee/period context.
4. Formula variables
Named variables that connect payroll screens and SQL-backed calculations.
| Field | Examples / notes |
|---|---|
| Variable name / code | Display name and code such as FIXED_SALARY |
| Category | Employee, Salary, Compensation, Deduction, Attendance, Other |
| Calculation type | Direct, Function, or Formula |
| Data source / field / function / formula | Binding to data |
| Default / active | Fallback and on/off |
Common built-in uses during payslip calculation include tax-related variables and totals such as:
- Grant / bracket / income tax variables
- Total advance installments for the month
- Total additional deductions for the month
You can evaluate a variable or a formula from the admin APIs/UI when configuring rules.
5. Employee groups
Groups collect employees for organization and (intended) rule targeting.
5.1 Group
| Field | Notes |
|---|---|
| Code / names | Unique group code; Arabic/English names |
| Group type | Department, Category, Activity, Custom, All |
| Description / active | Metadata |
5.2 Members
Manual membership: employee, active flag, optional expiry, notes. Bulk add can attach many employees and skip duplicates.
5.3 Criteria
Criteria rows describe filters (department, location, specialization, status, custom) with operators such as =, IN, LIKE, comparisons, and null checks.
Practical note: Membership used in day-to-day pay is the manual member list. Criteria are maintained as configuration metadata. For payslip calculation, dynamic rules that apply reliably today are those targeted to All or Individual employees; group-targeted rules may not be applied by the calculation engine until group expansion is fully wired.
6. Dynamic rules
Dynamic rules add compensations, grants, or deductions to a payslip when they match an employee and effective dates.
6.1 Rule types
| Type | Role in calculation |
|---|---|
| Compensation | Added when calculating compensations |
| Grant | Added when calculating grants |
| Deduction | Applied in the deductions phase |
| Addition | Stored in configuration; not processed by the current calc engine |
6.2 How the amount is calculated
| Calc type | Behavior |
|---|---|
| Fixed | Uses the rule amount |
| Percentage | Percentage of a calculation source |
| Formula | Evaluates a formula using parameters/variables |
Calculation sources include Gross, Net, Fixed, Other, Compensation, Grant. Percentage resolution currently anchors to fixed salary for several of these sources.
6.3 Targeting and schedule
| Field | Meaning |
|---|---|
| Apply to | Individual (+ employee), Group (+ group), or All |
| Priority | Lower values applied first |
| Effective from / to | Validity window |
| Months limit / permanent | Duration controls |
| Monthly or daily mode | Calculation mode flags |
| Active / suspended | On/off and temporary stop |
| Show in payslip | Visibility on the slip |
Suspend / Resume actions temporarily stop a rule without deleting it.
6.4 When rules run in a payslip
Each applied rule can be recorded as a rule application for audit on that payslip month.
7. Salaries
Every payslip requires an active salary for the employee.
| Field | Meaning |
|---|---|
| Employee | Who the salary belongs to |
| Fixed salary | Base monthly fixed amount |
| Previous salary | Optional prior amount |
| Insurance wage | Optional insurance base |
| Effective date | When this record starts |
| Active | Exactly one active salary per employee |
Rules
- Creating or activating a salary deactivates the previous active one.
- Payslip generation fails if no active salary exists.
- History is available via salary history APIs/UI.
There is no direct job-grade link inside Payroll; grade changes in HR do not automatically rewrite salary — maintain salary records explicitly (or via your operational process).
8. Advance types, advances, and installments
8.1 Advance types
Simple named categories (for example housing, salary advance). Manage under Advance Types.
8.2 Advances
| Field | Meaning |
|---|---|
| Employee | Recipient |
| Advance type / name | Category and label |
| Total amount | Full advance |
| Installment amount | Monthly repayment amount |
| Remaining amount | Still to be repaid |
| Decision number/date | Optional admin decision |
| Deducted | If true, installments can be taken on payslips |
| Suspended | Temporarily excluded |
| Status | Pending, Approved, Rejected, or empty |
Create paths:
| Who | Typical status |
|---|---|
| Payroll staff with Create | Advance created for any employee (status often empty / treated as operational) |
| Employee without Create | Self-request for own person → Pending |
Suspend / Resume control whether the advance participates in installment generation. You cannot delete an advance that already has paid installments (unpaid installments may be cleared first per rules).
8.3 Installments
Installments are the monthly repayment rows linked to an advance.
| Field | Meaning |
|---|---|
| Advance / employee | Parent advance |
| Amount | Deduction for the month |
| For month / year | Period |
| Paid | Whether marked paid |
| Paid date / calculation date | Tracking |
Auto-creation happens when generating/calculating a payslip month (or via calculate-installments-for-month), if:
- Advance is deducted, not suspended, remaining amount greater than 0
- No installment yet for that advance/employee/month/year
- Installment amount is positive and remaining covers it
Then remaining amount is recalculated from total minus all installment amounts.
In the payslip: unpaid installments for the period feed total advance installments into total deductions. Mark as paid excludes them from future unpaid totals.
9. Additional deductions
Recurring deductions such as loans or other withholdings.
| Field | Meaning |
|---|---|
| Deduction type | Loan, Advance, or Other |
| Name / totals | Total, monthly, paid, remaining amounts |
| Months | Total and remaining months |
| Start / end dates | Validity |
| Apply to | Individual, Group, or All |
| Active / suspended | Participation flags |
| Decision / notes | Admin metadata |
Month flow
You cannot delete a deduction that already has paid amount greater than zero. Suspend / Resume stop or resume monthly pickup.
10. Monthly changes
Monthly changes record period adjustments for an employee (reason text, from/to dates, decision fields).
| State | Meaning |
|---|---|
| Not executed | Editable |
| Executed | Locked with executed date |
Execute locks the record. In the current product, monthly changes are primarily documentary / reportable; they do not automatically rewrite salary or payslip totals. Use them for controlled period notes and reporting, and adjust salaries or dynamic rules when amounts must change.
11. Payslips
11.1 Lifecycle
There is no separate Draft status enum. Practically:
| State | Flag |
|---|---|
| Open for edit / recalculate | IsExecuted = false |
| Locked | IsExecuted = true (+ executed date) |
| Action | Behavior |
|---|---|
| Create / Generate | Builds payslip for employee + period; requires active salary; unique employee+period and payslip number |
| Recalculate | Only if not executed; rebuilds from current salary/rules/installments |
| Execute | Locks the payslip |
| Delete | Blocked when executed |
| Unlock | Updating executed flag back to false when permitted |
11.2 Calculation outline
- Validate employee, period uniqueness, payslip number, active salary.
- Ensure advance installments and additional deduction payments for the month.
- Work days from the calendar span of From–To; daily rate typically fixed salary / 30.
- Apply compensation and grant rules → refresh gross.
- Calculate taxes via formula variables; round income tax as configured.
- Apply deduction rules.
- Add advance installment and additional deduction totals.
- Compute total deductions, salary before tax, net, and rounded net.
11.3 Payslip content
Header totals typically include: payslip number, period, assigned/actual work days, daily salary, gross, compensations, grants, deductions, tax fields, net, decision metadata, executed flag.
Payslip detail screen loads the slip plus related salary/advances/installments for review and save-all editing when not locked.
12. Reports and related HR data
Payroll exposes report APIs for complete payslip details, compensations/grants, dynamic deductions, additional deductions, monthly changes, and rewards/penalties sourced from HR data via reporting queries.
HR module reports (monthly payslips, payslip full details) also surface payroll outputs for HR users with the matching HR report permissions.
There is no dedicated Payroll dashboard menu; use Payslips and report consumers for operational oversight.
13. Employee portal
Under the HR employee portal, employees can open:
| Screen | Ability |
|---|---|
| Advances | View own / request advance when permitted |
| Additional deductions | View own deductions |
Portal access is gated by HR portal policies plus Payroll advance permissions such as Request and ViewOwn.
14. Permissions summary
Permission group: Payroll.
| Resource | Permissions |
|---|---|
| Salaries | Default, Create, Update, Delete |
| Advance types | Default, Create, Update, Delete |
| Advances | Default, Create, Update, Delete, Request, ViewOwn |
| Payslips | Default, Create, Update, Delete |
| Monthly changes | Default, Create, Update, Delete |
| Additional deductions | Default, Create, Update, Delete |
| Dynamic rules | Default, Create, Update, Delete |
| Employee groups | Default, Create, Update, Delete |
| Installments | Default, Create, Update, Delete |
| Formula variables | Default, Create, Update, Delete |
| Calculation parameters | Default, Create, Update, Delete |
| Employee lookup | Payroll.EmployeeLookup for employee pickers without full HR rights |
Grant Create/Execute-path payslip rights only to payroll operators; grant Request/ViewOwn to employee roles for portal self-service.
15. Integration with HR and Attendance
| Module | Relationship |
|---|---|
| HR | Employees (and persons) are the subjects of salaries, advances, and payslips. Career events are not auto-applied into salary amounts; rewards/penalties appear in reporting. Employee groups used by circulars/other features may overlap conceptually. |
| Attendance | Not fully wired into payslip day counts today. Work days currently follow the payslip date span and a fixed /30 daily rate pattern. Plan operationally until attendance-driven days are enabled. |
| HR portal | Embeds Advances and Additional Deductions screens. |
Appendix A — Quick procedures
A.1 Prepare payroll for a new employee
- Ensure the person/employee exists in HR.
- Create an active salary.
- Attach any individual dynamic rules if needed.
- Optionally register advances or additional deductions.
- Generate the first payslip for the period.
A.2 Close a payroll month for one employee
- Confirm salary, rules, advances, and deductions are up to date.
- Generate or open the payslip.
- Review totals on Payslip detail; Recalculate if configuration changed.
- Execute to lock.
- Use reports for distribution/audit.
A.3 Run an advance through payroll
- Create advance type if needed.
- Create advance with total and installment amount; keep Deducted on.
- Generate payslip for the month → installment auto-created if eligible.
- After collection, Mark installment paid when appropriate.
A.4 Configure a new allowance
- Optionally add calculation parameters / formula variables.
- Create a Dynamic rule of type Compensation or Grant.
- Target All or Individual, set priority and effective dates.
- Generate a test payslip and verify rule applications.
- Execute production payslips when verified.
Appendix B — Operating notes
| Topic | Guidance |
|---|---|
| Group-targeted rules | Prefer All/Individual for reliable calc until group membership is applied in the engine |
| Rule type Addition | Config only; use Compensation/Grant/Deduction for amounts |
| Monthly changes | Documentary/locking record; change salary or rules to affect amounts |
| Advance Pending | Self-requests start Pending; staff process per your internal approval practice |
| Attendance days | Calendar-based until attendance integration is completed |
Appendix C — Document control
| Item | Value |
|---|---|
| Title | Payroll Module User Guide |
| Source of truth | modules/payroll and frontend/src/app/modules/payroll |
| Format | Markdown + Mermaid (PDF edition embeds rendered figures) |
| Screenshots | Not included (by design) |
This guide describes functional capabilities of the Payroll module as implemented in the Vertex ERP codebase. UI labels may appear in English or Arabic depending on language settings.