Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/teofilobetancourt/Restaurant-Equis/llms.txt

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

The Reports API provides two analytical views of restaurant activity. The summary endpoint (/api/reportes/resumen) computes a fixed set of business KPIs by comparing the current 30-day window against the preceding 30-day window, giving management an at-a-glance performance snapshot. The orders report endpoint (/api/reportes/pedidos) offers a filterable, time-bounded view of the full order history, suitable for building data tables and export flows in the dashboard.
All time calculations are performed in UTC using datetime.utcnow(). Ensure your frontend converts timestamps to the appropriate local timezone for display.

30-Day KPI Summary

curl -X GET https://your-api.com/api/reportes/resumen
Returns a single JSON object with five KPI fields covering the current 30-day period (today minus 30 days through now) compared against the preceding 30-day period (today minus 60 days through today minus 30 days). This comparison drives the percentage-change indicators shown on the management dashboard.

How Each Metric Is Computed

MetricComputation
total_pedidosCOUNT(pedido.num_ticket) where fecha_creacion >= now - 30 days
ingresos_brutosSUM(factura.total) joined to orders in the current 30-day window
tiempo_promedio_segAverage elapsed seconds from fecha_creacion to now for all orders in state listo or entregado in the current 30-day window
pct_cambio_pedidos(current_count - previous_count) / previous_count × 100, rounded to 1 decimal. Returns 100.0 if previous count was 0 and current count is positive; 0.0 if both are 0
pct_cambio_ingresosSame percentage formula applied to ingresos_brutos values

Response

total_pedidos
integer
Total number of orders created in the current 30-day window.
ingresos_brutos
number
Sum of all invoice totals (factura.total) linked to orders in the current 30-day window. Represents gross revenue including IVA.
tiempo_promedio_seg
number
Average time in seconds from order creation to the current moment, calculated only over orders whose estado_orden is listo or entregado within the current 30-day window. Returns 0.0 if no qualifying orders exist.
pct_cambio_pedidos
number
Percentage change in order count from the preceding 30-day period to the current 30-day period. Positive values indicate growth; negative values indicate a decline. Rounded to 1 decimal place.
pct_cambio_ingresos
number
Percentage change in gross revenue from the preceding 30-day period to the current 30-day period. Rounded to 1 decimal place.
Example response
{
  "total_pedidos": 143,
  "ingresos_brutos": 4821.60,
  "tiempo_promedio_seg": 2134.5,
  "pct_cambio_pedidos": 12.3,
  "pct_cambio_ingresos": -4.7
}

Filterable Order History

curl -X GET https://your-api.com/api/reportes/pedidos
Returns a list of orders within a configurable time window, optionally filtered by order status. Results are ordered by num_ticket descending (most recent first). Each element of the returned array is the same order object shape produced by GET /api/ordenes — including computed subtotal, iva, total, Estatus_Orden, and nested items.

Query Parameters

estado
string
Filters results to orders matching the given status. Accepted values:
ValueMeaning
recibidoOrder received, not yet in preparation
preparandoOrder currently being prepared in the kitchen
listoOrder ready for pickup or delivery
entregadoOrder delivered to the customer
The special value Todos (capital T) is treated the same as omitting the parameter — all statuses are returned. Values are normalised to lowercase before comparison.
periodo
string
Restricts results to orders created within the selected time window. Accepted values:
ValueWindow
hoyFrom midnight UTC today to the current moment
semanaFrom exactly 7 days ago (UTC) to the current moment
mesFrom exactly 30 days ago (UTC) to the current moment
Omitting this parameter defaults to the last 30 days (same as mes).

Response

Returns an array of order objects. Each object has the same shape as the response from GET /api/ordenes:
id_pedido
integer
Alias for num_ticket.
num_ticket
integer
Unique ticket number of the order.
hora_creacion
string (ISO 8601)
UTC timestamp of order creation.
cliente_nombre
string
Name of the customer who placed the order.
cliente_cedula
string
Customer national ID.
cliente_telefono
string
Customer phone number.
tipo
string
Alias for tipo_pedido. One of mesa, pickup, delivery.
tipo_pedido
string
Order fulfillment type.
mesa
integer | null
Alias for id_mesa. Table number for dine-in orders; null for pickup/delivery orders.
id_mesa
integer | null
Table number for mesa-type orders; null for pickup/delivery. Canonical DB column name.
direccion
string | null
Alias for direccion_envio. Delivery address; null for non-delivery orders.
direccion_envio
string | null
Delivery address used when tipo_pedido is delivery; null otherwise. Canonical DB column name.
items
array
Line items in this order. Each element contains id_producto, id_plato, nombre, cantidad, precio_unitario, and subtotal.
subtotal
number
Sum of all line-item subtotals before tax.
iva
number
16% IVA computed as subtotal × 0.16.
total
number
subtotal + iva.
Estatus_Orden
string
Capitalized display label, e.g. "Listo".
estado_orden
string
Lowercase machine-readable status, e.g. "listo".
Example response (single item)
[
  {
    "id_pedido": 88,
    "num_ticket": 88,
    "hora_creacion": "2024-03-20T18:45:00",
    "cliente_nombre": "María López",
    "cliente_cedula": "V-12345678",
    "cliente_telefono": "0414-1234567",
    "tipo": "delivery",
    "tipo_pedido": "delivery",
    "mesa": null,
    "id_mesa": null,
    "direccion": "Av. Principal, Edificio Sol, Piso 3",
    "direccion_envio": "Av. Principal, Edificio Sol, Piso 3",
    "items": [
      {
        "id_producto": 3,
        "id_plato": 3,
        "nombre": "Pabellón Criollo",
        "cantidad": 2,
        "precio_unitario": 15.50,
        "subtotal": 31.00
      }
    ],
    "subtotal": 31.00,
    "iva": 4.96,
    "total": 35.96,
    "Estatus_Orden": "Entregado",
    "estado_orden": "entregado"
  }
]
Use the periodo=hoy filter on the kitchen display to show only orders placed today. Combine it with estado=preparando to give the kitchen a real-time queue of orders currently being cooked.

Build docs developers (and LLMs) love