Skip to Content
Saldo is currently in alpha - report bugs here
Dependent WorkerGetting Started

Getting Started

Dependent worker payroll calculations. For self-employed, see independent worker docs.

Installation

npm install saldo # or pnpm add saldo

Quick Start (CLI)

You can run calculations directly from the terminal if you install the package globally:

saldo dependent --year 2025 --income 1500 --twelfths 2

Quick Start (Library)

Interactive Example

Understanding the Result

interface DependentWorkerResult { yearly: { totalGrossIncomeAmount: number; // Annual gross income totalNetIncomeAmount: number; // Annual net income totalLunchAllowanceGrossAmount: number; // Annual lunch allowance }; socialSecurityContributionRate: number; // SS rate applied monthlyBreakdown: MonthlyBreakdownResult[]; // 12 entries, one per month } interface MonthlyBreakdownResult { month: MonthName; // e.g. "january" period: PeriodT; // e.g. "2025-01-01_2025-07-31" grossIncome: { baseSalaryAmount: number; baseSalaryAndLunchAllowanceAmount: number; totalWithLunchAllowanceAndSubsidyTwelfthsAmount: number; }; irsWithholdingTax: { totalAmount: number; fromBaseSalaryAmount: number; fromLunchAllowanceAmount: number; fromSubsidyTwelfthsAmount: number; }; socialSecurityContribution: { totalAmount: number; fromBaseSalaryAmount: number; fromLunchAllowanceAmount: number; fromSubsidyTwelfthsAmount: number; }; netIncome: { totalAmount: number; // Monthly net salary (the main figure) fromBaseSalaryAmount: number; fromLunchAllowanceAmount: number; fromSubsidyTwelfthsAmount: number; }; lunchAllowance: LunchAllowanceAmountBreakdown; subsidyTwelfths: SubsidyTwelfthsAmountBreakdown; bracket: BracketResult; taxRetentionTable: TaxRetentionTableResult; }

Key Parameters

  • year: Tax year — required (e.g. 2025)
  • income: Monthly gross income in euros
  • married / numberOfHolders: Required together for married workers (1 or 2)
  • disabled, partnerDisabled, numberOfDependents, numberOfDependentsDisabled
  • location: 'continent' | 'azores' | 'madeira' (default 'continent')
  • socialSecurityContributionRate: Default 0.11
  • twelfths: Twelfths.NONE | ONE_HALF_MONTH | ONE_MONTH | TWO_MONTHS (default TWO_MONTHS)
  • lunchAllowanceDailyValue, lunchAllowanceMode ("cupon" or "salary"), lunchAllowanceDaysCount
  • includeLunchAllowanceInJune: Whether June gets lunch allowance (default false)
  • oneHalfMonthTwelfthsLumpSumMonth: "june" or "december" (default "december")
  • isencaoHorarioMonthly: Monthly “isenção de horário” supplement (Art. 218.º–219.º + 265.º CT). Default 0
  • benefitsOfYouthIrs + yearOfYouthIrs: IRS Jovem partial monthly retention exemption (Art. 2.º-C CIRS). See the IRS Jovem section in the API reference

Common Scenarios

Single Person

Interactive Example

Married with Children

Interactive Example

Disabled Worker

Interactive Example

With Lunch Allowance

Interactive Example

Using Twelfths Enum

Interactive Example

Working with Types

import { simulateDependentWorker, LocationT, Twelfths, DependentWorkerResult, SimulateDependentWorkerOptions } from 'saldo'; // Type-safe dependent worker calculation const dependentOpts: SimulateDependentWorkerOptions = { year: 2025, income: 1500, location: 'continent', }; const dependentResult: DependentWorkerResult = simulateDependentWorker(dependentOpts);

Regional Differences

Each Portuguese region has different tax rates:

Interactive Example

Error Handling

The library provides clear error messages for invalid configurations:

Interactive Example

Next Steps

Last updated on