From d5c27fc9aee28542afad47fe666de534090cec1b Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 15 Aug 2022 12:39:09 -0700 Subject: [PATCH] IO-2015 Job Costing fix for lines with no part type but a dollar amount. --- server/job/job-costing.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/job/job-costing.js b/server/job/job-costing.js index 19cd70f0a..36628273f 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -336,6 +336,7 @@ function GenerateCostingData(job) { console.log("Unknown type", val.line_desc, val.mod_lbr_ty); const rateName = `rate_${(val.mod_lbr_ty || "").toLowerCase()}`; + const laborAmount = Dinero({ amount: Math.round((job[rateName] || 0) * 100), }).multiply(val.mod_lb_hrs || 0); @@ -344,6 +345,19 @@ function GenerateCostingData(job) { acc.labor[laborProfitCenter] = acc.labor[laborProfitCenter].add(laborAmount); + if ( + val.mod_lb_hrs === 0 && + val.act_price > 0 && + val.lbr_op === "OP14" + ) { + //Scenario where SGI may pay out hours using a part price. + acc.labor[laborProfitCenter] = acc.labor[laborProfitCenter].add( + Dinero({ + amount: Math.round((val.act_price || 0) * 100), + }).multiply(val.part_qty) + ); + } + if (val.mod_lbr_ty === "LAR") { materialsHours.mapaHrs += val.mod_lb_hrs || 0; }