UI updates for audit.

This commit is contained in:
Patrick Fic
2024-05-24 15:12:25 -07:00
parent 019faf1411
commit 020eccc762
10 changed files with 202 additions and 83 deletions

View File

@@ -15,45 +15,60 @@ ipcMain.on(ipcTypes.default.audit.toMain.browseForFile, async (event, { sheetNam
});
if (!result.canceled) {
try {
var obj = xlsx.parse(result.filePaths[0], { cellDates: true });
store.set("auditFilePath", result.filePaths);
var obj = xlsx.parse(result.filePaths[0], { cellDates: true }); // parses a file
const detailSheet = obj.find((sheet) => sheet.name === sheetName);
const claimsArray = [];
let foundHeaderRow, foundTotalRow;
detailSheet.data.forEach((line) => {
//Check the first element. If it's claim number, we have our header row. the next one is important.
if (!foundHeaderRow && line[0] === "Claim Number") {
foundHeaderRow = true;
} else if (foundHeaderRow && !foundTotalRow && line[0] && line[0] !== "Grand Total") {
//Add it to the array
const row = {
clm_no: line[0].startsWith("00") ? line[0].slice(2) : line[0],
close_date: line[1],
v_model_yr: line[3],
v_makedesc: line[4],
v_model: line[5],
under20kmiles: line[6],
pan_total: line[7],
paa_total: line[8],
pal_total: line[9],
pam_total: line[10],
eligible_db_price_total: Math.round((line[11] + Number.EPSILON) * 100) / 100,
eligible_act_price_total: Math.round((line[12] + Number.EPSILON) * 100) / 100,
expected_rps_dollars: Math.round((line[15] + Number.EPSILON) * 100) / 100,
actual_rps_dollars: Math.round((line[16] + Number.EPSILON) * 100) / 100
};
claimsArray.push(row);
} else {
// foundTotalRow = true;
}
event.sender.send(ipcTypes.default.audit.toRenderer.auditFilePath, {
filePath: result.filePaths[0],
sheets: obj.map((sheet) => sheet.name)
});
event.sender.send(ipcTypes.default.audit.toRenderer.auditClaimsArray, claimsArray);
} catch (error) {
console.log("ot some sort of err", error);
console.log("Got some sort of err", error);
log.error("Error when trying to read audit xlsx file", error);
event.sender.send(ipcTypes.default.audit.toRenderer.auditError, error.message);
event.sender.send(ipcTypes.default.audit.toRenderer.auditError, error.meFssage);
}
}
});
ipcMain.on(ipcTypes.default.audit.toMain.runAudit, async (event, { sheetName }) => {
try {
const filePaths = store.get("auditFilePath");
var obj = xlsx.parse(filePaths[0], { cellDates: true }); // parses a file
const detailSheet = obj.find((sheet) => sheet.name === sheetName);
const claimsArray = [];
let foundHeaderRow, foundTotalRow;
detailSheet.data.forEach((line) => {
//Check the first element. If it's claim number, we have our header row. the next one is important.
if (!foundHeaderRow && line[0] === "Claim Number") {
foundHeaderRow = true;
} else if (foundHeaderRow && !foundTotalRow && line[0] && line[0] !== "Grand Total") {
//Add it to the array
const row = {
clm_no: line[0].startsWith("00") ? line[0].slice(2) : line[0],
close_date: line[1],
v_model_yr: line[3],
v_makedesc: line[4],
v_model: line[5],
under20kmiles: line[6],
pan_total: line[7],
paa_total: line[8],
pal_total: line[9],
pam_total: line[10],
eligible_db_price_total: Math.round((line[11] + Number.EPSILON) * 100) / 100,
eligible_act_price_total: Math.round((line[12] + Number.EPSILON) * 100) / 100,
expected_rps_dollars: Math.round((line[15] + Number.EPSILON) * 100) / 100,
actual_rps_dollars: Math.round((line[16] + Number.EPSILON) * 100) / 100
};
claimsArray.push(row);
} else {
// foundTotalRow = true;
}
});
event.sender.send(ipcTypes.default.audit.toRenderer.auditClaimsArray, claimsArray);
} catch (error) {
console.log("ot some sort of err", error);
log.error("Error when trying to read audit xlsx file", error);
event.sender.send(ipcTypes.default.audit.toRenderer.auditError, error.message);
}
});

View File

@@ -146,7 +146,12 @@
},
"1.2.0": {
"title": "Release Notes for 1.2.0",
"date": "05/51/2024",
"date": "05/21/2024",
"notes": "New Features\n* Introducing Score Card Auditing. Simply select your MPI scorecard and instantly compare it to your RPS score card to find discrepancies. Available in your side bar\n\nImprovements\n* Added additional models to SUV and Van databases for better detection.\n* Only -01 and -99 claims will now be brought into RPS.\n* Under the hood fixes and improvements."
},
"1.2.1": {
"title": "Release Notes for 1.2.1",
"date": "05/23/2024",
"notes": "Improvements\n* UI improvements for audit functionality."
}
}