# Dolibarr Custom Modules — General Roadmap
> Last updated: 2026-03-27 (planning PHASE 2 ✅ — capacity grid fully implemented and deployed)

---

> ⚠️ **PRIVATE — All modules listed in this document are proprietary software.**
> Developed by **Marcin Flaumenhaft** (marcin.flaumenhaft@neosintl.com) for and on behalf of **Neos International Ltd**.
> All intellectual property rights in this work vest in **Neos International Ltd**.
> Unauthorized use, copying or redistribution of any module code is not permitted.

---

## 0. Glossary — Abbreviations & Module Names

### Module name abbreviations

| Short name | Full name | What it does |
|---|---|---|
| **openorderbook** | Open Order Book | Tracks open Sales Orders vs. production — arrears, paper work, MO tracking |
| **planning** | Production Planning Board | Visual planning board — timeline, workstation scheduling |
| **scrap** | Scrap / Rework Registry | Records scrapped or reworked parts per MO, job, reason |
| **productionrules** | Production Rules Engine | Defines rules applied to SO/MO based on product or customer |
| **productlabels** | Product Label Suggestions | UI helper — autocomplete/suggestions for the product Label field when creating products; auto-focuses custom fields (FG/PACK/BOP) |
| **switchdolibarr** | Dolibarr Instance Switcher | Utility to switch between Dolibarr environments (dev/prod) |
| **doccontrol** | Document Control (QMS) | Manages quality documents — versions, approvals, R&U acknowledgements |
| **ncr** | Non-Conformance Report | Records internal/customer/supplier quality defects, tracks disposition and corrective actions |
| **oee** | Overall Equipment Effectiveness | Tracks machine availability, performance and quality. Formula: OEE = A × P × Q |
| **pm** | Preventive Maintenance | Schedules and records planned maintenance on machines/workstations |
| **trainmatrix** | Training Matrix | Competence matrix — which operators are qualified for which operations/machines |
| **calibration** | Gauge & Calibration | Registry of measurement instruments, calibration due dates, certificates |
| **scanstation** | Scan Station | Barcode/QR scan kiosk on shop floor — scans job traveler → auto-records operation progress |
| **jobcard** | Job Card / Job Traveler | Standalone module — prints a Job Card (traveler) for every MO; tracks print history; print queue for unprinted MOs |
| **suppscorecard** | Supplier Scorecard | Calculates OTD% and quality PPM per supplier per period |
| **complaints** | Customer Complaints / 8D | Manages customer complaints through 8D problem-solving process |
| **ppap** | PPAP Manager | Production Part Approval Process — tracks submission elements per part number |
| **spc** | Statistical Process Control | Control charts (X-bar R/S) for key dimensions — detects process drift |

### Technical abbreviations used in this document

| Abbreviation | Full form | Context |
|---|---|---|
| **MO** | Manufacturing Order | Production order in Dolibarr (`llx_mrp_mo`) |
| **SO** | Sales Order | Customer order (`llx_commande`) |
| **WS** | Workstation | Machine or work cell (`llx_workstation`) |
| **WI** | Work Instruction | Document describing how to perform an operation |
| **R&U** | Read & Understood | Acknowledgement that an operator has read and understood a document |
| **OEE** | Overall Equipment Effectiveness | = Availability × Performance × Quality |
| **IATF** | International Automotive Task Force | Automotive quality management standard (IATF 16949) |
| **QMS** | Quality Management System | System of processes ensuring product/service quality |
| **NCR** | Non-Conformance Report | Formal record of a quality defect or deviation |
| **8D** | 8 Disciplines | Structured problem-solving methodology (D1–D8) |
| **SCAR** | Supplier Corrective Action Request | Formal request to supplier to fix a quality problem |
| **PPAP** | Production Part Approval Process | AIAG process for approving new/changed parts |
| **COPQ** | Cost of Poor Quality | Financial cost of defects (scrap, rework, warranty, etc.) |
| **MSA** | Measurement System Analysis | Statistical analysis of gauge/measurement system accuracy |
| **GR&R** | Gauge Repeatability & Reproducibility | Type of MSA — checks if gauge gives consistent results |
| **PPM** | Parts Per Million | Defect rate measure (1 PPM = 1 defect per 1,000,000 parts) |
| **OTD** | On-Time Delivery | % of deliveries made on or before the agreed date |
| **MTBF** | Mean Time Between Failures | Average time between machine breakdowns |
| **MTTR** | Mean Time To Repair | Average time to restore machine after breakdown |
| **RAG** | Red / Amber / Green | Traffic-light status indicator |
| **ZPL** | Zebra Programming Language | Command language for Zebra label printers |
| **ECM** | Electronic Content Management | Dolibarr built-in document/file storage module |
| **ECR** | Engineering Change Request | Formal request to change a product design or process |
| **MRP** | Material Requirements Planning | Dolibarr manufacturing module (`mrp/`) |
| **PM** | Preventive Maintenance | Scheduled maintenance to prevent machine failure |
| **SPC** | Statistical Process Control | Use of control charts to monitor process stability |
| **QR** | Quick Response (code) | 2D matrix barcode |

