Initial work for claims clerk.
This commit is contained in:
192
electron/claims-clerk/claims-clerk.js
Normal file
192
electron/claims-clerk/claims-clerk.js
Normal file
@@ -0,0 +1,192 @@
|
||||
const { DBFFile } = require("dbffile");
|
||||
const path = require("path");
|
||||
const _ = require("lodash");
|
||||
const log = require("electron-log");
|
||||
const { store } = require("../electron-store");
|
||||
const { BrowserWindow } = require("electron");
|
||||
const ipcTypes = require("../../src/ipc.types.commonjs");
|
||||
|
||||
//Return the jobline. Modification happens in place.
|
||||
exports.claimsClerk = ({ jobline, joblines }) => {
|
||||
const alerts = rules
|
||||
.map((rule) => rule({ jobline, joblines })) //If it should be ignored, skip it.
|
||||
.filter((rule) => rule !== null);
|
||||
return alerts;
|
||||
};
|
||||
|
||||
const rules = [
|
||||
({ jobline, joblines }) => {
|
||||
//Upgrade 1
|
||||
if (
|
||||
jobline.db_ref === "900500" &&
|
||||
jobline.db_price === 0 &&
|
||||
jobline.db_hrs === 0 &&
|
||||
jobline.mod_lb_hrs !== jobline.db_hrs
|
||||
) {
|
||||
return {
|
||||
key: "Manual Line",
|
||||
alert: `<div>
|
||||
Manually entered line detected.
|
||||
<ul>
|
||||
<li>This part will NOT count towards your RPS.</li>
|
||||
<li>You will need to supply an invoice to MPI for this part.</li>
|
||||
<li>Always ensure part is not in CEG before creating a manual entry line.</li>
|
||||
</ul>
|
||||
</div>`
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
({ jobline, joblines }) => {
|
||||
//Upgrade 2
|
||||
if (joblines.db_hrs !== 0 && jobline.mod_lb_hrs !== jobline.db_hrs) {
|
||||
return {
|
||||
key: "Manual labor Time Change",
|
||||
alert: `<div>
|
||||
Labor time manually changed from original CEG time.
|
||||
<ul>
|
||||
<li>This could possibly be denied by MPI.</li>
|
||||
<li> Ensure labor time is accurate & justified.</li>
|
||||
<li>Add an explanation line if needed.</li>
|
||||
</ul>
|
||||
</div>`
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
({ jobline, joblines }) => {
|
||||
//Upgrade 3
|
||||
if (jobline.db_ref === "900500" && jobline.mod_lb_hrs !== jobline.db_hrs) {
|
||||
return {
|
||||
key: "Manual Labor Line",
|
||||
alert: `<div>
|
||||
Manually entered labor line detected.
|
||||
<ul>
|
||||
<li>Always ensure the labor operation you manually entered was not available in CEG.</li>
|
||||
<li>Make sure there are no overlaps with other labor lines to consider.</li>
|
||||
</ul>
|
||||
</div>`
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
({ jobline, joblines }) => {
|
||||
//Upgrade 4
|
||||
if (
|
||||
jobline.db_ref !== "900500" &&
|
||||
jobline.part_type &&
|
||||
jobline.oem_partno &&
|
||||
jobline.price_j //TODO Requires verification per Norm's email.
|
||||
) {
|
||||
if (jobline.act_price < jobline.db_price) {
|
||||
//TODO: Verify what should happen here when the two values are the same?
|
||||
return {
|
||||
key: "Modified part price",
|
||||
alert: `<div>
|
||||
Modified part price detected.
|
||||
<ul>
|
||||
<li>
|
||||
You will need to supply MPI with an invoice for this part showing the retail price you manually
|
||||
entered.
|
||||
</li>
|
||||
<li>
|
||||
Your manually entered price is <strong>LOWER</strong> than the database price, consider reverting back to database
|
||||
price.
|
||||
</li>
|
||||
<li>If you chose to leave the manually entered price, you will need to:</li>
|
||||
<li>Supply MPI with an invoice for this part showing the retail price you manually entered</li>
|
||||
<li>NOTE: You do not need to show MPI your cost on this part, only retail.</li>
|
||||
</ul>
|
||||
</div>`
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
key: "Modified part price",
|
||||
alert: `<div>
|
||||
Modified part price detected.
|
||||
<ul>
|
||||
<li>
|
||||
You will need to supply MPI with an invoice for this part showing the retail price you manually
|
||||
entered.
|
||||
</li>
|
||||
<li>NOTE: You do not need to show MPI your cost on this part, only retail.</li>
|
||||
</ul>
|
||||
</div>`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
({ jobline, joblines }) => {
|
||||
// In this update we want to identify OEM part lines where the part # and price have been changed.
|
||||
if (
|
||||
(jobline.part_type === "PAA" || jobline.part_type === "PAL") &&
|
||||
jobline.alt_partno &&
|
||||
jobline.act_price < jobline.db_price //TODO: Verify the equals than case.
|
||||
) {
|
||||
//Need to find a 900501 line that is right after it indicating it has the words pricematch
|
||||
const lineIndex = joblines.findIndex((line) => line.line_no === jobline.line_no);
|
||||
const nextLine = joblines[lineIndex + 1];
|
||||
console.log("*** ~ nextLine:", nextLine);
|
||||
|
||||
if (!nextLine?.line_desc.includes("price")) {
|
||||
return {
|
||||
key: "Missing pricematch explanation",
|
||||
alert: `<div>In that explanation line (900501) we are looking for the words “pricematch” or “price” & “match”.</div>`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
({ jobline, joblines }) => {
|
||||
//Upgrade 5
|
||||
//TODO: LIN Files did not seem accurate for this. Perhaps one was created and it doesn't work right.
|
||||
if (false) {
|
||||
return {
|
||||
key: "Modified part # & price",
|
||||
alert: `<div>
|
||||
Modified part # and Price detected
|
||||
<ul>
|
||||
<li>
|
||||
Try searching that part # in CEG to find the correct lines rather than modifying a different part line.
|
||||
</li>
|
||||
<li>If that part # does not exist in CEG, create a manual entry line and erase the one you modified.</li>
|
||||
<li>Since this part is not ins CEG, it will not be considered for RPS.</li>
|
||||
</ul>
|
||||
</div>`
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
({ jobline, joblines }) => {
|
||||
//Upgrade 6
|
||||
if (jobline.part_type && jobline.part_qty !== 1) {
|
||||
return {
|
||||
key: "Quantity changed",
|
||||
alert: `<div>
|
||||
Quantity manual change detected.
|
||||
<ul>
|
||||
<li>
|
||||
MPI Estimating Standard outline that every part should have 1 line rather than manually changing the
|
||||
quantity.
|
||||
</li>
|
||||
<li>Leaving the quantity modified <strong>MAY</strong> affect your RPS score.</li>
|
||||
<li>
|
||||
Consider creating manual entry lines for each part which will also disqualify those parts from your RPS
|
||||
calculation.
|
||||
</li>
|
||||
</ul>
|
||||
</div>`
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
];
|
||||
@@ -7,6 +7,7 @@ const { BrowserWindow } = require("electron");
|
||||
const ipcTypes = require("../../src/ipc.types.commonjs");
|
||||
const { NewNotification } = require("../notification-wrapper/notification-wrapper");
|
||||
const { WhichRulesetToApply } = require("./constants");
|
||||
const { claimsClerk } = require("../claims-clerk/claims-clerk");
|
||||
//const Nucleus = require("nucleus-nodejs");
|
||||
|
||||
async function ImportJob(filepath) {
|
||||
@@ -326,7 +327,7 @@ async function DecodeLinFile(extensionlessFilePath, close_date) {
|
||||
"PRT_DSMK_P",
|
||||
|
||||
"MOD_LBR_TY",
|
||||
// "DB_HRS",
|
||||
"DB_HRS",
|
||||
"MOD_LB_HRS",
|
||||
// "LBR_INC",
|
||||
// "LBR_OP",
|
||||
@@ -379,6 +380,8 @@ async function DecodeLinFile(extensionlessFilePath, close_date) {
|
||||
break;
|
||||
}
|
||||
|
||||
jobline.alerts = claimsClerk({ jobline, joblines });
|
||||
|
||||
//Moved from V1 function as they may be needed later.
|
||||
delete jobline.prt_dsmk_m; //Delete price markup for wheel repair
|
||||
delete jobline.prt_dsmk_p;
|
||||
@@ -448,7 +451,9 @@ function V1Ruleset(jobline, joblines) {
|
||||
jobline.line_desc.toLowerCase().startsWith("urethane") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("w/shield adhesive") ||
|
||||
//jobline.line_desc.toLowerCase().includes("wheel") || Removed as a part of RPS-41
|
||||
(jobline.line_desc.toLowerCase().includes("tire") && !jobline.line_desc.toLowerCase().includes("sensor")&& !jobline.line_desc.toLowerCase().includes("label")) ||
|
||||
(jobline.line_desc.toLowerCase().includes("tire") &&
|
||||
!jobline.line_desc.toLowerCase().includes("sensor") &&
|
||||
!jobline.line_desc.toLowerCase().includes("label")) ||
|
||||
jobline.line_desc.toLowerCase().startsWith("hazardous") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("detail") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("clean") ||
|
||||
|
||||
Reference in New Issue
Block a user