# Pharmacy reports validation - 2026-05-05

Validated locally against `http://demo.enterfarmaplus.test` with authenticated Playwright requests.

Scope:
- 7 inventory pharmacy reports under `/reports/pharmacy/{report}`.
- 2 analytics pharmacy reports under `/reports/pharmacy-analytics/{report}`.
- Filters included `warehouse_id=1`, `date_start=2026-04-01`, `date_end=2026-05-05`, and report-specific defaults.

Result:
- All 9 report pages loaded without visible 500 errors.
- All 9 `/records` endpoints returned HTTP 200.
- All 9 `/excel` endpoints returned HTTP 200 and valid XLSX content.
- Export headers matched the catalog columns for every report.
- Warehouse-scoped reports returned only warehouse 1 data in the current tenant evidence.

Database evidence:
- `item_lot_movements` latest 6 rows all had `warehouse_id=1`.
- Warehouse 1 is `Almacen Oficina Principal`; warehouse 2 exists as a QA branch and was not mixed into the filtered results.

Code fixes required by validation:
- Removed invalid eager loading of `Document::customer` as a relation in lot trace legacy extraction.
- Used the item-level `stock_min` for stock coverage after warehouse thresholds were removed.
- Sanitized pharmacy export filenames so titles containing `/` do not break Excel download headers.
