Inventory Count Management System

## Overview

This document provides a comprehensive view of the Inventory Count Management System's architecture, directory structure, and module organization. The system is built with PHP and follows a modular architecture for managing stocktaking workflows.

---

## Directory Structure

```
invcount/
├── index.php                     # Main application entry point
├── login.php                     # User authentication page
├── logout.php                    # User logout handler
├── register.php                  # User registration page
│
├── admin/                        # Admin module
│   ├── assignments.php           # Assignment management
│   ├── checking_guidelines.php   # Checking guidelines page
│   ├── counting_instructions.php # Counting instructions page
│   ├── dashboard.php             # Admin dashboard
│   ├── items.php                 # Item management
│   ├── pending_counts.php        # Pending counts view
│   ├── reports.php               # Reports page
│   ├── sessions.php              # Session management
│   ├── users.php                 # User management
├── checker/                      # Checker module
│   ├── checking_guidelines.php   # Checking guidelines
│   ├── dashboard.php             # Checker dashboard
│   ├── pending_counts.php        # Pending counts for review
│   ├── pending_counts - Copy.php # Backup file
│   ├── reports.php               # Checker reports
│
├── counter/                      # Counter module
│   ├── count_items.php           # Main counting interface
│   ├── count_items - Copy.php    # Backup file
│   ├── counting_instructions.php # Counting instructions
│   ├── dashboard.php             # Counter dashboard
│   ├── reports.php               # Counter reports
│
├── config/                       # Configuration directory
│   └── config.php                # Main configuration file
│
├── database/                     # Database related files                  # Database schema
│   └── mutalexc_stocktake.sql
│
├── includes/                     # Shared includes
│   ├── auth.php                  # Authentication functions
│   ├── csrf.php                  # CSRF protection
│   ├── flash_messages.php        # Flash message system
│   ├── functions.php             # Utility functions
│   ├── init.php                  # Application initialization
│   ├── session_manager.php       # Session management
│   └── validators.php            # Input validators
│
├── lib/                          # Core libraries
│   ├── Database.php              # Database connection class
│   ├── ExcelExport.php           # Excel export functionality
│   ├── Pagination.php            # Pagination helper
│   └── PDFGenerator.php          # PDF generation
│
├── middleware/                   # Middleware layer
│   ├── auth_middleware.php        # Authentication middleware
│   ├── role_middleware.php        # Role-based access control
│   └── workflow_middleware.php    # Workflow state validation
│
├── scripts/                      # Utility scripts
│   ├── php/                      # PHP scripts
│   │   ├── backup_database.php   # Database backup
│   │   ├── cleanup_logs.php      # Log cleanup
│   │   └── cron_sync.php         # Cron synchronization
│   ├── python/                   # Python scripts
│   │   ├── generate_report.py    # Report generation
│   │   ├── import_csv.py         # CSV import
│   │   └── requirements.txt      # Python dependencies
│   └── reports/                  # Report templates
│
├── storage/                      # Storage directory
│   ├── backups/                  # Database backups
│   │   └── .gitkeep
│   └── logs/                     # Application logs
│       └── export.log
│
├── templates/                    # View templates
│   ├── alert.php                 # Alert component
│   ├── footer.php                # Page footer
│   ├── header.php                # Page header
│   ├── modal.php                 # Modal component
│   ├── pagination.php            # Pagination component
│   └── sidebar.php               # Sidebar navigation
│
├── uploads/                      # Upload directory
│   ├── exports/                  # Exported files
│   └── imports/                  # Imported files
│
└── assets/                       # Static assets
    ├── css/                      # Stylesheets
    │   ├── responsive.css        # Responsive styles
    │   └── style.css             # Main styles
    ├── fonts/                    # Font files
    ├── images/                   # Image files
    └── js/                       # JavaScript files