From 901c64ed85315f2c71b81ddcdb2efe06ab4bccee Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 30 Aug 2021 16:38:45 -0700 Subject: [PATCH 1/2] IO-1336 Resolve towing/storage missing on export. --- server/accounting/qbxml/qbxml-receivables.js | 47 ++++++++++++++++++++ server/graphql-client/queries.js | 4 +- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/server/accounting/qbxml/qbxml-receivables.js b/server/accounting/qbxml/qbxml-receivables.js index 831f4f221..6fa0d9260 100644 --- a/server/accounting/qbxml/qbxml-receivables.js +++ b/server/accounting/qbxml/qbxml-receivables.js @@ -389,6 +389,53 @@ const generateInvoiceQbxml = ( }); }); + //Add Towing, storage and adjustment lines. + + if (jobs_by_pk.towing_payable && jobs_by_pk.towing_payable !== 0) { + InvoiceLineAdd.push({ + ItemRef: { + FullName: responsibilityCenters.defaults.profits["TOW"].accountitem, + }, + Desc: responsibilityCenters.defaults.profits["TOW"].accountdesc, + Quantity: 1, + Amount: Dinero(jobs_by_pk.towing_payable).toFormat(DineroQbFormat), + SalesTaxCodeRef: { + FullName: "E", + }, + }); + } + if (jobs_by_pk.storage_payable && jobs_by_pk.storage_payable !== 0) { + InvoiceLineAdd.push({ + ItemRef: { + FullName: responsibilityCenters.defaults.profits["TOW"].accountitem, + }, + Desc: responsibilityCenters.defaults.profits["TOW"].accountdesc, + Quantity: 1, + Amount: Dinero(jobs_by_pk.storage_payable).toFormat(DineroQbFormat), + SalesTaxCodeRef: { + FullName: "E", + }, + }); + } + if ( + jobs_by_pk.adjustment_bottom_line && + jobs_by_pk.adjustment_bottom_line !== 0 + ) { + InvoiceLineAdd.push({ + ItemRef: { + FullName: responsibilityCenters.defaults.profits["TOW"].accountitem, + }, + Desc: responsibilityCenters.defaults.profits["TOW"].accountdesc, + Quantity: 1, + Amount: Dinero(jobs_by_pk.adjustment_bottom_line).toFormat( + DineroQbFormat + ), + SalesTaxCodeRef: { + FullName: "E", + }, + }); + } + //Add tax lines const job_totals = jobs_by_pk.job_totals; diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js index 60439ce06..4796bc6f6 100644 --- a/server/graphql-client/queries.js +++ b/server/graphql-client/queries.js @@ -53,7 +53,6 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) { ro_number clm_total clm_no - invoice_allocation ownerid ownr_ln ownr_fn @@ -92,6 +91,9 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) { class ca_bc_pvrt ca_customer_gst + towing_payable + storage_payable + adjustment_bottom_line owner { accountingid } From cb76e2dcdee7e2fdce1b39b59c72a0694a039fa8 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 30 Aug 2021 16:59:15 -0700 Subject: [PATCH 2/2] IO-1336 Resolve issues with QB Export of towing. --- server/accounting/qbxml/qbxml-receivables.js | 32 +++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/server/accounting/qbxml/qbxml-receivables.js b/server/accounting/qbxml/qbxml-receivables.js index 6fa0d9260..ff3c98e4a 100644 --- a/server/accounting/qbxml/qbxml-receivables.js +++ b/server/accounting/qbxml/qbxml-receivables.js @@ -394,11 +394,15 @@ const generateInvoiceQbxml = ( if (jobs_by_pk.towing_payable && jobs_by_pk.towing_payable !== 0) { InvoiceLineAdd.push({ ItemRef: { - FullName: responsibilityCenters.defaults.profits["TOW"].accountitem, + FullName: responsibilityCenters.profits.find( + (c) => c.name === responsibilityCenters.defaults.profits["TOW"] + ).accountitem, }, - Desc: responsibilityCenters.defaults.profits["TOW"].accountdesc, + Desc: "Towing", Quantity: 1, - Amount: Dinero(jobs_by_pk.towing_payable).toFormat(DineroQbFormat), + Amount: Dinero({ + amount: Math.round((jobs_by_pk.towing_payable || 0) * 100), + }).toFormat(DineroQbFormat), SalesTaxCodeRef: { FullName: "E", }, @@ -407,11 +411,15 @@ const generateInvoiceQbxml = ( if (jobs_by_pk.storage_payable && jobs_by_pk.storage_payable !== 0) { InvoiceLineAdd.push({ ItemRef: { - FullName: responsibilityCenters.defaults.profits["TOW"].accountitem, + FullName: responsibilityCenters.profits.find( + (c) => c.name === responsibilityCenters.defaults.profits["TOW"] + ).accountitem, }, - Desc: responsibilityCenters.defaults.profits["TOW"].accountdesc, + Desc: "Storage", Quantity: 1, - Amount: Dinero(jobs_by_pk.storage_payable).toFormat(DineroQbFormat), + Amount: Dinero({ + amount: Math.round((jobs_by_pk.storage_payable || 0) * 100), + }).toFormat(DineroQbFormat), SalesTaxCodeRef: { FullName: "E", }, @@ -423,13 +431,15 @@ const generateInvoiceQbxml = ( ) { InvoiceLineAdd.push({ ItemRef: { - FullName: responsibilityCenters.defaults.profits["TOW"].accountitem, + FullName: responsibilityCenters.profits.find( + (c) => c.name === responsibilityCenters.defaults.profits["PAO"] + ).accountitem, }, - Desc: responsibilityCenters.defaults.profits["TOW"].accountdesc, + Desc: "Adjustment", Quantity: 1, - Amount: Dinero(jobs_by_pk.adjustment_bottom_line).toFormat( - DineroQbFormat - ), + Amount: Dinero({ + amount: Math.round((jobs_by_pk.adjustment_bottom_line || 0) * 100), + }).toFormat(DineroQbFormat), SalesTaxCodeRef: { FullName: "E", },