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 The target date in ISO 8601 format (YYYY-MM-DD), e.g. 2025-01-15.
Response — ReporteDTO Total revenue generated from table-time charges on the requested day.
Total revenue generated from product/food/drink sales on the requested day.
Combined total revenue (totalMesas + totalConsumos) for the requested day.
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
}
GET /api/reportes/semanal Returns the revenue summary for an arbitrary date range, typically a calendar week. Query Parameters Start date of the range in ISO 8601 format (YYYY-MM-DD), inclusive.
End date of the range in ISO 8601 format (YYYY-MM-DD), inclusive.
Response — ReporteDTO Total revenue from table-time charges across the date range.
Total revenue from product sales across the date range.
Combined total revenue (totalMesas + totalConsumos) across the date range.
Number of fully closed sessions included in the aggregation.
Example curl "http://localhost:8080/api/reportes/semanal?inicio=2025-01-13&fin=2025-01-19" \
-H "Authorization: Bearer $TOKEN "
{
"totalMesas" : 840000.0 ,
"totalConsumos" : 312000.0 ,
"totalGeneral" : 1152000.0 ,
"numeroSesiones" : 97
}
GET /api/reportes/mensual Returns the revenue summary for a full calendar month. The service automatically resolves the first and last day of the given month. Query Parameters Four-digit year, e.g. 2025.
Response — ReporteDTO Total revenue from table-time charges for the full calendar month.
Total revenue from product sales for the full calendar month.
Combined total revenue (totalMesas + totalConsumos) for the full calendar month.
Number of fully closed sessions included in the aggregation.
Example curl "http://localhost:8080/api/reportes/mensual?mes=1&anio=2025" \
-H "Authorization: Bearer $TOKEN "
{
"totalMesas" : 3600000.0 ,
"totalConsumos" : 1340000.0 ,
"totalGeneral" : 4940000.0 ,
"numeroSesiones" : 418
}
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 Target date in ISO 8601 format (YYYY-MM-DD).
Response — IngresoPorMesaDTO[] The table number identifying which physical table this entry refers to.
Total revenue collected on this table (table time + consumptions) during the period.
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
}
]
GET /api/reportes/ingresos-por-mesa/semanal Returns per-table income for an arbitrary date range. Query Parameters Start date in ISO 8601 format (YYYY-MM-DD), inclusive.
End date in ISO 8601 format (YYYY-MM-DD), inclusive.
Response — IngresoPorMesaDTO[] The table number identifying which physical table this entry refers to.
Total revenue collected on this table across the date range.
Number of fully closed sessions played on this table across the date range.
Example curl "http://localhost:8080/api/reportes/ingresos-por-mesa/semanal?inicio=2025-01-13&fin=2025-01-19" \
-H "Authorization: Bearer $TOKEN "
[
{
"numero" : 1 ,
"totalRecaudado" : 378000.0 ,
"numeroSesiones" : 33
},
{
"numero" : 2 ,
"totalRecaudado" : 391500.0 ,
"numeroSesiones" : 35
},
{
"numero" : 3 ,
"totalRecaudado" : 382500.0 ,
"numeroSesiones" : 29
}
]
GET /api/reportes/ingresos-por-mesa/mensual Returns per-table income for a full calendar month. Query Parameters Four-digit year, e.g. 2025.
Response — IngresoPorMesaDTO[] The table number identifying which physical table this entry refers to.
Total revenue collected on this table during the full calendar month.
Number of fully closed sessions played on this table during the full calendar month.
Example curl "http://localhost:8080/api/reportes/ingresos-por-mesa/mensual?mes=1&anio=2025" \
-H "Authorization: Bearer $TOKEN "
[
{
"numero" : 1 ,
"totalRecaudado" : 1620000.0 ,
"numeroSesiones" : 141
},
{
"numero" : 2 ,
"totalRecaudado" : 1680000.0 ,
"numeroSesiones" : 150
},
{
"numero" : 3 ,
"totalRecaudado" : 1640000.0 ,
"numeroSesiones" : 127
}
]
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
Start date of the range in ISO 8601 format (YYYY-MM-DD), inclusive.
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.
Calendar date for this entry, formatted as YYYY-MM-DD.
Total revenue from table-time charges on this day.
Total revenue from product sales on this day.
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 Target date in ISO 8601 format (YYYY-MM-DD).
Response — ProductoTopDTO[] (max 10, sorted by cantidadVendida descending) Product name as stored in the database.
Total units of this product sold across all closed sessions on the target day.
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 }
]
GET /api/reportes/productos-top/semanal Returns the top-selling products for an arbitrary date range. Query Parameters Start date in ISO 8601 format (YYYY-MM-DD), inclusive.
End date in ISO 8601 format (YYYY-MM-DD), inclusive.
Response — ProductoTopDTO[] (max 10, sorted by cantidadVendida descending) Product name as stored in the database.
Total units of this product sold across all closed sessions in the date range.
Total revenue collected from this product across the date range.
Example curl "http://localhost:8080/api/reportes/productos-top/semanal?inicio=2025-01-13&fin=2025-01-19" \
-H "Authorization: Bearer $TOKEN "
[
{ "nombre" : "Cerveza" , "cantidadVendida" : 238 , "totalRecaudado" : 714000.0 },
{ "nombre" : "Gaseosa" , "cantidadVendida" : 154 , "totalRecaudado" : 308000.0 },
{ "nombre" : "Agua" , "cantidadVendida" : 126 , "totalRecaudado" : 189000.0 }
]
GET /api/reportes/productos-top/mensual Returns the top-selling products for a full calendar month. Query Parameters Four-digit year, e.g. 2025.
Response — ProductoTopDTO[] (max 10, sorted by cantidadVendida descending) Product name as stored in the database.
Total units of this product sold across all closed sessions in the calendar month.
Total revenue collected from this product during the calendar month.
Example curl "http://localhost:8080/api/reportes/productos-top/mensual?mes=1&anio=2025" \
-H "Authorization: Bearer $TOKEN "
[
{ "nombre" : "Cerveza" , "cantidadVendida" : 1024 , "totalRecaudado" : 3072000.0 },
{ "nombre" : "Gaseosa" , "cantidadVendida" : 660 , "totalRecaudado" : 1320000.0 },
{ "nombre" : "Agua" , "cantidadVendida" : 541 , "totalRecaudado" : 811500.0 },
{ "nombre" : "Papas fritas" , "cantidadVendida" : 318 , "totalRecaudado" : 795000.0 },
{ "nombre" : "Jugo" , "cantidadVendida" : 275 , "totalRecaudado" : 550000.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
Start date of the range in ISO 8601 format (YYYY-MM-DD), inclusive.
End date of the range in ISO 8601 format (YYYY-MM-DD), inclusive.
Response — TicketPromedioDTO
Total revenue collected across all closed sessions in the date range (totalMesas + totalConsumos).
Total revenue from table-time charges only, across all closed sessions in the range.
Total revenue from product sales only, across all closed sessions in the range.
Number of fully closed sessions in the date range. Used as the denominator for all average calculations.
Average total revenue per closed session: totalFacturado / partidasCerradas.
Average table-time revenue per closed session: totalMesas / partidasCerradas.
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
}
Show Zero-session response example
When no closed sessions exist in the requested range, the API returns: {
"totalFacturado" : 0.0 ,
"totalMesas" : 0.0 ,
"totalConsumos" : 0.0 ,
"partidasCerradas" : 0 ,
"ticketPromedio" : 0.0 ,
"promedioMesa" : 0.0 ,
"promedioConsumos" : 0.0
}