---

## 1. Existing Modules (Active)

> ✅ **Production deployment baseline** — The modules listed in this section are complete and fully operational in the development environment. Their presence is sufficient to **go live with Dolibarr in production**. All remaining modules (sections 2–3) can be built and deployed **incrementally while the system is already in active use** — they do not block the initial go-live.

| Module                | Status        | Description |
| **openorderbook**     | ✅ Production | Arrears, paper work, MO tracking, scrap query via job_number |
| **planning**          | ✅ Production | Planning board, timeline, completed view — **PHASE 2 ✅** capacity grid (`planning.php` — workstation × week/day MO hour grid, cycle time calc, shift capacity, sat/sun toggles, avail/planned/unplanned totals). DB: `llx_planning_schedule`, `llx_planning_ws_config`, `llx_planning_capacity_override`. Latest commit `3522756`. |
| **scrap**             | ✅ Production | Scrap registry, reports, audit log, report per machine |
| **productionrules**   | ✅ Production | Production rules / Sales Order rules |
| **productlabels**     | ✅ Production | UI helper — label field autocomplete suggestions when creating products |
| **switchdolibarr**    | ✅ Utility    | Dolibarr instance switcher |
| **jobcard**           | ✅ Production | Job Card / Job Wallet printer — PHASE 1 ✅ PHASE 2 ✅ (queue.php). print.php, CSS, SQL, admin, ajax, queue.php. QR code on every job card (`MO:{rowid}|JOB:{job_number}|ENTITY:{entity}`). No dependencies on other custom modules. |

---

## 2. Modules Under Development
> 📌 **Status: Pending approval** — these modules are under active development and awaiting management sign-off before full rollout.

| Module | GitHub | Status | Description |
|---|---|---|---|
| **scanstation** | ciachoo/scanstation | 🔧 In progress | **Scan Station kiosk** — PHASE 1 ✅ PHASE 2 🔲 PHASE 3 🔲. PHASE 1 complete: module descriptor, SQL table (`llx_scanstation_log`), kiosk UI (`scan_station.php`), AJAX endpoint (lookup/confirm/scrap/get_log), dark theme CSS, JS with native `getUserMedia`+`jsQR` camera scanning (QR auto-decode on mobile). Camera working via HTTPS reverse proxy. Latest commit `e8bbd14`. PHASE 2 (part labels) + PHASE 3 (OEE/NCR integrations) pending. |
| **doccontrol** | ciachoo/doccontrol | 🔧 Scaffold ready | QMS Document Control — registry, versioning, approval flow. **Potential replacement for the paid SinglePoint app** — if feature-complete, would eliminate the current SaaS subscription cost. |
| **ncr** | ciachoo/ncr | 📋 Plan ready | Non-Conformance Reports — NCR-YYYY-XXXX, 8D, SCAR |
| **oee** | ciachoo/oee | 📋 Plan ready | OEE + Downtime Log — Availability × Performance × Quality |


---

## 3. Must-Have — New Module Roadmap

### 🔴 CRITICAL (IATF 16949 compliance)

#### 3.1 Training Matrix (`trainmatrix`)
- **IATF clause**: 7.2 — Competence
- **Goal**: Competence matrix — operator × position / operation / machine
- **Tables**: `llx_tm_skill`, `llx_tm_operator_skill`, `llx_tm_position_skill`
- **Links**: R&U acknowledgement from **doccontrol**, operators from Dolibarr `llx_user`
- **Levels**: 0=None, 1=In training, 2=Under supervision, 3=Independent, 4=Can train others
- **Views**: Matrix (operator × skill), competence gaps, re-certification due dates
- **PHASE 1**: Tables, CRUD skills/operators, matrix view
- **PHASE 2**: Link with doccontrol (R&U = proof of training), expiry alerts
- **PHASE 3**: Gap analysis report, PDF export

