Update hazard waste calculation.
This commit is contained in:
@@ -378,6 +378,18 @@ async function CalculateRatesTotals({ job, client }) {
|
|||||||
(!hasMahwLine || hasMahwLine.act_price !== stlMahw.ttl_amt)
|
(!hasMahwLine || hasMahwLine.act_price !== stlMahw.ttl_amt)
|
||||||
) {
|
) {
|
||||||
//Add a hazardous waste material line in case there isn't one on the estimate.
|
//Add a hazardous waste material line in case there isn't one on the estimate.
|
||||||
|
if (hasMahwLine) {
|
||||||
|
//Update it
|
||||||
|
job.joblines.forEach((jl) => {
|
||||||
|
if (jl.id === hasMahwLine.id) {
|
||||||
|
jl.act_price = stlMahw.ttl_amt;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await client.request(queries.UPDATE_JOB_LINE, {
|
||||||
|
lineId: hasMahwLine.id,
|
||||||
|
line: { act_price: stlMahw.ttl_amt },
|
||||||
|
});
|
||||||
|
} else {
|
||||||
const newMahwLine = {
|
const newMahwLine = {
|
||||||
line_desc: "Hazardous Waste Removal*",
|
line_desc: "Hazardous Waste Removal*",
|
||||||
part_type: "PAS",
|
part_type: "PAS",
|
||||||
@@ -401,6 +413,7 @@ async function CalculateRatesTotals({ job, client }) {
|
|||||||
lineInput: [newMahwLine],
|
lineInput: [newMahwLine],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Materials Scrubbing as required by CCC.
|
//Materials Scrubbing as required by CCC.
|
||||||
let matTotalLine = job.cieca_stl.data.find((l) => l.ttl_typecd === "MAT");
|
let matTotalLine = job.cieca_stl.data.find((l) => l.ttl_typecd === "MAT");
|
||||||
|
|||||||
Reference in New Issue
Block a user