Skip to main content

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.

The cashmanha database runs on MySQL/MariaDB with the utf8mb4 character set and InnoDB storage engine throughout. It contains 21 tables, 148 stored procedures, 67 views, 21 triggers, and 5 scheduled events. All data access from the PHP application layer goes through stored procedures — no inline SQL is written in controller or model code.

Domain Overview

DomainTables
Users & Authusuarios, roles, detalleusuarios, accesos, recuperacion
Creditscreditos, cuotas, historicocreditos, historicocuotascreditos
Credit Paymentstransacciones, historicotransacciones
Savings Accountscuentas, transaccionescuentasclientes, transferencias
Productsproductos
References & Vehiclesreferenciaspersonales, datosvehiculoscreditos
Communicationmensajeria, notificaciones
Transfer Securitycodigostransferencias
Systemreporteproblemasplataforma

Table Reference

usuarios

Core identity and permission record for every platform user (clients, employees, management, presidency).
ColumnTypeConstraintsNotes
idusuariosint(11)PK, AUTO_INCREMENTSurrogate key
nombresvarchar(255)NOT NULLFirst name(s)
apellidosvarchar(255)NOT NULLLast name(s)
codigousuariovarchar(255)UNIQUE, NOT NULLLogin username
contraseniavarchar(255)NOT NULLHashed password
correovarchar(255)UNIQUE, NOT NULLEmail address
fotoperfilvarchar(255)DEFAULT foto_usuarios_nuevos.pngProfile photo filename
idrolint(11)FK → roles.idrolAssigned role
estado_usuariovarchar(25)DEFAULT activoactivo / inactivo / bloqueado
completoperfilvarchar(2)DEFAULT nosi once detalleusuarios row inserted
habilitarsistemachar(2)DEFAULT nosi after first installment plan generated
nuevousuariochar(2)DEFAULT siCleared on first login credential change
poseecuentachar(2)DEFAULT noSet to si by trigger on account creation
poseecreditochar(2)DEFAULT noIndicates active credit on file
habilitarnuevoscreditoschar(2)DEFAULT siDisabled while a credit is in progress
quienregistrovarchar(255)NOT NULLcodigousuario of the registering employee

roles

Lookup table for the five platform roles.
ColumnTypeConstraints
idrolint(11)PK, AUTO_INCREMENT
nombrerolvarchar(75)UNIQUE, NOT NULL
descripcionrolvarchar(255)NOT NULL

detalleusuarios

Extended KYC profile for clients — populated during onboarding and required before a credit application can be submitted.
ColumnTypeNotes
iddetalleint(11) PK
duivarchar(10)El Salvador national ID
nitvarchar(17)Tax ID
telefono / celular / telefonotrabajovarchar(9)Contact numbers
direccionvarchar(255)Home address
empresa / cargo / direcciontrabajovarchar(255)Employment details
fechanacimientodate
generochar(1)Single character code
estadocivilvarchar(30)Marital status
fotoduifrontal / fotoduireversovarchar(255)Uploaded document filenames
fotonitvarchar(255)
fotofirmavarchar(255)Signature scan filename
idusuariosint(11)FK → usuarios, ON DELETE CASCADE
A composite UNIQUE constraint exists on (dui, nit) — duplicate identity documents are rejected at the database level.

accesos

Immutable login audit trail. Every successful login appends one row.
ColumnTypeNotes
idaccesoint(11) PKAUTO_INCREMENT
fechaaccesotimestampDEFAULT current_timestamp()
dispositivovarchar(255)Device description
sistemaoperativovarchar(255)OS string
idusuariosint(11)FK → usuarios, ON DELETE CASCADE

recuperacion

One-time tokens for password recovery flows.
ColumnTypeNotes
idrecuperacionesint(11) PKAUTO_INCREMENT
correovarchar(255)NOT NULL
tokenvarchar(255)Random token
codigoint(11)Numeric verification code
fechatimestampIssued at
estadovarchar(15)DEFAULT nousado; set to usado after use

