From 35046f11c2697aca18f312ce5929688d0a3fdd1f Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 7 Jun 2024 14:31:33 -0700 Subject: [PATCH 1/2] IO-2793 Add Comment to see output for testing Signed-off-by: Allan Carr --- server/accounting/qb-receivables-lines.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/accounting/qb-receivables-lines.js b/server/accounting/qb-receivables-lines.js index 5091e0136..8702dba33 100644 --- a/server/accounting/qb-receivables-lines.js +++ b/server/accounting/qb-receivables-lines.js @@ -67,6 +67,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes //Determine the Tax code grouping. //Going to always assume that we need to apply GST. + console.log("jobline", jobline) const taxAccountCode = findTaxCode( { local: false, From 5b76473cbc7dffa0fe13d30b16add51496a30d9a Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 7 Jun 2024 15:59:51 -0700 Subject: [PATCH 2/2] IO-2793 Correct Parts Side for Taxes Signed-off-by: Allan Carr --- server/accounting/qb-receivables-lines.js | 43 ++++++++++++++++------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/server/accounting/qb-receivables-lines.js b/server/accounting/qb-receivables-lines.js index 8702dba33..7c6c239ad 100644 --- a/server/accounting/qb-receivables-lines.js +++ b/server/accounting/qb-receivables-lines.js @@ -67,7 +67,12 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes //Determine the Tax code grouping. //Going to always assume that we need to apply GST. - console.log("jobline", jobline) + + //Find out CIECA Code based on profitcenter_part to determine if state tax applies or not. + const cieca_code = Object.keys(responsibilityCenters.defaults.profits).find( + (key) => responsibilityCenters.defaults.profits[key].toLowerCase() === jobline.profitcenter_part.toLowerCase() + ); + const taxAccountCode = findTaxCode( { local: false, @@ -75,20 +80,34 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes state: jobline.tax_part === false ? false - : jobline.part_type.toUpperCase() === "PAS" || jobline.part_type.toUpperCase() === "PASL" + : cieca_code === "PAS" || cieca_code === "PASL" ? jobs_by_pk.tax_sub_rt === 0 ? false : true - : jobs_by_pk.parts_tax_rates[`${jobline.part_type.toUpperCase()}`].prt_tax_in === false || - jobs_by_pk.parts_tax_rates[`${jobline.part_type.toUpperCase()}`].prt_tax_rt === 0 - ? false - : jobline.db_ref === "900511" || - jobline.db_ref === "900510" || - (jobline.mod_lb_hrs === 0 && //Extending IO-1375 as a part of IO-2023 - jobline.act_price > 0 && - jobline.lbr_op === "OP14") - ? true - : jobline.tax_part + : cieca_code.startsWith("LA") + ? jobs_by_pk.tax_lbr_rt === 0 + ? false + : true + : cieca_code === "MAPA" + ? jobs_by_pk.tax_paint_mat_rt === 0 + ? false + : true + : cieca_code === "MASH" + ? jobs_by_pk.tax_shop_mat_rt === 0 + ? false + : true + : cieca_code.startsWith("PA") + ? jobs_by_pk.parts_tax_rates[`${cieca_code}`].prt_tax_in === false || + jobs_by_pk.parts_tax_rates[`${cieca_code}`].prt_tax_rt === 0 + ? false + : true + : jobline.db_ref === "900511" || + jobline.db_ref === "900510" || + (jobline.mod_lb_hrs === 0 && //Extending IO-1375 as a part of IO-2023 + jobline.act_price > 0 && + jobline.lbr_op === "OP14") + ? true + : jobline.tax_part }, bodyshop.md_responsibility_centers.sales_tax_codes );