diff --git a/server/job/job-costing.js b/server/job/job-costing.js index 674d6346e..729fa2112 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -267,7 +267,6 @@ function GenerateCostingData(job) { const materialsHours = { mapaHrs: 0, mashHrs: 0 }; let mashOpCodes = InstanceManager({ - imex: [], rome: ParseCalopCode(job.materials["MASH"]?.cal_opcode) }); let hasMapaLine = false; @@ -356,8 +355,14 @@ function GenerateCostingData(job) { if (val.mod_lbr_ty === "LAR") { materialsHours.mapaHrs += val.mod_lb_hrs || 0; } - if (val.mod_lbr_ty !== "LAR" && mashOpCodes.includes(val.lbr_op)) { - materialsHours.mashHrs += val.mod_lb_hrs || 0; + if (InstanceManager({ imex: true, rome: false })) { + if (val.mod_lbr_ty !== "LAR") { + materialsHours.mashHrs += val.mod_lb_hrs || 0; + } + } else { + if (val.mod_lbr_ty !== "LAR" && mashOpCodes.includes(val.lbr_op)) { + materialsHours.mashHrs += val.mod_lb_hrs || 0; + } } } @@ -535,7 +540,11 @@ function GenerateCostingData(job) { if (!hasMapaLine) { let threshold; - if (job.materials["MAPA"].cal_maxdlr !== undefined && job.materials["MAPA"].cal_maxdlr >= 0) { + if ( + job.materials["MAPA"] && + job.materials["MAPA"].cal_maxdlr !== undefined && + job.materials["MAPA"].cal_maxdlr >= 0 + ) { //It has an upper threshhold. threshold = Dinero({ amount: Math.round(job.materials["MAPA"].cal_maxdlr * 100) @@ -581,7 +590,11 @@ function GenerateCostingData(job) { } if (!hasMashLine) { let threshold; - if (job.materials["MASH"].cal_maxdlr !== undefined && job.materials["MASH"].cal_maxdlr >= 0) { + if ( + job.materials["MASH"] && + job.materials["MASH"].cal_maxdlr !== undefined && + job.materials["MASH"].cal_maxdlr >= 0 + ) { //It has an upper threshhold. threshold = Dinero({ amount: Math.round(job.materials["MASH"].cal_maxdlr * 100)