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

@@ -20,7 +20,9 @@ export default function JobPartsGraphAtom({
}
acc[val.part_type] = acc[val.part_type].add(
Dinero({ amount: Math.round((val[price] || 0) * 100) })
Dinero({ amount: Math.round((val[price] || 0) * 100) }).multiply(
val.part_qty || 1
)
);
return acc;

View File

@@ -60,6 +60,13 @@ export default function JobLinesTableMolecule({ loading, job }) {
width: "15%",
sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno),
},
{
title: "Qty.",
dataIndex: "part_qty",
key: "part_qty",
width: "5%",
sorter: (a, b) => a.part_qty - b.part_qty,
},
{
title: "Database Price",
dataIndex: "db_price",

View File

@@ -17,6 +17,9 @@ export async function UpsertEstimate(job) {
logger.info("Beginning Upserting job from Renderer.");
const parsedYr = parseInt(job.v_model_yr);
logger.info(
"Job Loss Date",
job.loss_date,
"Parsed Year",
moment(job.loss_date).year() -
(parsedYr >= 0 ? 2000 + parsedYr : 1900 + parsedYr)
);
@@ -29,6 +32,8 @@ export async function UpsertEstimate(job) {
(parsedYr >= 0 ? 2000 + parsedYr : 1900 + parsedYr),
};
if (job.v_age < 0) job.v_age = 0;
const existingJobs = await client.query({
query: QUERY_JOB_BY_CLM_NO,
variables: { clm_no: job.clm_no },

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();