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 Savings Accounts module allows CashMan H.A. to provide clients with personal deposit accounts alongside their credit facilities. Customer Service staff (Role 4) manage account lifecycle events — opening, activating, blocking, and closing — while both staff and clients can initiate deposits, withdrawals, and inter-account transfers. Transfers are protected by a one-time numeric security code delivered via email, ensuring that no funds move without explicit confirmation from the account holder.

Account Lifecycle

Opening an Account

A new savings account is created by Customer Service via RegistroNuevasCuentasAhorroClientesCashmanha(), which calls the stored procedure RegistroNuevasCuentasAhorroClientesCashmanha. The account is assigned a unique account number (numerocuenta) and an opening date (fechaapertura).

Account States

StateMeaning
activoAccount is open and fully operational
bloqueadoAccount is frozen; no transactions permitted
cerradoAccount is permanently closed

State Transitions

ActionModel MethodStored Procedure
ActivateActivarCuentasAhorroClientes()ActivarCuentasAhorroRegistradasClientes
BlockBloquearCuentasAhorroClientes()BloquearCuentasAhorroRegistradasClientes
CloseCerrarCuentasAhorroClientes()CerrarCuentasAhorroRegistradasClientes
All three operations are handled via AJAX and return JSON responses to update the UI without a full page reload.

Deposits and Withdrawals

Customer Service staff process all cash transactions on behalf of clients. Each transaction records a reference number, the amount, the resulting balance, the processing employee, and a timestamp.
Transaction TypeModel MethodStored Procedure
DepositRegistroDepositosCuentasAhorroClientesCashmanha()RegistroDepositoCuentasAhorrosClientesCashManHa
WithdrawalRegistroRetirosCuentasAhorroClientesCashmanha()RegistroRetiroCuentasAhorrosClientesCashManHa
Void depositAnularDepositosProcesadosClientes()AnularDepositosTransaccionesCuentasClientes
Void withdrawalAnularRetirosProcesadosClientes()AnularRetirosTransaccionesCuentasClientes
Voided transactions update the account balance automatically via database triggers that recalculate saldo_actual on the cuentasahorro table.

Inter-Account Transfers

Transfers between savings accounts registered in the platform follow a two-step verification flow to prevent unauthorised movements of funds.
1

Initiate Transfer & Validate Destination

The initiating user (client or staff) enters the destination account number. The system calls ConsultaDatosClientes_TransferenciasCuentasAhorros() to verify that the destination account exists, is active, and belongs to a registered client.
// Validate destination account before generating security code
$objGestiones->setNumeroCuentaAhorroClientesTransferencias($_POST['numerocuenta']);
$resultado = $objGestiones->ConsultaDatosClientes_TransferenciasCuentasAhorros();
2

Generate & Email Security Code

Once the destination is validated, the system generates a numeric one-time security code. The code is:
  • Emailed to the sender’s registered address via PHPMailer (SMTP)
  • Stored in the codigostransferencias table via RegistroCodigoSeguridad_TransferenciasCuentas(), which calls SP RegistroCodigoSeguridadTransferenciasCuentasClientes, with an initial estado of Valido
// Store the generated code
$objGestiones->setCodigoSeguridad($codigoGenerado);
$resultado = $objGestiones->RegistroCodigoSeguridad_TransferenciasCuentas();
3

User Confirms with Security Code

The user submits the code they received by email. The stored procedure Verifica_ValidacionCodigoSeguridadTransferencias checks the code against the codigostransferencias table, confirming it is Valido and belongs to the current user session.
4

Execute Transfer

After successful code validation, the transfer is finalised by RegistroTransferenciasCuentasClientes(), which calls SP RegistrarTransferenciasEnviadasClientes. This procedure:
  • Debits the sender’s account balance
  • Credits the destination account balance
  • Records the transaction in transaccionescuentasclientes for both accounts
  • Marks the security code as Usado in codigostransferencias
// Execute confirmed transfer
$objGestiones->setIdCuentaAhorroTransferenciaDestinoClientes($_POST['idcuentadestino']);
$objGestiones->setMontoDepositosRetirosCuentas($_POST['monto']);
$resultado = $objGestiones->RegistroTransferenciasCuentasClientes();

codigostransferencias Table Structure

ColumnTypeDescription
codigoseguridadintThe numeric one-time transfer code
fechatimestampWhen the code was generated
estadovarcharValido (unused) or Usado (already consumed)
idusuariosintForeign key to the user who requested the transfer
Transfer security codes have a limited validity window. If a code expires before the user submits it, the validation stored procedure Verifica_ValidacionCodigoSeguridadTransferencias will reject it and the transfer cannot proceed. The user must restart the transfer flow to receive a fresh code.

Build docs developers (and LLMs) love