← back to Filemaker Mcp
invoice: wire WALLPAPER auto-complete into the live daemon path
e138cce9a1570a724cf8ce9035d78b2422db2b3a · 2026-07-10 09:03:11 -0700 · Steve Abrams
createInvoiceForOrder now calls ensureWallpaper(sku) per line — auto-creates/
completes the FileMaker WALLPAPER master from dw_unified and direct-writes VID +
Detail 1 Mfr Number onto each line, so every NEW order's width/name/vid/supplier/
mfr lookups resolve at creation (no manual redo). Best-effort: wrapped so a
WALLPAPER-completion failure never breaks invoicing. Verified end-to-end on a
2-sample order (DWTT70647 + DWKK134979 both fully resolve).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit e138cce9a1570a724cf8ce9035d78b2422db2b3a
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Fri Jul 10 09:03:11 2026 -0700
invoice: wire WALLPAPER auto-complete into the live daemon path
createInvoiceForOrder now calls ensureWallpaper(sku) per line — auto-creates/
completes the FileMaker WALLPAPER master from dw_unified and direct-writes VID +
Detail 1 Mfr Number onto each line, so every NEW order's width/name/vid/supplier/
mfr lookups resolve at creation (no manual redo). Best-effort: wrapped so a
WALLPAPER-completion failure never breaks invoicing. Verified end-to-end on a
2-sample order (DWTT70647 + DWKK134979 both fully resolve).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
lib/invoice.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/invoice.js b/lib/invoice.js
index 83be891..fd65875 100644
--- a/lib/invoice.js
+++ b/lib/invoice.js
@@ -12,8 +12,10 @@
// - SOLD/SHIP address written explicitly (Data API create does NOT fire lookups)
// - Notes stamped "Imported by Otto — <date time>"
import * as fm from '../src/fm-client.js';
+import { ensureWallpaper } from './wallpaper.js';
const HDR = 'Invoice to Client Copy';
+const SHIP_LAYOUT = 'Order Detail - Main - Shipping'; // exposes VID + Detail 1 Mfr Number
const SKU_LAYOUT = 'Layout #47'; // exposes "JS Easy SKU #"
const WCPAT_LAYOUT = '1-order detail 1 Copy3'; // exposes "wc pattern"
// Steve's writable Text[4] field (repeating, maxRepeat 4 -> rep 1 written via the
@@ -197,6 +199,17 @@ export async function createInvoiceForOrder(order, accountNumber, { commit = tru
try { await fm.updateRecord('invoice', WCPAT_LAYOUT, id, { 'wc pattern': wcPattern(li.sku) }, { dryRun: false }); } catch {}
try { await fm.updateRecord('invoice', DWSKU_LAYOUT, id, { [DWSKU_FIELD]: dwSku(li.sku) }, { dryRun: false }); } catch {}
+ // Auto-complete the FileMaker WALLPAPER master record for this sku from
+ // dw_unified so the invoice's width/name/vid/supplier lookups resolve, then
+ // write the copy-lookup fields (VID + Detail 1 Mfr Number) onto this line.
+ // Never let this break invoicing — the WALLPAPER completion is best-effort.
+ try {
+ const wp = await ensureWallpaper(dwSku(li.sku));
+ if (wp?.ok) {
+ try { await fm.updateRecord('invoice', SHIP_LAYOUT, id, { 'VID': wp.vid || '', 'Detail 1 Mfr Number': wp.mfr }, { dryRun: false }); } catch {}
+ }
+ } catch {}
+
// paid-in-full = the EXACT order total (merch + tax + shipping) on the first
// record, 0 on the SKU records. Computed directly (not read from GRAND TOTAL)
// so the money is exact even when a summarized per-unit line rounds by a cent.
← 0c0536f wallpaper: resolve legacy DWLK sku -> canonical DWSW via sho
·
back to Filemaker Mcp
·
wallpaper: resolve mfr# from flat metafields + vendor_catalo 4d2ed04 →