Overview
The reporting system generates comprehensive PDF reports for each permit type, providing detailed breakdowns by status and authorization state. Reports are useful for auditing, record-keeping, and administrative oversight.Report types
Alcoholic beverages
Complete report of all beverage sales permits
Advertising
Full advertising and propaganda permit report
Special events
Comprehensive special events permit report
Generating reports
Alcoholic beverage reports
Generate a complete report for all alcoholic beverage permits:Content-Type: application/pdf
Advertising reports
Generate a complete report for all advertising permits:Event reports
Generate a complete report for all special event permits:Reports are generated on-demand and include all permits from the database at the time of generation.
Report structure
All reports follow a consistent structure with the following sections:Header section
- Report title (e.g., “Reporte Completo de Permisos de Venta de Bebidas Alcohólicas”)
- Generation timestamp
- Summary statistics
Summary statistics
Each report includes aggregate counts:Total number of registered permits (all statuses)
Number of approved permits (emitido=1, cancelado=0)
Number of pending permits (emitido=0)
Number of cancelled permits (cancelado=1)
Data tables
The report contains multiple tables, each with permits grouped by status:Permisos Emitidos (Approved permits)
Permisos Emitidos (Approved permits)
Approved permits that are active.Columns:
- Código (Permit code)
- Requisitor (Applicant name)
- Autorizado por el DAT (Payment authorized: Sí/No)
- F. de Registro (Registration date)
Permisos no Emitidos (Pending permits)
Permisos no Emitidos (Pending permits)
Permits awaiting approval.Columns:
- Código
- Requisitor
- Autorizado por el DAT
- F. de Registro
Permisos Cancelados (Cancelled permits)
Permisos Cancelados (Cancelled permits)
Permits that were cancelled with observations.Columns:
- Código
- Requisitor
- Autorizado por el DAT
- F. de Registro
Permisos Autorizados (Authorized permits)
Permisos Autorizados (Authorized permits)
Permisos no Autorizados (Unauthorized permits)
Permisos no Autorizados (Unauthorized permits)
Report generation process
The system follows this process to generate reports:Report sections in detail
Emitted permits section
This section shows all permits that have been approved and are currently active:Not emitted permits section
Pending permits awaiting approval decision:This section helps administrators identify permits that need review.
Cancelled permits section
Permits that were cancelled, preserved for record-keeping:Authorization tracking
Separate sections track payment authorization status:Date formatting
Dates are formatted for display using the global functions:Report customization
The report template is located at:src/views/templates/reporte.html
Template placeholders
Template placeholders
{{host}}- Server hostname{{titleReport}}- Report title{{cuentas}}- Summary statistics string{{html}}- All report sections HTML{{todos}}- Total permits table (if needed)
PDF configuration
The system uses these PDF generation settings:PhantomJS is used as the rendering engine to convert HTML to PDF. Ensure it’s properly installed in production.
Performance considerations
Optimization tips
Database indexes
Ensure indexes exist on
emitido, cancelado, and dat_confirmacion fields.Caching
Consider caching reports for a short period (e.g., 5 minutes) if frequently accessed.
Pagination
For very large datasets, consider paginating or filtering reports by date range.
Async generation
For production, consider generating reports asynchronously and notifying when ready.
Common report use cases
Monthly audit
Monthly audit
Generate reports at the end of each month to review:
- Total permits processed
- Approval/rejection rates
- Outstanding pending permits
- Payment confirmation status
Year-end reporting
Year-end reporting
Use reports for annual statistics:
- Total permits issued per year
- Trends over time
- Compliance tracking
Department review
Department review
Managers can use reports to:
- Monitor staff workload
- Identify bottlenecks
- Track processing times
Troubleshooting
Report shows no data
Report shows no data
Possible causes:
- No permits in the database for that type
- Database connection issue
- Query error
PDF generation fails
PDF generation fails
Possible causes:
- PhantomJS not installed or not in PATH
- Insufficient memory
- Template rendering error
Report formatting issues
Report formatting issues
Possible causes:
- Template HTML errors
- Missing CSS styles
- Data formatting problems
Next steps
Individual permit PDFs
Learn how to generate PDFs for individual permits
Database schema
Understand the data structure behind reports