Export & Print Results
After generating an inspection report, you can export the data to JSON format for digital archiving or print a formatted report for physical records.Overview
The system provides three main actions for handling inspection results:- Print: Generate a print-friendly version of the report
- Export JSON: Download inspection data in JSON format
- New Form: Reset and start a new inspection
Printing Reports
Print Function Overview
TheimprimirResultados() function (script.js:551-573) creates a print-optimized version of the inspection report.
Click Print Button
After viewing your results, click the “🖨️ Imprimir” button in the action buttons section.Button attributes:
- Label: “🖨️ Imprimir”
- Function:
imprimirResultados() - Styling:
.btn-secondaryclass
Print Preview Generation
The system automatically:
- Saves the current page content
- Creates a print-friendly layout
- Removes interactive elements
- Adds print header and footer
- Opens browser print dialog
Print or Save as PDF
Use your browser’s print dialog to:
- Send to a physical printer
- Save as PDF
- Adjust print settings (orientation, margins, etc.)
Print Layout Format
The printed report includes:Print Timestamp
Each printed report includes an automatic timestamp:The timestamp uses Spanish locale formatting (DD/MM/YYYY and 24-hour time).
Exporting to JSON
Export Function Overview
TheexportarResultados() function (script.js:529-548) creates a downloadable JSON file with complete inspection data.
Click Export Button
Click the ”📥 Exportar JSON” button in the action buttons section.Function:
exportarResultados()JSON Generation
Data is formatted as pretty-printed JSON:The
null, 2 parameters create readable, indented JSON.JSON Structure
The exported JSON file follows this structure:JSON Data Fields
Cliente (Client) Fields
Cliente (Client) Fields
| Field | Type | Description |
|---|---|---|
nombre | string | Client’s first name |
apellidos | string | Client’s surname(s) |
razonSocial | string | Business name or “Particular” |
nAutos | number | Total number of vehicles inspected |
Vehiculos (Vehicles) Array
Vehiculos (Vehicles) Array
Array of vehicle objects, each containing:
| Field | Type | Values | Description |
|---|---|---|---|
numero | number | 1-50 | Vehicle sequence number |
motorizacion | string | Diesel, Gasolina, Hibrido, Electrico | Engine type |
estadoITV | string | Aprobo, NoAprobo | Inspection pass/fail status |
observaciones | string | 0-250 chars | Vehicle condition notes |
Metadata Fields
Metadata Fields
| Field | Type | Format | Description |
|---|---|---|---|
fecha | string | DD/MM/YYYY | Export date |
hora | string | HH:MM:SS | Export time (24-hour) |
File Download Implementation
The export function uses Blob and URL APIs:Reset and New Form
Restart Function
ThereiniciarFormulario() function (script.js:522-526) allows starting a new inspection.
Confirmation Dialog
A browser confirmation dialog appears:Options:
- OK: Proceed with reset
- Cancel: Return to current report
Action Buttons Styling
The action buttons section is added after report generation:Button Styling
Use Cases
Physical Records
Use Print Feature
- Legal documentation
- Customer receipts
- Archive hard copies
- Regulatory compliance
Digital Archive
Use Export Feature
- Database integration
- Long-term storage
- Data analysis
- Backup records
Quick Reference
View on Screen
- Immediate results
- Quick verification
- No storage needed
- Real-time decisions
Next Client
Use Reset Feature
- Start fresh inspection
- New client entry
- Clean slate
- Fast turnaround
Best Practices
Review Before Export/Print
Always review the generated report for accuracy before exporting or printing. Check:
- Client information
- Vehicle counts
- ITV statuses
- Observations
- Total calculations
Save Digital Copies
Export JSON files for all inspections to maintain digital records:
- Create a consistent naming convention
- Store in organized folders by date
- Keep backups of exported files
- Consider database integration
Technical Reference
Key functions for export and print:| Function | Purpose | Location |
|---|---|---|
exportarResultados() | JSON export | script.js:529-548 |
imprimirResultados() | Print report | script.js:551-573 |
reiniciarFormulario() | Reset form | script.js:522-526 |
agregarBotonesAccion() | Add action buttons | script.js:578-605 |
Browser Compatibility
These features work in all modern browsers:- Print: Uses native
window.print()API - Export: Uses Blob and URL APIs (supported in all modern browsers)
- Download: Uses programmatic
<a>element click
For best print results, use Chrome, Firefox, or Edge. Safari may require additional print settings adjustments.
Troubleshooting
Print dialog doesn't open
Print dialog doesn't open
Possible causes:
- Browser pop-up blocker
- Missing print permissions
JSON file doesn't download
JSON file doesn't download
Possible causes:
- Browser download restrictions
- Insufficient permissions
Print layout is broken
Print layout is broken
Possible causes:
- Browser compatibility
- Print CSS not loading