# lahiru92/salesmanager4 architecture

> Architecture diagram of the GitHub repository lahiru92/salesmanager4, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lahiru92/salesmanager4
- Repository: https://github.com/lahiru92/salesmanager4

## Overview

Salesmanager4 is a web-based sales and inventory management application, with workflows spanning purchasing, receiving, sales invoicing, payments, cash balancing, and reporting. Users work through server-rendered pages and browser-side form modules; the sampled JavaScript shows dynamic line-item calculations and asynchronous item, supplier, and customer searches. The tree also identifies ledger, inventory, master-data, user, and reporting subsystems. Java controller-to-service wiring was not sampled, so those server-side connections are not asserted.

Main entry points: [`src/main/resources/static/js/core/app.js`](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/core/app.js) (Interaction dispatcher), [`src/main/resources/static/js/modules/purchase-order.js`](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/purchase-order.js) (Purchase form logic), [`src/main/resources/static/js/modules/grn.js`](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/grn.js) (Receiving form logic), [`src/main/resources/static/js/modules/invoice.js`](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/invoice.js) (Invoice form logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interaction"]
  node_browser["Sales interface"]
  node_appjs["Interaction dispatcher<br/>[app.js]"]
  node_init["Fragment initializer<br/>[init-registry.js]"]
  node_pojs["Purchase form logic<br/>[purchase-order.js]"]
  node_grnjs["Receiving form logic<br/>[grn.js]"]
  node_invoicejs["Invoice form logic<br/>[invoice.js]"]
  node_cashjs["Cash form logic<br/>[cash-balancing.js]"]
end

subgraph group_stock["Inventory operations"]
  node_po["Purchase orders"]
  node_grn["Goods receiving"]
  node_inventory["Stock management"]
  node_invoice["Sales invoicing"]
  node_itemapi["Item search API"]
end

subgraph group_finance["Finance operations"]
  node_payments["Customer payments"]
  node_supplierpayments["Supplier payments"]
  node_balances["Cash balancing"]
  node_ledger["Financial ledger"]
end

subgraph group_admin["Administration and insight"]
  node_customers["Customer records"]
  node_suppliers["Supplier records"]
  node_employees["Employee records"]
  node_users["Users and access"]
  node_reports["Reports and exports"]
  node_dashboard["Dashboard stats"]
  node_supplierapi["Supplier search API"]
  node_customerapi["Customer search API"]
end

node_user(("Staff user"))
node_database[("Application database<br/>[schema.sql]")]

node_user -->|"uses"| node_browser
node_browser -->|"interaction events"| node_appjs
node_appjs -->|"initializes fragments"| node_init
node_appjs -->|"dispatches actions"| node_pojs
node_appjs -->|"dispatches actions"| node_grnjs
node_appjs -->|"dispatches actions"| node_invoicejs
node_appjs -->|"dispatches actions"| node_cashjs
node_pojs -->|"searches items"| node_itemapi
node_pojs -->|"searches suppliers"| node_supplierapi
node_grnjs -->|"searches items"| node_itemapi
node_grnjs -->|"searches suppliers"| node_supplierapi
node_invoicejs -->|"searches items"| node_itemapi
node_invoicejs -->|"searches customers"| node_customerapi

click node_browser "https://github.com/lahiru92/salesmanager4/tree/main/src/main/resources/templates"
click node_appjs "https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/core/app.js"
click node_init "https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/core/init-registry.js"
click node_po "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/purchase_order"
click node_grn "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/grn"
click node_inventory "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/inventory"
click node_invoice "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/invoice"
click node_customers "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/customers"
click node_suppliers "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/suppliers"
click node_employees "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/employees"
click node_users "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/users"
click node_payments "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/finance/payments/receivable"
click node_supplierpayments "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/finance/payments/payable"
click node_balances "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/cash/balancing"
click node_ledger "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/finance/ledger"
click node_reports "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/reports"
click node_dashboard "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/dashboard"
click node_database "https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/schema.sql"
click node_pojs "https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/purchase-order.js"
click node_grnjs "https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/grn.js"
click node_invoicejs "https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/invoice.js"
click node_cashjs "https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/cash-balancing.js"
click node_itemapi "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/inventory/item"
click node_supplierapi "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/suppliers"
click node_customerapi "https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/customers"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_appjs,node_init,node_pojs,node_grnjs,node_invoicejs,node_cashjs,node_user toneBlue
class node_po,node_grn,node_inventory,node_invoice,node_itemapi,node_database toneAmber
class node_payments,node_supplierpayments,node_balances,node_ledger toneMint
class node_customers,node_suppliers,node_employees,node_users,node_reports,node_dashboard,node_supplierapi,node_customerapi toneRose
```

## Components

### Web interaction

- [Sales interface](https://github.com/lahiru92/salesmanager4/tree/main/src/main/resources/templates): `src/main/resources/templates`
- [Interaction dispatcher](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/core/app.js): `src/main/resources/static/js/core/app.js`
- [Fragment initializer](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/core/init-registry.js): `src/main/resources/static/js/core/init-registry.js`
- [Purchase form logic](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/purchase-order.js): `src/main/resources/static/js/modules/purchase-order.js`
- [Receiving form logic](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/grn.js): `src/main/resources/static/js/modules/grn.js`
- [Invoice form logic](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/invoice.js): `src/main/resources/static/js/modules/invoice.js`
- [Cash form logic](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/static/js/modules/cash-balancing.js): `src/main/resources/static/js/modules/cash-balancing.js`

### Inventory operations

- [Purchase orders](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/purchase_order): `src/main/java/com/example/salesmanager4/purchase_order`
- [Goods receiving](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/grn): `src/main/java/com/example/salesmanager4/grn`
- [Stock management](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/inventory): `src/main/java/com/example/salesmanager4/inventory`
- [Sales invoicing](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/invoice): `src/main/java/com/example/salesmanager4/invoice`
- [Item search API](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/inventory/item): `src/main/java/com/example/salesmanager4/inventory/item`

### Finance operations

- [Customer payments](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/finance/payments/receivable): `src/main/java/com/example/salesmanager4/finance/payments/receivable`
- [Supplier payments](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/finance/payments/payable): `src/main/java/com/example/salesmanager4/finance/payments/payable`
- [Cash balancing](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/cash/balancing): `src/main/java/com/example/salesmanager4/cash/balancing`
- [Financial ledger](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/finance/ledger): `src/main/java/com/example/salesmanager4/finance/ledger`

### Administration and insight

- [Customer records](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/customers): `src/main/java/com/example/salesmanager4/customers`
- [Supplier records](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/suppliers): `src/main/java/com/example/salesmanager4/suppliers`
- [Employee records](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/employees): `src/main/java/com/example/salesmanager4/employees`
- [Users and access](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/users): `src/main/java/com/example/salesmanager4/users`
- [Reports and exports](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/reports): `src/main/java/com/example/salesmanager4/reports`
- [Dashboard stats](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/dashboard): `src/main/java/com/example/salesmanager4/dashboard`
- [Supplier search API](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/suppliers): `src/main/java/com/example/salesmanager4/suppliers`
- [Customer search API](https://github.com/lahiru92/salesmanager4/tree/main/src/main/java/com/example/salesmanager4/customers): `src/main/java/com/example/salesmanager4/customers`

### Other components

- **Staff user**
- [Application database](https://github.com/lahiru92/salesmanager4/blob/main/src/main/resources/schema.sql): `src/main/resources/schema.sql`

## Connections

- Staff user → Sales interface: uses
- Sales interface → Interaction dispatcher: interaction events
- Interaction dispatcher → Fragment initializer: initializes fragments
- Interaction dispatcher → Purchase form logic: dispatches actions
- Interaction dispatcher → Receiving form logic: dispatches actions
- Interaction dispatcher → Invoice form logic: dispatches actions
- Interaction dispatcher → Cash form logic: dispatches actions
- Purchase form logic → Item search API: searches items
- Purchase form logic → Supplier search API: searches suppliers
- Receiving form logic → Item search API: searches items
- Receiving form logic → Supplier search API: searches suppliers
- Invoice form logic → Item search API: searches items
- Invoice form logic → Customer search API: searches customers
