# GDC CMOD - Laboratory Management System

## Purpose
CodeIgniter 4 PHP application for laboratory management (GDC CMOD - Laboratory Request Management System). Handles specimen collection tracking, request validation, and result management with role-based access control.

## Tech Stack
- **Framework**: CodeIgniter 4 (PHP 8.1+)
- **Database**: SQL Server (primary) + Firebird/InterBase (legacy patient data via ODBC)
- **Frontend**: TailwindCSS + DaisyUI 5 + Alpine.js + Font Awesome 7
- **Testing**: PHPUnit 10.x
- **Server**: Windows (XAMPP/IIS)

## Database Architecture
- **Primary DB**: SQL Server (`GDC_CMOD.dbo`) via Microsoft ODBC Driver (MSOLEDBSQL)
- **Legacy DB**: Firebird/InterBase (`GLENEAGLES` via ODBC)
- **Connection**: `\Config\Database::connect()` returns MySQLi connection (configured as SQLSRV)
- **No CI4 Models**: Uses raw SQL queries via `Database::connect()->query()`

## Key Database Tables
- `GDC_CMOD.dbo.USERS` - Users with `USERID`, `USERROLEID`, `PASSWORD`
- `GDC_CMOD.dbo.CM_REQUESTS` - Validation tracking (`ISVAL1`, `ISVAL2`, validation users/dates)
- `GDC_CMOD.dbo.TUBES` - Sample collection status
- `GDC_CMOD.dbo.V_DASHBOARD_DEV` - Dashboard data view
- `glendb.dbo.*` - Legacy Firebird patient data

## Architecture Overview
- **Session-based authentication** with role-based access control (RBAC)
- **Dual-level validation** system requiring 2 different users to validate the same request
- **Role groups** filter middleware for routing control
- **API endpoints** for JSON responses
- **Page controllers** for HTML views

## Current Pending Features (CHECKLIST.md)
- Restrict Print/Save-to-PDF to CS Role only
- Add Dedicated Print Button
- Update PDF Report Metadata (Replace 'Printed By' with validating user's name)
- Reprint Label functionality
- Print Result Audit (Track when result reports are printed/exported)
