{ "name": "easybits Reconciliation Workflow", "nodes": [ { "parameters": { "formTitle": "Payment Reconciliation Automation", "formDescription": "Please upload your current Open Invoices export and your recent Bank Statement below. The system will automatically cross-reference payment references and amounts to generate your matching report. (Supported formats: .xlsx)", "formFields": { "values": [ { "fieldLabel": "Bank Statement Upload", "fieldType": "file", "fieldName": "bank_statement", "acceptFileTypes": ".xlsx", "requiredField": true }, { "fieldLabel": "Open Invoices Upload", "fieldType": "file", "fieldName": "open_invoices", "acceptFileTypes": ".xlsx", "requiredField": true } ] }, "responseMode": "lastNode", "options": { "path": "reconciliation" } }, "type": "n8n-nodes-base.formTrigger", "typeVersion": 2.5, "position": [ 64, 112 ], "id": "0d39deec-bbc5-430c-9b1e-f209d1fe5189", "name": "Form: Reconciliation Intake" }, { "parameters": { "content": "# 💰 Payment Reconciliation\n### Match bank deposits to open invoices automatically\n\n## What this does\nUpload your **Open Invoices** export and your latest **Bank Statement**, and this workflow cross-references them for you. Every payment is sorted into exact matches, partial (short or over) payments, unpaid invoices, and deposits with no matching invoice, then shown as a clean report you can download as a PDF.\n\n## How it works\n1. The user uploads two *.xlsx* files through the intake form.\n2. Both spreadsheets are read into rows.\n3. A code step matches bank credits to invoices by invoice number and amount.\n4. The results are grouped into four buckets and rendered as an HTML summary.\n5. The report is shown on screen with a download / print button.\n\n## Set up steps\nTakes about 5 minutes.\n\n**1. Match your column names**\nOpen the **Match & Build Report** node. The matching relies on these exact headers: invoices need *Invoice ID* and *Total Amount Due*; the bank file needs *Credit*, *Debit*, *Value Date*, and *Reference / Description*. Rename the columns in your exports, or adjust the names in the code to fit your own.\n\n**2. Check the reference format**\nA payment matches when a bank reference contains the full invoice ID, or its last three digits (for example *201* from *INV-2024-201*). If your invoice numbers follow a different pattern, tweak the matching rule in the code.\n\n**3. Activate and share the form**\nSet the workflow to active, open the form URL, and upload the two files to generate a report.", "height": 832, "width": 560 }, "type": "n8n-nodes-base.stickyNote", "position": [ -624, -336 ], "typeVersion": 1, "id": "9835eaae-f322-4757-85ce-b5f0c2746933", "name": "Sticky Note" }, { "parameters": { "content": "## 📥 Upload Intake Form\nCollects two spreadsheet uploads from the user, the **Open Invoices** export and the **Bank Statement**, both as *.xlsx* files. The form holds the browser open until the run finishes so the summary report can be shown on screen.", "height": 384, "width": 320, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ -48, -96 ], "typeVersion": 1, "id": "9e02e0e0-0506-4a26-9996-19c5a2565cf7", "name": "Sticky Note1" }, { "parameters": { "content": "## 📄 Read Invoices File\nReads the uploaded **Open Invoices** spreadsheet and turns every row into a data item. Each invoice needs an *Invoice ID* and a *Total Amount Due* column for the matching step to work.", "height": 368, "width": 320, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ 288, -272 ], "typeVersion": 1, "id": "c218d881-1ed8-4ce2-8207-2d52e49f2781", "name": "Sticky Note2" }, { "parameters": { "content": "## 🏦 Read Bank Statement\nReads the uploaded **Bank Statement** spreadsheet into data items, one per transaction. It expects *Credit*, *Debit*, *Value Date*, and *Reference / Description* columns.", "height": 368, "width": 320, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ 288, 112 ], "typeVersion": 1, "id": "d52c1cf9-1540-436d-9f65-dae1ae7730dc", "name": "Sticky Note3" }, { "parameters": { "content": "## 🔗 Merge Streams\nWaits for both files to finish reading, then brings the two branches back together so the next step runs once. The matching code pulls each dataset by node name, so this node mainly keeps the flow in sync.", "height": 384, "width": 320, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ 624, -96 ], "typeVersion": 1, "id": "188fac24-e26a-491a-beb9-b40c56cd2207", "name": "Sticky Note4" }, { "parameters": { "content": "## 🧮 Match & Build Report\nCompares every bank credit against the open invoices by invoice number and amount, sorting them into exact matches, partial matches, unpaid invoices, and unmatched deposits. It then builds the full HTML summary page the user sees at the end.", "height": 384, "width": 320, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ 960, -96 ], "typeVersion": 1, "id": "6a9f6a34-fd89-4cd7-b912-24fe05beac75", "name": "Sticky Note5" }, { "parameters": { "content": "## 🖥️ Show Summary\nDisplays the finished reconciliation report in the browser as a styled dashboard with a print / download-PDF button. This is the last step, so the user lands here the moment the run completes.", "height": 384, "width": 320, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ 1296, -96 ], "typeVersion": 1, "id": "26c06dd2-d2d8-4ef6-b50e-5d7854abaaee", "name": "Sticky Note6" }, { "parameters": { "operation": "xlsx", "binaryPropertyName": "open_invoices", "options": {} }, "type": "n8n-nodes-base.extractFromFile", "typeVersion": 1.1, "position": [ 400, -80 ], "id": "40b8a778-9145-472a-8096-0bb0010155c0", "name": "Extract: Open Invoices" }, { "parameters": { "operation": "xlsx", "binaryPropertyName": "bank_statement", "options": {} }, "type": "n8n-nodes-base.extractFromFile", "typeVersion": 1.1, "position": [ 400, 304 ], "id": "04bec87c-d8ef-4007-b331-7c1f874e8e92", "name": "Extract: Bank Statement" }, { "parameters": {}, "type": "n8n-nodes-base.merge", "typeVersion": 3.2, "position": [ 736, 112 ], "id": "f1a9bb57-5a0e-4b7b-a487-14eb88ae4e88", "name": "Merge: Invoices & Bank Data" }, { "parameters": { "jsCode": "const invoices = $('Extract: Open Invoices').all().map(item => item.json);\nconst bankStatements = $('Extract: Bank Statement').all().map(item => item.json);\n\nlet exactMatches = [];\nlet partialMatches = [];\nlet unmatched = [];\n\nbankStatements.forEach(txn => {\n if (txn['Debit'] !== null && txn['Debit'] > 0) return;\n\n let creditAmount = txn['Credit'];\n let desc = txn['Reference / Description'] || \"\";\n let matched = false;\n let extractedNumbers = desc.match(/\\b\\d{3}\\b/g) || [];\n\n for (let inv of invoices) {\n let invId = inv['Invoice ID']; \n let invAmount = inv['Total Amount Due'];\n \n if (desc.includes(invId) || extractedNumbers.includes(invId.split('-')[2])) {\n matched = true;\n if (creditAmount === invAmount) {\n exactMatches.push({ txn, inv });\n } else {\n partialMatches.push({ txn, inv, discrepancy: creditAmount - invAmount });\n }\n break; \n }\n }\n if (!matched && creditAmount > 0) unmatched.push(txn);\n});\n\n// Accurate Metric Calculations\nconst totalInvoices = invoices.length || 0;\nconst exactCount = exactMatches.length;\nconst partialCount = partialMatches.length;\nconst unmatchedCount = unmatched.length;\nconst unpaidCount = Math.max(0, totalInvoices - exactCount - partialCount);\nconst totalDeposits = bankStatements.filter(t => (t['Credit'] || 0) > 0).length;\n\nconst totalCollected = exactMatches.reduce((sum, m) => sum + (m.txn['Credit'] || 0), 0) + \n partialMatches.reduce((sum, m) => sum + (m.txn['Credit'] || 0), 0);\n\nconst matchRate = totalInvoices > 0 ? Math.min(100, Math.round((exactCount / totalInvoices) * 100)) : 0;\nconst circumference = 2 * Math.PI * 40; // 251.32\nconst strokeDashoffset = circumference - (circumference * matchRate) / 100;\n\n// ---- Additional derived data for the detail tables (additive, non-breaking) ----\nconst matchedInvoiceIds = new Set([...exactMatches, ...partialMatches].map(m => m.inv['Invoice ID']));\nconst unpaidInvoices = invoices.filter(inv => !matchedInvoiceIds.has(inv['Invoice ID']));\nconst unpaidDisplayCount = unpaidInvoices.length;\n\n// ---- Small presentation helpers ----\nconst money = (n) => '$' + (Number(n) || 0).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });\nconst generatedDate = new Date().toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' });\nconst emptyRow = (cols, msg) => `
${subtitle}
\n| ${h.label} | `).join('')}\n
|---|
\n Cross-referenced ${totalDeposits} bank deposits against ${totalInvoices} open invoices. A total of ${money(totalCollected)} was collected and cleared.\n
\n