Remove MPI Claim format filter.
This commit is contained in:
@@ -52,18 +52,17 @@ async function DecodeEstimate(filePath, includeFilePathInReturnJob = false, clos
|
||||
...(await DecodeVehFile(extensionlessFilePath)),
|
||||
...(await DecodeTtlFile(extensionlessFilePath)),
|
||||
...(await DecodeLinFile(extensionlessFilePath, close_date)),
|
||||
...(await DecodePflFile(extensionlessFilePath,)),
|
||||
...(await DecodePfmFile(extensionlessFilePath,)),
|
||||
...(await DecodePfhFile(extensionlessFilePath,)),
|
||||
...(await DecodeStlFile(extensionlessFilePath,)),
|
||||
...(await DecodePflFile(extensionlessFilePath)),
|
||||
...(await DecodePfmFile(extensionlessFilePath)),
|
||||
...(await DecodePfhFile(extensionlessFilePath)),
|
||||
...(await DecodeStlFile(extensionlessFilePath)),
|
||||
...(includeFilePathInReturnJob ? { filePath } : {})
|
||||
};
|
||||
|
||||
const ad2 = await DecodeAd2File(extensionlessFilePath);
|
||||
|
||||
|
||||
job.rates = [...job.rates || [], ...job.mat_rates || []];
|
||||
delete job.mat_rates
|
||||
job.rates = [...(job.rates || []), ...(job.mat_rates || [])];
|
||||
delete job.mat_rates;
|
||||
job.insp_date = ad2.INSP_DATE;
|
||||
|
||||
if (job.OWNR_FN === "" || !job.OWNR_FN) job.OWNR_FN = ad2.CLMT_FN;
|
||||
@@ -78,6 +77,8 @@ async function DecodeEstimate(filePath, includeFilePathInReturnJob = false, clos
|
||||
// returnValue = { ERROR: "Vehicle mileage is less than 20,000kms." };
|
||||
// } else
|
||||
|
||||
const ins_rule_set = store.get("ins_rule_set");
|
||||
|
||||
if (!accepted_ins_co.includes(job.INS_CO_NM)) {
|
||||
returnValue = {
|
||||
ERROR: `Insurance Company Name is not valid for RPS. (${job.INS_CO_NM || "No name set"})`
|
||||
@@ -87,7 +88,7 @@ async function DecodeEstimate(filePath, includeFilePathInReturnJob = false, clos
|
||||
returnValue = {
|
||||
ERROR: `An unique claim number must be set for all jobs sent to RPS.`
|
||||
};
|
||||
} else if (!(job.CLM_NO.match("-01$") || job.CLM_NO.match("-99$"))) {
|
||||
} else if (ins_rule_set === "MPI" && !(job.CLM_NO.match("-01$") || job.CLM_NO.match("-99$"))) {
|
||||
// 2024-05-10 Only -01 and -99 apply. Refactor logic.
|
||||
log.info("Job ignored. This is not a -01 or -99 claim. Claim #. " + job.CLM_NO);
|
||||
returnValue = {
|
||||
@@ -218,7 +219,7 @@ async function DecodeAd1File(extensionlessFilePath) {
|
||||
// "OWNR_ST",
|
||||
// "OWNR_ZIP",
|
||||
// "OWNR_CTRY",
|
||||
"OWNR_PH1",
|
||||
"OWNR_PH1"
|
||||
// "OWNR_PH1X",
|
||||
// "OWNR_PH2",
|
||||
// "OWNR_PH2X",
|
||||
@@ -265,9 +266,7 @@ async function DecodePfhFile(extensionlessFilePath) {
|
||||
} finally {
|
||||
if (!dbf) return {};
|
||||
let records = await dbf.readRecords(1);
|
||||
return _.pick(records[0], [
|
||||
"ID_PRO_NAM"
|
||||
]);
|
||||
return _.pick(records[0], ["ID_PRO_NAM"]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,7 +303,7 @@ async function DecodeVehFile(extensionlessFilePath) {
|
||||
// "V_ENGINE",
|
||||
// "V_COLOR",
|
||||
// "V_TONE",
|
||||
"V_STAGE",
|
||||
"V_STAGE"
|
||||
// "PAINT_CD1",
|
||||
// "PAINT_CD2",
|
||||
// "PAINT_CD3",
|
||||
@@ -426,30 +425,22 @@ async function DecodeLinFile(extensionlessFilePath, close_date) {
|
||||
|
||||
return { joblines: { data: joblines } };
|
||||
}
|
||||
async function DecodePflFile(extensionlessFilePath,) {
|
||||
async function DecodePflFile(extensionlessFilePath) {
|
||||
let dbf = await DBFFile.open(`${extensionlessFilePath}.PFL`);
|
||||
let records = await dbf.readRecords();
|
||||
let pflLines = records.map((record) => {
|
||||
return (
|
||||
_.pick(record, [
|
||||
"LBR_TYPE", "LBR_DESC", "LBR_RATE"
|
||||
])
|
||||
);
|
||||
return _.pick(record, ["LBR_TYPE", "LBR_DESC", "LBR_RATE"]);
|
||||
});
|
||||
|
||||
//Check for discounts that need to be ignored after the fact.
|
||||
|
||||
return { rates: pflLines };
|
||||
}
|
||||
async function DecodeStlFile(extensionlessFilePath,) {
|
||||
async function DecodeStlFile(extensionlessFilePath) {
|
||||
let dbf = await DBFFile.open(`${extensionlessFilePath}.STL`);
|
||||
let records = await dbf.readRecords();
|
||||
let pflLines = records.map((record) => {
|
||||
return (
|
||||
_.pick(record, [
|
||||
"TTL_TYPECD", "T_AMT", 'T_HRS', "NT_HRS"
|
||||
])
|
||||
);
|
||||
return _.pick(record, ["TTL_TYPECD", "T_AMT", "T_HRS", "NT_HRS"]);
|
||||
});
|
||||
|
||||
//Check for discounts that need to be ignored after the fact.
|
||||
@@ -457,15 +448,11 @@ async function DecodeStlFile(extensionlessFilePath,) {
|
||||
return { totals: pflLines };
|
||||
}
|
||||
|
||||
async function DecodePfmFile(extensionlessFilePath,) {
|
||||
async function DecodePfmFile(extensionlessFilePath) {
|
||||
let dbf = await DBFFile.open(`${extensionlessFilePath}.PFM`);
|
||||
let records = await dbf.readRecords();
|
||||
let pflLines = records.map((record) => {
|
||||
return (
|
||||
_.pick(record, [
|
||||
"MATL_TYPE", "CAL_PRETHR"
|
||||
])
|
||||
);
|
||||
return _.pick(record, ["MATL_TYPE", "CAL_PRETHR"]);
|
||||
});
|
||||
|
||||
//Check for discounts that need to be ignored after the fact.
|
||||
|
||||
Reference in New Issue
Block a user