Skip to content
Sami Bentaleb Independent software engineerContact

Ledgerdock n., 3PL billing

Month-end billing for small warehouses, without the spreadsheet.

Ledgerdock prices every pick, pack, pallet-week and shipment against each brand’s rate card, then issues numbered, taxed invoices.

My part
Design and build
Built with
Go, Postgres, htmx
For
Small 3PL warehouses

The problem

what month end looks like

A small warehouse stores and ships for a handful of online brands, each on its own rate card. At month end someone exports the activity, prices it line by line in a spreadsheet and types up the invoices.

Plate to comeA brand’s rate card.

Plate I. The rate card, once its screen ships.

Constraints

what it has to work within

One warehouse never sees another’s data. An issued invoice never changes, so a mistake is put right with a credit note. Money has to be exact to the cent, and tax differs from country to country.

Plate to comeAn issued invoice and its credit note.

Plate II. The invoice, once its screen ships.

What I built

the decisions, in order

  1. Each warehouse walled off

    The database itself keeps workspaces apart. Row-level security is forced on every table that holds a warehouse’s data, so a query that forgets its filter returns nothing rather than another warehouse’s rows.

  2. A ledger that only grows

    Charges are added and never edited. A wrong charge is reversed by an exact negative entry and charged again, so every invoice adds up from its lines.

    See Plate III.

  3. Money in whole cents

    Amounts are stored as whole numbers of the smallest unit and rounded once, half away from zero, so totals never drift by a cent.

  4. Invoice numbers with no gaps

    Each warehouse has one locked counter a year, and a number is taken only when an invoice is issued. Credit notes run in their own series.

    See Plate III.

NO.BILLABLE EVENTAMOUNT0041Pick and pack, 3 units4.500042Storage, 1 pallet-week12.000043Reversal of 0042−12.000044Storage, re-rated9.00appended onlyInvoice 0007 · Brand A13.50 + taxNumbered when it’s issued, with no gaps.NO.BILLABLE EVENTAMOUNT0041Pick and pack, 3 units4.500042Storage, 1 pallet-week12.000043Reversal of 0042−12.000044Storage, re-rated9.00appended onlyInvoice 0007 · Brand A13.50 + taxNumbered when it’s issued,with no gaps.
Plate III. A diagram of how Ledgerdock records a charge and corrects it. The figures are made up.
SigBase n., the next entry