IO-2015 Job Costing fix for lines with no part type but a dollar amount.

This commit is contained in:
Patrick Fic
2022-08-15 12:39:09 -07:00
parent 129c94f066
commit d5c27fc9ae

View File

@@ -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;
}