Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ierinconc/billar-pro-backend/llms.txt

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

The Reports API aggregates data from closed billiard sessions across configurable time windows, giving operators a clear picture of revenue performance. Endpoints span five analytical areas — revenue summaries, per-table income, day-by-day income trends, top-selling product rankings, and average ticket calculations. All endpoints are read-only (GET) and require a valid JWT bearer token in every request.
Every report endpoint filters exclusively for sessions where horaFin IS NOT NULL. Sessions that are still in progress (open sessions) are never included in any aggregation.

Revenue Summary

Aggregate totals for table time, product consumptions, and overall revenue across a chosen time window. All three variants return the same ReporteDTO shape.

GET /api/reportes/diario

Returns the revenue summary for a single calendar day.

Query Parameters

fecha
string
required
The target date in ISO 8601 format (YYYY-MM-DD), e.g. 2025-01-15.

Response — ReporteDTO

totalMesas
Double
Total revenue generated from table-time charges on the requested day.
totalConsumos
Double
Total revenue generated from product/food/drink sales on the requested day.
totalGeneral
Double
Combined total revenue (totalMesas + totalConsumos) for the requested day.
numeroSesiones
Integer
Number of fully closed sessions included in the aggregation.

Example

curl "http://localhost:8080/api/reportes/diario?fecha=2025-01-15" \
  -H "Authorization: Bearer $TOKEN"
{
  "totalMesas": 120000.0,
  "totalConsumos": 45500.0,
  "totalGeneral": 165500.0,
  "numeroSesiones": 14
}

Income by Table

Break down revenue and session counts per physical table for a given time window. Useful for identifying which tables drive the most business. All three variants return an array of IngresoPorMesaDTO.

GET /api/reportes/ingresos-por-mesa/diario

Returns per-table income for a single day.

Query Parameters

fecha
string
required
Target date in ISO 8601 format (YYYY-MM-DD).

Response — IngresoPorMesaDTO[]

numero
Integer
The table number identifying which physical table this entry refers to.
totalRecaudado
Double
Total revenue collected on this table (table time + consumptions) during the period.
numeroSesiones
Integer
Number of fully closed sessions played on this table during the period.

Example

curl "http://localhost:8080/api/reportes/ingresos-por-mesa/diario?fecha=2025-01-15" \
  -H "Authorization: Bearer $TOKEN"
[
  {
    "numero": 1,
    "totalRecaudado": 54000.0,
    "numeroSesiones": 5
  },
  {
    "numero": 2,
    "totalRecaudado": 48500.0,
    "numeroSesiones": 4
  },
  {
    "numero": 3,
    "totalRecaudado": 63000.0,
    "numeroSesiones": 5
  }
]

Income by Day

GET /api/reportes/ingresos-por-dia

Returns a day-by-day breakdown of revenue within a date range. Each entry in the response represents one calendar day that had at least one closed session. Results are sorted in ascending date order, making this endpoint well-suited for building trend charts.

Query Parameters

inicio
string
required
Start date of the range in ISO 8601 format (YYYY-MM-DD), inclusive.
fin
string
required
End date of the range in ISO 8601 format (YYYY-MM-DD), inclusive.

Response — IngresoPorDiaDTO[]

The array is sorted ascending by fecha. Days within the range that have no closed sessions are not included.
fecha
string
Calendar date for this entry, formatted as YYYY-MM-DD.
totalMesas
Double
Total revenue from table-time charges on this day.
totalConsumos
Double
Total revenue from product sales on this day.
totalGeneral
Double
Combined total revenue (totalMesas + totalConsumos) for this day.

Example

curl "http://localhost:8080/api/reportes/ingresos-por-dia?inicio=2025-01-13&fin=2025-01-15" \
  -H "Authorization: Bearer $TOKEN"
[
  {
    "fecha": "2025-01-13",
    "totalMesas": 115000.0,
    "totalConsumos": 42000.0,
    "totalGeneral": 157000.0
  },
  {
    "fecha": "2025-01-14",
    "totalMesas": 98000.0,
    "totalConsumos": 37500.0,
    "totalGeneral": 135500.0
  },
  {
    "fecha": "2025-01-15",
    "totalMesas": 120000.0,
    "totalConsumos": 45500.0,
    "totalGeneral": 165500.0
  }
]
Use this endpoint together with a charting library to render weekly or monthly revenue trend lines. The ascending sort order means you can pass the array directly to most chart data series without any client-side sorting.

Top Products

Rank products by units sold within a chosen time window. The response is capped at 10 entries, sorted by cantidadVendida descending. Only consumptions linked to fully closed sessions are counted.

GET /api/reportes/productos-top/diario

Returns the top-selling products for a single day.

Query Parameters

fecha
string
required
Target date in ISO 8601 format (YYYY-MM-DD).

Response — ProductoTopDTO[] (max 10, sorted by cantidadVendida descending)

nombre
String
Product name as stored in the database.
cantidadVendida
Integer
Total units of this product sold across all closed sessions on the target day.
totalRecaudado
Double
Total revenue collected from this product (sum of line-item subtotals) on the target day.

Example

curl "http://localhost:8080/api/reportes/productos-top/diario?fecha=2025-01-15" \
  -H "Authorization: Bearer $TOKEN"
[
  { "nombre": "Cerveza", "cantidadVendida": 34, "totalRecaudado": 102000.0 },
  { "nombre": "Gaseosa", "cantidadVendida": 22, "totalRecaudado": 44000.0 },
  { "nombre": "Agua", "cantidadVendida": 18, "totalRecaudado": 27000.0 }
]

Average Ticket

GET /api/reportes/ticket-promedio

Calculates per-session averages over a date range, breaking out table time and product consumptions separately. This is the primary KPI endpoint for understanding how much revenue each billiard session generates on average.

Query Parameters

inicio
string
required
Start date of the range in ISO 8601 format (YYYY-MM-DD), inclusive.
fin
string
required
End date of the range in ISO 8601 format (YYYY-MM-DD), inclusive.

Response — TicketPromedioDTO

totalFacturado
Double
Total revenue collected across all closed sessions in the date range (totalMesas + totalConsumos).
totalMesas
Double
Total revenue from table-time charges only, across all closed sessions in the range.
totalConsumos
Double
Total revenue from product sales only, across all closed sessions in the range.
partidasCerradas
Integer
Number of fully closed sessions in the date range. Used as the denominator for all average calculations.
ticketPromedio
Double
Average total revenue per closed session: totalFacturado / partidasCerradas.
promedioMesa
Double
Average table-time revenue per closed session: totalMesas / partidasCerradas.
promedioConsumos
Double
Average product-sales revenue per closed session: totalConsumos / partidasCerradas.
When partidasCerradas equals 0 (no closed sessions found in the range), all three average fields — ticketPromedio, promedioMesa, and promedioConsumos — return 0.0 instead of dividing by zero.

Example

curl "http://localhost:8080/api/reportes/ticket-promedio?inicio=2025-01-01&fin=2025-01-31" \
  -H "Authorization: Bearer $TOKEN"
{
  "totalFacturado": 4940000.0,
  "totalMesas": 3600000.0,
  "totalConsumos": 1340000.0,
  "partidasCerradas": 418,
  "ticketPromedio": 11818.18,
  "promedioMesa": 8612.44,
  "promedioConsumos": 3205.74
}

Build docs developers (and LLMs) love