JSPM

@emisso/payroll-cl

0.4.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17
  • Score
    100M100P100Q91249F
  • License MIT

Chilean payroll calculation engine — AFP, health, tax, unemployment, Previred, and more

Package Exports

  • @emisso/payroll-cl
  • @emisso/payroll-cl/providers
  • @emisso/payroll-cl/providers/node

Readme

@emisso/payroll-cl

Chilean payroll calculation engine — AFP, health, tax, unemployment, Previred, and more.

Install

npm install @emisso/payroll-cl

Usage

import {
  calculateEmployeePayroll,
  DEFAULT_REFERENCE_DATA,
} from '@emisso/payroll-cl';

const result = calculateEmployeePayroll(
  {
    employeeId: '1',
    rut: '12345678-9',
    firstName: 'Juan',
    lastName: 'Perez',
    baseSalary: 1_000_000,
    gratificationType: 'legal',
    colacion: 50_000,
    movilizacion: 30_000,
    afpCode: 'capital',
    afpFund: 'c',
    healthPlan: 'fonasa',
    familyAllowanceLoads: 2,
    earnings: [],
    deductions: [],
  },
  DEFAULT_REFERENCE_DATA,
);

console.log(result.netPay); // Net pay in CLP
console.log(result.employerCosts.total); // Total employer costs

Providers (optional)

Fetch live reference data from official Chilean sources:

import { Effect } from 'effect';
import { fetchCurrentIndicators } from '@emisso/payroll-cl/providers';

const program = Effect.gen(function* () {
  const indicators = yield* fetchCurrentIndicators();
  console.log(`UF: ${indicators.uf}, UTM: ${indicators.utm}`);
});

Effect.runPromise(program);

Providers require effect as a peer dependency.

License

MIT