A professional, easy-to-use invoice generator that creates invoices in PDF, Excel, or HTML formats with a friendly menu system.
✅ 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
pip install -r requirements.txtpython main.py- [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!
- Select [1] Create New Invoice
- Enter the client name (e.g., "Acme Corp")
- Enter how many line items the invoice has
- For each item, enter:
- Item name (e.g., "Website Design")
- Item price (e.g., "2500")
- Preview the invoice (tax is calculated automatically)
- Choose formats: PDF, Excel, HTML (or multiple!)
- Done! Files are saved in a new session folder
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
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)
Want to add JSON, XML, or another format? Easy! 3 steps:
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 filepathIn 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
}Your new format is now available in the menu! That's it.
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
- Python 3.8 or higher
- reportlab (for PDF)
- openpyxl (for Excel)
Install with:
pip install -r requirements.txtQ: 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.
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!
Educational purposes.