Docs

Kiralytics documentation

How to set up, use, and get the most out of Kiralytics.

Invoices Step by step

Invoices

Numbering, line items, taxes — how Kiralytics handles the part of your business clients actually see.

How to read this guide

Follow the numbered steps in order. If you only need one answer, you can also jump straight to the section heading that matches what you are trying to do.

Quick flow

An invoice in Kiralytics is more than a number. It's the smallest durable artefact that ties together: a client, a project, a list of work, a price, a tax treatment, a payment link.

This section covers how to make those things work for you.

The numbering scheme

Every invoice is numbered KLT-YYYYMM-NNNN:

  • KLT — fixed brand prefix
  • YYYYMM — year and month the invoice was allocated (not necessarily issued)
  • NNNN — four-digit counter per (owner, period), starting at 0001 each month

The counter is allocated atomically inside Postgres, so two near-simultaneous inserts cannot collide. The implementation lives in src/lib/server/invoice-number.ts.

When invoices are allocated vs. issued

You can:

  • Save a draft — gets a number, but doesn't appear on the share link or in PDFs
  • Issue — visible to clients via the public link
  • Re-save a draft — keeps the same number
  • Re-issue — same number, refreshed PDF

The first time you save, the number is allocated. There's no "ghost numbering" — drafts count toward your monthly counter. This avoids the surprise of editing a draft, then realizing you burned two numbers that you can't recover.

What's next

  • Line items and totals — discount rules, per-line tax, multi-currency.
  • Payment receipts — what happens after a client pays, and how to share proof of payment cleanly.
  • LHDN tax handling — service tax (SR), exempt (ES), out-of-scope (OS), and what each means at invoice time.