Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DanielRivera03/SistemaBancario/llms.txt
Use this file to discover all available pages before exploring further.
CashMan H.A. follows the Model-View-Controller (MVC) pattern strictly within a single CashManHA/ directory. The Model layer (modelo/) houses the database connection class, stored-procedure wrappers, and all business-logic helpers. The View layer (vista/) contains PHP/HTML templates organized into one subdirectory per user role. The Controller layer (controlador/) contains two front-controller scripts that inspect a ?cashmanha= or ?cashmanhagestion= GET parameter and dispatch to the correct model calls and view includes via a switch/case block. There is no framework-level router — every request is explicitly handled by one of these two controllers.
Directory Structure
CashManHA/
├── index.php # Entry point — redirects to login controller
├── composer.json # Composer dependencies
├── .htaccess
│
├── controlador/
│ ├── cIniciosSesionesUsuarios.php # Auth front-controller (?cashmanha=)
│ └── cGestionesCashman.php # Main front-controller (?cashmanhagestion=)
│
├── modelo/
│ ├── conexion.php # DB connection class + 7 parallel MySQLi connections
│ ├── mRecuperacionCuentas.php # Account recovery model
│ └── mGestionesCashman.php # Core business operations model
│
├── vista/
│ ├── iniciarsesion.php # Shared login view
│ ├── Administradores/ # Admin portal views
│ ├── Presidencia/ # Presidency portal views
│ ├── Gerencia/ # Management portal views
│ ├── AtencionClientes/ # Customer Service portal views
│ ├── Clientes/ # Client self-service views
│ └── MenuNavegacion/ # Shared navigation partials
│
├── FPDF/ # FPDF library for PDF generation
├── PHPMailer/ # PHPMailer library for SMTP email
└── vendor/ # Composer packages (bramus/router, luecano/numero-a-letras)
Routing
Entry Point
index.php is the sole entry point at the web root. Its only responsibility is to issue an immediate redirect to the authentication controller:
// index.php
header('location:controlador/cIniciosSesionesUsuarios.php?cashmanha=iniciarsesion');
Two Front Controllers
All application logic is dispatched by exactly two controllers, each reading a distinct GET key.
| Controller | GET Parameter | Handles |
|---|
cIniciosSesionesUsuarios.php | ?cashmanha= | Login, session validation, password recovery |
cGestionesCashman.php | ?cashmanhagestion= | Every authenticated operation across all five roles |
Both controllers follow the same pattern: read the GET parameter, default to a safe value if absent, then switch on the resulting string:
// cIniciosSesionesUsuarios.php
if (isset($_GET['cashmanha'])) {
$peticion_url = $_GET['cashmanha']; // read requested action from URL
} else {
$peticion_url = "iniciarsesion"; // default to login screen
}
switch ($peticion_url) {
case "iniciarsesion":
// render login view
require('../vista/iniciarsesion.php');
$conectarsistema->close();
break;
case "validar-sesiones":
// process login POST, validate credentials, set $_SESSION, redirect by role
break;
// ...
}
// cGestionesCashman.php
if (isset($_GET['cashmanhagestion'])) {
$peticion_url = $_GET['cashmanhagestion'];
} else {
$peticion_url = "inicioadministradores";
}
switch ($peticion_url) {
case "inicioadministradores":
if ($_SESSION['id_rol'] == 1) {
// load admin dashboard data and render view
} else {
header('location:cGestionesCashman.php?cashmanhagestion=redirecciones-sistema-cashmanha');
}
break;
case "iniciopresidencia":
if ($_SESSION['id_rol'] == 2) {
// load presidency dashboard data and render view
} else {
header('location:cGestionesCashman.php?cashmanhagestion=redirecciones-sistema-cashmanha');
}
break;
// one case per route, with inline role checks throughout
}
The $UrlGlobal variable defined near the top of both controllers sets the base URL for all internal redirects and asset paths. It is constructed dynamically as "http://" . $_SERVER['SERVER_NAME'] . ":90" . "/CashManHA" . '/'. If your server runs on a different port, update the hardcoded :90 segment to match your environment.
Database Access Pattern
All database reads and writes go exclusively through MySQL stored procedures. There is no inline SQL anywhere in the application code. Calls use mysqli_query() with a CALL ProcedureName(args) string:
// modelo/conexion.php — example stored procedure call
public function IniciarSesionUsuarios($conectarsistema, $usuario, $contrasenia)
{
$resultado = mysqli_query($conectarsistema, "CALL IniciarSesion('$usuario','$contrasenia');");
return $resultado;
}
Multiple Parallel Connections
conexion.php instantiates eight independent MySQLi connections against the same cashmanha database — one primary ($conectarsistema) and seven auxiliaries ($conectarsistema1 through $conectarsistema7). This pattern allows a single page render that requires multiple concurrent queries to use a dedicated connection for each, avoiding multi-query conflicts on a single MySQLi resource:
// modelo/conexion.php — connection instantiation
$conectando = new conexion();
$conectando->conectar("cashmanha");
$conectarsistema = $conectando->establecerconexion; // primary
$conectando = new conexion();
$conectando->conectar("cashmanha");
$conectarsistema1 = $conectando->establecerconexion; // auxiliary 1
$conectando = new conexion();
$conectando->conectar("cashmanha");
$conectarsistema2 = $conectando->establecerconexion; // auxiliary 2
// ... repeated through $conectarsistema7
Every controller case closes all connections it used before the break:
$conectarsistema->close();
$conectarsistema1->close();
$conectarsistema2->close();
$conectarsistema3->close();
$conectarsistema4->close();
The cashmanha database schema contains 21 tables, 148 stored procedures, 67 views, 21 triggers, and 5 scheduled events. MySQL Workbench is recommended over phpMyAdmin for importing the full schema due to its better handling of stored procedure and trigger definitions.
View Organization
The vista/ directory is divided into five role-specific subdirectories — one per user role — plus shared partials:
vista/
├── iniciarsesion.php # Public login page (shared)
├── Administradores/ # Views for Role 1 — Administrator
├── Presidencia/ # Views for Role 2 — Presidency
├── Gerencia/ # Views for Role 3 — Management
├── AtencionClientes/ # Views for Role 4 — Customer Service
├── Clientes/ # Views for Role 5 — Client
├── MenuNavegacion/ # Shared navigation bar partials
├── copiacontratosclientes/ # PDF contract templates
├── css/ # Application stylesheets
├── js/ # Application JavaScript
├── dist/ # Bootstrap distribution assets
└── images/ # Static images and profile photos
Views are never called directly via URL. Each is require()-d from within the appropriate switch/case block in cGestionesCashman.php only after the role check passes.
Timezone Configuration
The application is configured for UTC-6 (El Salvador). This is set in cGestionesCashman.php:
date_default_timezone_set('America/El_Salvador');
Update this value to match your deployment region. Refer to the PHP timezone documentation for the full list of supported identifiers.