From d59a0a563df68f3b1bdb456a9cd558f6f669108c Mon Sep 17 00:00:00 2001 From: jason Date: Mon, 23 Mar 2026 17:12:35 -0500 Subject: [PATCH] fixes --- README.md | 2 + app/assemblies/page.tsx | 21 ++-- app/purchase-orders/page.tsx | 16 +-- app/sales-orders/page.tsx | 16 +-- .../purchase-order-fulfillment-form.tsx | 74 +++++++++++++ components/sales-order-fulfillment-form.tsx | 76 +++++++++++++ lib/actions.ts | 104 +++++++++++++++--- lib/repository.ts | 50 +++++++++ lib/types.ts | 27 +++++ 9 files changed, 346 insertions(+), 40 deletions(-) create mode 100644 components/purchase-order-fulfillment-form.tsx create mode 100644 components/sales-order-fulfillment-form.tsx diff --git a/README.md b/README.md index c9fb1db..750bd3c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Inven is a single-container inventory management system for Unraid-style deploym - Sales orders can be created and shipped - Purchase orders can be created and received - Sales orders and purchase orders are created from relational inventory line selections +- Shipping and receiving are posted from relational order-line quantity controls - Sales orders support partial shipments - Purchase orders support partial receipts - Invoices are generated from shipped sales orders @@ -75,6 +76,7 @@ Suggested Unraid mapping: - Add parts and assemblies in the Parts module. - Define assembly components in the Assemblies module. - Create SOs and POs by selecting actual inventory items from the item master instead of typing free-form SKUs. +- Fulfill SOs and POs by entering quantities against existing order lines instead of typing SKU text. - Use purchase orders to restock and receive inventory. - Use build transactions to convert component stock into assembly stock. - Use sales orders and ship them fully or partially to reduce stock and generate invoices plus journal entries. diff --git a/app/assemblies/page.tsx b/app/assemblies/page.tsx index 6a0069d..68cbce5 100644 --- a/app/assemblies/page.tsx +++ b/app/assemblies/page.tsx @@ -1,7 +1,12 @@ import { addKitComponent, buildAssembly } from "@/lib/actions"; import { getAssembliesWithComponents, getParts } from "@/lib/repository"; -export default function AssembliesPage() { +export default async function AssembliesPage({ + searchParams +}: { + searchParams?: Promise<{ error?: string; success?: string }>; +}) { + const params = (await searchParams) ?? {}; const parts = getParts(); const assemblies = parts.filter((part) => part.kind === "assembly"); const components = parts.filter((part) => part.kind === "part"); @@ -9,6 +14,8 @@ export default function AssembliesPage() { return (
+ {params.error ?

{params.error}

: null} + {params.success ?

{params.success}

: null}

Bill of Materials

@@ -16,26 +23,26 @@ export default function AssembliesPage() {
- +
- +
- +

Build Assembly

-

Consume component stock and create finished kit inventory in one transaction flow.

+

Consume component stock and create finished kit inventory in one transaction flow. This only works after the assembly has a BOM and enough component stock exists.

- +
- +
diff --git a/app/purchase-orders/page.tsx b/app/purchase-orders/page.tsx index fedbb20..a490f53 100644 --- a/app/purchase-orders/page.tsx +++ b/app/purchase-orders/page.tsx @@ -1,12 +1,13 @@ -import { receivePurchaseOrder } from "@/lib/actions"; +import { PurchaseOrderFulfillmentForm } from "@/components/purchase-order-fulfillment-form"; import { PurchaseOrderForm } from "@/components/purchase-order-form"; import { formatCurrency, formatDate } from "@/lib/format"; -import { getLowStockParts, getOrderItemOptions, getPurchaseOrders, getVendors } from "@/lib/repository"; +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 ( @@ -19,7 +20,7 @@ export default function PurchaseOrdersPage() {

Receiving Flow

-

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

+

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

@@ -39,11 +40,10 @@ export default function PurchaseOrdersPage() { {order.status === "received" ? ( Received ) : ( - - -
OrderVendorStatusTotalQty ProgressCreatedAction