Merged in feature/IO-3503-Job-Costing-Fixes (pull request #2875)

IO-3503 Job Costing Fixes

Approved-by: Dave Richer
This commit is contained in:
Allan Carr
2026-01-23 19:29:24 +00:00
committed by Dave Richer

View File

@@ -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)