← All packages

@lacspace/invoice

v1.0.0Commerce & Ledger0 deps

Invoice model, numbering and tax-rollup engine — per-line and total calculation, tax grouped by rate, sequential invoice numbers, payment tracking and a render-ready row structure for PDF/XLSX. Integer minor units, zero-dependency, isomorphic.

npm i @lacspace/invoice

Usage

invoice.ts
import { createInvoice, recordPayment, invoiceNumber } from "@lacspace/invoice";

let inv = createInvoice({
  number: invoiceNumber(123),         // "INV-2026-000123"
  currency: "NPR",
  seller: { name: "Lacspace", taxId: "PAN123" },
  buyer:  { name: "Sita Rai" },
  lines: [{ description: "Dhaka Topi", qty: 2, unitPrice: 120000, taxRate: 0.13 }],
});
// inv.taxSummary groups tax by rate; inv.totals.balanceDue in integer paisa
inv = recordPayment(inv, 271200);     // status -> "paid", balanceDue -> 0

Exports 8

createInvoicerecordPaymentmarkVoidmarkIssuedisOverdueinvoiceNumberrenderRowsInvoiceError

Keywords

invoiceinvoicingbillingtaxaccountingecommerce

More in Commerce & Ledger