# Reorder Report & Manufacturer Emails

_Enterprise_

The Reorder tab surfaces every inventory item at or below its reorder point, grouped by manufacturer, with a suggested order quantity. Two actions per group: "Create PO from suggestions" pre-fills a PO with every below-threshold item, and "Email Report" opens a preview-then-send modal that attaches a manufacturer-scoped PDF and ships it to the vendor.

## Steps
1. Set a reorder point on each tracked item (Inventory > Items > edit item > Reorder Point). Items with reorderPoint = 0 are skipped — they're not tracked.
2. Go to Inventory > Reorder. The screen groups items by manufacturer; each group shows count + total suggested units + per-item rows (current qty, reorder point, suggested qty).
3. For one-click PO creation: click "Create PO from suggestions" on a group. The Purchase Orders tab opens with a pre-filled PO ready to save.
4. For email-out: click "Email Report" on a group. A two-pane modal appears — PDF preview on the left (iframe), recipient/subject/body on the right. Edit the message if needed, hit Send.
5. The PDF is a single-manufacturer reorder report — branded, paginated, with per-item current/reorder/suggested columns and the manufacturer contact info in the header.

## Tips
- Suggested qty formula: max(reorderQuantity ?? 0, reorderPoint × 2 − quantityOnHand), floored at 1. Items with a configured reorderQuantity respect it; items without one get a "top up to twice the threshold" fallback.
- The "Unassigned" group surfaces items with no manufacturer link. You can't email or create a PO for this group — assign a manufacturer first.
- Sandbox orgs intercept the email — the manufacturer never receives it. Useful for verifying the workflow without sending real procurement requests.
- The same endpoint serves both web preview and the email attachment, so what you see in the iframe is exactly what the vendor receives.

## Example
Monday-morning replenishment ritual: open Reorder, see 18 items below threshold across 5 vendors. Click Email Report on three with known-reliable vendors — done. The remaining two need a phone call first, so click Create PO from suggestions, draft the email separately. Total time: 4 minutes instead of an hour of spreadsheet copy-paste.

## Troubleshooting
- **"No items currently below reorder threshold for this manufacturer"** — You clicked Email Report but in the time between page-load and click, every item for that vendor was restocked or its threshold was raised. Fix: Refresh the Reorder tab — the group should disappear from the list. If it persists, check each item's reorder point and quantity manually.
- **"Manufacturer has no email on file"** — The Manufacturer record has no email field populated. Fix: In the modal's "To" field, type the recipient address directly. Or go to Inventory > Manufacturers > edit the vendor and save its email so future sends pre-fill automatically.
- **Reorder tab shows zero items even though stock looks low** — Items are filtered to reorderPoint > 0 AND quantityOnHand ≤ reorderPoint. Items without a configured reorder point are skipped — they're not "tracked" for replenishment. Fix: Set a non-zero reorder point on items you want monitored. Items track only after that.

## Plans
Enterprise suite required. Email-out uses one Resend API call per send.