#### 3.2 Preventive Maintenance (`pm`)
- **IATF clause**: 8.5.1 — Control of production equipment
- **Goal**: PM schedule + execution records, feeds directly into OEE (planned downtime)
- **Tables**: `llx_pm_plan` (cycle, machine, description), `llx_pm_execution` (date, who, result), `llx_pm_checklist`
- **Links**: Machines from `llx_workstation`, scheduled tasks → **oee_downtime** (PLAN_MAINT)
- **Views**: PM calendar, execution history, overdue tasks
- **PHASE 1**: Tables, schedule, execution recording
- **PHASE 2**: Auto-create oee_downtime entry on PM, email notifications
- **PHASE 3**: MTBF/MTTR analysis (together with OEE), report export

#### 3.3 Gauge & Calibration (`calibration`)
- **IATF clause**: 7.1.5.1 — Measurement resources / MSA
- **Goal**: Measurement equipment registry, calibration due dates, calibration certificates
- **Tables**: `llx_cal_gauge` (reg. number, type, range, tolerance), `llx_cal_record` (date, lab, result, cert_nr), `llx_cal_msa`
- **Views**: Equipment list with RAG status (OK / Due in N days / Overdue), calibration history
- **Alerts**: Email N days before due date (configurable)
- **PHASE 1**: Registry, calibration history, RAG status
- **PHASE 2**: Email alerts, certificate upload to ECM
- **PHASE 3**: MSA reference (GR&R data), link with doccontrol

---

### 🟡 IMPORTANT

#### 3.4 Customer Complaints / 8D (`complaints`)
- **Goal**: Customer complaints → root cause → 8D report → SCAR to supplier
- **Links**: Link with **ncr** (complaint → internal NCR), link with Dolibarr societe (customer)
- **PHASE 1**: Complaint registry, status flow (Open→Investigation→8D→Closed)
- **PHASE 2**: 8D report PDF generator, SCAR email to supplier
- **PHASE 3**: Trend / Pareto per customer, link with PPAP

#### 3.5 Supplier Scorecard (`suppscorecard`)
- **Goal**: OTD% + quality PPM per supplier, visible in delivery history
- **Sources**: Dolibarr `llx_delivery`, `llx_reception`, ncr (material returns)
- **PHASE 1**: Automated OTD + PPM calculation per supplier per quarter
- **PHASE 2**: Supplier dashboard view, CSV/PDF export
- **PHASE 3**: Annual evaluation, audit trail

---

### 🟢 NICE-TO-HAVE

#### 3.6 Scan Station + Barcode Labels (`scanstation`)
- **Goal**: Scan job wallet traveler at each workstation → auto-update `llx_mrp_mo_optracking`; print part label post-Wash
- **Tables**: `llx_scanstation_log` (audit trail of all scan events)
- **Barcode encoding**: `MO:{rowid}|JOB:{job_number}|ENTITY:{entity}` (QR on traveler), Code128+QR on part label
- **Kiosk UI**: `scan_station.php` — tablet-friendly, workstation selector, standard Dolibarr login, last N scans
- **Label**: ZPL (Zebra direct) or PDF fallback; triggered post-Wash op
- **Camera**: Native `getUserMedia` + self-hosted `jsQR` — auto-decodes QR on mobile Chrome (HTTPS required; fixed via `Permissions-Policy: camera=(self)` in Apache reverse proxy)
- **Auth**: Standard Dolibarr session (`rights->scanstation->use`)
- **Op selection**: Manual dropdown from `llx_mrp_production` grouped by workstation
- **Scrap**: Own `llx_scanstation_log` entry (`scan_type='scrap'`)
- **PHASE 1** ✅: Module descriptor, SQL, kiosk UI, AJAX (lookup/confirm/scrap/get_log), CSS, JS camera, admin setup
- **PHASE 2**: Part label print (post-Wash), Zebra ZPL, cross-check scan
- **PHASE 3**: Feed cycle time into OEE, pre-fill scrap from scan, WI display from doccontrol
- **GitHub**: https://github.com/ciachoo/scanstation
- **Module number**: 999104

#### 3.7 Shop Floor WI Display (`wikioskd`)
- Display work instructions from **doccontrol** on production tablet / kiosk
- No login required — read-only mode after scanning operation QR code
- Link with MO (paper_work) → automatic WI selection by part number + operation

#### 3.7 SPC / Control Chart (`spc`)
- Shewhart control charts (X-bar R, X-bar S) for key dimensions
- Data import from CSV or manual entry
- Alert on control limit breach

#### 3.8 PPAP Manager (`ppap`)
- New product documentation package (PPAP Level 1–5)
- Submission element checklist per Part Number, completeness status
- Link with doccontrol (each element = document in registry)

---

## 4. Implementation Priorities

> 🥇 **jobcard module — COMPLETE** ✅ — All phases delivered. Job card renders correctly with vinci-style layout, QR code, operations from BOM services, print log, queue.php. Moved to section 1 (Active). Foundation for scan station, OEE, scrap tracking.

