Skip to content

botirov206/Fintrack-Invoice-Generator

Repository files navigation

FinTrack Co. Invoice Generator

A professional, easy-to-use invoice generator that creates invoices in PDF, Excel, or HTML formats with a friendly menu system.

🎯 What This App Does

✅ Create professional invoices in PDF, Excel, or HTML
✅ Automatic tax calculation (10% VAT)
✅ Organized file storage with timestamps
✅ Consistent professional design across all formats
✅ Easy menu system - even non-technical users can use it
✅ Extensible - add new formats easily


⚡ Quick Start (2 minutes)

1. Install Dependencies

pip install -r requirements.txt

2. Run the App

python main.py

3. Choose an Option from the Menu

  • [1] Create a new invoice
  • [2] View previous invoices
  • [3] Open the invoices folder
  • [4] Exit

Your invoices are automatically saved in the invoices/ folder!


📋 How to Create an Invoice

  1. Select [1] Create New Invoice
  2. Enter the client name (e.g., "Acme Corp")
  3. Enter how many line items the invoice has
  4. For each item, enter:
    • Item name (e.g., "Website Design")
    • Item price (e.g., "2500")
  5. Preview the invoice (tax is calculated automatically)
  6. Choose formats: PDF, Excel, HTML (or multiple!)
  7. Done! Files are saved in a new session folder

📁 How Files Are Organized

invoices/
├── session_20251112_110530_2a4a80/    (timestamp-based folder)
│   ├── invoice_Ali_20251112_110530.pdf
│   ├── invoice_Ali_20251112_110530.xlsx
│   ├── invoice_Ali_20251112_110530.html
│   └── invoice_summary.txt
│
├── session_20251112_112306_6c8c81/
│   └── (more invoices...)

Each invoice gets its own session folder containing:

  • PDF - Print-ready professional format
  • Excel - Spreadsheet with formatted cells
  • HTML - Modern web-ready format
  • Text summary - Quick reference file

🎨 Professional Design

All invoices use the same professional branding:

  • Dark Blue headers for titles
  • Bright Blue accents for highlights
  • Clean tables with alternating row colors
  • Automatic tax calculation (10% VAT)
  • Professional currency formatting
  • Mobile-friendly (HTML)

🔧 Adding New Formats (For Developers)

Want to add JSON, XML, or another format? Easy! 3 steps:

Step 1: Create the Generator

Create invoice_generator/json_generator.py:

import json
from .base import InvoiceGenerator

class JSONInvoiceGenerator(InvoiceGenerator):
    def generate_invoice(self, filepath: str) -> str:
        filepath = self._ensure_invoices_dir(filepath)
        total = self.calculate_total()
        tax_total = self.calculate_total_with_tax(total)
        
        data = {
            "client": self.client_name,
            "items": self.items,
            "subtotal": total,
            "tax": tax_total - total,
            "total": tax_total,
        }
        
        with open(filepath, 'w') as f:
            json.dump(data, f, indent=2)
        return filepath

Step 2: Register in the Factory

In invoice_generator/factory.py, add to the _formats dictionary:

from .json_generator import JSONInvoiceGenerator

_formats = {
    "pdf": PDFInvoiceGenerator,
    "excel": ExcelInvoiceGenerator,
    "html": HTMLInvoiceGenerator,
    "json": JSONInvoiceGenerator,  # ← Add this
}

Step 3: Done!

Your new format is now available in the menu! That's it.


📁 Project Structure

fintrack-invoice-generator/
├── main.py                      # Interactive menu app
├── invoice_generator/           # Where invoices are created
│   ├── base.py                 # Base class for all generators
│   ├── pdf_generator.py        # PDF format
│   ├── excel_generator.py      # Excel format
│   ├── html_generator.py       # HTML format
│   └── factory.py              # Creates generators
├── manager/                     # Handles file saving
│   └── invoice_manager.py
├── invoices/                    # Output folder (auto-created)
├── requirements.txt             # Python packages needed
└── README.md                    # This file

📦 What You Need

  • Python 3.8 or higher
  • reportlab (for PDF)
  • openpyxl (for Excel)

Install with:

pip install -r requirements.txt

❓ FAQ

Q: Can I create multiple formats at once?
A: Yes! Enter pdf, excel, html when asked to choose formats.

Q: Where are my invoices saved?
A: In the invoices/ folder, organized by creation date.

Q: Can I change the colors/branding?
A: Yes! Edit the color values in the generator files (search for #2c3e50).

Q: How is tax calculated?
A: Automatically at 10%. Example: $100 + $10 tax = $110 total.

Q: Does it work on Mac/Linux?
A: Yes! It works on Windows, Mac, and Linux.

Q: Can I add my own invoice format?
A: Yes! See the "Adding New Formats" section above.


💡 For Programmers

This project demonstrates:

  • Object-Oriented Programming (OOP)
  • Abstract Base Classes (ABC)
  • Factory Design Pattern
  • Polymorphism
  • Code reusability with Mixins

The design makes it trivial to add new formats without modifying existing code!


📝 License

Educational purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published