Overview
Alcoholic beverage permits are required for businesses that want to sell alcoholic beverages within the municipality. These permits track the authorization period, schedule, and location where beverages can be sold.Required Fields
When creating or editing an alcoholic beverage permit, the following information is required:Start date when the permit becomes valid (issue date)
Expiration date of the permit
Authorized schedule for alcoholic beverage sales (e.g., “8:00 AM - 10:00 PM”)
Applicant’s first name
Applicant’s last name
Applicant’s identification document number
Applicant’s phone number
Applicant’s address or location
Sector or area where the permit is authorized (sector_permisado)
Payment receipt file upload (optional)
Current date in YYYY-MM-DD format for validation
Creating a Permit
To create a new alcoholic beverage permit, send a POST request with multipart form data:Request Body
Response
YYYY-NNN (year + sequential number).
Error Responses
Editing a Permit
Update an existing permit by sending a POST request:Request Body
All fields from creation plus:ID of the permit to edit
Set to “true” if updating the payment receipt, “false” otherwise
Example
Response
Approving a Permit
Approve a permit by uploading the authorized permit document:Request Body
ID of the permit to approve
Authorized permit document file
Example
Response
emitido field is set to 1 (approved status).
Canceling a Permit
Cancel a permit with an observation note:Request Body
ID of the permit to cancel
Reason for cancellation
Example
Response
Searching and Filtering
Search for permits with various filters:Request Body
Search term to filter results (searches across permit code, dates, applicant name, document, phone, sector)
Filter by status: “Todos” (all), “Emitido” (approved), or “No Emitido” (not approved)
Example
Response
Returns HTML template with search results:- Red (disaproved): Not approved (
emitido=0) - Green (aproved): Approved (
emitido=1,cancelado=0) - Gray (canceled): Canceled (
cancelado=1)
Getting Permit Details
Retrieve details for a specific permit:Request Body
Permit ID
Response
Listing All Permits
Get all alcoholic beverage permits:permisos_bebidas table.
PDF Generation
Generate a PDF document for a specific permit:bebidas-alcoholicas_{codigo_permiso}
Response
Returns a PDF document with:- Content-Type:
application/pdf - Permit details formatted using the template at
views/templates/permisos/bebidas.html - Information includes: permit code, dates, schedule, applicant details, authorized area
Deleting a Permit
Delete a permit (only if not approved):Request Body
ID of the permit to delete
Response
Restrictions
- Cannot delete permits that have been approved (
emitido=1) - Cannot delete if newer permits from the same year have already been approved
- When deleted, subsequent permit codes are automatically renumbered
Error Responses
Report Generation
Generate a comprehensive PDF report of all alcoholic beverage permits:- Total registered permits
- Approved permits (emitido)
- Not approved permits (no emitido)
- Canceled permits
- Payment confirmation status
- Detailed tables for each category
Database Schema
Thepermisos_bebidas table structure:
| Field | Type | Description |
|---|---|---|
| id | int | Primary key |
| codigo_permiso | varchar | Unique permit code (YYYY-NNN) |
| habilitacion | date | Start/issue date |
| vencimiento | date | Expiration date |
| horario | varchar | Authorized schedule |
| dat_confirmacion | tinyint | Payment confirmed (0 or 1) |
| requisitor_nombre | varchar | Applicant first name |
| requisitor_apellido | varchar | Applicant last name |
| requisitor_doc | varchar | ID document |
| requisitor_tlf | varchar | Phone number |
| requisitor_habitacion | varchar | Address |
| sector_permisado | varchar | Authorized sector |
| comprobante_de_pago | varchar | Payment receipt filename |
| permiso_autorizado | varchar | Authorized permit filename |
| creador | varchar | Creator name |
| editor | varchar | Last editor name |
| fecha_creacion | timestamp | Creation date |
| emitido | tinyint | Approval status (0 or 1) |
| cancelado | tinyint | Canceled status (0 or 1) |
| observacion | text | Cancellation notes |
File Storage
Files are stored in:- Payment receipts:
comprobante_de_pago_{timestamp}{extension} - Authorized permits:
permiso_autorizado{timestamp}{extension}