Back to All Projects
Bin Khalid Dairy Farm V1
Client WorkCompleted

Bin Khalid Dairy Farm V1

From manual monthly billing to automated dairy invoices.

PythonFlaskSQLiteBootstraphtml2canvasGunicorn

Problem Statement

The farm handled customer milk billing manually every month. Repeated calculations, paper records, and manual reconciliation of totals and dues made the process slow and left room for arithmetic errors, and monthly reporting took longer than it should have.

Proposed Solution

A Flask web app stores voucher data in SQLite and gives the admin a dashboard for customers and monthly summaries. It calculates total milk, bill amounts, and outstanding dues automatically, and generates printable bilingual bills that can be saved as images and shared straight from a phone.

Key Features

  • Admin-only login with session protection for the dashboard.
  • Dashboard with monthly totals, customer list, search, and recent activity.
  • Add, edit, and delete milk vouchers with a live calculation preview before saving.
  • Customer history view showing previous vouchers and totals per customer.
  • Printable, mobile-optimized bill page with bilingual English and Urdu details and payment information.
  • Save-as-image export for sharing bills on WhatsApp.

System Architecture Flow

Browser (Flask templates: dashboard, history, bill, login) -> Flask routes and billing logic (app.py) -> SQLite database -> Bill rendering and image export (bill.html with html2canvas)

Engineering Challenges

  • Manual billing math was error-prone, so the calculation logic is centralized in one place and a live preview shows the result before a voucher is saved.
  • Customers needed bills that look professional and are easy to send, so the bill page is mobile-optimized, bilingual, and can be saved as an image.
  • Financial records had to stay private, so critical routes are protected with login-required checks and session-based authentication.

Lessons Learned

  • Turning real operational steps into reliable calculations and data validation.
  • A simple Flask and SQLite stack can support a genuinely useful business system when the workflow is well structured.
  • Invoice formatting and reporting matter as much as the billing logic for adoption.

Results

Built in 2025 as the first version of the farm's system, and later rebuilt as the advanced V2 (Next.js, TypeScript, PostgreSQL) in 2026.