IVA
Chile's IVA is 19%. Amounts are whole pesos and rounding is half up (half away from zero for credit notes), computed in exact integer arithmetic so 1.050 × 19% is always 200, never 199. On invoices, IVA is computed once on the net total, not per line.
import { grossFromNet, invoiceTotals, ivaFromNet, splitGross } from "chile-kit/iva";
ivaFromNet(10000); // 1900
grossFromNet(10000); // 11900
splitGross(9990); // { net: 8395, iva: 1595, gross: 9990 } net + iva === gross
invoiceTotals([
{ unitPrice: 1050, quantity: 2 },
{ unitPrice: 5000, exempt: true },
]);
// { lines: [2100, 5000], net: 2100, exempt: 5000, iva: 399, total: 7499 }
Every function takes an optional rate (a fraction, default IVA_RATE = 0.19). roundClp rounds any amount to whole pesos.