The Cash Registers module is the backbone of every cashier shift in Kantuta POS. A Caja (physical register) holds configuration like its name and operational specialty. A SesionCaja represents a single cashier turn — it opens with a declared starting balance and closes with a physical count. When the session closes, the backend automatically computesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Eleazarguitar18/kantuta_pos_front/llms.txt
Use this file to discover all available pages before exploring further.
monto_final_teorico from all tracked movements and derives the diferencia for reconciliation. MovimientoCaja records any ad-hoc cash in-flows or out-flows during the session.
TypeScript Interfaces
Endpoints
List All Cajas
GET /cajas — Returns all active cash register records. Inactive registers (soft-deleted) are filtered automatically.
Response: Caja[]
Create a Caja
POST /cajas — Creates a new physical cash register.
Display name for the register. Minimum 3 characters.
Determines which operations the register accepts. One of:
SOLO_VENTAS, SOLO_AGENTES, or MIXTA.Optional opening balance to set on the register record. Separate from the session’s
monto_inicial.ID of the user creating the record. Injected automatically by the frontend service from the logged-in user’s session.
Caja
Get Caja by ID
GET /cajas/:id — Returns a single register with its full session history.
Caja — includes the sesiones array with all historical sessions.
Update a Caja
PATCH /cajas/:id — Partially updates a cash register. Accepts any subset of CrearCajaRequest fields.
New display name for the register.
Updated specialty:
SOLO_VENTAS, SOLO_AGENTES, or MIXTA.Caja (updated object)
Delete a Caja (Soft Delete)
DELETE /cajas/:id?id_user_update=N — Marks the register as inactive. The record is not removed from the database.
ID of the user performing the deletion. Required for audit trail.
void
Get Active Session for a User
GET /cajas/sesion-activa/:userId — Returns the currently open session assigned to a given cashier user.
SesionCaja with estado_sesion: "ABIERTA", or null if no active session exists.
Open a Session
POST /cajas/abrir — Opens a new cashier session (starts a shift). Only one session per user can be open at a time.
ID of the physical register to open.
The starting cash balance declared by the cashier (used as the base for theoretical reconciliation).
ID of the cashier opening the session.
Audit user ID (usually the same as
id_usuario). Auto-injected by the frontend service.SesionCaja with estado_sesion: "ABIERTA" and a populated fecha_apertura.
Close a Session (Reconciliation)
PATCH /cajas/sesion/:id/cerrar — Closes an open session and triggers the backend reconciliation calculation.
The physical cash count performed by the cashier at end-of-shift.
ID of the user closing the session. Auto-injected by the frontend service.
SesionCaja — The returned object includes the backend-computed fields:
Calculated by the backend as:
monto_inicial + sum of all INGRESO movements − sum of all EGRESO movements recorded during the session.Computed as
monto_final_real − monto_final_teorico. A positive value indicates a surplus; a negative value indicates a shortage.Set to
"CERRADA" upon successful close.ISO 8601 timestamp of when the session was closed.
The reconciliation formula is: Teorico = monto_inicial + Σ INGRESOS − Σ EGRESOS. The
diferencia is the discrepancy between what should be in the register and what was physically counted. A value of 0.00 indicates a perfect balance.Get Session Balance
GET /cajas/sesion/:id/balance — Retrieves a real-time balance summary for an open session, including all movements registered so far.
Register an Internal Movement
POST /cajas/movimiento — Records an ad-hoc cash in-flow (INGRESO) or out-flow (EGRESO) within an active session. These movements are factored into the theoretical balance at close.
Movement direction:
INGRESO (cash in) or EGRESO (cash out).Amount of the movement. Minimum value:
0.10.Free-text justification for the movement (e.g., “Pago de servicios”, “Fondo de cambio adicional”).
ID of the active session to which this movement belongs.
Audit user ID. Auto-injected by the frontend service.
MovimientoCaja
Reconciliation Logic
WhenPATCH /cajas/sesion/:id/cerrar is called, the backend executes the following reconciliation steps:
- Fetch all movements — Retrieves every
MovimientoCajalinked to the session’sid. - Sum inflows — Adds all movements with
tipo: "INGRESO". - Sum outflows — Adds all movements with
tipo: "EGRESO". - Compute theoretical balance —
monto_final_teorico = monto_inicial + Σ INGRESOS − Σ EGRESOS. - Compute difference —
diferencia = monto_final_real − monto_final_teorico. - Set session state —
estado_sesionis set to"CERRADA"andfecha_cierreis stamped.
diferencia of 0.00 means the physical count matches the system exactly. Positive values indicate a surplus (more cash than expected); negative values indicate a shortage.