Skip to main content

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

1

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
Date format: DD/MM/YYYY (e.g., 15/03/2026)
2

Run the Report

Click the Buscar (Search) button to generate the report.The system will:
  • Validate both dates are selected
  • Send request to /Venta/Reporte endpoint
  • Retrieve all sales within the date range
  • Display results in the table below
3

Review Results

The report table shows detailed transaction data with pagination support. Review the data or proceed to export.
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

ColumnDescriptionData Source
Fecha RegistroDate and time of saleTransaction timestamp
Numero de VentaUnique sale identifiernumeroDocumento
Tipo de PagoPayment methodEfectivo or Tarjeta
TotalComplete sale totaltotalVenta
ProductoProduct nameIndividual product
CantidadQuantity soldPer product
PrecioUnit pricePer product
Total por ProductoLine item totalCantidad × 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
A single sale with 2 products appears as 2 rows:
FechaNumero VentaTotalProductoCantidadPrecioTotal Producto
15/03/2026000011599.98Laptop Dell11299.991299.99
15/03/2026000011599.98Mouse Logitech1299.99299.99
Notice both rows share the same sale number and total, but show different products.

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_FORMATS in 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
Use the pagination controls to navigate:
  • 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.
1

Generate Report

First, run a report using the date filters. The export button is disabled until report data exists.
2

Click Export

Click the red Exportar Excel (Export Excel) button above the report table.
3

Download File

The system generates an Excel file named “Reporte Ventas.xlsx” and downloads it to your browser’s download folder.

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
The export uses the XLSX library (reporte.component.ts:93-99) to generate true Excel files, not CSV. This preserves data types and allows for advanced Excel features like formulas, charts, and pivot tables.

Excel Export Structure

The exported Excel file contains columns matching the report:
| fechaRegistro | numeroDocumento | tipoPago  | totalVenta | producto      | cantidad | precio  | total   |
|---------------|-----------------|-----------|------------|---------------|----------|---------|---------|
| 15/03/2026    | 00001          | Efectivo  | 1299.99    | Laptop Dell   | 1        | 1299.99 | 1299.99 |
| 15/03/2026    | 00002          | Tarjeta   | 599.98     | Mouse         | 2        | 299.99  | 599.98  |

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:
// Get sales report by date range
GET /Venta/Reporte?fechaInicio={DD/MM/YYYY}&fechaFin={DD/MM/YYYY}

// Example
GET /Venta/Reporte?fechaInicio=01/03/2026&fechaFin=31/03/2026

// Response structure
{
  "status": true,
  "value": [
    {
      "fechaRegistro": "15/03/2026 14:30:00",
      "numeroDocumento": "00001",
      "tipoPago": "Efectivo",
      "totalVenta": "1299.99",
      "producto": "Laptop Dell Inspiron 15",
      "cantidad": 1,
      "precio": "1299.99",
      "total": "1299.99"
    },
    // ... more line items
  ]
}

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
The formatting is configured via 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

  1. Open exported file in Excel
  2. Select data range
  3. Insert > PivotTable
  4. 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

  1. Select data columns
  2. Insert > Chart (Column, Line, Pie, etc.)
  3. 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
  • 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

Both date fields must be filled before you can search. Click the calendar icon on each field and select dates.Check that:
  • Fecha Inicio is selected
  • Fecha Fin is selected
  • Both dates are valid
Two possible causes:
  1. No sales in date range: Try expanding date range or verify sales exist
  2. API error: Check console for errors, verify backend is running
Alert message: “No se encontraron datos”
The export button remains disabled until report data exists. Generate a report first by:
  1. Selecting date range
  2. Clicking Search
  3. Waiting for results to load
Export button enables when listaVentasReporte.length > 0
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
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
This is expected behavior for detailed analysis.

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
The report table includes pagination to handle large result sets efficiently, displaying 5-20 rows at a time based on your preference.

Build docs developers (and LLMs) love