Overview
The Reports module provides powerful analytics and data export capabilities for Sistema Venta. Generate detailed sales reports filtered by date range, analyze transaction data, and export reports to Excel for further analysis or record-keeping.Accessing Reports
Navigate to Reporte or Reporte Venta (Sales Report) from the main menu to access the reporting interface.Report Interface
The reports page consists of three main sections:Date Filters
Select date range for report generation
Results Table
Detailed line-by-line sales data
Export Options
Download reports as Excel files
Generating a Sales Report
Select Date Range
Choose the reporting period using the date picker fields:
- Fecha Inicio (Start Date): Click the calendar icon, select start date
- Fecha Fin (End Date): Click the calendar icon, select end date
Run the Report
Click the Buscar (Search) button to generate the report.The system will:
- Validate both dates are selected
- Send request to
/Venta/Reporteendpoint - Retrieve all sales within the date range
- Display results in the table below
Both start and end dates are required. The search button remains disabled until both dates are selected (
reporte.component.ts:50-51).Report Data Structure
The sales report displays comprehensive transaction details:Table Columns
| Column | Description | Data Source |
|---|---|---|
| Fecha Registro | Date and time of sale | Transaction timestamp |
| Numero de Venta | Unique sale identifier | numeroDocumento |
| Tipo de Pago | Payment method | Efectivo or Tarjeta |
| Total | Complete sale total | totalVenta |
| Producto | Product name | Individual product |
| Cantidad | Quantity sold | Per product |
| Precio | Unit price | Per product |
| Total por Producto | Line item total | Cantidad × Precio |
Report Format
The report displays line-by-line details, meaning:- Each row represents one product from a sale
- Sales with multiple products appear on multiple rows
- Same sale number appears on multiple rows for multi-item sales
- Enables detailed product-level analysis
Example: Multi-Product Sale
Example: Multi-Product Sale
A single sale with 2 products appears as 2 rows:
Notice both rows share the same sale number and total, but show different products.
| Fecha | Numero Venta | Total | Producto | Cantidad | Precio | Total Producto |
|---|---|---|---|---|---|---|
| 15/03/2026 | 00001 | 1599.98 | Laptop Dell | 1 | 1299.99 | 1299.99 |
| 15/03/2026 | 00001 | 1599.98 | Mouse Logitech | 1 | 299.99 | 299.99 |
Date Range Selection
The report uses Material Design date pickers for easy date selection:Date Picker Features
- Calendar UI: Click calendar icon to open visual date picker
- Month/Year Navigation: Navigate months and years quickly
- Date Format: DD/MM/YYYY (e.g., 05/03/2026)
- Validation: Prevents invalid dates
- Custom Format: Configured via
MY_DATA_FORMATSin component
Date Range Tips
Single Day Report
Set both start and end dates to the same day to see sales for just that date.
Monthly Report
Set start date to first of month and end date to last day for complete monthly sales.
Quarter/Year Report
Select first and last days of quarter or year for longer-term analysis.
Custom Periods
Any date range is supported - analyze week-over-week, promotional periods, or custom ranges.
Viewing Report Results
After generating a report, the data appears in a paginated table:Pagination Options
- 5 rows per page: Quick overview
- 10 rows per page: Moderate detail
- 20 rows per page: Extensive view
- First page button
- Previous page button
- Page numbers
- Next page button
- Last page button
No Results Message
If no sales exist in the selected date range:- Table displays empty
- Alert message: “No se encontraron datos” (No data found)
- Try adjusting date range or verify sales exist in system
Exporting to Excel
Sistema Venta includes built-in Excel export functionality for offline analysis and record-keeping.Generate Report
First, run a report using the date filters. The export button is disabled until report data exists.
Excel Export Features
The exported Excel file includes:- All report columns: Every field from the report table
- All rows: Complete dataset, not just current page
- Single worksheet: Named “Reporte”
- Header row: Column names included
- Raw data: Unformatted data ready for analysis
Excel Export Structure
The exported Excel file contains columns matching the report:Working with Exported Data
Once exported, you can:- Create Pivot Tables: Analyze sales by product, date, payment method
- Build Charts: Visualize trends and patterns
- Apply Formulas: Calculate averages, totals, margins
- Share Reports: Email to stakeholders or archive
- Import to Other Systems: Use in accounting software, BI tools, etc.
Report Analysis Use Cases
Daily Sales Summary
Purpose: Track daily performanceSet date range to current day, export to see total revenue and top products.
Product Performance
Purpose: Identify best/worst sellersGenerate monthly report, export to Excel, create pivot table by product name.
Payment Method Trends
Purpose: Understand customer payment preferencesUse Excel to calculate percentage of cash vs. card sales.
Revenue Analysis
Purpose: Track sales trends over timeExport multiple periods, create chart showing revenue by week/month.
API Integration
The Reports module uses the following API endpoint:Date Formatting
Sistema Venta uses the Moment.js library for consistent date handling:- Input Format: Browser native date picker
- Display Format: DD/MM/YYYY (e.g., 15/03/2026)
- API Format: DD/MM/YYYY string
- Timezone: Uses local browser timezone
- Validation: “Invalid date” detected and rejected
MY_DATA_FORMATS constant (reporte.component.ts:16-24).
Best Practices
Regular Exports
Export reports regularly for backup and offline access. Excel files serve as point-in-time snapshots.
Consistent Periods
Use consistent date ranges (e.g., always month-end to month-end) for trend analysis.
Validate Data
Cross-reference report totals with dashboard or accounting records to ensure accuracy.
Archive Reports
Save exported Excel files with descriptive names including date ranges for easy retrieval.
Advanced Excel Analysis
After exporting, enhance your reports with Excel features:Create Pivot Tables
- Open exported file in Excel
- Select data range
- Insert > PivotTable
- Drag fields to analyze:
- Rows: Producto (to see sales by product)
- Values: Sum of total (total revenue per product)
- Filters: tipoPago (filter by payment method)
Build Charts
- Select data columns
- Insert > Chart (Column, Line, Pie, etc.)
- Visualize trends like:
- Sales over time (line chart)
- Top products (bar chart)
- Payment method distribution (pie chart)
Calculate Metrics
Add columns for calculated metrics:- Profit Margin: If you track cost data
- Average Sale Value: Total ÷ Count of unique numeroDocumento
- Units per Sale: Average quantity per transaction
- Daily Averages: Total revenue ÷ Number of days
Related Components
- Component:
reporte.component.ts- Report generation and export logic - Template:
reporte.component.html- Report interface and filters - Service:
venta.service.ts:26-28- Report data API endpoint - Library: XLSX - Excel file generation (
reporte.component.ts:10) - Library: Moment.js - Date formatting and validation
Troubleshooting
Search button is disabled
Search button is disabled
Invalid date error after clicking search
Invalid date error after clicking search
One or both dates are invalid. This happens when:
- Date picker is opened but no date is selected
- Form is submitted with empty date fields
Report shows no data
Report shows no data
Two possible causes:
- No sales in date range: Try expanding date range or verify sales exist
- API error: Check console for errors, verify backend is running
Export button is disabled
Export button is disabled
Excel file won't open
Excel file won't open
The export generates true .xlsx format. If it won’t open:
- Ensure you have Excel, LibreOffice, or compatible software
- Check download completed successfully (file size > 0)
- Try re-exporting the report
- Verify browser didn’t corrupt download
Report data doesn't match sales history
Report data doesn't match sales history
Reports show line-item details (one row per product), while sales history shows transactions (one row per sale).A sale with 3 products appears as:
- Sales History: 1 row
- Report: 3 rows
Performance Considerations
Large date ranges with many sales may take longer to load. Consider:
- Breaking large date ranges into smaller periods
- Using specific date ranges rather than all-time reports
- Exporting to Excel for faster analysis of large datasets