IO-3503 Job Costing Fixes
Correction to handle CAD Signed-off-by: Allan Carr <allan@imexsystems.ca>
This commit is contained in:
@@ -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,10 +355,16 @@ function GenerateCostingData(job) {
|
||||
if (val.mod_lbr_ty === "LAR") {
|
||||
materialsHours.mapaHrs += 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Part Profit Center
|
||||
if (val.part_type && val.part_type !== "PAE" && val.part_type !== "PAS" && val.part_type !== "PASL") {
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user