Overview
The payroll calculation process in NominaSoft is handled by thefun_act_nomina() function, which calculates employee compensation including earnings (devengados), deductions (deducidos), and the final net payment for a specific period.
Core Calculation Function
The payroll calculation is executed using:Parameters
- year (
ano_nomina): The year for which to calculate payroll (e.g., 2025) - month (
mes_nomina): The month number (1-12) - period (
per_nomina): Payment period indicator1= First period (quincenal/biweekly)2= Second period
The year, month, and period must match the values configured in
tab_pmtros (parameters table), otherwise the function will raise error 22008.Payment Period Logic
The system supports two payment frequencies configured intab_pmtros.ind_perio_pago:
Q(Quincenal): Biweekly payment - employees are paid twice per monthM(Mensual): Monthly payment - employees are paid once per month
Days Calculation
Earnings (Devengados)
Earnings are concepts whereind_operacion = TRUE. The system calculates two mandatory earnings:
1. Basic Salary (Salario Básico)
Identified bytab_pmtros.id_concep_sb, the basic salary is prorated based on the payment period:
2. Transportation Subsidy (Auxilio de Transporte)
Identified bytab_pmtros.id_concep_at, this subsidy is only paid to employees whose basic salary is at or below a threshold:
Optional Earnings (Non-Mandatory)
Optional earnings haveind_legal = FALSE and can include:
- Bonuses (
val_fijo): Fixed amount bonuses (e.g., 100,000 for special achievements) - Overtime (
val_porcent): Percentage-based calculations- Daytime overtime: 25% of hourly rate
- Nighttime overtime: 75% of hourly rate
- Holiday daytime: 100% of hourly rate
- Holiday nighttime: 150% of hourly rate
Deductions (Deducidos)
Deductions are concepts whereind_operacion = FALSE. The system calculates mandatory deductions:
Percentage-Based Deductions
Mandatory Deductions
EPS (Health Insurance) - 4%
EPS (Health Insurance) - 4%
Concept ID: 3
Type: Percentage-based deduction
Rate: 4% of basic salary
Period: Monthly (
Type: Percentage-based deduction
Rate: 4% of basic salary
Period: Monthly (
ind_perio_pago = 'M')Example for employee earning $8,000,000/month:- Monthly deduction: $320,000
- Biweekly deduction: $160,000 (if system configured as quincenal)
AFP (Pension Fund) - 4%
AFP (Pension Fund) - 4%
Concept ID: 4
Type: Percentage-based deduction
Rate: 4% of basic salary
Period: Monthly (
Type: Percentage-based deduction
Rate: 4% of basic salary
Period: Monthly (
ind_perio_pago = 'M')Example for employee earning $8,000,000/month:- Monthly deduction: $320,000
- Biweekly deduction: $160,000 (if system configured as quincenal)
Fixed-Value Deductions
Calculation Process Flow
Load parameters
Retrieve company parameters from
tab_pmtros including SMLV, transportation subsidy, and payment period configurationValidate inputs
Verify that year, month, and period match the configured parameters. Raises
22008 error if mismatch.Clear previous calculations
Delete existing payroll records for the specified period to ensure clean recalculation:
Calculate mandatory earnings
For each employee:
- Calculate basic salary (prorated for period)
- Determine transportation subsidy eligibility
- Add to total earnings (
wsum_devengado)
Calculate mandatory deductions
For each employee:
- Calculate EPS (4% health insurance)
- Calculate AFP (4% pension)
- Add to total deductions (
wsum_deducido)
Result Structure
Each payroll calculation creates multiple records intab_nomina, one for each concept applied to each employee:
| Field | Description |
|---|---|
ano_nomina | Payroll year |
mes_nomina | Payroll month (1-12) |
per_nomina | Period within month (1 or 2) |
id_emplea | Employee identifier |
id_concepto | Concept identifier (salary, transport, EPS, etc.) |
val_dias_trab | Number of days worked in period |
val_nomina | Calculated amount for this concept |
Example Calculation
For an employee with basic salary of $5,000,000/month in a biweekly system: Earnings (Devengados):- Basic Salary (15 days): 2,500,000**
- Transportation Subsidy: 100,000** (if eligible)
- Total Earnings: $2,600,000
- EPS (4%): (100,000**
- AFP (4%): (100,000**
- Total Deductions: $200,000
Error Handling
The calculation function includes comprehensive error handling:Next Steps
Configure Concepts
Learn how to create and configure payroll concepts
Manage Employees
Understand employee lifecycle and payroll integration