Glass Updates.
This commit is contained in:
@@ -277,229 +277,237 @@ async function DecodeTtlFile(extensionlessFilePath) {
|
||||
async function DecodeLinFile(extensionlessFilePath) {
|
||||
let dbf = await DBFFile.open(`${extensionlessFilePath}.LIN`);
|
||||
let records = await dbf.readRecords();
|
||||
let joblines = records
|
||||
.map((record) => {
|
||||
return _.transform(
|
||||
_.pick(record, [
|
||||
"LINE_NO",
|
||||
"LINE_IND",
|
||||
// "LINE_REF",
|
||||
// "TRAN_CODE",
|
||||
"DB_REF",
|
||||
"UNQ_SEQ",
|
||||
// "WHO_PAYS",
|
||||
"LINE_DESC",
|
||||
"PART_TYPE",
|
||||
// "PART_DESCJ",
|
||||
"PRT_DSMK_M",
|
||||
"OEM_PARTNO",
|
||||
// "PRICE_INC",
|
||||
// "ALT_PART_I",
|
||||
// "TAX_PART",
|
||||
"DB_PRICE",
|
||||
"ACT_PRICE",
|
||||
"PART_QTY",
|
||||
"PRICE_J",
|
||||
"GLASS_FLAG",
|
||||
// "CERT_PART",
|
||||
// "ALT_CO_ID",
|
||||
// "ALT_PARTNO",
|
||||
// "ALT_OVERRD",
|
||||
// "ALT_PARTM",
|
||||
"PRT_DSMK_P",
|
||||
let joblines = records.map((record) => {
|
||||
return _.transform(
|
||||
_.pick(record, [
|
||||
"LINE_NO",
|
||||
"LINE_IND",
|
||||
"LINE_REF",
|
||||
// "TRAN_CODE",
|
||||
"DB_REF",
|
||||
"UNQ_SEQ",
|
||||
// "WHO_PAYS",
|
||||
"LINE_DESC",
|
||||
"PART_TYPE",
|
||||
// "PART_DESCJ",
|
||||
"PRT_DSMK_M",
|
||||
"OEM_PARTNO",
|
||||
// "PRICE_INC",
|
||||
// "ALT_PART_I",
|
||||
// "TAX_PART",
|
||||
"DB_PRICE",
|
||||
"ACT_PRICE",
|
||||
"PART_QTY",
|
||||
"PRICE_J",
|
||||
"GLASS_FLAG",
|
||||
// "CERT_PART",
|
||||
// "ALT_CO_ID",
|
||||
// "ALT_PARTNO",
|
||||
// "ALT_OVERRD",
|
||||
// "ALT_PARTM",
|
||||
"PRT_DSMK_P",
|
||||
|
||||
// "MOD_LBR_TY",
|
||||
// "DB_HRS",
|
||||
// "MOD_LB_HRS",
|
||||
// "LBR_INC",
|
||||
// "LBR_OP",
|
||||
// "LBR_HRS_J",
|
||||
// "LBR_TYP_J",
|
||||
// "LBR_OP_J",
|
||||
// "PAINT_STG",
|
||||
// "PAINT_TONE",
|
||||
// "LBR_TAX",
|
||||
// "LBR_AMT",
|
||||
// "MISC_AMT",
|
||||
// "MISC_SUBLT",
|
||||
// "MISC_TAX",
|
||||
// "BETT_TYPE",
|
||||
// "BETT_PCTG",
|
||||
// "BETT_AMT",
|
||||
// "BETT_TAX",
|
||||
]),
|
||||
function (result, val, key) {
|
||||
//Required because unq_seq gets pulled as a numeric instaed of a string.
|
||||
// "MOD_LBR_TY",
|
||||
// "DB_HRS",
|
||||
// "MOD_LB_HRS",
|
||||
// "LBR_INC",
|
||||
// "LBR_OP",
|
||||
// "LBR_HRS_J",
|
||||
// "LBR_TYP_J",
|
||||
// "LBR_OP_J",
|
||||
// "PAINT_STG",
|
||||
// "PAINT_TONE",
|
||||
// "LBR_TAX",
|
||||
// "LBR_AMT",
|
||||
// "MISC_AMT",
|
||||
// "MISC_SUBLT",
|
||||
// "MISC_TAX",
|
||||
// "BETT_TYPE",
|
||||
// "BETT_PCTG",
|
||||
// "BETT_AMT",
|
||||
// "BETT_TAX",
|
||||
]),
|
||||
function (result, val, key) {
|
||||
//Required because unq_seq gets pulled as a numeric instaed of a string.
|
||||
|
||||
if (key === "UNQ_SEQ") {
|
||||
result[key.toLowerCase()] = val.toString();
|
||||
return;
|
||||
}
|
||||
result[key.toLowerCase()] = val;
|
||||
if (key === "UNQ_SEQ") {
|
||||
result[key.toLowerCase()] = val.toString();
|
||||
return;
|
||||
}
|
||||
result[key.toLowerCase()] = val;
|
||||
return;
|
||||
}
|
||||
);
|
||||
});
|
||||
// .filter(
|
||||
// (jobline) =>
|
||||
// jobline.part_type &&
|
||||
// !jobline.db_ref.startsWith("900") &&
|
||||
// !jobline.line_desc.toLowerCase().startsWith("urethane") &&
|
||||
// !jobline.line_desc.toLowerCase().startsWith("wheel") &&
|
||||
// !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() !== "PAS" &&
|
||||
// jobline.part_type.toUpperCase() !== "PASL" &&
|
||||
// jobline.part_type.toUpperCase() !== "PAE" &&
|
||||
// jobline.glass_flag === false
|
||||
// )
|
||||
|
||||
joblines.map((jobline) => {
|
||||
//Removed as a result of conversation with Norm.
|
||||
// Appears you are calculating based on ‘N.A.’ part values in the Mitchell database.
|
||||
// Reminder – if Mitchell DB has $0.00 price updates can be tracked, if it has N.A. it cannot calculate RPS value.
|
||||
|
||||
// if (
|
||||
// (jobline.db_price === null || jobline.db_price === 0) &&
|
||||
// !!jobline.act_price &&
|
||||
// jobline.act_price > 0
|
||||
// ) {
|
||||
// // log.info(
|
||||
// // "DB Price null/lower than act price",
|
||||
// // jobline.line_desc,
|
||||
// // jobline.db_price,
|
||||
// // jobline.act_price
|
||||
// // );
|
||||
// jobline.db_price = jobline.act_price;
|
||||
// }
|
||||
|
||||
//*****TODO LINE****
|
||||
//Any PAL, Remanufactured, Recycled, Aftermarket, Used,
|
||||
// If DB Price 0, ignore them.
|
||||
// if (
|
||||
// (jobline.part_type === "PAL" ||
|
||||
// jobline.part_type === "PAM" ||
|
||||
// jobline.part_type === "PAR" ||
|
||||
// jobline.part_type === "PAA") &&
|
||||
// jobline.db_price === 0
|
||||
// ) {
|
||||
// jobline.ignore = true;
|
||||
// }
|
||||
|
||||
jobline.ignore = false;
|
||||
|
||||
//Wheel Repair Pricing PRS-82
|
||||
//Verified on 08/24/21
|
||||
if (
|
||||
jobline.part_type === "PAN" &&
|
||||
jobline.line_desc.toLowerCase().includes("wheel") &&
|
||||
Math.abs(jobline.prt_dsmk_m) ===
|
||||
Math.round((jobline.act_price / 2) * 100) / 100
|
||||
) {
|
||||
log.info(`Jobline '${jobline.line_desc}' ignored due to wheel repair.`);
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
//RPS-46 Ignore NA Line Items.
|
||||
//Removed on 05/20. We are seeing more $0DB lines than NA lines and they are getting incorrectly ignored.
|
||||
// if (
|
||||
// jobline.part_type === "PAN" &&
|
||||
// jobline.price_j === true &&
|
||||
// jobline.db_price === 0
|
||||
// ) {
|
||||
// jobline.ignore = true;
|
||||
// }
|
||||
|
||||
//RPS-39 - OEM ON OEM SAVINGS
|
||||
//Verified on 08/24/21
|
||||
if (jobline.part_type === "PAN" && jobline.db_price !== jobline.act_price) {
|
||||
jobline.db_price = jobline.act_price;
|
||||
}
|
||||
|
||||
//$0DB price for aftermarket and recycled parts. RPS-83
|
||||
//Verified on 08/24/21
|
||||
if (
|
||||
(jobline.part_type === "PAA" || jobline.part_type === "PAL") &&
|
||||
jobline.db_price === 0 &&
|
||||
jobline.db_price !== jobline.act_price
|
||||
) {
|
||||
jobline.db_price = jobline.act_price;
|
||||
}
|
||||
|
||||
//05/20
|
||||
//We’ll have to apply a rule that will not count any A/M, Reman or new part price that is manually changed to $0.00.
|
||||
//Only recycled parts that are changed to $0.00 can be counted towards RPS.
|
||||
// This is separate from $0.00 DB prices that need to be updated to the manually entered price.
|
||||
//Verified on 08/24/21
|
||||
if (
|
||||
jobline.part_type !== "PAL" &&
|
||||
jobline.act_price === 0 &&
|
||||
jobline.price_j
|
||||
) {
|
||||
log.info(
|
||||
`Jobline '${jobline.line_desc}' ignored because it was manually changed to 0..`
|
||||
);
|
||||
})
|
||||
// .filter(
|
||||
// (jobline) =>
|
||||
// jobline.part_type &&
|
||||
// !jobline.db_ref.startsWith("900") &&
|
||||
// !jobline.line_desc.toLowerCase().startsWith("urethane") &&
|
||||
// !jobline.line_desc.toLowerCase().startsWith("wheel") &&
|
||||
// !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() !== "PAS" &&
|
||||
// jobline.part_type.toUpperCase() !== "PASL" &&
|
||||
// jobline.part_type.toUpperCase() !== "PAE" &&
|
||||
// jobline.glass_flag === false
|
||||
// )
|
||||
.map((jobline) => {
|
||||
//Removed as a result of conversation with Norm.
|
||||
// Appears you are calculating based on ‘N.A.’ part values in the Mitchell database.
|
||||
// Reminder – if Mitchell DB has $0.00 price updates can be tracked, if it has N.A. it cannot calculate RPS value.
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
// if (
|
||||
// (jobline.db_price === null || jobline.db_price === 0) &&
|
||||
// !!jobline.act_price &&
|
||||
// jobline.act_price > 0
|
||||
// ) {
|
||||
// // log.info(
|
||||
// // "DB Price null/lower than act price",
|
||||
// // jobline.line_desc,
|
||||
// // jobline.db_price,
|
||||
// // jobline.act_price
|
||||
// // );
|
||||
// jobline.db_price = jobline.act_price;
|
||||
// }
|
||||
//08/24/21 - Norm to take as action item to determine what the final set of rules were per Derek.
|
||||
// if (jobline.glass_flag && jobline.part_type !== "PAL") {
|
||||
// jobline.ignore = true;
|
||||
|
||||
// }
|
||||
|
||||
//*****TODO LINE****
|
||||
//Any PAL, Remanufactured, Recycled, Aftermarket, Used,
|
||||
// If DB Price 0, ignore them.
|
||||
// if (
|
||||
// (jobline.part_type === "PAL" ||
|
||||
// jobline.part_type === "PAM" ||
|
||||
// jobline.part_type === "PAR" ||
|
||||
// jobline.part_type === "PAA") &&
|
||||
// jobline.db_price === 0
|
||||
// ) {
|
||||
// jobline.ignore = true;
|
||||
// }
|
||||
//09/2021 Detect NAGS lines using RegEx for the Part Number
|
||||
if (
|
||||
jobline.line_desc.toLowerCase().includes("glass") &&
|
||||
jobline.oem_partno.match(`[A-Z]{2}[0-9]{5,6}[A-Z]{3}`)
|
||||
) {
|
||||
console.log(jobline.line_desc, "NAGS Line ignored");
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
//Logic Based Exclusions.
|
||||
//Verified on 08/24/21
|
||||
if (
|
||||
!jobline.part_type ||
|
||||
jobline.db_ref.startsWith("900") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("urethane") ||
|
||||
//jobline.line_desc.toLowerCase().includes("wheel") || Removed as a part of RPS-41
|
||||
jobline.line_desc.toLowerCase().includes("tire") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("hazardous") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("detail") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("clean") ||
|
||||
// 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 //Removed for RPS-43.
|
||||
) {
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
//Check to see if this is a discount line i.e. a 900511
|
||||
if (jobline.db_ref === "900511" && jobline.prt_dsmk_p !== 50) {
|
||||
jobline.ignore = false;
|
||||
|
||||
//Wheel Repair Pricing PRS-82
|
||||
//Verified on 08/24/21
|
||||
if (
|
||||
jobline.part_type === "PAN" &&
|
||||
jobline.line_desc.toLowerCase().includes("wheel") &&
|
||||
Math.abs(jobline.prt_dsmk_m) ===
|
||||
Math.round((jobline.act_price / 2) * 100) / 100
|
||||
) {
|
||||
log.info(`Jobline '${jobline.line_desc}' ignored due to wheel repair.`);
|
||||
//Calculate the discount to be added as a negative.
|
||||
jobline.act_price = jobline.prt_dsmk_m;
|
||||
//Check to see if the parent line has a discount.
|
||||
const parentLine = joblines.find(
|
||||
(r) => parseInt(r.unq_seq) === jobline.line_ref
|
||||
);
|
||||
if (parentLine && parentLine.ignore) {
|
||||
jobline.ignore = true;
|
||||
}
|
||||
}
|
||||
|
||||
//RPS-46 Ignore NA Line Items.
|
||||
//Removed on 05/20. We are seeing more $0DB lines than NA lines and they are getting incorrectly ignored.
|
||||
// if (
|
||||
// jobline.part_type === "PAN" &&
|
||||
// jobline.price_j === true &&
|
||||
// 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;
|
||||
}
|
||||
|
||||
//RPS-39 - OEM ON OEM SAVINGS
|
||||
//Verified on 08/24/21
|
||||
if (
|
||||
jobline.part_type === "PAN" &&
|
||||
jobline.db_price !== jobline.act_price
|
||||
) {
|
||||
jobline.db_price = jobline.act_price;
|
||||
}
|
||||
delete jobline.prt_dsmk_m; //Delete price markup for wheel repair
|
||||
delete jobline.prt_dsmk_p;
|
||||
delete jobline.glass_flag;
|
||||
delete jobline.price_j;
|
||||
delete jobline.line_ref;
|
||||
return jobline;
|
||||
});
|
||||
|
||||
//$0DB price for aftermarket and recycled parts. RPS-83
|
||||
//Verified on 08/24/21
|
||||
if (
|
||||
(jobline.part_type === "PAA" || jobline.part_type === "PAL") &&
|
||||
jobline.db_price === 0 &&
|
||||
jobline.db_price !== jobline.act_price
|
||||
) {
|
||||
jobline.db_price = jobline.act_price;
|
||||
}
|
||||
|
||||
//05/20
|
||||
//We’ll have to apply a rule that will not count any A/M, Reman or new part price that is manually changed to $0.00.
|
||||
//Only recycled parts that are changed to $0.00 can be counted towards RPS.
|
||||
// This is separate from $0.00 DB prices that need to be updated to the manually entered price.
|
||||
//Verified on 08/24/21
|
||||
if (
|
||||
jobline.part_type !== "PAL" &&
|
||||
jobline.act_price === 0 &&
|
||||
jobline.price_j
|
||||
) {
|
||||
log.info(
|
||||
`Jobline '${jobline.line_desc}' ignored because it was manually changed to 0..`
|
||||
);
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
//08/24/21 - Norm to take as action item to determine what the final set of rules were per Derek.
|
||||
if (jobline.glass_flag && jobline.part_type !== "PAL") {
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
//09/2021 Detect NAGS lines using RegEx for the Part Number
|
||||
if (
|
||||
jobline.line_desc.toLowerCase().includes("glass") &&
|
||||
jobline.oem_partno.match(`[A-Z]{2}[0-9]{5}[A-Z]{3}`)
|
||||
) {
|
||||
console.log(jobline.line_desc, "NAGS Line ignored");
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
//Logic Based Exclusions.
|
||||
//Verified on 08/24/21
|
||||
if (
|
||||
!jobline.part_type ||
|
||||
jobline.db_ref.startsWith("900") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("urethane") ||
|
||||
//jobline.line_desc.toLowerCase().includes("wheel") || Removed as a part of RPS-41
|
||||
jobline.line_desc.toLowerCase().includes("tire") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("hazardous") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("detail") ||
|
||||
jobline.line_desc.toLowerCase().startsWith("clean") ||
|
||||
// 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 //Removed for RPS-43.
|
||||
) {
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
//Check to see if this is a discount line i.e. a 900511
|
||||
if (jobline.db_ref === "900511" && jobline.prt_dsmk_p !== 50) {
|
||||
jobline.ignore = false;
|
||||
//Calculate the discount to be added as a negative.
|
||||
jobline.act_price = jobline.prt_dsmk_m;
|
||||
}
|
||||
|
||||
//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.prt_dsmk_m; //Delete price markup for wheel repair
|
||||
delete jobline.prt_dsmk_p;
|
||||
delete jobline.glass_flag;
|
||||
delete jobline.price_j;
|
||||
return jobline;
|
||||
});
|
||||
//Check for discounts that need to be ignored after the fact.
|
||||
|
||||
return { joblines: { data: joblines } };
|
||||
}
|
||||
|
||||
44
package.json
44
package.json
@@ -7,39 +7,39 @@
|
||||
"main": "electron/main.js",
|
||||
"homepage": "./",
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.3.16",
|
||||
"antd": "^4.15.4",
|
||||
"@apollo/client": "^3.4.11",
|
||||
"antd": "^4.16.13",
|
||||
"apollo-link-logger": "^2.0.0",
|
||||
"chokidar": "^3.5.1",
|
||||
"dbffile": "^1.4.3",
|
||||
"dinero.js": "^1.8.1",
|
||||
"dotenv": "^8.2.0",
|
||||
"electron-is-dev": "^1.2.0",
|
||||
"electron-log": "^4.3.1",
|
||||
"electron-reload": "^1.5.0",
|
||||
"electron-store": "^6.0.1",
|
||||
"electron-updater": "^4.3.5",
|
||||
"chokidar": "^3.5.2",
|
||||
"dbffile": "^1.7.1",
|
||||
"dinero.js": "^1.9.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"electron-is-dev": "^2.0.0",
|
||||
"electron-log": "^4.4.1",
|
||||
"electron-reload": "^2.0.0-alpha.1",
|
||||
"electron-store": "^8.0.0",
|
||||
"electron-updater": "^4.3.9",
|
||||
"firebase": "^7.24.0",
|
||||
"graphql": "^15.5.0",
|
||||
"graphql": "^15.5.3",
|
||||
"lodash": "^4.17.20",
|
||||
"logrocket": "^1.1.0",
|
||||
"logrocket": "^2.0.0",
|
||||
"moment": "^2.29.1",
|
||||
"node-sass": "^4.14.1",
|
||||
"nucleus-nodejs": "^3.0.8",
|
||||
"query-string": "^6.14.1",
|
||||
"node-sass": "^6.0.1",
|
||||
"nucleus-nodejs": "^3.0.9",
|
||||
"query-string": "^7.0.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-infinite-scroller": "^1.2.4",
|
||||
"react-redux": "^7.2.4",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-scripts": "4.0.0",
|
||||
"recharts": "^1.8.5",
|
||||
"redux": "^4.0.5",
|
||||
"react-redux": "^7.2.5",
|
||||
"react-router-dom": "^5.3.0",
|
||||
"react-scripts": "4.0.3",
|
||||
"recharts": "^2.1.2",
|
||||
"redux": "^4.1.1",
|
||||
"redux-logger": "^3.0.6",
|
||||
"redux-persist": "^6.0.0",
|
||||
"redux-saga": "^1.1.3",
|
||||
"reselect": "^4.0.0",
|
||||
"subscriptions-transport-ws": "^0.9.18"
|
||||
"subscriptions-transport-ws": "^0.9.19"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
"TRAVERSE",
|
||||
"TRAX",
|
||||
"UPLANDER",
|
||||
|
||||
"YUKON",
|
||||
"EQUINOX LS",
|
||||
"EQUINOX LT",
|
||||
"EQUINOX PREMIER",
|
||||
|
||||
Reference in New Issue
Block a user