From a8b09316596ba20f717ea7907d6357f791c71e0c Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 2 Aug 2024 14:49:20 -0700 Subject: [PATCH] Correct for Dinero type Signed-off-by: Allan Carr --- server/accounting/qb-receivables-lines.js | 4 ++-- server/cdk/cdk-calculate-allocations.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/accounting/qb-receivables-lines.js b/server/accounting/qb-receivables-lines.js index 77b4c13c7..625a72cc2 100644 --- a/server/accounting/qb-receivables-lines.js +++ b/server/accounting/qb-receivables-lines.js @@ -723,7 +723,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes if ( job_totals.rates[key] && job_totals.rates[key].adjustment && - job_totals.rates[key].adjustment.isZero() === false + Dinero(job_totals.rates[key].adjustment).isZero() === false ) { if (qbo) { //Going to always assume that we need to apply GST and PST for labor. @@ -748,7 +748,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes : taxCodes[taxAccountCode]; InvoiceLineAdd.push({ DetailType: "SalesItemLineDetail", - Amount: Dinero(job_totals.rates[key]).adjustment.toFormat(DineroQbFormat), + Amount: Dinero(job_totals.rates[key].adjustment).toFormat(DineroQbFormat), Description: `${account.accountdesc} - Adjustment`, SalesItemLineDetail: { ...(jobs_by_pk.class ? { ClassRef: { value: classes[jobs_by_pk.class] } } : {}), diff --git a/server/cdk/cdk-calculate-allocations.js b/server/cdk/cdk-calculate-allocations.js index 780468345..a1dd8cb7f 100644 --- a/server/cdk/cdk-calculate-allocations.js +++ b/server/cdk/cdk-calculate-allocations.js @@ -380,7 +380,7 @@ function calculateAllocations(connectionData, job) { }); //profile level adjustments for labor and materials Object.keys(job.job_totals.rates).forEach((key) => { - if (job.job_totals.rates[key] && job.job_totals.rates[key].adjustment && job.job_totals.rates[key].adjustment.isZero() === false) { + if (job.job_totals.rates[key] && job.job_totals.rates[key].adjustment && Dinero(job.job_totals.rates[key].adjustment).isZero() === false) { const accountName = selectedDmsAllocationConfig.profits[key.toUpperCase()]; const otherAccount = bodyshop.md_responsibility_centers.profits.find((c) => c.name === accountName); if (otherAccount) {