Problem
Filling-station work relies on connected records: a sale affects fuel or product stock, cash totals, customer credit, and end-of-day reporting. Duplicating those figures across manual logs creates reconciliation work and makes mismatches harder to trace.
Solution & approach
The system records an operation once and updates its related records in a database transaction. Staff can record meter readings and tank dips, sell fuel and products, track customer credit and payments, manage expenses, reconcile cash, and finalize a daily close. Reports then use the same operational data for sales, stock, customer balances, and profit.
Technology stack
Next.js App Router · TypeScript · React · PostgreSQL · Prisma ORM · Tailwind CSS · Zod · Decimal.js · Jest · Next.js API Routes and Server Actions
Key features
- Fuel sales from pump meter readings and tank dips
- Mixed fuel and non-fuel product sales
- Fuel and product inventory with stock reconciliation and variance tracking
- Weighted-average fuel costing and historical prices
- Customer credit ledger and payment tracking
- Operating expenses integrated with cash records
- Expected-versus-actual cash reconciliation
- Daily closing workflow with finalized-day protection
- Revenue, cost-of-goods, and expense-based profit calculations
- Print-ready operational and financial reports
- English, Urdu, Sindhi, and right-to-left interface support
- Database backup and restore workflows
Screenshots and demonstration
Challenges and decisions
Sales and stock operations must keep their related records in sync, including when requests overlap or a day is being finalized. The implementation places finalized-day checks inside transactions and uses database transactions for dependent record changes. Decimal arithmetic and historical prices help preserve financial accuracy when rates change.
Results and limitations
Delivered a connected web application for station sales, inventory, customer accounts, expenses, cash management, daily closing, and reporting. Project delivery notes dated October 17, 2026 record clean TypeScript compilation and 22 passing tests across finalized-day protection and tank-reconciliation workflows.
Lessons learned
A single source of truth reduces repeated data entry, but only when every dependent update succeeds or rolls back together. Closing a business day also needs transaction-level protection so concurrent operations cannot slip into a finalized period.