Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Henry4ndrew/saborGestion/llms.txt

Use this file to discover all available pages before exploring further.

The billing module covers the financial end of every shift. It progresses through three stages: invoice generation (facturas), payment registration (pagos), and daily cash register closing (cierres).
Route::resource('facturas', FacturaController::class)->middleware('role:admin,cajero');
Route::resource('pagos', PagoController::class)->middleware('role:admin,cajero');
Route::resource('cierres', CierreCajaController::class)->middleware('role:admin,cajero');

Facturas

Generate a pre-invoice or final invoice from a completed order.

Pagos

Register cash, card, transfer, or other payment methods against an invoice.

Cierre de Caja

Summarize daily totals by payment method and record any observations.

End-of-day workflow

Step-by-step guide to close out a full shift.

Invoices (facturas)

Database schema

Defined in database/migrations/2026_03_21_012544_create_facturas_table.php:
Schema::create('facturas', function (Blueprint $table) {
    $table->id();
    $table->foreignId('pedido_id')->constrained()->onDelete('cascade');
    $table->decimal('total', 10, 2);
    $table->timestamp('fecha')->useCurrent();
    $table->enum('estado', ['prefactura', 'facturado'])->default('prefactura');
    $table->timestamps();
});
ColumnTypeNotes
idbigint (PK)Auto-increment
pedido_idbigint (FK)References pedidos.id; cascades on delete
totaldecimal(10,2)Invoice total amount
fechatimestampInvoice date; defaults to CURRENT_TIMESTAMP
estadoenumprefactura (draft) or facturado (finalised); defaults to prefactura
created_at / updated_attimestampLaravel timestamps

Invoice statuses

StatusDescription
prefacturaDraft invoice, pending customer confirmation or payment
facturadoInvoice has been finalised and issued

Routes

MethodURIAction
GET/facturasindex — list all invoices
GET/facturas/createcreate — show creation form
POST/facturasstore — generate a new invoice
GET/facturas/{factura}show — view invoice detail
GET/facturas/{factura}/editedit — show edit form
PUT/PATCH/facturas/{factura}update — apply changes
DELETE/facturas/{factura}destroy — delete an invoice
Deleting the associated pedido will also delete any invoices linked to it via CASCADE. Finalise the invoice before archiving old orders.

Payments (pagos)

Database schema

Defined in database/migrations/2026_03_21_012545_create_pagos_table.php:
Schema::create('pagos', function (Blueprint $table) {
    $table->id();
    $table->foreignId('factura_id')->constrained()->onDelete('cascade');
    $table->decimal('monto', 10, 2);
    $table->enum('metodo', ['efectivo', 'tarjeta', 'transferencia', 'otro']);
    $table->timestamp('fecha')->useCurrent();
    $table->timestamps();
});
ColumnTypeNotes
idbigint (PK)Auto-increment
factura_idbigint (FK)References facturas.id; cascades on delete
montodecimal(10,2)Amount paid in this transaction
metodoenumPayment method (see below)
fechatimestampPayment date; defaults to CURRENT_TIMESTAMP
created_at / updated_attimestampLaravel timestamps

Payment methods

MethodDescription
efectivoCash payment
tarjetaCredit or debit card
transferenciaBank transfer
otroAny other method

Routes

MethodURIAction
GET/pagosindex — list all payments
GET/pagos/createcreate — show creation form
POST/pagosstore — register a payment
GET/pagos/{pago}show — view payment detail
GET/pagos/{pago}/editedit — show edit form
PUT/PATCH/pagos/{pago}update — apply changes
DELETE/pagos/{pago}destroy — delete a payment
A single invoice can have multiple pago records, for example when a customer splits payment between cash and card. Sum all monto values for a given factura_id to determine the total amount collected.

Cash register closing (cierre de caja)

The cierre_cajas table stores a daily summary of sales broken down by payment method. The cashier creates one record at the end of each shift.

Database schema

Defined in database/migrations/2026_03_21_012546_create_cierre_cajas_table.php:
Schema::create('cierre_cajas', function (Blueprint $table) {
    $table->id();
    $table->timestamp('fecha')->useCurrent();
    $table->decimal('total_ventas', 10, 2)->default(0);
    $table->decimal('total_efectivo', 10, 2)->default(0);
    $table->decimal('total_tarjeta', 10, 2)->default(0);
    $table->decimal('total_otros', 10, 2)->default(0);
    $table->text('observaciones')->nullable();
    $table->timestamps();
});
ColumnTypeNotes
idbigint (PK)Auto-increment
fechatimestampClosing date and time; defaults to CURRENT_TIMESTAMP
total_ventasdecimal(10,2)Grand total of all sales for the period; defaults to 0
total_efectivodecimal(10,2)Total collected in cash; defaults to 0
total_tarjetadecimal(10,2)Total collected by card; defaults to 0
total_otrosdecimal(10,2)Total collected by transfer or other methods; defaults to 0
observacionestext (nullable)Free-text notes (discrepancies, incidents, etc.)
created_at / updated_attimestampLaravel timestamps

Routes

MethodURIAction
GET/cierresindex — list all closing records
GET/cierres/createcreate — show creation form
POST/cierresstore — record a new closing
GET/cierres/{cierre}show — view closing detail
GET/cierres/{cierre}/editedit — show edit form
PUT/PATCH/cierres/{cierre}update — apply corrections
DELETE/cierres/{cierre}destroy — delete a closing record

End-of-day workflow

1

Confirm all orders are closed

Review /pedidos and ensure all active orders have estado = entregado or cancelado. No order should remain in pendiente or preparando before closing.
2

Generate invoices for completed orders

For each delivered order that does not yet have an invoice, go to /facturas/create, select the pedido_id, enter the total, and set estado to prefactura. Review the amounts with the customer and then update estado to facturado.
3

Register payments

For each finalised invoice, go to /pagos/create. Select the factura_id, enter the monto, and choose the metodo (efectivo, tarjeta, transferencia, or otro). Repeat if the payment is split across multiple methods.
4

Tally totals by method

Sum all pagos.monto records for the shift, grouped by metodo, to get your efectivo, tarjeta, and otros subtotals.
5

Create the cierre de caja

Navigate to /cierres/create. Fill in total_ventas with the grand total, and total_efectivo, total_tarjeta, and total_otros with the per-method sums. Add any observaciones for discrepancies and submit.
A quick way to derive the total_ventas figure is to sum all facturas.total values where estado = 'facturado' and fecha falls within the shift period.
There is no automatic reconciliation between the pagos records and the cierre_caja totals — the cashier enters the closing figures manually. Always cross-check against the payments list before submitting the closing record.

Build docs developers (and LLMs) love