The Reportes module generates on-demand PDF documents for store administrators. Two reports are available: a Sales Report that lists every transaction with customer, user, subtotal, IGV, total, and status; and an Inventory Report that lists all products with their codes, categories, current stock, minimum stock, sale price, and a low-stock flag. Both reports are generated server-side at request time using iTextPDF 5.5.13.3 and streamed directly to the client as a file download — no intermediate storage is involved. Access is restricted exclusively to theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/interezante456-pixel/Miercoles-Proyecto/llms.txt
Use this file to discover all available pages before exploring further.
ADMIN role.
GET /api/reportes/ventas
Generate and download the sales report as a PDF file. The report is rendered in A4 landscape orientation and includes a styled header, alternating-row table, and a total count footer.GET http://localhost:8080/api/reportes/ventas
Authorization
Bearer token — requires
ADMIN role. Class-level @PreAuthorize("hasRole('ADMIN')") applies to all endpoints in this module.Response Headers
| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename=reporte-ventas.pdf |
HTTP Status | 200 OK |
PDF Report Contents
The generated document includes the following columns:| Column | Source field |
|---|---|
# | Row index |
N° Venta | venta.numeroVenta |
Cliente | cliente.nombres + apellidos |
Usuario | usuario.nombre + apellido |
Subtotal | venta.subtotal (prefixed S/) |
IGV | venta.igv (prefixed S/) |
Total | venta.total (prefixed S/) |
Estado | venta.estado (COMPLETADA / ANULADA) |
Error Codes
| Status | Meaning |
|---|---|
401 Unauthorized | Token missing, invalid, or expired. |
403 Forbidden | Authenticated user does not have ADMIN role. |
500 Internal Server Error | PDF generation failed (iTextPDF DocumentException). |
cURL — Download sales report
Verify the downloaded file
GET /api/reportes/inventario
Generate and download the inventory report as a PDF file. The report is rendered in A4 portrait orientation and lists all products currently in the catalog with their stock status highlighted.GET http://localhost:8080/api/reportes/inventario
Authorization
Bearer token — requires
ADMIN role.Response Headers
| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename=reporte-inventario.pdf |
HTTP Status | 200 OK |
PDF Report Contents
The generated document includes the following columns:| Column | Source field | Notes |
|---|---|---|
Código | producto.codigo | |
Nombre | producto.nombre | |
Categoría | producto.categoria.nombre | |
Stock Act. | producto.stockActual | Highlighted red if stock ≤ minimum |
Stock Mín. | producto.stockMinimo | |
P. Venta | producto.precioVenta | Prefixed S/ |
Estado | "STOCK BAJO" or "OK" | Red cell when stockActual <= stockMinimo |
Rows where
stockActual <= stockMinimo are flagged visually in the PDF with a red cell background (#FEE2E2) for both the stock column and the status column, making low-stock items immediately visible at a glance.Error Codes
| Status | Meaning |
|---|---|
401 Unauthorized | Token missing, invalid, or expired. |
403 Forbidden | Authenticated user does not have ADMIN role. |
500 Internal Server Error | PDF generation failed (iTextPDF DocumentException). |
cURL — Download inventory report
PDF Generation Library
Both reports are generated using iTextPDF 5.5.13.3 (
com.itextpdf:itextpdf), a battle-tested Java PDF library. Documents are assembled in-memory using ByteArrayOutputStream and streamed directly in the HTTP response body — no temporary files are written to disk. The PDF color palette uses indigo (#6366F1) for column headers and slate (#1E293B) for the document title banner.