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

Create Purchase Order

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

Receiving Flow

Leave line quantities blank to receive the remaining balance, or enter `SKU,quantity` rows for a partial receipt.

{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 ) : (