3720 lines
170 KiB
JSON
3720 lines
170 KiB
JSON
{
|
|
"id": "RelVmn3jWi1OwGdm",
|
|
"name": "QBO Invoice → Postgres (multi company)",
|
|
"active": true,
|
|
"activeVersionId": "65890494-0c1b-47e0-9270-18356fc341a8",
|
|
"createdAt": "2026-04-15T14:43:16.316Z",
|
|
"updatedAt": "2026-11-04T03:34:00.074Z",
|
|
"isArchived": false,
|
|
"versionId": "65890494-0c1b-47e0-9270-18356fc341a8",
|
|
"triggerCount": 1,
|
|
"nodes": [
|
|
{
|
|
"id": "891369e9-74c3-4033-b022-da8d12dc3fba",
|
|
"name": "Schedule Trigger",
|
|
"type": "n8n-nodes-base.scheduleTrigger",
|
|
"typeVersion": 1.3,
|
|
"position": [
|
|
-1360,
|
|
128
|
|
],
|
|
"parameters": {
|
|
"rule": {
|
|
"interval": [
|
|
{
|
|
"field": "cronExpression",
|
|
"expression": "16,46 * * * *"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "15a82673-04f0-4907-aa35-1cf64a1a14d1",
|
|
"name": "Set Defaults",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-912,
|
|
128
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const start_date='2023-01-01';\nconst end_date='2027-12-31';\nconst companies=['MUS','MMX','MSAG','MHAG','MGC'];\nreturn companies.map(company_id=>({json:{company_id,start_date,end_date}}));"
|
|
}
|
|
},
|
|
{
|
|
"id": "0f911349-9483-469f-aa28-7e96af706e72",
|
|
"name": "Resolve Company",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-688,
|
|
128
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "const COMPANY_MAP = {\n MUS: { realmId: '9341452327761715', credentialId: 'i6dFL9yjAAhFxsmn', credentialName: 'QuickBooks Online MUS' },\n MMX: { realmId: '9341452328017372', credentialId: 'USLCXCphdJqcpr2C', credentialName: 'QuickBooks Online MMX' },\n MSAG: { realmId: '9341452373926753', credentialId: 'Q0bvGHliYfQTGUWW', credentialName: 'QuickBooks Online MSAG' },\n MHAG: { realmId: '9341452561201469', credentialId: 'vE8iWZDtmiPKgGao', credentialName: 'QuickBooks Online MHAG' },\n MGC: { realmId: '9130354300064436', credentialId: 'bm9Oc2QzBM8bx9YW', credentialName: 'QuickBooks Online MGC' },\n};\nconst companyId = $input.item.json.company_id;\nconst company = COMPANY_MAP[companyId];\nif (!company) throw new Error(`Unknown company_id: \"${companyId}\"`);\nreturn {\n ...($input.item.json),\n realm_id: company.realmId,\n credential_id: company.credentialId,\n credential_name: company.credentialName,\n qbo_base_url: `https://quickbooks.api.intuit.com/v3/company/${company.realmId}`\n};"
|
|
}
|
|
},
|
|
{
|
|
"id": "659301f4-640b-4d48-906c-38b6e3cb42c5",
|
|
"name": "Route by Company",
|
|
"type": "n8n-nodes-base.switch",
|
|
"typeVersion": 3,
|
|
"position": [
|
|
-464,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"rules": {
|
|
"values": [
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MUS",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MUS"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MMX",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MMX"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MSAG",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MSAG"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MHAG",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MHAG"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MGC",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MGC"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
}
|
|
},
|
|
{
|
|
"id": "f1bd8cbe-0152-41fe-aff7-00d7e8fd4af8",
|
|
"name": "Fetch Invoices - MUS",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
-304
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "i6dFL9yjAAhFxsmn",
|
|
"name": "QuickBooks Online MUS"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "c50da5a4-a458-4688-aa15-4c8b193dfa2b",
|
|
"name": "Stamp - MUS",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
-304
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MUS', realm_id: '9341452327761715' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "725c58fd-2160-403b-a680-843c82f20379",
|
|
"name": "Parse Invoices - MUS",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
-304
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "e4b6838f-4f44-441d-97ea-476145409bda",
|
|
"name": "Fetch Invoices - MMX",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
-112
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "USLCXCphdJqcpr2C",
|
|
"name": "QuickBooks Online MMX"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "50eef155-aa61-4ecc-9067-9c151770d132",
|
|
"name": "Stamp - MMX",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
-112
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MMX', realm_id: '9341452328017372' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "f9e179ec-9696-459b-9847-b98c6a5d1264",
|
|
"name": "Parse Invoices - MMX",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
-112
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "8d82d7b9-622a-4bb9-9695-31e62383bf82",
|
|
"name": "Fetch Invoices - MSAG",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "Q0bvGHliYfQTGUWW",
|
|
"name": "QuickBooks Online MSAG"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "7cc8951e-156c-4d0f-a479-82a5d56f8572",
|
|
"name": "Stamp - MSAG",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MSAG', realm_id: '9341452373926753' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "b061f326-4d29-4bdc-be4a-0128dcd301e2",
|
|
"name": "Parse Invoices - MSAG",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "e5235f7e-6642-4fdb-8187-bfa93e1886f7",
|
|
"name": "Fetch Invoices - MHAG",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
272
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "vE8iWZDtmiPKgGao",
|
|
"name": "QuickBooks Online MHAG"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "9de8098f-4a5b-4b6e-b11a-ddd0db57de1f",
|
|
"name": "Stamp - MHAG",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
272
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MHAG', realm_id: '9341452561201469' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "e1c47b51-fc32-4c81-8341-8797d4451ff0",
|
|
"name": "Parse Invoices - MHAG",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
272
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "8884f858-de6e-4fba-80ae-13300aca4978",
|
|
"name": "Fetch Invoices - MGC",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
464
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "bm9Oc2QzBM8bx9YW",
|
|
"name": "QuickBooks Online MGC"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "b16cf762-b4fa-4f6f-8d37-72c2af75bed8",
|
|
"name": "Stamp - MGC",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
464
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MGC', realm_id: '9130354300064436' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "817d8271-b7e1-42c3-bec9-e99abbdf3216",
|
|
"name": "Parse Invoices - MGC",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
464
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "6cf7f183-1b83-45f6-83cd-7b88e57f93af",
|
|
"name": "Sticky Note",
|
|
"type": "n8n-nodes-base.stickyNote",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
-992,
|
|
-128
|
|
],
|
|
"parameters": {
|
|
"content": "## Set date range here\n## WARNING - BALANCE IS A DYNAMIC FIELD THAT GETS UPDATED WITH API",
|
|
"height": 496
|
|
}
|
|
},
|
|
{
|
|
"id": "756c3af0-5629-45a1-a418-2ca3845a43b5",
|
|
"name": "Execute Workflow Trigger",
|
|
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
-1344,
|
|
-144
|
|
],
|
|
"parameters": {}
|
|
},
|
|
{
|
|
"id": "3ce008d1-4e29-411d-a9cc-7356998d6cd7",
|
|
"name": "Merge",
|
|
"type": "n8n-nodes-base.merge",
|
|
"typeVersion": 3.2,
|
|
"position": [
|
|
432,
|
|
32
|
|
],
|
|
"parameters": {
|
|
"numberInputs": 5
|
|
}
|
|
},
|
|
{
|
|
"id": "6cc9b161-2c07-4363-9707-77c0987532e2",
|
|
"name": "Tag Run",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
656,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, run_id: String($execution.id) } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "8308ce04-92bd-4b27-8bfc-c6ac0ab51c9c",
|
|
"name": "Summary",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1104,
|
|
-16
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const items = $input.all();\nconst byCompany = {};\nfor (const item of items) {\n const cid = item.json.company_id ?? 'unknown';\n if (!byCompany[cid]) byCompany[cid] = { rows: 0, total: 0 };\n byCompany[cid].rows++;\n byCompany[cid].total += Number(item.json.TotalAmt) || 0;\n}\nfor (const [cid, s] of Object.entries(byCompany)) {\n console.log(`✅ ${cid}: ${s.rows} rows | TotalAmt total: ${s.total.toFixed(2)}`);\n}\nreturn [{ json: { status: 'success', total_rows: items.length, by_company: byCompany, completed_at: new Date().toISOString() } }];"
|
|
}
|
|
},
|
|
{
|
|
"id": "e7066ee3-7140-4356-b917-9c1bddb965bd",
|
|
"name": "Swap to Live",
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.6,
|
|
"position": [
|
|
1328,
|
|
-16
|
|
],
|
|
"parameters": {
|
|
"operation": "executeQuery",
|
|
"query": "=SELECT * FROM swap_txn_table('invoices', '{{ $execution.id }}');",
|
|
"options": {}
|
|
},
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "NoPrLWbqySMMmIaI",
|
|
"name": "Postgres n8n-quickbooks"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "72a00f97-bfe4-4846-b4f8-bf7a4e24801a",
|
|
"name": "Write invoices",
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.6,
|
|
"position": [
|
|
1104,
|
|
176
|
|
],
|
|
"parameters": {
|
|
"schema": {
|
|
"__rl": true,
|
|
"mode": "list",
|
|
"value": "public"
|
|
},
|
|
"table": {
|
|
"__rl": true,
|
|
"value": "invoices_staging",
|
|
"mode": "name"
|
|
},
|
|
"columns": {
|
|
"mappingMode": "autoMapInputData",
|
|
"value": {
|
|
"allowonlinecreditcardpayment": false,
|
|
"applytaxafterdiscount": false,
|
|
"allowonlineachpayment": false,
|
|
"freeformaddress": false
|
|
},
|
|
"matchingColumns": [
|
|
"id"
|
|
],
|
|
"schema": [
|
|
{
|
|
"id": "company_id",
|
|
"displayName": "company_id",
|
|
"required": true,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "realm_id",
|
|
"displayName": "realm_id",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "id",
|
|
"displayName": "id",
|
|
"required": true,
|
|
"defaultMatch": true,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "synctoken",
|
|
"displayName": "synctoken",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "metadata_createtime",
|
|
"displayName": "metadata_createtime",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "metadata_lastupdatedtime",
|
|
"displayName": "metadata_lastupdatedtime",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "customfieldaggregate",
|
|
"displayName": "customfieldaggregate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "docnumber",
|
|
"displayName": "docnumber",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "txndate",
|
|
"displayName": "txndate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "privatenote",
|
|
"displayName": "privatenote",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "linkedtxnaggregate",
|
|
"displayName": "linkedtxnaggregate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "lineaggregate",
|
|
"displayName": "lineaggregate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "txntaxdetail_txntaxcoderef",
|
|
"displayName": "txntaxdetail_txntaxcoderef",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "txntaxdetail_totaltax",
|
|
"displayName": "txntaxdetail_totaltax",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "txntaxdetail_taxlineaggregate",
|
|
"displayName": "txntaxdetail_taxlineaggregate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "customerref",
|
|
"displayName": "customerref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "customerref_name",
|
|
"displayName": "customerref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "customermemo",
|
|
"displayName": "customermemo",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_id",
|
|
"displayName": "billaddr_id",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line1",
|
|
"displayName": "billaddr_line1",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line2",
|
|
"displayName": "billaddr_line2",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line3",
|
|
"displayName": "billaddr_line3",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line4",
|
|
"displayName": "billaddr_line4",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line5",
|
|
"displayName": "billaddr_line5",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_city",
|
|
"displayName": "billaddr_city",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_country",
|
|
"displayName": "billaddr_country",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_countrysubdivisioncode",
|
|
"displayName": "billaddr_countrysubdivisioncode",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_postalcode",
|
|
"displayName": "billaddr_postalcode",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_lat",
|
|
"displayName": "billaddr_lat",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_long",
|
|
"displayName": "billaddr_long",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_id",
|
|
"displayName": "shipaddr_id",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line1",
|
|
"displayName": "shipaddr_line1",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line2",
|
|
"displayName": "shipaddr_line2",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line3",
|
|
"displayName": "shipaddr_line3",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line4",
|
|
"displayName": "shipaddr_line4",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line5",
|
|
"displayName": "shipaddr_line5",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_city",
|
|
"displayName": "shipaddr_city",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_country",
|
|
"displayName": "shipaddr_country",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_countrysubdivisioncode",
|
|
"displayName": "shipaddr_countrysubdivisioncode",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_postalcode",
|
|
"displayName": "shipaddr_postalcode",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_lat",
|
|
"displayName": "shipaddr_lat",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_long",
|
|
"displayName": "shipaddr_long",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "classref",
|
|
"displayName": "classref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "classref_name",
|
|
"displayName": "classref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "salestermref",
|
|
"displayName": "salestermref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "salestermref_name",
|
|
"displayName": "salestermref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "duedate",
|
|
"displayName": "duedate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipmethodref",
|
|
"displayName": "shipmethodref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipmethodref_name",
|
|
"displayName": "shipmethodref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipdate",
|
|
"displayName": "shipdate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "trackingnum",
|
|
"displayName": "trackingnum",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "totalamt",
|
|
"displayName": "totalamt",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "printstatus",
|
|
"displayName": "printstatus",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "emailstatus",
|
|
"displayName": "emailstatus",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billemail_address",
|
|
"displayName": "billemail_address",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billemailcc_address",
|
|
"displayName": "billemailcc_address",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billemailbcc_address",
|
|
"displayName": "billemailbcc_address",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "balance",
|
|
"displayName": "balance",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "paymentrefnum",
|
|
"displayName": "paymentrefnum",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "paymentmethodref",
|
|
"displayName": "paymentmethodref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "paymentmethodref_name",
|
|
"displayName": "paymentmethodref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deposittoaccountref",
|
|
"displayName": "deposittoaccountref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deposittoaccountref_name",
|
|
"displayName": "deposittoaccountref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deliveryinfo_deliverytype",
|
|
"displayName": "deliveryinfo_deliverytype",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deliveryinfo_deliverytime",
|
|
"displayName": "deliveryinfo_deliverytime",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deposit",
|
|
"displayName": "deposit",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "hometotalamt",
|
|
"displayName": "hometotalamt",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "departmentref",
|
|
"displayName": "departmentref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "departmentref_name",
|
|
"displayName": "departmentref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "allowonlinecreditcardpayment",
|
|
"displayName": "allowonlinecreditcardpayment",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "boolean",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "applytaxafterdiscount",
|
|
"displayName": "applytaxafterdiscount",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "boolean",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "allowonlineachpayment",
|
|
"displayName": "allowonlineachpayment",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "boolean",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "freeformaddress",
|
|
"displayName": "freeformaddress",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "boolean",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "currencyref",
|
|
"displayName": "currencyref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "currencyref_name",
|
|
"displayName": "currencyref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "exchangerate",
|
|
"displayName": "exchangerate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "globaltaxcalculation",
|
|
"displayName": "globaltaxcalculation",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "transactionlocationtype",
|
|
"displayName": "transactionlocationtype",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "invoicelink",
|
|
"displayName": "invoicelink",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "projectref",
|
|
"displayName": "projectref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "recurdataref",
|
|
"displayName": "recurdataref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "taxexemptionref",
|
|
"displayName": "taxexemptionref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "homebalance",
|
|
"displayName": "homebalance",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
}
|
|
],
|
|
"attemptToConvertTypes": false,
|
|
"convertFieldsToString": false
|
|
},
|
|
"options": {
|
|
"queryBatching": "transaction"
|
|
}
|
|
},
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "NoPrLWbqySMMmIaI",
|
|
"name": "Postgres n8n-quickbooks"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "5a0718d1-d092-4b63-9453-326c48d5a4b3",
|
|
"name": "Loop Over Items",
|
|
"type": "n8n-nodes-base.splitInBatches",
|
|
"typeVersion": 3,
|
|
"position": [
|
|
880,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"batchSize": 500,
|
|
"options": {}
|
|
}
|
|
}
|
|
],
|
|
"connections": {
|
|
"Schedule Trigger": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Set Defaults",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Set Defaults": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Resolve Company",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Resolve Company": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Route by Company",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Route by Company": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MUS",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MMX",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MSAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MHAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MGC",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MUS": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MUS",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MUS": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MUS",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MUS": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MMX": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MMX",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MMX": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MMX",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MMX": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 1
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MSAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MSAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MSAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MSAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MSAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 2
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MHAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MHAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MHAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MHAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MHAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 3
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MGC": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MGC",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MGC": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MGC",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MGC": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 4
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Execute Workflow Trigger": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Set Defaults",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Merge": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Tag Run",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Tag Run": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Loop Over Items",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Summary": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Swap to Live",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Write invoices": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Loop Over Items",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Loop Over Items": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Summary",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Write invoices",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"nodeGroups": [],
|
|
"settings": {
|
|
"binaryMode": "separate",
|
|
"errorWorkflow": "tJSgL4iy63ys2NCA",
|
|
"executionOrder": "v1"
|
|
},
|
|
"staticData": {
|
|
"node:Schedule Trigger": {
|
|
"recurrenceRules": [
|
|
null
|
|
],
|
|
"recurrenceRuleSignatures": [
|
|
null
|
|
]
|
|
}
|
|
},
|
|
"pinData": {},
|
|
"meta": null,
|
|
"tags": [],
|
|
"shared": [
|
|
{
|
|
"role": "workflow:owner",
|
|
"workflowId": "RelVmn3jWi1OwGdm",
|
|
"projectId": "X4TTvIwW8wN0Iirz",
|
|
"createdAt": "2026-04-15T14:43:16.316Z",
|
|
"updatedAt": "2026-04-15T14:43:16.316Z"
|
|
}
|
|
],
|
|
"activeVersion": {
|
|
"versionId": "65890494-0c1b-47e0-9270-18356fc341a8",
|
|
"workflowId": "RelVmn3jWi1OwGdm",
|
|
"nodes": [
|
|
{
|
|
"id": "891369e9-74c3-4033-b022-da8d12dc3fba",
|
|
"name": "Schedule Trigger",
|
|
"type": "n8n-nodes-base.scheduleTrigger",
|
|
"typeVersion": 1.3,
|
|
"position": [
|
|
-1360,
|
|
128
|
|
],
|
|
"parameters": {
|
|
"rule": {
|
|
"interval": [
|
|
{
|
|
"field": "cronExpression",
|
|
"expression": "16,46 * * * *"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "15a82673-04f0-4907-aa35-1cf64a1a14d1",
|
|
"name": "Set Defaults",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-912,
|
|
128
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const start_date='2023-01-01';\nconst end_date='2027-12-31';\nconst companies=['MUS','MMX','MSAG','MHAG','MGC'];\nreturn companies.map(company_id=>({json:{company_id,start_date,end_date}}));"
|
|
}
|
|
},
|
|
{
|
|
"id": "0f911349-9483-469f-aa28-7e96af706e72",
|
|
"name": "Resolve Company",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-688,
|
|
128
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "const COMPANY_MAP = {\n MUS: { realmId: '9341452327761715', credentialId: 'i6dFL9yjAAhFxsmn', credentialName: 'QuickBooks Online MUS' },\n MMX: { realmId: '9341452328017372', credentialId: 'USLCXCphdJqcpr2C', credentialName: 'QuickBooks Online MMX' },\n MSAG: { realmId: '9341452373926753', credentialId: 'Q0bvGHliYfQTGUWW', credentialName: 'QuickBooks Online MSAG' },\n MHAG: { realmId: '9341452561201469', credentialId: 'vE8iWZDtmiPKgGao', credentialName: 'QuickBooks Online MHAG' },\n MGC: { realmId: '9130354300064436', credentialId: 'bm9Oc2QzBM8bx9YW', credentialName: 'QuickBooks Online MGC' },\n};\nconst companyId = $input.item.json.company_id;\nconst company = COMPANY_MAP[companyId];\nif (!company) throw new Error(`Unknown company_id: \"${companyId}\"`);\nreturn {\n ...($input.item.json),\n realm_id: company.realmId,\n credential_id: company.credentialId,\n credential_name: company.credentialName,\n qbo_base_url: `https://quickbooks.api.intuit.com/v3/company/${company.realmId}`\n};"
|
|
}
|
|
},
|
|
{
|
|
"id": "659301f4-640b-4d48-906c-38b6e3cb42c5",
|
|
"name": "Route by Company",
|
|
"type": "n8n-nodes-base.switch",
|
|
"typeVersion": 3,
|
|
"position": [
|
|
-464,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"rules": {
|
|
"values": [
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MUS",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MUS"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MMX",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MMX"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MSAG",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MSAG"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MHAG",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MHAG"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 1
|
|
},
|
|
"combinator": "and",
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.company_id }}",
|
|
"rightValue": "MGC",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "MGC"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
}
|
|
},
|
|
{
|
|
"id": "f1bd8cbe-0152-41fe-aff7-00d7e8fd4af8",
|
|
"name": "Fetch Invoices - MUS",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
-304
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "i6dFL9yjAAhFxsmn",
|
|
"name": "QuickBooks Online MUS"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "c50da5a4-a458-4688-aa15-4c8b193dfa2b",
|
|
"name": "Stamp - MUS",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
-304
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MUS', realm_id: '9341452327761715' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "725c58fd-2160-403b-a680-843c82f20379",
|
|
"name": "Parse Invoices - MUS",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
-304
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "e4b6838f-4f44-441d-97ea-476145409bda",
|
|
"name": "Fetch Invoices - MMX",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
-112
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "USLCXCphdJqcpr2C",
|
|
"name": "QuickBooks Online MMX"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "50eef155-aa61-4ecc-9067-9c151770d132",
|
|
"name": "Stamp - MMX",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
-112
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MMX', realm_id: '9341452328017372' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "f9e179ec-9696-459b-9847-b98c6a5d1264",
|
|
"name": "Parse Invoices - MMX",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
-112
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "8d82d7b9-622a-4bb9-9695-31e62383bf82",
|
|
"name": "Fetch Invoices - MSAG",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "Q0bvGHliYfQTGUWW",
|
|
"name": "QuickBooks Online MSAG"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "7cc8951e-156c-4d0f-a479-82a5d56f8572",
|
|
"name": "Stamp - MSAG",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MSAG', realm_id: '9341452373926753' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "b061f326-4d29-4bdc-be4a-0128dcd301e2",
|
|
"name": "Parse Invoices - MSAG",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "e5235f7e-6642-4fdb-8187-bfa93e1886f7",
|
|
"name": "Fetch Invoices - MHAG",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
272
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "vE8iWZDtmiPKgGao",
|
|
"name": "QuickBooks Online MHAG"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "9de8098f-4a5b-4b6e-b11a-ddd0db57de1f",
|
|
"name": "Stamp - MHAG",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
272
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MHAG', realm_id: '9341452561201469' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "e1c47b51-fc32-4c81-8341-8797d4451ff0",
|
|
"name": "Parse Invoices - MHAG",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
272
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "8884f858-de6e-4fba-80ae-13300aca4978",
|
|
"name": "Fetch Invoices - MGC",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
-240,
|
|
464
|
|
],
|
|
"parameters": {
|
|
"url": "={{ $json.qbo_base_url }}/query",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "quickBooksOAuth2Api",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "=SELECT * FROM Invoice WHERE TxnDate >= '{{$json.start_date}}' AND TxnDate <= '{{$json.end_date}}' STARTPOSITION 1 MAXRESULTS 1000"
|
|
},
|
|
{
|
|
"name": "minorversion",
|
|
"value": "65"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Accept",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"pagination": {}
|
|
}
|
|
},
|
|
"credentials": {
|
|
"quickBooksOAuth2Api": {
|
|
"id": "bm9Oc2QzBM8bx9YW",
|
|
"name": "QuickBooks Online MGC"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "b16cf762-b4fa-4f6f-8d37-72c2af75bed8",
|
|
"name": "Stamp - MGC",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
-16,
|
|
464
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, company_id: 'MGC', realm_id: '9130354300064436' } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "817d8271-b7e1-42c3-bec9-e99abbdf3216",
|
|
"name": "Parse Invoices - MGC",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
464
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const allItems = $input.all();\nif (!allItems?.length) {\n console.log('Invoice Parser: no input items, skipping.');\n return [];\n}\nconst companyId = allItems[0].json.company_id ?? 'unknown';\nconst realmId = allItems[0].json.realm_id ?? 'unknown';\nconst str = v => (v === undefined || v === null || v === '') ? null : String(v);\nconst num = v => { const n = parseFloat(v); return isNaN(n) ? null : n; };\nconst bool = v => (v === undefined || v === null) ? null : Boolean(v);\nconst rows = [];\nfor (const item of allItems) {\n const invoices = item.json.QueryResponse?.Invoice ?? [];\n for (const inv of invoices) {\n rows.push({ json: {\n company_id: companyId,\n realm_id: realmId,\n id: str(inv.Id),\n synctoken: str(inv.SyncToken),\n metadata_createtime: inv.MetaData?.CreateTime ?? null,\n metadata_lastupdatedtime: inv.MetaData?.LastUpdatedTime ?? null,\n customfieldaggregate: inv.CustomField?.length ? JSON.stringify(inv.CustomField) : null,\n docnumber: str(inv.DocNumber),\n txndate: inv.TxnDate ?? null,\n privatenote: str(inv.PrivateNote),\n linkedtxnaggregate: inv.LinkedTxn?.length ? JSON.stringify(inv.LinkedTxn) : null,\n lineaggregate: inv.Line?.length ? JSON.stringify(inv.Line) : null,\n txntaxdetail_txntaxcoderef: str(inv.TxnTaxDetail?.TxnTaxCodeRef?.value),\n txntaxdetail_totaltax: num(inv.TxnTaxDetail?.TotalTax),\n txntaxdetail_taxlineaggregate: inv.TxnTaxDetail?.TaxLine?.length ? JSON.stringify(inv.TxnTaxDetail.TaxLine) : null,\n customerref: str(inv.CustomerRef?.value),\n customerref_name: str(inv.CustomerRef?.name),\n customermemo: str(inv.CustomerMemo?.value),\n billaddr_id: str(inv.BillAddr?.Id),\n billaddr_line1: str(inv.BillAddr?.Line1),\n billaddr_line2: str(inv.BillAddr?.Line2),\n billaddr_line3: str(inv.BillAddr?.Line3),\n billaddr_line4: str(inv.BillAddr?.Line4),\n billaddr_line5: str(inv.BillAddr?.Line5),\n billaddr_city: str(inv.BillAddr?.City),\n billaddr_country: str(inv.BillAddr?.Country),\n billaddr_countrysubdivisioncode: str(inv.BillAddr?.CountrySubDivisionCode),\n billaddr_postalcode: str(inv.BillAddr?.PostalCode),\n billaddr_lat: str(inv.BillAddr?.Lat),\n billaddr_long: str(inv.BillAddr?.Long),\n shipaddr_id: str(inv.ShipAddr?.Id),\n shipaddr_line1: str(inv.ShipAddr?.Line1),\n shipaddr_line2: str(inv.ShipAddr?.Line2),\n shipaddr_line3: str(inv.ShipAddr?.Line3),\n shipaddr_line4: str(inv.ShipAddr?.Line4),\n shipaddr_line5: str(inv.ShipAddr?.Line5),\n shipaddr_city: str(inv.ShipAddr?.City),\n shipaddr_country: str(inv.ShipAddr?.Country),\n shipaddr_countrysubdivisioncode: str(inv.ShipAddr?.CountrySubDivisionCode),\n shipaddr_postalcode: str(inv.ShipAddr?.PostalCode),\n shipaddr_lat: str(inv.ShipAddr?.Lat),\n shipaddr_long: str(inv.ShipAddr?.Long),\n classref: str(inv.ClassRef?.value),\n classref_name: str(inv.ClassRef?.name),\n salestermref: str(inv.SalesTermRef?.value),\n salestermref_name: str(inv.SalesTermRef?.name),\n duedate: inv.DueDate ?? null,\n shipmethodref: str(inv.ShipMethodRef?.value),\n shipmethodref_name: str(inv.ShipMethodRef?.name),\n shipdate: inv.ShipDate ?? null,\n trackingnum: str(inv.TrackingNum),\n totalamt: num(inv.TotalAmt),\n printstatus: str(inv.PrintStatus),\n emailstatus: str(inv.EmailStatus),\n billemail_address: str(inv.BillEmail?.Address),\n billemailcc_address: str(inv.BillEmailCc?.Address),\n billemailbcc_address: str(inv.BillEmailBcc?.Address),\n balance: num(inv.Balance),\n paymentrefnum: str(inv.PaymentRefNum),\n paymentmethodref: str(inv.PaymentMethodRef?.value),\n paymentmethodref_name: str(inv.PaymentMethodRef?.name),\n deposittoaccountref: str(inv.DepositToAccountRef?.value),\n deposittoaccountref_name: str(inv.DepositToAccountRef?.name),\n deliveryinfo_deliverytype: str(inv.DeliveryInfo?.DeliveryType),\n deliveryinfo_deliverytime: inv.DeliveryInfo?.DeliveryTime ?? null,\n deposit: num(inv.Deposit),\n hometotalamt: num(inv.HomeTotalAmt),\n departmentref: str(inv.DepartmentRef?.value),\n departmentref_name: str(inv.DepartmentRef?.name),\n allowonlinecreditcardpayment: bool(inv.AllowOnlineCreditCardPayment),\n applytaxafterdiscount: bool(inv.ApplyTaxAfterDiscount),\n currencyref: str(inv.CurrencyRef?.value),\n currencyref_name: str(inv.CurrencyRef?.name),\n exchangerate: num(inv.ExchangeRate),\n globaltaxcalculation: str(inv.GlobalTaxCalculation),\n allowonlineachpayment: bool(inv.AllowOnlineACHPayment),\n transactionlocationtype: str(inv.TransactionLocationType),\n invoicelink: str(inv.InvoiceLink),\n projectref: str(inv.ProjectRef?.value),\n recurdataref: str(inv.RecurDataRef?.value),\n taxexemptionref: str(inv.TaxExemptionRef?.value),\n freeformaddress: bool(inv.FreeFormAddress),\n homebalance: num(inv.HomeBalance),\n }});\n }\n}\nconsole.log(`${companyId} — emitting ${rows.length} invoices.`);\nreturn rows;"
|
|
}
|
|
},
|
|
{
|
|
"id": "6cf7f183-1b83-45f6-83cd-7b88e57f93af",
|
|
"name": "Sticky Note",
|
|
"type": "n8n-nodes-base.stickyNote",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
-992,
|
|
-128
|
|
],
|
|
"parameters": {
|
|
"content": "## Set date range here\n## WARNING - BALANCE IS A DYNAMIC FIELD THAT GETS UPDATED WITH API",
|
|
"height": 496
|
|
}
|
|
},
|
|
{
|
|
"id": "756c3af0-5629-45a1-a418-2ca3845a43b5",
|
|
"name": "Execute Workflow Trigger",
|
|
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
-1344,
|
|
-144
|
|
],
|
|
"parameters": {}
|
|
},
|
|
{
|
|
"id": "3ce008d1-4e29-411d-a9cc-7356998d6cd7",
|
|
"name": "Merge",
|
|
"type": "n8n-nodes-base.merge",
|
|
"typeVersion": 3.2,
|
|
"position": [
|
|
432,
|
|
32
|
|
],
|
|
"parameters": {
|
|
"numberInputs": 5
|
|
}
|
|
},
|
|
{
|
|
"id": "6cc9b161-2c07-4363-9707-77c0987532e2",
|
|
"name": "Tag Run",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
656,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"mode": "runOnceForEachItem",
|
|
"jsCode": "return { json: { ...$input.item.json, run_id: String($execution.id) } };"
|
|
}
|
|
},
|
|
{
|
|
"id": "8308ce04-92bd-4b27-8bfc-c6ac0ab51c9c",
|
|
"name": "Summary",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1104,
|
|
-16
|
|
],
|
|
"parameters": {
|
|
"jsCode": "const items = $input.all();\nconst byCompany = {};\nfor (const item of items) {\n const cid = item.json.company_id ?? 'unknown';\n if (!byCompany[cid]) byCompany[cid] = { rows: 0, total: 0 };\n byCompany[cid].rows++;\n byCompany[cid].total += Number(item.json.TotalAmt) || 0;\n}\nfor (const [cid, s] of Object.entries(byCompany)) {\n console.log(`✅ ${cid}: ${s.rows} rows | TotalAmt total: ${s.total.toFixed(2)}`);\n}\nreturn [{ json: { status: 'success', total_rows: items.length, by_company: byCompany, completed_at: new Date().toISOString() } }];"
|
|
}
|
|
},
|
|
{
|
|
"id": "e7066ee3-7140-4356-b917-9c1bddb965bd",
|
|
"name": "Swap to Live",
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.6,
|
|
"position": [
|
|
1328,
|
|
-16
|
|
],
|
|
"parameters": {
|
|
"operation": "executeQuery",
|
|
"query": "=SELECT * FROM swap_txn_table('invoices', '{{ $execution.id }}');",
|
|
"options": {}
|
|
},
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "NoPrLWbqySMMmIaI",
|
|
"name": "Postgres n8n-quickbooks"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "72a00f97-bfe4-4846-b4f8-bf7a4e24801a",
|
|
"name": "Write invoices",
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.6,
|
|
"position": [
|
|
1104,
|
|
176
|
|
],
|
|
"parameters": {
|
|
"schema": {
|
|
"__rl": true,
|
|
"mode": "list",
|
|
"value": "public"
|
|
},
|
|
"table": {
|
|
"__rl": true,
|
|
"value": "invoices_staging",
|
|
"mode": "name"
|
|
},
|
|
"columns": {
|
|
"mappingMode": "autoMapInputData",
|
|
"value": {
|
|
"allowonlinecreditcardpayment": false,
|
|
"applytaxafterdiscount": false,
|
|
"allowonlineachpayment": false,
|
|
"freeformaddress": false
|
|
},
|
|
"matchingColumns": [
|
|
"id"
|
|
],
|
|
"schema": [
|
|
{
|
|
"id": "company_id",
|
|
"displayName": "company_id",
|
|
"required": true,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "realm_id",
|
|
"displayName": "realm_id",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "id",
|
|
"displayName": "id",
|
|
"required": true,
|
|
"defaultMatch": true,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "synctoken",
|
|
"displayName": "synctoken",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "metadata_createtime",
|
|
"displayName": "metadata_createtime",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "metadata_lastupdatedtime",
|
|
"displayName": "metadata_lastupdatedtime",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "customfieldaggregate",
|
|
"displayName": "customfieldaggregate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "docnumber",
|
|
"displayName": "docnumber",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "txndate",
|
|
"displayName": "txndate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "privatenote",
|
|
"displayName": "privatenote",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "linkedtxnaggregate",
|
|
"displayName": "linkedtxnaggregate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "lineaggregate",
|
|
"displayName": "lineaggregate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "txntaxdetail_txntaxcoderef",
|
|
"displayName": "txntaxdetail_txntaxcoderef",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "txntaxdetail_totaltax",
|
|
"displayName": "txntaxdetail_totaltax",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "txntaxdetail_taxlineaggregate",
|
|
"displayName": "txntaxdetail_taxlineaggregate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "customerref",
|
|
"displayName": "customerref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "customerref_name",
|
|
"displayName": "customerref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "customermemo",
|
|
"displayName": "customermemo",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_id",
|
|
"displayName": "billaddr_id",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line1",
|
|
"displayName": "billaddr_line1",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line2",
|
|
"displayName": "billaddr_line2",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line3",
|
|
"displayName": "billaddr_line3",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line4",
|
|
"displayName": "billaddr_line4",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_line5",
|
|
"displayName": "billaddr_line5",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_city",
|
|
"displayName": "billaddr_city",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_country",
|
|
"displayName": "billaddr_country",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_countrysubdivisioncode",
|
|
"displayName": "billaddr_countrysubdivisioncode",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_postalcode",
|
|
"displayName": "billaddr_postalcode",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_lat",
|
|
"displayName": "billaddr_lat",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billaddr_long",
|
|
"displayName": "billaddr_long",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_id",
|
|
"displayName": "shipaddr_id",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line1",
|
|
"displayName": "shipaddr_line1",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line2",
|
|
"displayName": "shipaddr_line2",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line3",
|
|
"displayName": "shipaddr_line3",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line4",
|
|
"displayName": "shipaddr_line4",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_line5",
|
|
"displayName": "shipaddr_line5",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_city",
|
|
"displayName": "shipaddr_city",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_country",
|
|
"displayName": "shipaddr_country",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_countrysubdivisioncode",
|
|
"displayName": "shipaddr_countrysubdivisioncode",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_postalcode",
|
|
"displayName": "shipaddr_postalcode",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_lat",
|
|
"displayName": "shipaddr_lat",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipaddr_long",
|
|
"displayName": "shipaddr_long",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "classref",
|
|
"displayName": "classref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "classref_name",
|
|
"displayName": "classref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "salestermref",
|
|
"displayName": "salestermref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "salestermref_name",
|
|
"displayName": "salestermref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "duedate",
|
|
"displayName": "duedate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipmethodref",
|
|
"displayName": "shipmethodref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipmethodref_name",
|
|
"displayName": "shipmethodref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "shipdate",
|
|
"displayName": "shipdate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "trackingnum",
|
|
"displayName": "trackingnum",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "totalamt",
|
|
"displayName": "totalamt",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "printstatus",
|
|
"displayName": "printstatus",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "emailstatus",
|
|
"displayName": "emailstatus",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billemail_address",
|
|
"displayName": "billemail_address",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billemailcc_address",
|
|
"displayName": "billemailcc_address",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "billemailbcc_address",
|
|
"displayName": "billemailbcc_address",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "balance",
|
|
"displayName": "balance",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "paymentrefnum",
|
|
"displayName": "paymentrefnum",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "paymentmethodref",
|
|
"displayName": "paymentmethodref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "paymentmethodref_name",
|
|
"displayName": "paymentmethodref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deposittoaccountref",
|
|
"displayName": "deposittoaccountref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deposittoaccountref_name",
|
|
"displayName": "deposittoaccountref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deliveryinfo_deliverytype",
|
|
"displayName": "deliveryinfo_deliverytype",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deliveryinfo_deliverytime",
|
|
"displayName": "deliveryinfo_deliverytime",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "deposit",
|
|
"displayName": "deposit",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "hometotalamt",
|
|
"displayName": "hometotalamt",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "departmentref",
|
|
"displayName": "departmentref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "departmentref_name",
|
|
"displayName": "departmentref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "allowonlinecreditcardpayment",
|
|
"displayName": "allowonlinecreditcardpayment",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "boolean",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "applytaxafterdiscount",
|
|
"displayName": "applytaxafterdiscount",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "boolean",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "allowonlineachpayment",
|
|
"displayName": "allowonlineachpayment",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "boolean",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "freeformaddress",
|
|
"displayName": "freeformaddress",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "boolean",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "currencyref",
|
|
"displayName": "currencyref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "currencyref_name",
|
|
"displayName": "currencyref_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "exchangerate",
|
|
"displayName": "exchangerate",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "globaltaxcalculation",
|
|
"displayName": "globaltaxcalculation",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "transactionlocationtype",
|
|
"displayName": "transactionlocationtype",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "invoicelink",
|
|
"displayName": "invoicelink",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "projectref",
|
|
"displayName": "projectref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "recurdataref",
|
|
"displayName": "recurdataref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "taxexemptionref",
|
|
"displayName": "taxexemptionref",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "homebalance",
|
|
"displayName": "homebalance",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "number",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
}
|
|
],
|
|
"attemptToConvertTypes": false,
|
|
"convertFieldsToString": false
|
|
},
|
|
"options": {
|
|
"queryBatching": "transaction"
|
|
}
|
|
},
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "NoPrLWbqySMMmIaI",
|
|
"name": "Postgres n8n-quickbooks"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "5a0718d1-d092-4b63-9453-326c48d5a4b3",
|
|
"name": "Loop Over Items",
|
|
"type": "n8n-nodes-base.splitInBatches",
|
|
"typeVersion": 3,
|
|
"position": [
|
|
880,
|
|
80
|
|
],
|
|
"parameters": {
|
|
"batchSize": 500,
|
|
"options": {}
|
|
}
|
|
}
|
|
],
|
|
"connections": {
|
|
"Schedule Trigger": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Set Defaults",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Set Defaults": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Resolve Company",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Resolve Company": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Route by Company",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Route by Company": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MUS",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MMX",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MSAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MHAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Fetch Invoices - MGC",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MUS": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MUS",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MUS": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MUS",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MUS": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MMX": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MMX",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MMX": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MMX",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MMX": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 1
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MSAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MSAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MSAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MSAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MSAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 2
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MHAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MHAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MHAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MHAG",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MHAG": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 3
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Invoices - MGC": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Stamp - MGC",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Stamp - MGC": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Invoices - MGC",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Invoices - MGC": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 4
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Execute Workflow Trigger": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Set Defaults",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Merge": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Tag Run",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Tag Run": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Loop Over Items",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Summary": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Swap to Live",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Write invoices": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Loop Over Items",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Loop Over Items": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Summary",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Write invoices",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"nodeGroups": [],
|
|
"authors": "Michael Nolan (with n8n Assistant)",
|
|
"name": null,
|
|
"description": null,
|
|
"autosaved": false,
|
|
"createdAt": "2026-11-04T03:34:00.090Z",
|
|
"updatedAt": "2026-11-04T03:34:00.090Z"
|
|
}
|
|
} |