import { PurchaseOrderFulfillmentForm } from "@/components/purchase-order-fulfillment-form"; import { PurchaseOrderForm } from "@/components/purchase-order-form"; import { formatCurrency, formatDate } from "@/lib/format"; import { getLowStockParts, getOrderItemOptions, getPurchaseOrderLineDetails, getPurchaseOrders, getVendors } from "@/lib/repository"; export default function PurchaseOrdersPage() { const vendors = getVendors(); const items = getOrderItemOptions(); const orders = getPurchaseOrders(); const orderLines = getPurchaseOrderLineDetails(); const lowStockParts = getLowStockParts(); return (

Create Purchase Order

Build the PO from real inventory items so receipts, costing, and restocking stay relational.

Receiving Flow

Receive relational order lines directly by entering quantities against the remaining balance on each line.

{orders.length === 0 ? ( ) : ( orders.map((order) => ( )) )}
OrderVendorStatusTotalQty ProgressCreatedAction
No purchase orders yet.
{order.orderNumber} {order.vendorName} {order.status} {formatCurrency(order.totalAmount)} {order.fulfilledQuantity} / {order.orderedQuantity} {formatDate(order.createdAt)} {order.status === "received" ? ( Received ) : ( line.purchaseOrderId === order.id && line.remainingQuantity > 0)} /> )}

Restock Recommendations

Use this list to plan the next purchase order from items already below target.

{lowStockParts.length === 0 ? ( ) : ( lowStockParts.map((part) => ( )) )}
SKUNameOn HandReorder PointSuggested QtyLast Vendor
No parts currently need restocking.
{part.sku} {part.name} {part.quantityOnHand} {part.unitOfMeasure} {part.reorderPoint} {part.suggestedReorderQuantity} {part.preferredVendorName || "-"}
); }