A purchase invoice register for Nepali businesses, with Bikram Sambat dates, company-configurable VAT calculations, fiscal-year reporting, and CSV/Excel import. Built as a TypeScript full-stack application with Next.js and PostgreSQL.
Context
The problem
Nepali businesses need purchase records tied to parties, VAT, and local fiscal years. Invoice dates use Bikram Sambat (BS), so fiscal-year reporting must follow the local calendar rather than assume Gregorian dates.
Solution
How TeachMate works
VAT Expense Ledger provides a company-scoped purchase register with single-entry and batch-ledger workflows, spreadsheet import, reports, and exports.
Capabilities
What it includes
Record purchase invoices in a single form or keyboard-driven ledger grid
Import CSV and Excel files with a preview, row suggestions, and duplicate warnings
Calculate VAT using a company-configurable rate (13% default)
Resolve fiscal years from each invoice’s Miti date
Review fiscal-year, monthly, and party reports; export CSV or XLSX
Manage parties, categories, locations, trucks, and truck documents
System design
Architecture
Next.js App Router combines server-rendered dashboards and reports with API routes and server actions for data workflows.
Drizzle ORM models company-scoped records in PostgreSQL; Neon is used for serverless production connections.
Domain helpers handle Bikram Sambat date validation, fiscal-year resolution, fixed-point money, VAT calculation, and import-row validation.
Trade-offs
Engineering decisions
Parse and validate Miti dates explicitly, then derive the fiscal year using the Nepali fiscal-year start month (Shrawan).
Use a preview-and-confirm import flow so party/category suggestions and duplicate warnings can be reviewed before invoices are committed.
Scope ledger and master-data records by company to support multiple businesses in one installation.