[object Object]

← back to Filemaker Mcp

new-invoice-monitor: label booked sale vs unpaid quote (payment-received gate)

700b05c481bec508b0dee8eb5265de66d12bac2d · 2026-07-02 07:54:09 -0700 · Steve

Files touched

Diff

commit 700b05c481bec508b0dee8eb5265de66d12bac2d
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Jul 2 07:54:09 2026 -0700

    new-invoice-monitor: label booked sale vs unpaid quote (payment-received gate)
---
 scripts/new-invoice-monitor.mjs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/new-invoice-monitor.mjs b/scripts/new-invoice-monitor.mjs
index f3894cd..330c8f5 100644
--- a/scripts/new-invoice-monitor.mjs
+++ b/scripts/new-invoice-monitor.mjs
@@ -81,7 +81,10 @@ async function main() {
     const total = num(f['GRAND TOTAL 2']);
     const item = String(f['DETAIL 1(1)'] || f['DETAIL 1'] || '').replace(/\s+$/, '').slice(0, 80);
     const rep = f['SALES PERSON'] ? ` · ${f['SALES PERSON']}` : '';
-    const tag = total < 0 ? '↩️ *Refund*' : '🛎️ *New sale*';
+    // Booked sale = payment received; otherwise it's an open quote (don't call it a sale).
+    const paid = String(f['PAID ON ACCOUNT'] ?? '').trim();
+    const booked = paid !== '' && num(paid) !== 0;
+    const tag = !booked ? '📝 *New quote* (no payment yet)' : (total < 0 ? '↩️ *Refund*' : '🛎️ *New sale*');
     const text = `${tag} — ${client} · Invoice #${n} · *${money(total)}*${rep}${item ? `\n• ${item}` : ''}`;
     if (DRY_RUN) console.log('[would post] ' + text.replace(/\n/g, '  '));
     else { await post(text); }

← 7bf6a1d sales-summary: count BOOKED orders only (payment received);  ·  back to Filemaker Mcp  ·  add DWTA baxter dedup: archive+delete script for FM dup reco fec4102 →