> ⚡ **Contingency rule:** If any item is not completed within its quarter, it automatically carries over to the next quarter as **top priority** — before any new items are started.
> Items marked 🔴 (Critical / IATF) take precedence over 🟡 (Important) and 🟢 (Nice-to-have) in all carry-over decisions.
> Each quarter has a designated **buffer week** at the end for carry-over, testing and documentation catch-up.

```
PRE-Q2  [DONE ✅]
└── ✅ jobcard — ALL PHASES COMPLETE → moved to Active modules

Q2 2026  [Apr – Jun]
├── 🔴 doccontrol PHASE 1   — scaffold ready, needs: document_card, version_add, approve
├── 🔴 scanstation PHASE 1  — ✅ COMPLETE (kiosk UI, camera QR scan, AJAX, optracking write, admin setup)
├── 🔴 Training Matrix PHASE 1 — tables + matrix view
└── 🔴 ncr PHASE 1          — plan ready, start implementation
    ⚠️  Contingency: if doccontrol PHASE 1 slips → carry to Q3 top priority
    ⚠️  Contingency: if scanstation PHASE 1 slips → carry to Q3, paper traveler remains in use

Q3 2026  [Jul – Sep]
├── 🔴 [Carry-over from Q2 if needed — top priority]
├── 🔴 Preventive Maintenance PHASE 1
├── 🔴 Calibration PHASE 1
├── 🟡 oee PHASE 1
└── 🔴 doccontrol PHASE 2
    ⚠️  Contingency: if PM PHASE 1 slips → carry to Q4; manual PM log continues as interim
    ⚠️  Contingency: if Calibration PHASE 1 slips → carry to Q4; existing spreadsheet stays active

Q4 2026  [Oct – Dec]
├── 🔴 [Carry-over from Q3 if needed — top priority]
├── 🔴 Training Matrix PHASE 2 — R&U link with doccontrol
├── 🟡 PM PHASE 2 — link with OEE
├── 🟡 Customer Complaints PHASE 1
└── 🟡 Supplier Scorecard PHASE 1
    ⚠️  Contingency: if Training Matrix PHASE 2 slips → carry to Q1 2027 (IATF audit risk — flag to management)
    ⚠️  Contingency: if Complaints/Scorecard slip → defer to 2027 Nice-to-have backlog

2027+
├── 🟢 Shop Floor WI Display
├── 🟢 SPC / Control Chart
└── 🟢 PPAP Manager
    ⚠️  Contingency: all 2027+ items are nice-to-have — deferral has no compliance impact
```

---

## 5. Module Dependency Architecture

```
doccontrol ──────────────────────────────────┐
    │ R&U acknowledgement                     │ WI to display
    ▼                                         ▼
trainmatrix          wikioskd ◄──── openorderbook (paper_work → MO)
    │ competences
    ▼
planning / MRP
    │ production
    ├──► scrap ──────────────────────────────► ncr (internal NCR)
    │                                              │ SCAR
    └──► oee_downtime                              ▼
              ▲                              complaints ◄── societe (customer)
              │ PLAN_MAINT                        │
              pm (Preventive Maintenance)    suppscorecard

calibration ── MSA reference ── (data for SPC)
                                      ▼
                                    spc / control chart
```

---

## 6. GitHub Repositories

| Repo | URL | Branch |
|---|---|---|
| openorderbook | https://github.com/ciachoo/openorderbook | master |
| doccontrol | https://github.com/ciachoo/doccontrol | master |
| ncr | https://github.com/ciachoo/ncr | master |
| oee | https://github.com/ciachoo/oee | master |
| trainmatrix | — to be created — | master |
| pm | — to be created — | master |
| calibration | — to be created — | master |
| scanstation | https://github.com/ciachoo/scanstation | master |
| jobcard | https://github.com/ciachoo/jobcard | master |

---

## 7. Coding Standards (Custom Modules)

- **PHP include**: `require '../../main.inc.php'` (or `../../../main.inc.php` for subdirectories)
- **config_page_url**: `array('/custom/MODULENAME/admin/setup.php')` — full path required
- **Module numbering**: 999100 (doccontrol), 999101 (ncr), 999102 (oee), 999103+ sequential
- **Quality top menu**: existing — append with `fk_menu=''` + incrementing `position`
- **Line endings**: `.gitattributes` with `* text=auto eol=lf` in ALL repos
- **Chart.js**: `DOL_URL_ROOT.'/includes/chart.js/chart.min.js'` (Dolibarr 17+)
- **DB prefix**: `MAIN_DB_PREFIX` (defaults to `llx_`)
- **Commit format**: `type: short description` (feat/fix/chore/docs)
