Payments, warehouse, and site operations automation for Afra Holding
A bilingual internal system for tracking seven-step payments, warehouse operations, and daily site work, with separate roles and access per unit and a full history of every action.
Industry: A holding supplying construction and industrial ironware, with operational and site-based projects · Client: Afra Holding
The problem
Payments, goods requests, and daily work across several projects passed through several units: site engineer, accounting, commercial, finance managers, payment, and warehouse. Each file needed a defined path, a named owner, and a traceable history.
Existing workflow
The project documentation does not describe the previous workflow in detail. The scope was defined in an agreed statement of work, and the system was built to record, follow, and report the financial, warehouse, and operational events of the projects.
Requirements analysis
A seven-step flow from pro-forma invoice to financial documents with the ability to return to the previous step, referral to an owner, an inbox, and a notification at each step; warehouse operations covering goods requests, issue notes, receipts, stock, and minimum-stock alerts; roles and access per unit; a Persian and English interface with Jalali and Gregorian dates; reports with Excel export; and a history of every change.
Architecture
A single Next.js application with a server layer separate from the interface: separate modules for payments, requests, warehouse, reports, and site supervision, shared services for unique codes, activity history, notifications, and SMS, and a SQLite database with Drizzle ORM and versioned migrations. Every action passes through a shared layer that checks session, permission, and input validity on the server.
Implemented solution
Seven payment steps: record the pro-forma invoice, accounting review, commercial review, accounting manager approval, finance manager approval, make the payment, and complete documents. A default owner for the steps is set per project and a file can return to the previous step. Warehouse operations cover a goods request, supervisor approval, a storekeeper issue note, receiver confirmation, a receipt, adjustment with a reason, and an alert when stock is below the minimum. A site-supervisor page shows daily activity and assignment to staff. Reports have filters and Excel export.
Departments involved
- Site engineer
- Site supervisor
- Accounting
- Commercial
- Accounting manager
- Finance manager
- Payment officer
- Warehouse
- System administrator
Technologies
- Next.js 16 (App Router)
- React 19
- TypeScript
- Tailwind CSS 4
- SQLite with better-sqlite3 and Drizzle ORM
- Radix UI
- next-intl
- Zod
- ExcelJS
- PDFKit
Integrations
- Excel export for reports
- PDF export
- SMS gateway (Kavenegar): prepared, and real sending is enabled once the panel is connected
Security considerations
- Passwords are stored with Argon2id and never appear in an SMS or a log.
- Session, permission, and input validity of each action are checked on the server.
- Every change records, in the same transaction, a history entry with actor, role, action, entity, and time.
- Database and attachment backup through a separate command, keeping a set number of copies.
Implementation phases
- Phase 1: user login, bilingual interface, roles and access, users, projects, role-based dashboard, activity history, in-app notifications, and an SMS log
- Phase 2: the seven-step payment flow, step locking, referral to an owner, an inbox, and a notification at each step
- Phase 3: warehouse operations, a complete dashboard per role, reports, and Excel export
- Phase 4: a live site-supervisor page, SMS connection preparation, and a user guide
Verifiable results
- All four phases of the agreed scope are implemented.Evidence: The implementation status table in the project documentation
- The database is defined with 27 tables and five versioned migrations.Evidence: The database schema file and the migrations folder
- 44 automated tests are written for domain logic, the database, payments, requests, and the warehouse.Evidence: The project's tests folder
This study claims no measured figure for time saved, cost reduced, or productivity gained, because no such measurement was recorded. Production usage reports are also not in the project documentation.
