Skip to content
Rana Sohail
All projects

Web App · 2026 · Zaman Traders

Zaman Traders ERP

In progress

Import costing, workshop, sales, and full accounts for a treadmill importer

Zaman Traders ERP — cover

Problem

A family business importing used treadmills from the USA ran on paper registers and Excel: nobody knew the true landed cost or profit of a machine or a container, post-dated cheques were tracked by memory, and the books were kept separately from the trading.

Solution

One web app covering the whole trade — containers bought in dollars and costed down to each machine, the factory workshop, invoicing with WhatsApp PDFs, post-dated cheques, payroll, partners, and full double-entry books where every document posts its own balanced journal entry.

Outcome

  • The landed cost and profit of every machine and every container comes straight from the system
  • Who owes what — including uncleared post-dated cheques — is visible at any moment to the people allowed to see it
  • Trial balance, P&L, and balance sheet come from the same postings as daily work, with no separate bookkeeping

Background

Zaman Traders is a family business dealing in exercise machines, mostly treadmills. They buy used machines at auctions and gym liquidations in the USA, ship them to Pakistan in containers, repair them in their own factory, and sell them from a showroom for cash and on credit. They also buy new machines and parts locally.

The trade ran on paper registers and Excel. The question that matters most in this business — what did this machine actually cost us, and what did we make on it? — had no reliable answer, because a container's price is in dollars, its freight and duty arrive weeks apart, and the costs were never split down to individual machines.

What I built

From container to machine

A container holds one or more purchase lots, each bought in USD at its own exchange rate. Freight, insurance, customs duty, clearing, port charges, and transport are added as they're paid. The system splits the full landed cost across the container's machines by CBM, so every machine carries its own cost. Until the owners close the container, any new expense recosts the machines — and sales already made show their profit as provisional.

The factory floor

Each machine gets a tag like CZT-2026-07-004 and a status: received, in repair, ready, sold, or returned. The workshop board shows the supervisor what's waiting, what's on the bench, and what's ready for the showroom. Parts issued to a repair are tracked against stock.

Selling, and getting paid

Invoices cover machines, parts, and services, with an optional GST tax invoice that requires the customer's NTN. Every invoice has a PDF and a Share-on-WhatsApp button, because that's how customers actually receive them. If a salesman prices a machine below cost, the invoice waits for an owner's approval and can't take a payment until it gets one.

Post-dated cheques are normal in this trade, so they're first-class: a cheque reduces the customer's balance immediately and sits in Cheques in hand, then moves through deposit to cleared or bounced. A bounce puts the amount — plus any bank charges — back on the customer and flags them.

Books that keep themselves

Users never write journal entries for routine work. Every document — a lot payment, a container expense, an invoice, a receipt, a payroll run — goes through one posting service that validates it, saves it, and writes a balanced journal entry linked back to it, all in one database transaction. A deferred database trigger rejects any entry where debits don't equal credits.

Nothing is deleted. A posted document can only be cancelled with a reason, which posts a reversing entry. Owners can lock a month, and every create, edit, and cancel is written to an audit log with before-and-after values. The trial balance, P&L, and balance sheet are read straight from those postings.

People and partners

Payroll for 10–30 factory workers is produced from daily attendance, paid monthly or weekly, with advances and loans tracked. Each partner has capital and drawings accounts and a profit share. Roles are enforced on the server: salesmen and the supervisor use the app on their phones without ever seeing cost or profit.

The screenshots on this page use made-up sample data — the business's real figures stay private.

Stack notes

Next.js (App Router) with TypeScript, server actions, and Drizzle ORM on Neon Postgres. Money is stored as fixed-point numerics and calculated with decimal.js, never floating point. Sessions are built in-house: a random token in an httpOnly cookie, only its SHA-256 hash stored, with idle and absolute timeouts. PDFs come from @react-pdf/renderer and Excel import/export from exceljs. Development and the 547 tests run on PGlite — real Postgres inside Node — with the production migrations, and Vercel runs a nightly backup to private blob storage.

Screenshots

Zaman Traders ERP — screenshot
Zaman Traders ERP — screenshot
Zaman Traders ERP — screenshot
Zaman Traders ERP — screenshot
Zaman Traders ERP — screenshot

Running a similar operation?

I build systems like this end to end — from the data model to the day-to-day screens your staff actually use.

Get in touch