Repository navigation
Shipment Report Generator #320
Description
HFH needs to perform high-level financial and logistical analysis that the current UI doesn't support. We need to implement two specific CSV export reports with custom aggregation and date-filtering capabilities. This will involve a two-step modal process to select a report type and apply specific filters before triggering a CSV download.
Frontend Flow
Entry Point: Add a "Generate Reports" button to the Completed Signoffs tab, left of the filter button. When clicked, a two step modal should appear.
Step 1: User selects between:
- Report 1: Shipment & Partner Summary
- Report 2: Donor & Category Summary
Step 2: Based on the selection, show relevant filters (Date Range, Fiscal/Calendar Year, or specific Shipment ID).
On "Submit," the system processes the filtered data and triggers an automatic browser download of the CSV file. Look at PR #316 for guidance on the CSV generation and download portion.
Report 1: Shipment & Partner Summary
Goal: A financial breakdown of what was sent to specific recipients.
Filter/Join Logic: Filter by the selected Date Range or Shipping #.
Group By: shipment_id first, then recipient, then category.
Join: Ensure shipment_id from the signoff matches the shipment_number in the items table.
Columns to Include:
Shipment Number
Recipient
Category
Total Items (Sum of # of containers)
Category Value (Sum of total value for that category)
Shipment Total (Sum of all total value for that specific Shipment ID)
Example Output:
| Shipment # | Recipient | Category | Total Items | Item Type | Shipment Total |
|---|---|---|---|---|---|
| SH-101 | Hope Medical Center | Medication | 500 | 5000.00 | 6200.00 |
| SH-101 | Hope Medical Center | Non-Medication | 200 | 1200.00 | 6200.00 |
Report 2: Donor & Category Summary
Goal: An impact report showing total contributions from donors over a time period.
Filter/Join Logic: Filter by Custom Date Range OR Donor Name OR BOTH
Group By: donor name, then category.
Join: Aggregate all line items across all signoffs that fall within the date range, matched by the donor string.
Columns to Include:
Donor Name
Type
Total Quantity (Sum of # of containers)
Total Value Sent (Sum of total_value for that donor/category combo)
Example Output:
| Donor Name | Category | Total Quantity | Total Value Sent |
|---|---|---|---|
| Direct Relief | Medication | 5000 | 25000.00 |
| Direct Relief | Medical Supplies | 1200 | 8400.00 |
Activity