New fix for NA mitchell items. RPS-46. Fixed vehicle age bug RPS-51

This commit is contained in:
Patrick Fic
2020-11-18 15:10:45 -08:00
parent b057f50579
commit 6ecdcefe92
7 changed files with 53 additions and 26 deletions

View File

@@ -9,11 +9,15 @@ export function CalculateJobRpsDollars(job, returnSumActPrice) {
.filter((j) => !j.ignore)
.reduce((acc, val) => {
actPriceSum = actPriceSum.add(
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
Dinero({ amount: Math.round((val.act_price || 0) * 100) }).multiply(
val.part_qty || 1
)
);
if (val.price_diff > 0) {
return acc.add(
Dinero({ amount: Math.round((val.price_diff || 0) * 100) })
Dinero({ amount: Math.round((val.price_diff || 0) * 100) }).multiply(
val.part_qty || 1
)
);
} else {
return acc;
@@ -34,7 +38,11 @@ export function CalculateJobRpsPc(
const dbPriceSum = job.joblines
.filter((j) => !j.ignore)
.reduce((acc, val) => {
return acc.add(Dinero({ amount: Math.round((val.db_price || 0) * 100) }));
return acc.add(
Dinero({ amount: Math.round((val.db_price || 0) * 100) }).multiply(
val.part_qty || 1
)
);
}, Dinero());
const jobRpsPc = currentRpsDollars.getAmount() / dbPriceSum.getAmount();