IO-1375 SGI Add Sublet Labor Lines Calculation
This commit is contained in:
@@ -189,6 +189,25 @@ function CalculateRatesTotals(ratesList) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.mod_lbr_ty) {
|
if (item.mod_lbr_ty) {
|
||||||
|
//Check to see if it has 0 hours and a price instead.
|
||||||
|
if (
|
||||||
|
item.mod_lb_hrs === 0 &&
|
||||||
|
item.act_price > 0 &&
|
||||||
|
item.lbr_op === "OP14"
|
||||||
|
) {
|
||||||
|
//Scenario where SGI may pay out hours using a part price.
|
||||||
|
if (!ret[item.mod_lbr_ty.toLowerCase()].total) {
|
||||||
|
ret[item.mod_lbr_ty.toLowerCase()].total = Dinero();
|
||||||
|
}
|
||||||
|
ret[item.mod_lbr_ty.toLowerCase()].total = ret[
|
||||||
|
item.mod_lbr_ty.toLowerCase()
|
||||||
|
].total.add(
|
||||||
|
Dinero({ amount: Math.round((item.act_price || 0) * 100) }).multiply(
|
||||||
|
item.part_qty
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//There's a labor type, assign the hours.
|
//There's a labor type, assign the hours.
|
||||||
ret[item.mod_lbr_ty.toLowerCase()].hours =
|
ret[item.mod_lbr_ty.toLowerCase()].hours =
|
||||||
ret[item.mod_lbr_ty.toLowerCase()].hours + item.mod_lb_hrs;
|
ret[item.mod_lbr_ty.toLowerCase()].hours + item.mod_lb_hrs;
|
||||||
@@ -212,9 +231,14 @@ function CalculateRatesTotals(ratesList) {
|
|||||||
(property === "mash" && hasMashLine)
|
(property === "mash" && hasMashLine)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
ret[property].total = Dinero({
|
if (!ret[property].total) {
|
||||||
amount: Math.round((ret[property].rate || 0) * 100),
|
ret[property].total = Dinero();
|
||||||
}).multiply(ret[property].hours);
|
}
|
||||||
|
ret[property].total = ret[property].total.add(
|
||||||
|
Dinero({
|
||||||
|
amount: Math.round((ret[property].rate || 0) * 100),
|
||||||
|
}).multiply(ret[property].hours)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
subtotal = subtotal.add(ret[property].total);
|
subtotal = subtotal.add(ret[property].total);
|
||||||
@@ -222,6 +246,7 @@ function CalculateRatesTotals(ratesList) {
|
|||||||
if (property !== "mapa" && property !== "mash")
|
if (property !== "mapa" && property !== "mash")
|
||||||
rates_subtotal = rates_subtotal.add(ret[property].total);
|
rates_subtotal = rates_subtotal.add(ret[property].total);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.subtotal = subtotal;
|
ret.subtotal = subtotal;
|
||||||
ret.rates_subtotal = rates_subtotal;
|
ret.rates_subtotal = rates_subtotal;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user