The Reports module (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ProyectoFerretek/FerreMarket/llms.txt
Use this file to discover all available pages before exploring further.
/reportes) focuses exclusively on inventory health. Rather than offering a broad analytics suite, it gives store managers a fast, actionable view of which products are running critically low and which have already hit zero stock — along with supplier contact details, reorder tools, and one-click export to PDF or Excel. It is the primary tool for preventing stock-outs and managing purchase orders.
Views
Two mutually exclusive views are toggled via tab buttons at the top of the report table. Both views share the same filter panel and export controls.Stock Crítico
Shows products where
stock > 0 but stock ≤ nivelMinimo. The row background is yellow (bg-yellow-50) to signal urgency. The Nivel Mínimo column is visible in this view.Sin Stock
Shows products where
stock === 0. The row background is red (bg-red-50). The Tiempo Sin Stock column replaces the Nivel Mínimo column in this view.KPI Summary
Four cards at the top of the page summarise the overall inventory state:| Card | Metric | Source |
|---|---|---|
| Total Productos | Count of all product rows in the catalogue | productos.length |
| Valor Inventario | SUM(precio × stock) across all products (CLP) | calcularValorInventario(productos) from formatters.ts |
| Sin Stock | Count of products with stock === 0 | Filtered from productosExtendidos |
| Stock Crítico | Count of products with 0 < stock ≤ nivelMinimo | Filtered from productosExtendidos |
Supplier Information
Each product row in the report table is extended at runtime with a randomly assigned supplier drawn from theproveedores constant defined in Reportes.tsx:
| Supplier field | Description |
|---|---|
nombre | Company name (e.g. “Ferretería Central”) |
contacto | Supplier email address |
telefono | Supplier phone number |
ArrowUpDown icon — sorting is delegated to the supplier’s nombre string.
Requesting Reorders
Identify the product
Locate the critical or out-of-stock product in the table. Its stock level and supplier details are shown on the same row.
Click Solicitar Reposición
Click the orange Solicitar Reposición button (with a
Truck icon) on the product row. This stores the product in productoSeleccionado state and opens ReposicionModal.Filtering
The filter panel sits inside the report card, directly above the product table. All filters apply to both Crítico and Sin Stock views simultaneously:| Filter | Column filtered | Control type |
|---|---|---|
| Search | nombre and sku (case-insensitive) | Text input |
| Categoría | categoria ID | Select dropdown — all six categories |
| Proveedor | proveedor.id | Select dropdown — all four suppliers |
| Precio mínimo | precio ≥ value | Number input |
| Precio máximo | precio ≤ value | Number input |
| Último pedido desde | ultimoPedido.split('T')[0] ≥ date | Date input |
ArrowUpDown header buttons: SKU, Stock Actual, Proveedor, and Último Pedido all support ascending/descending toggle.
Exporting
Two export buttons appear in the page header, always visible regardless of which view tab is active:Exportar PDF
Calls
generatePDF() which uses jsPDF with the jspdf-autotable plugin. The output is an A4 portrait document containing:- A centred title: “FerreMarket - Reporte de Inventario”
- A subtitle indicating the current view (stock crítico or sin stock)
- The generation date
- A summary table with total products, inventory value, out-of-stock count, and critical-stock count
- The full filtered product table with alternating grey/white row fills
- A paginated footer: “FerreMarket - Reporte de Inventario - Página X de Y”
ferremarket_reporte_inventario_YYYY-MM-DD.pdf.Exportar Excel
Calls
exportarReporte('excel'). The Excel export handler is a placeholder in the current version — it logs to the console and is intended for a future implementation using a library such as SheetJS.productosFiltrados are included in the exported document. Apply filters before exporting to produce targeted reports for specific categories, suppliers, or price ranges.
Estimated Days Without Stock
ThetiempoSinStock field tracks how many calendar days a product has been continuously out of stock. It is computed at runtime when the productosExtendidos array is built:
text-red-600 cell as “X días”. It also appears in the PDF export column header as “Tiempo Sin Stock” (replacing “Nivel Mínimo” which is used in the Crítico view).