Skip to main content
Pal PatelFreelance Remote Developer
All Case Studies
Mining & QuarryingERP / Business Management Platform 6 months

Quarry Accounting & ERP System

End-to-end ERP for quarry and mining operations — replacing manual ledgers with real-time financial control.

Quarry Accounting & ERP System

Technology Stack

Laravel 11Filament 3MySQLGoogle Cloud Vision (OCR)PWACamera IntegrationPDF GenerationRole-based Access Control

Overview

Quarry operations in India run on a mix of handwritten ledgers, WhatsApp messages, and spreadsheets. Contractor payments depend on weight slips that can be forged or miscounted. Machinery costs are tracked verbally. There's no audit trail.

This client operates 3 quarry sites across Gujarat, managing 40+ contractors (thekdars), 15 pieces of heavy machinery, and processing 200+ weight slips per day. Before this system, month-end billing took a week of manual reconciliation and disputes were common.

I built a complete ERP system that digitises every operation — from weight slip capture via mobile camera + OCR to automated contractor payment calculation, multi-company accounting, and real-time production reports.

The Problem

The client faced several compounding operational problems:

Manual weight slip fraud: Weight slips were hand-written at the quarry gate and manually entered into Excel. Discrepancies between what was recorded at the gate and what reached the billing team were common.

Contractor payment disputes: Calculating contractor (thekedar) payments involved matching weight slips to specific contractors, applying variable rates by material type, and deducting advances. This was done manually and took 3–4 days each month.

No machinery cost tracking: Fuel, maintenance, and operational costs for 15 machines were scattered across multiple notebooks. There was no way to calculate per-machine profitability.

Multi-site complexity: With 3 quarry sites operating simultaneously, there was no consolidated view of production or financials. Each site maintained independent records.

Credit (havala) management: The business ran significant credit lines with contractors and material buyers. Tracking outstanding credit was entirely manual.

The Solution

I designed a system around three core principles: data capture must be frictionless at the quarry gate, calculations must be fully automated, and management visibility must be real-time.

OCR Weight Slip Processing:

Field staff use the mobile PWA to photograph weight slips at the gate. Google Cloud Vision extracts the weight, material type, contractor name, and vehicle number. The extracted data is reviewed on-screen and confirmed with a single tap. This eliminates manual re-entry entirely.

Automated Contractor Billing:

The system calculates contractor payments automatically at month-end — summing weight-based production, applying material rates, deducting advances, and generating a payment slip that both parties sign digitally.

Multi-Company Chart of Accounts:

Each quarry site operates as a separate company in the system, with a consolidated view available to the owner. Journal entries, credit notes, and inter-company transactions are all tracked.

Credit & Havala Ledger:

Every credit transaction is recorded against a party. Outstanding balances are visible in real-time. Alerts trigger when credit limits are approached.

Machinery Cost Tracking:

Each machine has a dedicated cost ledger. Fuel fill-ups, maintenance, and repairs are logged against the machine. Monthly cost-per-machine reports feed into profitability analysis.

Architecture

Backend:

Laravel 11 with a structured service-layer architecture. Business logic lives in dedicated service classes — no fat controllers. Each operation (weight slip creation, contractor calculation, machinery cost entry) has its own service with full unit test coverage.

Admin Panel:

Filament 3 for the entire management interface. Custom Filament pages for OCR review, contractor billing review, and production dashboards. Filament's resource system handled 90% of the CRUD requirements, letting me focus on business logic.

Database:

MySQL with a multi-tenancy pattern per company. Foreign key constraints enforce referential integrity throughout. Soft deletes on all financial records for audit trail preservation.

OCR Pipeline:

Google Cloud Vision API processes weight slip images. A confidence threshold determines whether auto-extraction is accepted or flagged for manual review. The pipeline handles rotation correction and image enhancement before sending to the API.

PWA:

Service workers cache the core UI for offline-capable access at quarry sites with poor connectivity. Weight slip data queues locally and syncs when connection is available.

Key Implementation Details

  • Built multi-company chart of accounts with inter-company transaction support
  • Integrated Google Cloud Vision OCR for weight slip digitisation with confidence scoring
  • Designed contractor (thekedar) billing engine with variable material rates and advance deductions
  • Implemented credit/havala ledger with party-wise outstanding tracking and limit alerts
  • Built machinery cost tracking with per-machine P&L reporting
  • Created PWA with service workers for offline queue on mobile devices
  • Implemented role-based permissions: Owner, Site Manager, Gate Operator, Accountant
  • Built PDF generation for weight slips, payment vouchers, and monthly statements
  • Created production analytics dashboard with site-wise and consolidated views

Screenshots

Quarry Accounting & ERP System screenshot 2
Quarry Accounting & ERP System screenshot 3
Quarry Accounting & ERP System screenshot 4
Quarry Accounting & ERP System screenshot 5

Business Impact

  • Month-end contractor billing reduced from 4 days to 4 hours
  • Weight slip disputes dropped to near-zero due to OCR-verified records
  • Management gained real-time visibility across all 3 quarry sites for the first time
  • Per-machine profitability reporting enabled data-driven machinery retirement decisions
  • Credit outstanding tracking eliminated three instances of uncollected receivables within first month

Key Engineering Challenge

The biggest technical challenge was OCR reliability at a quarry site. Weight slips are handwritten on pre-printed forms, sometimes dirty, folded, or photographed in direct sunlight. I tested 40+ real slips before settling on a preprocessing pipeline that corrects gamma, deskews, and sharpens before sending to the Cloud Vision API. The confidence threshold required tuning — too strict and too many slips required manual review; too loose and errors slipped through. I landed at 85% confidence for auto-acceptance with a review queue for lower-confidence extractions. The multi-company accounting model also required careful design. Transactions between sites needed to be atomic — a debit on one site's ledger had to create a matching credit on another, or roll back entirely. Laravel's database transactions handled this cleanly once the service layer was designed correctly.