From 7b420b1855384396d2254a0d229adb83d8a55d4d Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Thu, 12 Sep 2024 16:27:43 -0700 Subject: [PATCH 1/2] IO-2928 QBO CA US Tax Accumulator Signed-off-by: Allan Carr --- server/accounting/qbo/qbo-payables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/accounting/qbo/qbo-payables.js b/server/accounting/qbo/qbo-payables.js index eacf36f4d..2e91623bb 100644 --- a/server/accounting/qbo/qbo-payables.js +++ b/server/accounting/qbo/qbo-payables.js @@ -219,7 +219,7 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor, bodyshop) Amount: Dinero({ amount: Math.round( bill.billlines.reduce((acc, val) => { - return acc + val.actual_cost * val.quantity; + return acc + val.applicable_taxes?.federal ? val.actual_cost * val.quantity : 0; }, 0) * 100 ) }) From 4e6c45b1953d8feee2b88919c167cdc481efc6c6 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Thu, 12 Sep 2024 17:13:29 -0700 Subject: [PATCH 2/2] IO-2928 Null coalesce billline amount Signed-off-by: Allan Carr --- server/accounting/qbo/qbo-payables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/accounting/qbo/qbo-payables.js b/server/accounting/qbo/qbo-payables.js index 2e91623bb..1d16b0daf 100644 --- a/server/accounting/qbo/qbo-payables.js +++ b/server/accounting/qbo/qbo-payables.js @@ -219,7 +219,7 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor, bodyshop) Amount: Dinero({ amount: Math.round( bill.billlines.reduce((acc, val) => { - return acc + val.applicable_taxes?.federal ? val.actual_cost * val.quantity : 0; + return acc + val.applicable_taxes?.federal ? (val.actual_cost * val.quantity ?? 0) : 0; }, 0) * 100 ) })