creditos

Central credit application and lifecycle table. Each row represents one credit from submission through full repayment or archival.
ColumnTypeNotes
idcreditosint(11) PKAUTO_INCREMENT
idusuariosint(11)FK → usuarios, ON DELETE CASCADE
idproductoint(11)FK → productos, ON DELETE CASCADE
tipoclientevarchar(50)Asalariado / Independiente / Jubilado
montocreditodecimal(9,2)Approved principal amount
interescreditofloatAnnual interest rate
plazocreditoint(11)Term in months (years × 12 for mortgages)
cuotamensualdecimal(9,2)Computed monthly installment
fechasolicituddateApplication date
salarioclientedecimal(9,2)Declared monthly salary
saldocreditodecimal(15,6)Running principal balance (decremented by triggers)
estadovarchar(30)en proceso / aprobacioninicial / aprobado / denegado / reestructuracion / cancelado — DEFAULT en proceso
observacionesvarchar(1500)Client-side notes
observacion_gerenciavarchar(1500)Gerencia review notes
observacion_presidenciavarchar(1500)Presidencia decision notes
usuario_empleadovarchar(255)codigousuario of the assigning employee
progreso_solicitudtinyint(4)0–100 progress bar value; DEFAULT 10
progreso_pagocreditotinyint(4)Payment progress 0–100; DEFAULT 0
fecha_ultimarevisiontimestampNullable; set on each review action
usuario_gestionandovarchar(255)Last reviewer username
cuotas_generadaschar(2)DEFAULT no; set to si by trigger after installments inserted
copiacontratoclientevarchar(255)Signed contract filename
estadocrediticiovarchar(255)DEFAULT Nuevo Cliente; updated to Excelente / Regular / Deficiente by triggers
proceso_finalizadochar(2)DEFAULT no
enviaralhistoricochar(2)DEFAULT no; set by trigger when history installments written
ocultartransacciones_clienteschar(2)DEFAULT no; hides old transactions from client portal
creditoactivochar(2)DEFAULT si

cuotas

Monthly installment schedule generated after a credit is approved.
ColumnTypeNotes
idcuotasint(11) PKAUTO_INCREMENT
idcreditosint(11)FK → creditos, ON DELETE CASCADE
idproductoint(11)FK → productos
idusuariosint(11)FK → usuarios
montocancelardecimal(9,2)Amount due (increases when overdue penalty applied)
estadocuotavarchar(30)DEFAULT pendiente; set to cancelado by trigger on payment
nombreproductovarchar(255)Denormalized product name
montocapitaldecimal(9,2)Capital portion of installment
fechavencimientodateDue date
incumplimiento_pagochar(2)DEFAULT NO; set to SI by event when overdue, then PT (paid-late) by trigger after payment
disponiblehistoricochar(2)DEFAULT no

historicocreditos and historicocuotascreditos

Archive tables that receive credit and installment records respectively when a credit is fully repaid or deleted. Populated by the trigger EnviarSolicitudesCreditosDenegadas_HistoricoCreditos (on DELETE from creditos) and by the procedure RegistrarCuotasMensualesHistoricoCreditosClientes.

transacciones

Immutable record of every installment payment processed through the platform.
ColumnTypeNotes
idtransaccionint(11) PKAUTO_INCREMENT
idusuariosint(11)FK → usuarios, ON DELETE CASCADE
idproductoint(11)FK → productos, ON DELETE CASCADE
idcreditosint(11)FK → creditos, ON DELETE CASCADE
idcuotasint(11)FK → cuotas, ON DELETE CASCADE
referenciavarchar(255)Payment reference code
montodecimal(9,2)Amount paid
fechatimestampDEFAULT current_timestamp()
dias_incumplimientoint(11)Days overdue at time of payment (0 if on-time)
empleado_gestionvarchar(255)codigousuario of processing employee
An INSERT into transacciones fires eight triggers simultaneously: installment status change, credit balance recalculation, credit status (cancelled if balance = 0), credit rating updates (two triggers), overdue flag reset, payment notification, and history archival.

