Bottle Shop End of Trade Web Application
by Diadems666
A web-based application designed for Australian bottle shops to streamline end-of-trade processes, cash handling, and financial reconciliation. It provides an intuitive interface for managing daily takings and ensuring accurate financial reporting.
Last updated: N/A
Bottle Shop End of Trade Web Application
A web-based application for Australian bottle shops to manage end-of-trade processes, cash handling, and financial reconciliation.
Overview
This application streamlines the daily reconciliation of sales, cash handling, and financial reporting for bottle shops. It features an intuitive calendar interface, robust support for all denominations of Australian currency, dedicated modules for managing safe and till floats, and comprehensive end-of-trade reconciliation.
Features
- Calendar Interface: Navigate and select specific dates for financial management
- Australian Currency Support: Handle all coin denominations (5c, 10c, 20c, 50c, $1, $2) and banknote denominations ($5, $10, $20, $50, $100)
- Safe Float Management: Track and maintain the $1,500 safe float with automatic excess/deficit calculation
- Till Float Management: Track, reconcile and calculate optimal denomination breakdown for the $500 till float
- Daily Trade Variables: Record and track till readings, EFTPOS transactions, card payments, account charges, cash amounts, and customer counts
- End-of-Trade Reconciliation: Automatically calculate variance between recorded sales and payment methods
- Settlement Process: Mark daily takings as settled once reconciliation is complete
- Knowledge Graph Integration: Comprehensive graph representation of application components and relationships
- Rule Engine: Business rules enforcement and documentation
Technology Stack
- Backend: Python 3.13, Flask 2.3.3 framework
- Frontend: HTML5, CSS3, JavaScript (with Bootstrap 5)
- Database: SQLite with SQLAlchemy 2.0.36
- Forms: Flask-WTF 1.2.1 with WTForms 3.0.1
- Authentication: Flask-Login 0.6.2
- Database Migrations: Flask-Migrate 4.0.4
- Environment Variables: python-dotenv 1.0.0
- Knowledge Graph: MCP Knowledge Graph server
Known Compatibility Issues
There are currently compatibility issues between SQLAlchemy 2.0.x and Python 3.13. The error appears related to type annotations in the SQLAlchemy codebase:
AssertionError: Class <class 'sqlalchemy.sql.elements.SQLCoreOperations'> directly inherits TypingOnly but has additional attributes {'__firstlineno__', '__static_attributes__'}.
Potential solutions include:
- Downgrading to Python 3.11 or 3.12
- Waiting for SQLAlchemy to release a version compatible with Python 3.13
- Manually patching the SQLAlchemy code
Installation
- Clone the repository
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- Windows:
venv\Scripts\activate
- macOS/Linux:
source venv/bin/activate
- Windows:
- Install the required packages:
pip install -r requirements.txt
- Initialize the database:
flask db init flask db migrate -m "Initial migration" flask db upgrade
- Run the application:
flask run
Usage
After starting the application, navigate to http://localhost:5000
in your web browser. The application will redirect you to the current day's takings page. From there, you can:
- Navigate to different dates using the calendar view
- Enter safe and till float denomination counts
- Record payment method totals
- Calculate optimal till float denomination breakdown
- View the variance between recorded sales and payment methods
- Save and settle daily takings
Business Rules
The application enforces several key business rules:
- Safe float must maintain a target value of $1,500
- Till float must maintain a target value of $500
- All Australian currency denominations are supported
- Till float makeup prioritizes smaller denominations for the float
- Once a day is settled, its records cannot be modified without special permissions
- All financial values are stored as floating-point to two decimal places
- Customer count must be a non-negative integer
Database Schema
The application uses a SQLite database with the following structure:
- daily_takings: Records daily financial data
date
(PRIMARY KEY): Date of the recordtill_read
: Total sales from the POSeftpos_total
: Fixed EFTPOS terminal transactionsportable_eftpos_total
: Portable EFTPOS transactionsamex
: American Express transactionsdiners
: Diners Club transactionsaccount_charges
: Account charge transactionstotal_cash
: Total cash transactionspoints_redeemed
: Loyalty points redeemedcustomer_count
: Number of customerssafe_float_open
: JSON string of opening safe float denominationssafe_float_close
: JSON string of closing safe float denominationstill_float_open
: JSON string of opening till float denominationstill_float_close_before_makeup
: JSON string of closing till float denominations before makeuptill_float_makeup
: JSON string of till float makeup denominationsvariance
: Calculated variance between till read and payment methodssettled
: Boolean indicating if the day's takings are settled
Knowledge Graph
The application integrates with MCP Knowledge Graph to maintain a comprehensive representation of the system's architecture, components, and relationships. This graph provides:
- Detailed mapping of code structure and relationships
- Documentation of business rules and logic
- Visualization of component interactions
- Support for developer onboarding and maintenance
To interact with the Knowledge Graph:
- Ensure MCP servers are installed and running
- Use the MCP Knowledge Graph API to query the application structure
- Visualize relationships between components
Development
Project Structure
bottle_shop/
├── __init__.py # Application factory and extensions
├── controllers/ # Route controllers
│ ├── __init__.py
│ ├── main.py # Main routes
│ └── takings.py # Takings-related routes
├── models/ # Database models
│ ├── __init__.py
│ └── daily_takings.py # DailyTakings model
├── services/ # Business logic services
│ ├── __init__.py
│ └── currency_service.py # Currency handling service
├── static/ # Static assets
│ ├── css/ # Stylesheets
│ └── js/ # JavaScript files
└── templates/ # Jinja2 templates
├── layout.html # Base template
├── about.html # About page
├── calendar.html # Calendar view
└── takings.html # Daily takings form
Rule Engine Configuration
The application uses a Rule Engine system to maintain and enforce business rules:
.cursor/CORE/RULE-ENGINE/
├── MDC-BOTTLE-SHOP.rules # Main domain context rules
└── WORKFLOW.rules # Development workflow rules
Future Enhancements
Planned enhancements include:
- User authentication for manager access
- Data export functionality for reporting
- Dashboard for historical variance tracking
- Backup/restore functionality for the database
- Cash flow trend visualization
License
This project is licensed under the MIT License - see the LICENSE file for details.
Authors
- Developed for Australian bottle shops to streamline end-of-trade processes