Report Types
The system offers five different report categories:1. Stock Actual (Current Stock)
Shows current inventory levels for all products.Stock actual
- Rubro: Product name
- Categoría: Product category
- Stock: Current quantity with unit
- Estado: Stock status badge (BAJO / MEDIO / OK)
- BAJO (Red):
stock < 10 - MEDIO (Amber):
stock >= 10 AND stock < 50 - OK (Green):
stock >= 50
2. Entradas (Entry Guides)
Displays all inventory entries from approved guides within a date range.Entradas (guías)
Start date filterDefault: First day of current month
End date filterDefault: Today
- Fecha: Entry date
- Guía: SUNAGRO guide number
- Rubro: Product name
- Cantidad: Amount received with unit
3. Salidas (Outputs/Consumption)
Shows all inventory deductions (typically from daily operations).Salidas (menús)
- Fecha: Consumption date
- Rubro: Product name
- Cantidad: Amount consumed with unit
- Motivo: Reason (e.g., “Almuerzo - 774 alumnos”)
4. Lotes por Vencer (Expiring Batches)
Lists all batches approaching expiration within the next 365 days, sorted by expiration date.Lotes por vencer
- Rubro: Product name
- Cantidad Lote: Batch quantity
- Stock Total: Total product stock
- Vencimiento: Expiration date
- Días restantes: Days until expiration with badge
- VENCIDO (Red):
dias_restantes < 0 - X días (Red badge):
dias_restantes <= 7 - X días (Amber badge):
dias_restantes <= 30 - X días (No badge):
dias_restantes > 30
lotes_detalle JSONB field in approved entry guides:
5. Consumo por Rubro (Consumption by Product)
Aggregates total consumption per product within a date range.Consumo por rubro
- Rubro: Product name
- Total consumido: Sum of all consumption
- Veces usado: Number of times the product was used
- Promedio por uso: Average quantity per use
menu_diario and menu_detalle (legacy tables) and groups by product:
Note: This report currently uses legacy
menu_diario/menu_detalle tables. For systems using the newer registro_diario workflow, consumption data comes from the output table instead.CSV Export
All reports can be exported to CSV format using the “Exportar a CSV” button.Export Features
UTF-8 BOM
Files include UTF-8 BOM (
\uFEFF) for proper character encoding in ExcelAuto-filename
Format:
reporte_{type}_{date}.csvExample: reporte_stock_2026-03-03.csvQuoted Fields
Text fields are quoted to handle commas and special characters
Browser Download
Uses Blob API with auto-download link
CSV Structure Examples
Stock Report
Entradas Report
Vencimientos Report
Report UI
Filter Panel
The filter card shows:Data Table
Report data displays in a responsive table with:- Loading state:
<GlobalLoader text="Generando reporte..." /> - Empty state: “No hay datos para este reporte”
- Overflow handling:
overflow-x-autowrapper for horizontal scroll
Table Styling
- Font weight: Product names shown in bold (
font-semibold) - Text size: Secondary info in smaller font (
text-sm) - Badges: Color-coded status indicators
- Alignment: Numeric data right-aligned
Use Cases
Inventory Audits
Export current stock for physical count verification and reconciliation
Procurement Planning
Analyze consumption patterns to forecast reorder quantities and timing
Waste Prevention
Monitor expiring batches to prioritize usage and minimize losses
Budget Reporting
Track entry guide data for budget compliance and government reporting
Consumption Analysis
Identify high-usage items and optimize portion recipes
Historical Trends
Compare consumption across date ranges to identify seasonal patterns
Technical Details
File location:
src/pages/Reportes.jsx:1-386Key Functions
- loadReport(): Dispatcher that calls appropriate report loader based on
reportType - loadStockReport(): Fetches current inventory with categories
- loadEntradasReport(): Queries input table with date filter
- loadSalidasReport(): Queries output table with date filter
- loadVencimientosReport(): Calls
get_lotes_por_vencerRPC - loadConsumoReport(): Aggregates menu_detalle data
- exportToCSV(): Generates CSV file with UTF-8 BOM and triggers download
State Management
Report Auto-reload
- Report type changes
- Date range is modified