historicotransacciones

Mirror of transacciones, written by trigger RegistroTransaccionesCuotasCreditosClientes_Historico on every INSERT. Provides an immutable audit log that cannot be affected by cascade deletes on the main tables.

cuentas

Savings account master record. Each user may have at most one active account (enforced by a UNIQUE key on idusuarios).
ColumnTypeNotes
idcuentasint(11) PKAUTO_INCREMENT
numerocuentaint(12)UNIQUE — account number presented to clients
montocuentadecimal(9,2)Current balance (updated by triggers)
fechaaperturatimestampDEFAULT current_timestamp()
idproductoint(11)FK → productos
idusuariosint(11)FK → usuarios, UNIQUE
estadocuentavarchar(50)DEFAULT activa; bloqueada / cerrada

transaccionescuentasclientes

Ledger of every deposit, withdrawal, and transfer movement on a savings account.
ColumnTypeNotes
idtransaccioncuentasint(11) PKAUTO_INCREMENT
idusuariosint(11)FK → usuarios, ON DELETE CASCADE
idproductoint(11)FK → productos, ON DELETE CASCADE
idcuentasint(11)FK → cuentas, ON DELETE CASCADE
referenciavarchar(255)Operation reference code
montodecimal(9,2)Transaction amount
fechatimestampDEFAULT current_timestamp()
empleado_gestionvarchar(255)Teller or Clientes (self-service)
tipotransaccionvarchar(50)Entrada / Salida / EnvioTransferencia / DepositoTransferencia
estadotransaccionvarchar(50)Procesada / AnularDeposito / AnularRetiro
saldonuevocuenta_transacciondecimal(9,2)Balance snapshot after transaction

transferencias

Outbound transfer request record. One row represents a full inter-account transfer; the trigger RecalcularSaldoFinal_TransferenciasClientes debits the source account and credits the destination atomically.
ColumnTypeNotes
idtransferenciaint(11) PKAUTO_INCREMENT
numerocuentaint(11)Source account number
montodecimal(9,2)Transfer amount
referenciavarchar(255)Reference string
fechatimestampDEFAULT current_timestamp()
estadovarchar(15)DEFAULT NoProcesado
idusuariosint(11)FK → usuarios (sender)
idusuariodestinoint(11)FK → usuarios (recipient)
idproductoint(11)FK → productos
idcuentasint(11)FK → cuentas (source)
idcuentadestinoint(11)FK → cuentas (destination)

codigostransferencias

Ephemeral table for OTP security codes used to authorise outbound transfers. A scheduled event expires codes after 2 minutes.
ColumnTypeNotes
idcodigoint(11) PKAUTO_INCREMENT
codigoseguridadint(11)Numeric OTP
fechatimestampDEFAULT current_timestamp()
estadovarchar(50)DEFAULT Valido; set to Vencido by event
idusuariosint(11)FK → usuarios, ON DELETE CASCADE

productos

Financial product catalogue (savings accounts, personal loans, vehicle loans, mortgages, etc.).
ColumnTypeNotes
idproductoint(11) PKAUTO_INCREMENT
codigovarchar(255)Unique product code
nombreproductovarchar(255)Display name
descripcionproductovarchar(255)Short description
requisitosproductosvarchar(1000)Requirements text
estadovarchar(15)activo / inactivo / expirado

referenciaspersonales

Stores two personal/professional references per credit application.
ColumnNotes
idreferencias PK
idcreditosFK → creditos, CASCADE
idusuariosFK → usuarios
idproductoFK → productos
nombres_referencia1, apellidos_referencia1Reference 1 name
empresa_referencia1, profesion_oficioreferencia1, telefono_referencia1Reference 1 employment
nombres_referencia2telefono_referencia2Reference 2 (same structure)

