Skip to main content
The Reports module enables you to generate comprehensive shipment reports, apply filters, sort data, and export to Excel for further analysis.

Overview

Reports provide detailed views of all shipments with advanced filtering, sorting, and export capabilities. The system automatically adjusts data visibility based on your user role.
Administrators can view all shipments and financial data, while regular users see only shipments assigned to their packages.

Shipment Reports Table

The reports page displays a comprehensive table with the following information:

Regular User Columns

ColumnDescription
IDUnique shipment identifier
PackagePackage name
SourceOrigin location
DestinationDelivery location
MaterialType of material being transported
TransportTransporter company name
VehicleVehicle registration number
Gross WeightTotal weight including container (tons)
Tare WeightEmpty container weight (tons)
Net WeightActual cargo weight (tons)
Departure DateWhen the shipment departed

Admin Additional Columns

Administrators see additional financial columns:
ColumnDescriptionCalculation
Material UnitUnit of measurementFrom materials table
Billing RateRate per ton charged to client₹/Ton
Vendor RateRate per ton paid to vendor₹/Ton
Billing AmountTotal client chargeBilling Rate × Net Weight
Vendor AmountTotal vendor paymentVendor Rate × Net Weight
ProfitNet profit per shipmentBilling Amount - Vendor Amount

Filtering by Date Range

Use the date range picker to filter shipments:
1

Open Date Picker

Click the calendar button in the top-right corner showing “Select date range”
2

Choose Start Date

Select the beginning date for your report period
3

Choose End Date

Select the ending date for your report period
4

Apply Filter

The date range is displayed in the button (e.g., “Jan 01, 2024 - Jan 31, 2024”)
The date picker shows two months side-by-side for easy range selection.

Sorting Data

Click on any column header to sort the data:
  1. First click: Sort ascending (A-Z, 0-9, oldest-newest)
  2. Second click: Sort descending (Z-A, 9-0, newest-oldest)
  3. Arrow indicator: Shows current sort direction
// Sorting is available for all columns
handleSort("transporters.name")  // Sort by transporter
handleSort("quantity_tons")      // Sort by weight
handleSort("departure_time")     // Sort by date

Pagination

Reports are paginated for better performance:
  • Page size: 10 shipments per page
  • Navigation: Use Previous/Next buttons
  • Current position: Displayed as “Page X of Y”
Pagination resets to page 1 when filters or sorting are applied.

Export to Excel

Export shipment data to Excel format for offline analysis:

Export Process

1

Select Date Range

Choose the date range using the date picker (required)
2

Click Export Button

Click the “Export Excel” button in the top-right corner
3

Wait for Processing

A loading spinner appears while the file is being generated
4

Download File

The Excel file automatically downloads with filename format: Shipments_YYYY-MM-DD_to_YYYY-MM-DD.xlsx

Export Features

  • Format: XLSX (Excel)
  • Worksheet name: “Shipments”
  • Headers: First row contains column names
  • Data: Each shipment is a separate row
Regular Users:
  • Package, Source, Destination
  • Transporter, Vehicle
  • Material (name, unit, description)
  • Gross Weight, Tare Weight, Net Weight
  • Departure Time, Remarks
Administrators (additional):
  • Shipment ID
  • Billing Rate, Vendor Rate
  • Billing Amount, Vendor Amount, Profit
  • Dates: “MMM d, yyyy h:mm a” (e.g., “Jan 15, 2024 2:30 PM”)
  • Weights: Two decimal places (e.g., “45.50”)
  • Currency: Two decimal places (e.g., “12500.00”)
  • Empty values: “N/A”

Export Validation

The export button is disabled when:
  • No date range is selected
  • Export is currently in progress
  • You have no assigned packages (regular users)
You must select both start and end dates before exporting. The export will fail with an error message if dates are missing.

Export Example

// Excel file structure for admin export
{
  "ID": 123,
  "Package": "Plant A Deliveries",
  "Source": "Mumbai Warehouse",
  "Destination": "Delhi Distribution Center",
  "Transporter": "Fast Logistics Ltd",
  "Vehicle": "MH-01-AB-1234",
  "Material": "Steel Rods",
  "Material Unit": "Tons",
  "Gross Weight (Tons)": "45.50",
  "Tare Weight (Tons)": "5.50",
  "Net Weight (Tons)": "40.00",
  "Departure Time": "Jan 15, 2024 2:30 PM",
  "Billing Rate (₹/Ton)": 1500,
  "Vendor Rate (₹/Ton)": 1200,
  "Billing Amount (₹)": "60000.00",
  "Vendor Amount (₹)": "48000.00",
  "Profit (₹)": "12000.00",
  "Remarks": "Handle with care"
}

Error Handling

No Data Available

If no shipments are found:
  • All users: “No shipments found in the selected date range”
  • Regular users: “No shipments have been assigned to you”
  • Admins: “No shipments found in the system”

Loading Errors

If data fails to load:
  1. Error icon is displayed
  2. Error message: “Failed to load shipments”
  3. Detailed error description shown
If you encounter export errors, check:
  • Date range is valid
  • You have assigned packages (regular users)
  • Network connection is stable

Role-Based Access

Administrator Access

// Admins see all shipments
query = supabase
  .from("shipments")
  .select("*")
  .gte("departure_time", startDate)
  .lte("departure_time", endDate);

Regular User Access

// Regular users only see assigned packages
const assignedPackages = userProfile.assigned_packages;
query = query.in("package_id", assignedPackages);

Performance Considerations

  • Pagination: Only 10 records displayed per page
  • Query optimization: Date range filtering on database level
  • Export limit: No hard limit, but large date ranges may take longer
  • Caching: Analytics data uses short-term caching
For best performance, limit your date range to specific periods rather than exporting years of data at once.

Use Cases

Financial Analysis

Export admin reports to analyze profit margins and billing efficiency

Operational Review

Review shipment volumes and transporter performance

Compliance Reporting

Generate date-range reports for audit and compliance purposes

Trend Analysis

Export data to external tools for advanced analytics

Dashboard Analytics

View real-time metrics and trends

Shipments

Create and manage shipments

Build docs developers (and LLMs) love