Added OEM Partno dynamic inclusion and exclusion. RPS-42. Removed glass exclusions RPS-43.

This commit is contained in:
Patrick Fic
2020-11-13 11:51:40 -08:00
parent ffea9ad109
commit 26af34e73d

View File

@@ -60,8 +60,8 @@ async function DecodeEstimate(filePath, includeFilePathInReturnJob = false) {
//Removed as a part of RPS-40.
// if (job.V_MILEAGE <= 20000) {
// returnValue = { ERROR: "Vehicle mileage is less than 20,000kms." };
// } else
// } else
if (!accepted_ins_co.includes(job.INS_CO_NM)) {
returnValue = {
ERROR: `Insurance Company Name is not valid for RPS. (${
@@ -377,7 +377,7 @@ async function DecodeLinFile(extensionlessFilePath) {
jobline.part_type === "PAN" &&
jobline.db_price !== jobline.act_price
) {
jobline.db_price = jobline.act_price;
jobline.db_price = jobline.act_price;
}
if (
@@ -386,15 +386,11 @@ async function DecodeLinFile(extensionlessFilePath) {
!!jobline.act_price &&
jobline.act_price > jobline.db_price
) {
// log.info(
// "Act price higher than existing db price",
// jobline.line_desc,
// jobline.db_price,
// jobline.act_price
// );
//Actual price should never be higher than the DB Price.
jobline.db_price = jobline.act_price;
}
//Logic Based Exclusions.
if (
!jobline.part_type ||
jobline.db_ref.startsWith("900") ||
@@ -404,15 +400,22 @@ async function DecodeLinFile(extensionlessFilePath) {
jobline.line_desc.toLowerCase().startsWith("hazardous") ||
jobline.line_desc.toLowerCase().startsWith("detail") ||
jobline.line_desc.toLowerCase().startsWith("clean") ||
// jobline.part_type.toUpperCase() === "PAG" ||
// jobline.part_type.toUpperCase() === "PAG" ||Removed for RPS-43.
jobline.part_type.toUpperCase() === "PAS" ||
jobline.part_type.toUpperCase() === "PASL" ||
jobline.part_type.toUpperCase() === "PAE" ||
//jobline.glass_flag === true ||
//jobline.glass_flag === true //Removed for RPS-43.
jobline.db_price === 0
)
jobline.ignore = true;
//RPS-42 Dynamic Inclusion or Exclusion of Lines based on RPS-EXCLUDE or RPS.
if (jobline.oem_partno.toLowerCase().includes("/rps-exclude")) {
jobline.ignore = true;
} else if (jobline.oem_partno.toLowerCase().includes("/rps")) {
jobline.ignore = false;
}
delete jobline.glass_flag;
return jobline;
});