datosvehiculoscreditos

Vehicle details required for vehicle-backed credit products.
ColumnNotes
iddatosvehiculos PK
idcreditosFK → creditos, CASCADE
placavarchar(8) — licence plate
clase, anio, capacidad, asientosVehicle classification
marca, modeloMake and model
numeromotor, chasisgrabado, chasisvinChassis identifiers (varchar(17))
colorvarchar(40)

mensajeria

Internal messaging system allowing any user to send messages to any other user.
ColumnTypeNotes
idmensajeriaint(11) PKAUTO_INCREMENT
idusuariosint(11)FK → usuarios (sender)
nombremensajevarchar(255)Sender display name
asuntomensajevarchar(255)Subject line
detallemensajevarchar(5000)Message body
fechamensajetimestampDEFAULT + ON UPDATE current_timestamp()
idusuariosdestinatarioint(11)FK → usuarios (recipient)
ocultarmensajechar(2)DEFAULT no; set to si to archive
An AFTER INSERT trigger on this table automatically inserts a notification row in notificaciones for the recipient.

notificaciones

Platform notification feed. Every event that should surface in the UI notifications bar writes here.
ColumnTypeNotes
idnotificacionint(11) PKAUTO_INCREMENT
idusuariosint(11)FK → usuarios (recipient)
titulonotificacionvarchar(255)Notification title
descripcionnotificacionvarchar(255)Detail text
fechanotificaciontimestampDEFAULT current_timestamp()
clasificacionnotificacionvarchar(100)Type tag (e.g. nuevomensaje, pagorecibido)
ocultarnotificacionchar(2)DEFAULT no; dismissed notifications set to si

reporteproblemasplataforma

Help-desk ticket table. Users submit bug reports; staff resolve and close them. A scheduled event auto-closes tickets idle for more than 3 days.
ColumnNotes
idreporte PK
idusuariosFK → usuarios
nombrereporteTicket title
descripcionreportevarchar(3000)
fotoreporteScreenshot filename
fecharegistroreportedatetime
fechaactualizacionreportetimestamp ON UPDATE
estadovarchar(50) — open / resuelto / cerrado
comentarioactualizacionStaff response
empleado_gestionHandling employee

Foreign Key Summary

Child TableColumnReferencesOn Delete
accesosidusuariosusuariosCASCADE
codigostransferenciasidusuariosusuariosCASCADE
creditosidusuariosusuariosCASCADE
creditosidproductoproductosCASCADE
cuentasidusuariosusuariosRESTRICT
cuentasidproductoproductosRESTRICT
cuotasidusuariosusuariosNO ACTION
cuotasidcreditoscreditosCASCADE
cuotasidproductoproductosNO ACTION
datosvehiculoscreditosidcreditoscreditosCASCADE
detalleusuariosidusuariosusuariosCASCADE
mensajeriaidusuariosusuariosCASCADE
mensajeriaidusuariosdestinatariousuariosCASCADE
notificacionesidusuariosusuariosCASCADE
referenciaspersonalesidcreditoscreditosCASCADE
reporteproblemasplataformaidusuariosusuariosCASCADE
transaccionesidusuariosusuariosCASCADE
transaccionesidcreditoscreditosCASCADE
transaccionesidcuotascuotasCASCADE
transaccionescuentasclientesidcuentascuentasCASCADE
transferenciasidusuariosusuariosCASCADE
transferenciasidcuentascuentasCASCADE
transferenciasidcuentadestinocuentasCASCADE
usuariosidrolrolesRESTRICT
All 21 tables use ENGINE=InnoDB and DEFAULT CHARSET=utf8mb4, ensuring full referential integrity enforcement and support for the complete Unicode character set, including emoji and multi-byte Latin characters used in names and addresses.

Build docs developers (and LLMs) love