How lynx479/billing_software works
Purpose and Runtime
This is a server-rendered PHP accounting application for invoices, credit notes, parties/sellers, inventory items, payments, bank accounts, settlements, and financial/tax reports. The public HTTP entry point is public/index.php; Apache rewrite behavior is defined in public/.htaccess. UI is PHP views with Bootstrap, ApexCharts, Flatpickr, and local CSS/JS assets.
Application Dispatch and MVC Base
Requests enter public/index.php, are resolved by the custom router, then dispatched to controller actions. app/core/Router.php is the routing/control boundary. app/core/Controller.php provides controller-level rendering/request behavior, while app/core/Model.php anchors database-backed domain access. Controllers mediate all major use cases and select views.
Paths:
• public/index.php
• app/core/Router.php
• app/core/Controller.php
Financial Document Lifecycle
Invoices and credit notes are the primary transactional document flow: listing, creation/editing, and printable/preview output. Invoice behavior is concentrated in app/controllers/InvoicesController.php and app/models/Invoice.php; credit-note operations have a separate controller and view set but are visibly linked through app/views/invoices/credit-note-create.php.
Paths:
• app/controllers/InvoicesController.php
• app/controllers/CreditNotesController.php
• app/models/Invoice.php
Parties, Items, and Reference Data
Parties represent business counterparts, including seller-specific views and account statements. Items support catalog management and history. Settings manages reference data—taxes, units, categories, currencies, and customization—which forms a dependency boundary for document entry and reporting.
Paths:
• app/controllers/PartiesController.php
• app/models/Party.php
• app/controllers/ItemsController.php
Cash, Banking, and Settlement Flow
Payments support distinct pay-in and pay-out workflows, with creation, editing, indexes, and previews. Bank accounts expose account-level views. Settlements provide a separate process, likely reconciling seller or financial positions after transactions. These flows are represented by dedicated controllers/models rather than embedded in invoice handling.
Paths:
• app/controllers/PaymentsController.php
• app/controllers/BankAccountsController.php
• app/controllers/SettlementsController.php
Reporting and Dashboard Read Models
The dashboard is the high-level operational summary. Reports expose financial, sales, GST R1, reconciliation, commissions, advertising, subscriptions, users, and seller-settlement views. Report is the reporting data boundary, separating aggregate/read-oriented queries from transactional models.
Paths:
• app/controllers/DashboardController.php
• app/controllers/ReportsController.php
• app/models/Report.php
Persistence, Validation, and Presentation
Database connectivity is configured in app/config/database.php; SQL schema and evolution artifacts are under database/, including database/lx_accounting.sql and database/migrations_2026_09.sql. Domain inputs should pass through common validation and monetary/currency handling before persistence. Controllers render feature views inside shared layout fragments and theme configuration.
Paths:
• app/config/database.php
• app/core/Validation.php
• app/core/Currency.php
Components 18
HTTP & MVC
- Public entry
public/index.php - Router
app/core/Router.php - Controller base · Provides request and rendering behavior.
app/core/Controller.php - Validation & currency · Validates domain input and monetary values.
app/core/Validation.php
Transaction flows
- Invoices
app/controllers/InvoicesController.php - Credit notes · Separate credit-note lifecycle linked to invoice entry.
app/controllers/CreditNotesController.php - Invoice model
app/models/Invoice.php
Operational domains
- Payments · Pay-in and pay-out workflows.
app/controllers/PaymentsController.php - Bank accounts
app/controllers/BankAccountsController.php - Settlements · Reconciles seller or financial positions.
app/controllers/SettlementsController.php - Parties
app/controllers/PartiesController.php - Party model
app/models/Party.php - Items · Catalog management and item history.
app/controllers/ItemsController.php
Reporting & persistence
- Dashboard · Operational summary read model.
app/controllers/DashboardController.php - Reports · Financial, tax, reconciliation, and seller reporting.
app/controllers/ReportsController.php - Report model · Aggregate and read-oriented query boundary.
app/models/Report.php - Database connection
app/config/database.php - Schema & migrations · SQL schema and migration artifacts.
database/lx_accounting.sql
Connections 20
- Public entry → Router: dispatches
- Router → Controller base: resolves actions
- Controller base → Invoices: base for
- Controller base → Payments: base for
- Controller base → Parties: base for
- Controller base → Dashboard: base for
- Invoices → Validation & currency: validates input
- Invoices → Invoice model: manages
- Credit notes → Invoices: linked document flow
- Payments → Bank accounts: uses accounts
- Settlements → Payments: reconciles transactions
- Parties → Party model: manages
- Invoices → Parties: references counterparts
- Invoices → Items: references catalog
- Dashboard → Report model: reads summaries
- Reports → Report model: queries aggregates
- Invoice model → Database connection: persists through
- Party model → Database connection: persists through
- Report model → Database connection: reads through
- Database connection → Schema & migrations: uses schema