Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/teofilobetancourt/Tradiciones-y-Sabores/llms.txt

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

The Reports module transforms raw order and invoice data into actionable business intelligence. Three KPI cards at the top of the page surface the metrics that matter most—total orders, gross revenue, and average kitchen preparation time—all calculated over a rolling 30-day window and compared against the preceding 30-day period so managers can see at a glance whether the business is trending up or down. Below the KPIs, a paginated order table lets staff drill into individual records filtered by time period and order status, with a one-click CSV export for external analysis.

KPI Summary Cards

The KPI data is fetched from GET /api/reportes/resumen each time the page loads. All metrics cover the current 30-day rolling window (today minus 30 days through now).
MetricFieldDescription
Total Orderstotal_pedidosCount of all orders with a fecha_creacion in the last 30 days
Gross Revenueingresos_brutosSum of factura.total for orders in the last 30 days
Avg. Prep Timetiempo_promedio_segAverage seconds from order creation to completion for listo and entregado orders
Orders Changepct_cambio_pedidosPercentage change in order count vs the prior 30-day period
Revenue Changepct_cambio_ingresosPercentage change in gross revenue vs the prior 30-day period
Percentage-change values are displayed with a trending-up (green) or trending-down (red) arrow indicator. Positive values mean the current period outperformed the prior one.
All KPI comparisons use a rolling 30-day window, not calendar months. The “current” period spans from 30 days ago to now; the “prior” period spans from 60 days ago to 30 days ago. A business open for fewer than 30 days will see the prior-period baseline as zero, which causes percentage changes to display as +100% even on modest current-period numbers.

Revenue Calculation

Revenue figures are read directly from the factura table. Each order generates exactly one invoice record at creation time with the following breakdown:
  • subtotal — sum of all detalle_pedido.subtotal line items
  • impuesto — 16% IVA applied to the subtotal (subtotal × 0.16)
  • totalsubtotal + impuesto (the value summed into ingresos_brutos)
This means the gross revenue figure shown in Reports includes tax. To derive pre-tax revenue, divide ingresos_brutos by 1.16.

Average Preparation Time

tiempo_promedio_seg is computed server-side by finding all orders in the current 30-day window whose estado_orden is listo or entregado, then averaging (now − fecha_creacion) in seconds across those orders. The frontend formats this as Xm YYs for readability (e.g., 12m 34s).

Period and Status Filters

The order table below the KPI cards can be narrowed with two independent filters:
FilterOptionsDefault
Periodhoy (today), 7d (last 7 days), 30d (last 30 days)hoy
StatusTodos, Recibido, Preparando, ListoTodos
Both filters trigger a fresh API call to GET /api/reportes/pedidos with the corresponding periodo and estado query parameters, so the KPI cards and the order table always reflect consistent data for the selected time range.

Browsing and Exporting the Order Table

1

Select a time period

Use the Hoy / 7 días / 30 días toggle in the top toolbar to define the date range for the order table.
2

Filter by status (optional)

Use the status dropdown inside the table toolbar to narrow results to a specific order state.
3

Page through results

The table displays 10 orders per page. Use the numbered pagination controls at the bottom of the table to navigate. The footer shows the current slice (e.g., “Showing 1–10 of 47”).
4

Export to CSV

Click Exportar CSV to download the currently filtered order list as a .csv file named pedidos_YYYY-MM-DD.csv. The export includes: ID Pedido, Hora, Cliente, Cédula, Teléfono, Tipo, Total, and Estado.
For end-of-month accounting, set the period to 30 días and leave the status filter on Todos, then export to CSV. The file will contain all orders for the rolling month—including total and status—ready to import into a spreadsheet for reconciliation.

API Reference

MethodEndpointQuery paramsDescription
GET/api/reportes/resumenReturn the five KPI metrics for the rolling 30-day window
GET/api/reportes/pedidosperiodo, estadoReturn orders filtered by time period and optional status
periodo values: hoy, 7d, 30d (any unrecognized value, including omitted, defaults to last 30 days) estado values: recibido, preparando, listo (omit or pass Todos for no status filter)

Build docs developers (and LLMs) love