From 0a330b66b63a32f3d4a8ea42cbf72e5ccdd24e5d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 7 May 2021 09:58:52 -0700 Subject: [PATCH 1/2] Package updates. --- electron/changelog.json | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/electron/changelog.json b/electron/changelog.json index eddaa53..60823fa 100644 --- a/electron/changelog.json +++ b/electron/changelog.json @@ -63,5 +63,10 @@ "title": "Release Notes for 1.0.21", "date": "05/07/2021", "notes": "New Features: \n- Improved glass parts recognition.\n- Added additional models for more accurate group detection." + }, + "1.0.22": { + "title": "Release Notes for 1.0.22", + "date": "TBD1", + "notes": "" } } diff --git a/package.json b/package.json index 0fc8207..eed0b70 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "ImEX RPS", "author": "ImEX Systems Inc. ", "description": "ImEX RPS", - "version": "1.0.21", + "version": "1.0.22", "main": "electron/main.js", "homepage": "./", "dependencies": { From 7d529c31558bddce6a03b71a1cb3ad212a3fae93 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 20 May 2021 14:07:18 -0700 Subject: [PATCH 2/2] Add line discounting & remove NA ignores & reset ignore values on reimport. --- WIP Changelog.txt | 6 +- electron/changelog.json | 4 +- electron/decoder/decoder.js | 102 ++++++++++++---------------------- src/ipc/ipc-estimate-utils.js | 12 ++-- 4 files changed, 50 insertions(+), 74 deletions(-) diff --git a/WIP Changelog.txt b/WIP Changelog.txt index 88a150e..4a0be1c 100644 --- a/WIP Changelog.txt +++ b/WIP Changelog.txt @@ -1,5 +1,5 @@ New Features: -- Improved glass parts recognition. -- Added additional models for more accurate group detection. +- Added support Line Discounting +- Ignored lines will now automatically reset when importing to ensure lines are not ignored when updated in place. Bug Fixes: -- \ No newline at end of file +- Improved detection of $0 price items. \ No newline at end of file diff --git a/electron/changelog.json b/electron/changelog.json index 60823fa..f8599e8 100644 --- a/electron/changelog.json +++ b/electron/changelog.json @@ -66,7 +66,7 @@ }, "1.0.22": { "title": "Release Notes for 1.0.22", - "date": "TBD1", - "notes": "" + "date": "05/20/2021", + "notes": "New Features: \n- Added support Line Discounting\n- Ignored lines will now automatically reset when importing to ensure lines are not ignored when updated in place.\nBug Fixes: \n- Improved detection of $0 price items." } } diff --git a/electron/decoder/decoder.js b/electron/decoder/decoder.js index 62cda24..2170c4f 100644 --- a/electron/decoder/decoder.js +++ b/electron/decoder/decoder.js @@ -279,61 +279,6 @@ async function DecodeLinFile(extensionlessFilePath) { let records = await dbf.readRecords(); let joblines = records .map((record) => { - try { - console.log( - "Trying pick", - _.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", - ]) - ); - } catch (error) { - console.log(error); - } return _.transform( _.pick(record, [ "LINE_NO", @@ -361,7 +306,7 @@ async function DecodeLinFile(extensionlessFilePath) { // "ALT_PARTNO", // "ALT_OVERRD", // "ALT_PARTM", - // "PRT_DSMK_P", + "PRT_DSMK_P", // "MOD_LBR_TY", // "DB_HRS", @@ -385,7 +330,7 @@ async function DecodeLinFile(extensionlessFilePath) { ]), function (result, val, key) { //Required because unq_seq gets pulled as a numeric instaed of a string. - console.log(result, val, key); + if (key === "UNQ_SEQ") { result[key.toLowerCase()] = val.toString(); return; @@ -442,6 +387,8 @@ async function DecodeLinFile(extensionlessFilePath) { // jobline.ignore = true; // } + jobline.ignore = false; + //Wheel Repair Pricing PRS-82 if ( jobline.part_type === "PAN" && @@ -452,14 +399,16 @@ async function DecodeLinFile(extensionlessFilePath) { log.info(`Jobline '${jobline.line_desc}' ignored due to wheel repair.`); jobline.ignore = true; } + //RPS-46 Ignore NA Line Items. - if ( - jobline.part_type === "PAN" && - jobline.price_j === true && - jobline.db_price === 0 - ) { - jobline.ignore = true; - } + //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 if ( @@ -479,6 +428,20 @@ async function DecodeLinFile(extensionlessFilePath) { 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. + // 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; + // } + // if ( // !!jobline.db_price && // jobline.db_price > 0 && @@ -509,8 +472,16 @@ async function DecodeLinFile(extensionlessFilePath) { 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; + console.log("dsmk_d", jobline.prt_dsmk_p); + //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")) { @@ -520,6 +491,7 @@ async function DecodeLinFile(extensionlessFilePath) { } 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; diff --git a/src/ipc/ipc-estimate-utils.js b/src/ipc/ipc-estimate-utils.js index 4941ea2..38d4132 100644 --- a/src/ipc/ipc-estimate-utils.js +++ b/src/ipc/ipc-estimate-utils.js @@ -104,10 +104,14 @@ export const GetSupplementDelta = async (jobId, existingLinesO, newLines) => { //Found a relevant matching line. Add it to lines to update. linesToUpdate.push({ id: existingLines[matchingIndex].id, - newData: { - ...newLine, - ignore: existingLines[matchingIndex].ignore, - }, + newData: newLine, + // { + // ...newLine, + // ignore: + // newLine.db_ref === "900511" && newLine.prt_dsmk_p !== 50 + // ? false + // : existingLines[matchingIndex].ignore, + // }, }); //Splice out item we found for performance. existingLines.splice(matchingIndex, 1);