# samerkhokon/pharmacutical-inventory-core-php architecture

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

- Interactive diagram: https://gitdiagram.com/samerkhokon/pharmacutical-inventory-core-php
- Repository: https://github.com/samerkhokon/pharmacutical-inventory-core-php

## Overview

This is a legacy PHP pharmaceutical inventory and sales/distributor management application. A signed-in user enters a section, navigates database-driven menus, and the section’s page controller loads a requested page; the repository also contains product/stock, ordering/invoicing, transfers/returns, reporting, and HR functionality. The excerpts establish the main-shell dispatch and menu/database relationships. Domain branches beyond those excerpts are represented at their existing directories; their internal calls are not inferred.

Main entry points: [`index.php`](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/index.php) (Main application), [`inv/index.php`](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/index.php) (Inventory application), [`hr/index.php`](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/index.php) (HR application), [`db.php`](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/db.php) (MySQL database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shells["Application shells"]
  node_main["Main application<br/>[index.php]"]
  node_hr_app["HR application<br/>[index.php]"]
  node_inv_app["Inventory application<br/>[index.php]"]
  node_main_nav["Main navigation<br/>[top_menu.php]"]
  node_main_sidebar["Main sidebar<br/>[left_menu.php]"]
  node_hr_nav["HR navigation<br/>[top_menu.php]"]
  node_hr_sidebar["HR sidebar<br/>[left_menu.php]"]
  node_inv_nav["Inventory navigation<br/>[top_menu.php]"]
  node_inv_sidebar["Inventory sidebar<br/>[left_menu.php]"]
  node_main_blank["Main landing page<br/>[blank.php]"]
  node_main_footer["Main footer<br/>[footer.php]"]
end

subgraph group_inventory["Inventory and sales"]
  node_catalog_stock["Products and stock"]
  node_orders_sales["Orders and sales"]
  node_transfers_returns["Transfers and returns"]
  node_inv_blank["Inventory landing page<br/>[blank.php]"]
  node_inv_footer["Inventory footer<br/>[footer.php]"]
end

subgraph group_people["HR management"]
  node_hr_pages["Employee management"]
  node_hr_blank["HR landing page<br/>[blank.php]"]
  node_hr_footer["HR footer<br/>[footer.php]"]
end

subgraph group_reports["Reports and output"]
  node_reports["Operational reports"]
  node_pdf["PDF output"]
end

subgraph group_shared["Shared services"]
  node_database[("MySQL database<br/>[db.php]")]
end

node_user(("Signed-in user"))

node_user -->|"opens"| node_main
node_main -->|"includes"| node_database
node_main -->|"includes"| node_main_nav
node_main -->|"includes"| node_main_sidebar
node_main -->|"dispatches page"| node_catalog_stock
node_main -->|"dispatches page"| node_orders_sales
node_main -->|"dispatches page"| node_transfers_returns
node_main -->|"dispatches page"| node_reports
node_main -->|"loads fallback"| node_main_blank
node_main -->|"includes"| node_main_footer
node_main_nav -->|"queries menus"| node_database
node_main_sidebar -->|"queries menus"| node_database
node_user -->|"opens"| node_hr_app
node_hr_app -->|"includes"| node_hr_nav
node_hr_app -->|"includes"| node_hr_sidebar
node_hr_app -->|"dispatches page"| node_hr_pages
node_hr_app -->|"loads fallback"| node_hr_blank
node_hr_app -->|"includes"| node_hr_footer
node_hr_nav -->|"queries menus"| node_database
node_hr_sidebar -->|"queries menus"| node_database
node_user -->|"opens"| node_inv_app
node_inv_app -->|"includes"| node_inv_nav
node_inv_app -->|"includes"| node_inv_sidebar
node_inv_app -->|"dispatches page"| node_catalog_stock
node_inv_app -->|"dispatches page"| node_orders_sales
node_inv_app -->|"dispatches page"| node_transfers_returns
node_inv_app -->|"dispatches page"| node_reports
node_inv_app -->|"loads fallback"| node_inv_blank
node_inv_app -->|"includes"| node_inv_footer
node_inv_nav -->|"queries menus"| node_database
node_inv_sidebar -->|"queries menus"| node_database
node_reports -.->|"exports PDF"| node_pdf

click node_main "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/index.php"
click node_hr_app "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/index.php"
click node_inv_app "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/index.php"
click node_main_nav "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/top_menu.php"
click node_main_sidebar "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/left_menu.php"
click node_hr_nav "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/top_menu.php"
click node_hr_sidebar "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/left_menu.php"
click node_inv_nav "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/top_menu.php"
click node_inv_sidebar "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/left_menu.php"
click node_catalog_stock "https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/includes"
click node_orders_sales "https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/includes"
click node_transfers_returns "https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/includes"
click node_hr_pages "https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/hr/includes"
click node_reports "https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/includes"
click node_pdf "https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/html2pdf"
click node_database "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/db.php"
click node_main_blank "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/includes/blank.php"
click node_hr_blank "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/includes/blank.php"
click node_inv_blank "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/includes/blank.php"
click node_main_footer "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/footer.php"
click node_hr_footer "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/footer.php"
click node_inv_footer "https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/footer.php"

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_main,node_hr_app,node_inv_app,node_main_nav,node_main_sidebar,node_hr_nav,node_hr_sidebar,node_inv_nav,node_inv_sidebar,node_main_blank,node_main_footer,node_user toneBlue
class node_catalog_stock,node_orders_sales,node_transfers_returns,node_inv_blank,node_inv_footer toneAmber
class node_hr_pages,node_hr_blank,node_hr_footer toneMint
class node_reports,node_pdf toneRose
class node_database toneIndigo
```

## Components

### Application shells

- [Main application](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/index.php): `index.php`
- [HR application](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/index.php): `hr/index.php`
- [Inventory application](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/index.php): `inv/index.php`
- [Main navigation](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/top_menu.php): `top_menu.php`
- [Main sidebar](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/left_menu.php): `left_menu.php`
- [HR navigation](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/top_menu.php): `hr/top_menu.php`
- [HR sidebar](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/left_menu.php): `hr/left_menu.php`
- [Inventory navigation](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/top_menu.php): `inv/top_menu.php`
- [Inventory sidebar](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/left_menu.php): `inv/left_menu.php`
- [Main landing page](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/includes/blank.php): `includes/blank.php`
- [Main footer](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/footer.php): `footer.php`

### Inventory and sales

- [Products and stock](https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/includes): `includes`
- [Orders and sales](https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/includes): `includes`
- [Transfers and returns](https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/includes): `includes`
- [Inventory landing page](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/includes/blank.php): `inv/includes/blank.php`
- [Inventory footer](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/inv/footer.php): `inv/footer.php`

### HR management

- [Employee management](https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/hr/includes): `hr/includes`
- [HR landing page](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/includes/blank.php): `hr/includes/blank.php`
- [HR footer](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/hr/footer.php): `hr/footer.php`

### Reports and output

- [Operational reports](https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/includes): `includes`
- [PDF output](https://github.com/samerkhokon/pharmacutical-inventory-core-php/tree/master/html2pdf): `html2pdf`

### Shared services

- [MySQL database](https://github.com/samerkhokon/pharmacutical-inventory-core-php/blob/master/db.php): `db.php`

### Other components

- **Signed-in user**

## Connections

- Signed-in user → Main application: opens (evidence: `index.php`)
- Main application → MySQL database: includes (evidence: `index.php`)
- Main application → Main navigation: includes (evidence: `index.php`)
- Main application → Main sidebar: includes (evidence: `index.php`)
- Main application → Products and stock: dispatches page (evidence: `index.php`)
- Main application → Orders and sales: dispatches page (evidence: `index.php`)
- Main application → Transfers and returns: dispatches page (evidence: `index.php`)
- Main application → Operational reports: dispatches page (evidence: `index.php`)
- Main application → Main landing page: loads fallback (evidence: `index.php`)
- Main application → Main footer: includes (evidence: `index.php`)
- Main navigation → MySQL database: queries menus (evidence: `top_menu.php`)
- Main sidebar → MySQL database: queries menus (evidence: `left_menu.php`)
- Signed-in user → HR application: opens (evidence: `hr/index.php`)
- HR application → HR navigation: includes (evidence: `hr/index.php`)
- HR application → HR sidebar: includes (evidence: `hr/index.php`)
- HR application → Employee management: dispatches page (evidence: `hr/index.php`)
- HR application → HR landing page: loads fallback (evidence: `hr/index.php`)
- HR application → HR footer: includes (evidence: `hr/index.php`)
- HR navigation → MySQL database: queries menus (evidence: `hr/top_menu.php`)
- HR sidebar → MySQL database: queries menus (evidence: `hr/left_menu.php`)
- Signed-in user → Inventory application: opens (evidence: `inv/index.php`)
- Inventory application → Inventory navigation: includes (evidence: `inv/index.php`)
- Inventory application → Inventory sidebar: includes (evidence: `inv/index.php`)
- Inventory application → Products and stock: dispatches page (evidence: `inv/index.php`)
- Inventory application → Orders and sales: dispatches page (evidence: `inv/index.php`)
- Inventory application → Transfers and returns: dispatches page (evidence: `inv/index.php`)
- Inventory application → Operational reports: dispatches page (evidence: `inv/index.php`)
- Inventory application → Inventory landing page: loads fallback (evidence: `inv/index.php`)
- Inventory application → Inventory footer: includes (evidence: `inv/index.php`)
- Inventory navigation → MySQL database: queries menus (evidence: `inv/top_menu.php`)
- Inventory sidebar → MySQL database: queries menus (evidence: `inv/left_menu.php`)
- Operational reports → PDF output: exports PDF
