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.
What are gastos?
Gastos are the operational expenses incurred by the water board (junta directiva) to maintain the rural water system. These include:- Materials: PVC pipes, fittings, valves, cement, lumber
- Fuel: Gasoline for vehicles and equipment used in field repairs
- Electricity: Annual or monthly power bills for the pump system
- Labor: Day-work payments for community repair crews
- Supplies: Cleaning products, chlorine, stationery, printing
Who can record gastos?
| Role | Access | Can add? |
|---|---|---|
cobrador | /gastos | ✅ Yes |
admin | /gastos | ✅ Yes |
minsa | /reporte | 🔍 Read via reports only |
cliente | — | ❌ No access |
Fields on the expense form
| Field | Input type | Required | Description |
|---|---|---|---|
desc | Text | ✅ | Description or reason for the expense |
monto | Number (step="0.01") | ✅ | Amount in Panamanian balboas (B/.) |
fecha | Date | ✅ | Date the expense occurred (defaults to today) |
addGasto() in gastosService.js generates a record with an auto-prefixed ID (gst-...) and writes it to db.gastos:
Demo expense entries
The following ten entries are pre-loaded into every fresh installation viaDEMO_GASTOS in constants.js. They represent real-world expense categories from a Panamanian rural water board:
| Date | Amount (B/.) | Description |
|---|---|---|
| 28/12/2023 | 126.93 | Compra de materiales e insumos de aseo |
| 06/01/2024 | 596.50 | Pago anual electricidad sistema (bomba) |
| 30/01/2024 | 80.84 | Tubos PVC, llaves de paso y uniones |
| 09/02/2024 | 25.90 | Confección de boletos y papelería |
| 25/03/2024 | 702.50 | Materiales y combustible revisión tuberías |
| 22/04/2024 | 545.50 | Cemento, pago día de trabajo local |
| 11/07/2024 | 65.09 | Pegamento y gasolina (daño toma de agua) |
| 06/08/2024 | 92.25 | Alimentación jornada de limpieza en toma |
| 21/10/2024 | 38.00 | Tablón, tubos blancos PVC |
| 26/11/2024 | 22.07 | Jabón, cloro y meriendas |
initDB() in db.js the first time the app is loaded on a new device:
How gastos feed into MINSA reports
When a MINSA inspector or administrator generates the quarterly report from/reporte, getAllGastos() returns all expense records sorted by date (descending). The export pipeline places them in the Egresos sheet of the Excel workbook (Reporte_SIMAP_YYYY-MM-DD.xlsx), with columns for date, description, and amount.
This sheet is one of the four produced by the reporting module and is required for MINSA transparency obligations. The total from getTotalGastos() appears as the summary figure in the report header.
Soft-delete: gastos are never physically removed
Consistent with SIMAP Digital’s audit-first design, gastos are not physically deleted. ThegastosService.js has no delete function — once an expense is recorded, it remains in db.gastos permanently. This prevents retroactive manipulation of the board’s financial records.
If an entry was made in error, the recommended approach is to record a corrective entry with a negative or offsetting description and note it in the description field for audit clarity.
Only
admin users can manage corrections. Cobradores should flag erroneous entries to the administrator rather than attempting to remove them.Offline behavior
Like all transactional modules in SIMAP Digital, Gastos works fully offline:addGasto()writes directly todb.gastos(IndexedDB via Dexie.js).- A sync task is queued in
db.pendingSyncwithtype: 'ADD_GASTO'and the full record payload. - The expense list and running total update instantly via
useLiveQuery. - When connectivity returns,
syncServiceuploads the pending entry to Supabase.