From d7bfc789e2194a2aaec13eab0adf7f48123e1b3a Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 18 Jun 2024 08:44:35 -0700 Subject: [PATCH] IO-2814 Job Costing Correction for OP14 Duplication Signed-off-by: Allan Carr --- server/job/job-costing.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/job/job-costing.js b/server/job/job-costing.js index 8b966140e..f8cbd2515 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -318,7 +318,9 @@ function GenerateCostingData(job) { if (!partsProfitCenter) console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type); const partsAmount = Dinero({ - amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100) + amount: val.act_price_before_ppc + ? Math.round(val.act_price_before_ppc * 100) + : Math.round(val.act_price * 100) }) .multiply(val.part_qty || 1) .add( @@ -327,7 +329,9 @@ function GenerateCostingData(job) { ? val.prt_dsmk_m ? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) }) : Dinero({ - amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100) + amount: val.act_price_before_ppc + ? Math.round(val.act_price_before_ppc * 100) + : Math.round(val.act_price * 100) }) .multiply(val.part_qty || 0) .percentage(Math.abs(val.prt_dsmk_p || 0)) @@ -368,7 +372,10 @@ function GenerateCostingData(job) { } //Additional Profit Center - if ((!val.part_type && !val.mod_lbr_ty) || (!val.part_type && val.mod_lbr_ty)) { + if ( + (!val.part_type && !val.mod_lbr_ty) || + (!val.part_type && val.mod_lbr_ty && val.act_price > 0 && val.lbr_op !== "OP14") + ) { //Does it already have a defined profit center? //If so, use it, otherwise try to use the same from the auto-allocate logic in IO app jobs-close-auto-allocate. const partsProfitCenter = val.profitcenter_part || getAdditionalCostCenter(val, defaultProfits) || "Unknown";