A modern billing system built with Django, Tailwind CSS, and HTMX. The system features a responsive design with light/dark theme support and real-time updates.
The system is live at: http://midknightdev.pythonanywhere.com/
- Username: admin
- Password: 123
You can customize the business name throughout the application by setting the BUSINESS_NAME
environment variable in your .env
file:
# Add to your .env file
BUSINESS_NAME="Your Business Name"
This will automatically update the business name across:
- Admin interface
- Navigation bar
- Page titles
- Printed bills
- All other relevant places in the application
If BUSINESS_NAME
is not set, it defaults to "Billing System".
- ποΈ Product management
- Add, edit products through admin panel
- Set default rates for products
- Product search with Select2
- Enhanced barcode scanning for quick product selection:
- Scan barcodes from create/edit bill page
- NEW: Quick product lookup from dashboard
- NEW: Product details modal for scanned items
- π Sales dashboard with period-wise summaries
- 7 days sales summary
- Monthly sales summary
- 3 months sales summary
- Filter bills by date, salesperson, and search terms
- π§Ύ Bill management
- Create new bills
- Add multiple items with custom rates
- Flexible discount options:
- Pre-defined discounts (40%, 50%)
- Custom percentage discount
- Per-item discount application
- Print bills in a clean format
- Edit existing bills
- Delete bills (with proper permissions)
- π₯ Multi-user support
- Admin/Owner access to all bills
- Salesperson can create and manage their own bills
- Role-based permissions
- π Light/Dark theme support
- π± Responsive design
- β‘ Real-time updates using HTMX
- π User authentication and authorization
- π· Enhanced barcode scanning capabilities:
- Product selection during bill creation
- NEW: Product information lookup from dashboard
- Mobile-friendly camera interface
- Support for multiple barcode formats
-
Backend: Django 4.2
-
Frontend:
- Tailwind CSS 3.4
- DaisyUI 4.12
- HTMX 1.18
- Web Barcode Detector API
-
Database: SQLite (default Django DB)
- Python 3.x
- Node.js and npm
- Git
- Modern browser that supports BarcodeDetector API
- Clone the repository
git clone https://github.com/jethliya-balaji/Billing-System.git
cd Billing-System
- Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install Python dependencies
pip install -r requirements.txt
- Install Node.js dependencies
npm install
- Create .env file in the root directory
# Create .env file
touch .env # On Windows: type nul > .env
# Add the following configuration to .env
SECRET_KEY=django-insecure-your-secret-key-here
DEBUG=TRUE
ALLOWED_HOSTS=localhost 127.0.0.1
BUSINESS_NAME="Your Business Name" # Optional: defaults to "Billing System"
Note: You can generate a secure secret key using Python:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
- Run database migrations
python manage.py migrate
- Create a superuser
python manage.py createsuperuser
- Start the Django development server
python manage.py runserver
- Watch for Tailwind CSS changes
npm run dev
Billing-System/
βββ src/
β βββ billing/ # Main Django app
β β βββ management/
β β β βββ commands/
β β β βββ delete_empty_bills.py
β β βββ migrations/
β β β βββ __init__.py
β β β βββ 0001_initial.py
β β βββ __init__.py
β β βββ admin.py # Admin interface configuration
β β βββ apps.py # App configuration
β β βββ filters.py # Bill filtering logic
β β βββ forms.py # Form definitions
β β βββ models.py # Database models
β β βββ tests.py # Test cases
β β βββ urls.py # URL routing
β β βββ views.py # View logic
β βββ core/ # Project settings
β β βββ __init__.py
β β βββ settings.py # Django settings
β β βββ urls.py # Main URL configuration
β β βββ wsgi.py # WSGI configuration
β βββ static/
β β βββ css/
β β β βββ tailwind-output.css # Compiled Tailwind CSS
β β βββ js/
β β β βββ script.js # General JavaScript
β β β βββ barcode-scanner.js # Barcode scanning functionality
β β β βββ create_edit_bill_page.js # Bill page specific logic
β β βββ htmx.min.js # HTMX library
β β βββ src/
β β βββ tailwind-input.css # Tailwind source
β βββ templates/
β βββ 403.html # Permission denied page
β βββ 404.html # Not found page
β βββ billing/
β βββ partials/
β β βββ create_edit_bill_item.html
β β βββ dashboard_bill.html
β β βββ messages.html
β β βββ navbar.html
β βββ base.html # Base template
β βββ create_edit_bill.html
β βββ dashboard.html
β βββ login.html
β βββ print_bill.html
β βββ view_bill.html
βββ .gitignore
βββ manage.py # Django management script
βββ package.json # Node.js dependencies
βββ requirements.txt # Python dependencies
βββ tailwind.config.js # Tailwind configuration
The project uses DaisyUI themes with two default options:
- Corporate (Light theme)
- Business (Dark theme)
Theme preferences are automatically saved to localStorage and persists across sessions.
- Add and edit products through Django admin interface
- Set default rates for products
- Products appear in Select2 dropdown during bill creation
- Enhanced barcode scanning using device camera for quick selection and lookup
- Auto-barcode generation for new products
- Inventory tracking with stock management
- Uses Web BarcodeDetector API for real-time barcode scanning
- Compatible with various barcode formats including Code 128, EAN-13, UPC-A, and QR codes
- Two scanning modes:
- Product selection during bill creation
- NEW: Product information lookup from dashboard
- Camera access with mobile-friendly interface
- Optimized video resolution settings for better scanning performance
- Improved callback pattern for flexible implementation
- Create new bills with customer details
- Add multiple items with option for custom rates
- Flexible discount options:
- Pre-defined discounts (40%, 50%)
- Custom percentage discount
- Per-item discount application
- Print bills in a clean, professional format
- Edit existing bills (own bills for salesperson, all bills for admin)
- Delete bills with proper permissions
- Automatic bill number generation with date prefix
- View comprehensive sales summaries
- NEW: Quick product lookup via barcode scanner
- NEW: Product details modal for displaying scanned product information
- Filter bills by:
- Date
- Salesperson (admin only)
- Search terms (customer name, bill number)
- Quick access to recent bills
- Pagination with "Load More" functionality
- Different views for admin and salesperson
- Admin/Owner can:
- View all bills
- Filter by salesperson
- Access admin panel
- Manage products
- Salesperson can:
- Create new bills
- View their own bills
- Edit their own bills
- Print bills
- Improved JavaScript organization:
- Core UI functionality in script.js
- Billing page logic in dedicated create_edit_bill_page.js
- Barcode scanning functionality in barcode-scanner.js
- Reduced dependencies with optimized script loading
- Better template structure with proper script blocks
The barcode scanning feature requires a browser that supports the BarcodeDetector API
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
MIT License
- DaisyUI for the UI components
- HTMX for dynamic interactions
- Tailwind CSS for styling
- Select2 for enhanced select inputs
- Django for the web framework
- Web BarcodeDetector API for barcode scanning capabilities
If you encounter any issues or have questions, please open an issue.