The Reports module (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AdriP-maker/JAAR_Antigravity/llms.txt
Use this file to discover all available pages before exploring further.
/reporte) is the primary interface for MINSA inspectors and the financial transparency tool for admins and collectors. It reads directly from the local IndexedDB store, so every report can be generated fully offline without any server connection.
| Role | Access Level |
|---|---|
minsa | Primary user — redirected here automatically on login, read-only |
cobrador | Secondary — can view and export financial summaries |
admin | Secondary — full access to reports and export |
Route
ROLE_HOME constant in src/utils/constants.js maps the minsa role directly to this route:
Dashboard Metrics
The page surfaces four live summary cards populated via DexieuseLiveQuery hooks:
| Card | Calculation |
|---|---|
| Ingresos (Pagos) | Sum of all pagos.monto values (fallback: B/.3.00 per record) |
| Egresos (Gastos) | Sum of all gastos.monto values |
| Balance Neto | totalIngresos − totalEgresos |
| Comunidad | Count of all entries in db.usuarios |
formatMonto() from src/utils/formatters.js.
Export: Excel (.xlsx)
The Excel export uses SheetJS (xlsx), bundled locally so it works without internet. The exported workbook contains two sheets:
| # | Sheet Name | Contents |
|---|---|---|
| 1 | Ingresos | All payment records with date, type, and amount |
| 2 | Egresos | All expense records with date, description, and amount |
Reporte_SIMAP_YYYY-MM-DD.xlsx
Export: PDF
The PDF export uses jsPDF + jsPDF-autotable, also bundled locally.- Institution header with report date
- Resumen de Ingresos table with
gridtheme - Resumen de Egresos table appended below
- Summary totals (Total Ingresos, Total Egresos, Saldo a Favor in bold)
- Signature line for the President / Treasurer
Reporte_SIMAP_YYYY-MM-DD.pdf
Report Data Sources
The export pulls data from two Dexie tables:Ingresos
Allpagos records, drawn from db.pagos:
| Field | Source | Description |
|---|---|---|
fecha | pagos.fecha | Date of payment |
tipo | pagos.tipo | Payment type (e.g., mensual, parcial, multi_mes) |
monto | pagos.monto | Amount paid in B/. (fallback: 3.00) |
Egresos
Allgastos records, drawn from db.gastos:
| Field | Source | Description |
|---|---|---|
fecha | gastos.fecha | Date of expense |
descripcion | gastos.descripcion | Description of the expense |
monto | gastos.monto | Amount in B/. |
MINSA Inspector Workflow
The following scenario matches Escenario 4 from the project requirements (docs/requisitos.md):
Log in as minsa
Use credentials
minsa / 1234. The system authenticates via authService.js and reads the ROLE_HOME mapping.Automatic redirect to /reporte
The router guard detects the
minsa role and redirects immediately to /reporte — no navigation required.Review dashboard metrics
The four summary cards (Ingresos, Egresos, Balance Neto, Comunidad) update live via
useLiveQuery, giving an instant financial snapshot without any interaction.Offline Report Generation
Reports are generated entirely from local IndexedDB data via Dexie.js — no network request is made during export. A MINSA inspector can download a complete Excel or PDF report even when the device has no internet connection, as long as the data has been synced at least once beforehand. Both the SheetJS and jsPDF libraries are bundled locally in the app.
Export Libraries Reference
| Library | Version | Purpose | Bundle |
|---|---|---|---|
xlsx (SheetJS) | included locally | .xlsx multi-sheet workbook generation | Local |
jspdf | npm package | PDF document creation | Bundled |
jspdf-autotable | npm package | Auto-formatted tables in PDF | Bundled |