Add Winax dependency back. Multiple bug fixes for estimate decoding.

This commit is contained in:
Patrick FIc
2025-03-28 14:56:22 -07:00
parent c33b02f77e
commit bf3f0205d6
12 changed files with 267 additions and 2750 deletions

2925
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -21,11 +21,13 @@
"build:linux": "electron-vite build && electron-builder --linux" "build:linux": "electron-vite build && electron-builder --linux"
}, },
"dependencies": { "dependencies": {
"@apollo/client": "^3.13.5",
"@electron-toolkit/preload": "^3.0.1", "@electron-toolkit/preload": "^3.0.1",
"@electron-toolkit/utils": "^4.0.0", "@electron-toolkit/utils": "^4.0.0",
"electron-log": "^5.3.2", "electron-log": "^5.3.2",
"electron-store": "^8.2.0", "electron-store": "^8.2.0",
"electron-updater": "^6.3.9" "electron-updater": "^6.3.9",
"winax": "^3.6.2"
}, },
"devDependencies": { "devDependencies": {
"@ant-design/v5-patch-for-react-19": "^1.0.3", "@ant-design/v5-patch-for-react-19": "^1.0.3",
@@ -71,8 +73,5 @@
"redux-thunk": "^3.1.0", "redux-thunk": "^3.1.0",
"typescript": "^5.8.2", "typescript": "^5.8.2",
"vite": "^6.2.1" "vite": "^6.2.1"
},
"optionalDependencies": {
"winax": "^3.1.4"
} }
} }

View File

@@ -157,7 +157,7 @@ const DecodeAD1 = async (
rawAd1Data.asgn_date = newAsgnDate.toISOString().split("T")[0]; rawAd1Data.asgn_date = newAsgnDate.toISOString().split("T")[0];
} }
if (!rawAd1Data.ownr_ph1) { if (!rawAd1Data.ownr_ph1 || _.isEmpty(rawAd1Data.ownr_ph1)) {
rawAd1Data.ownr_ph1 = rawAd1Data.ownr_ph2; rawAd1Data.ownr_ph1 = rawAd1Data.ownr_ph2;
} }

View File

@@ -33,7 +33,7 @@ const DecodePfh = async (
//TODO: Several of these fields will fail. Should extend schema to capture them. //TODO: Several of these fields will fail. Should extend schema to capture them.
//"ID_PRO_NAM", //Remove //"ID_PRO_NAM", //Remove
"TAX_PRETHR", "TAX_PRETHR",
//"TAX_THRAMT", //Remove "TAX_THRAMT",
"TAX_PSTTHR", "TAX_PSTTHR",
//"TAX_TOW_IN", //Remove //"TAX_TOW_IN", //Remove
"TAX_TOW_RT", "TAX_TOW_RT",

View File

@@ -37,5 +37,20 @@ export interface JobLaborRateFields {
} }
export interface DecodedPfl extends JobLaborRateFields { export interface DecodedPfl extends JobLaborRateFields {
cieca_pfl: DecodedPflLine[]; cieca_pfl: {
LAA?: DecodedPflLine;
LAB?: DecodedPflLine;
LAD?: DecodedPflLine;
LAS?: DecodedPflLine;
LAR?: DecodedPflLine;
LAE?: DecodedPflLine;
LAG?: DecodedPflLine;
LAF?: DecodedPflLine;
LAM?: DecodedPflLine;
LAU?: DecodedPflLine;
LA1?: DecodedPflLine;
LA2?: DecodedPflLine;
LA3?: DecodedPflLine;
LA4?: DecodedPflLine;
};
} }

View File

@@ -73,6 +73,13 @@ const DecodePfl = async (
//Set the job.rate_<CIECA_TYPE> field based on the value. //Set the job.rate_<CIECA_TYPE> field based on the value.
jobLaborRates[`rate_${singleLineData.lbr_type.toLowerCase()}`] = jobLaborRates[`rate_${singleLineData.lbr_type.toLowerCase()}`] =
singleLineData.lbr_rate; singleLineData.lbr_rate;
//For Mitchell, Alum is stored under LA3 instead of LAA. Shift it back over.
//The old partner had a check for this, but it always was true. Matching that logic.
if (singleLineData.lbr_type === "LA3") {
jobLaborRates[`rate_laa`] = singleLineData.lbr_rate;
}
//Also capture the whole object. //Also capture the whole object.
//This is segmented because the whole object was not previously captured for ImEX as it wasn't needed. //This is segmented because the whole object was not previously captured for ImEX as it wasn't needed.
//Rome needs the whole object to accurately calculate the tax rates. //Rome needs the whole object to accurately calculate the tax rates.
@@ -83,7 +90,9 @@ const DecodePfl = async (
//Apply business logic transfomrations. //Apply business logic transfomrations.
//We don't have an inspection date, we instead have `date_estimated` //We don't have an inspection date, we instead have `date_estimated`
return { ...jobLaborRates, cieca_pfl: rawPflData }; const pflObj = _.keyBy(rawPflData, "lbr_type");
return { ...jobLaborRates, cieca_pfl: pflObj };
}; };
export default DecodePfl; export default DecodePfl;

View File

@@ -43,8 +43,8 @@ export interface JobMaterialRateFields {
export interface DecodedPfm extends JobMaterialRateFields { export interface DecodedPfm extends JobMaterialRateFields {
materials: { materials: {
mapa?: DecodedPfmLine; MAPA?: DecodedPfmLine;
mash?: DecodedPfmLine; MASH?: DecodedPfmLine;
}; };
cieca_pfm: DecodedPfmLine[]; cieca_pfm?: DecodedPfmLine[];
} }

View File

@@ -136,8 +136,8 @@ const DecodePfm = async (
return { return {
...jobMaterialRates, ...jobMaterialRates,
materials: { materials: {
mash: mashLine, MASH: mashLine,
mapa: mapaLine, //TODO: Need to verify if more fields are to come in here. MAPA: mapaLine, //TODO: Need to verify if more fields are to come in here.
}, },
//cieca_pfm: rawPfmData, //TODO: Not currently captured. This may have valu in the future. //cieca_pfm: rawPfmData, //TODO: Not currently captured. This may have valu in the future.
}; };

View File

@@ -49,7 +49,7 @@ const DecodeTtl = async (
return { return {
clm_total: rawTtlData.g_ttl_amt || 0, clm_total: rawTtlData.g_ttl_amt || 0,
depreciation_taxes: 0, //TODO: Find where this needs to be filled from depreciation_taxes: rawTtlData.g_bett_amt || 0, //TODO: Find where this needs to be filled from
cieca_ttl: { data: rawTtlData }, cieca_ttl: { data: rawTtlData },
}; };
}; };

View File

@@ -10,10 +10,10 @@ import {
default as errorTypeCheck, default as errorTypeCheck,
} from "../util/errorTypeCheck"; } from "../util/errorTypeCheck";
import ipcTypes from "../util/ipcTypes.json"; import ipcTypes from "../util/ipcTypes.json";
import client from "./graphql/graphql-client"; import ImportJob from "./decoder/decoder";
import LocalServer from "./http-server/http-server"; import LocalServer from "./http-server/http-server";
import store from "./store/store";
import { TestQB } from "./quickbooks-desktop/quickbooks-desktop"; import { TestQB } from "./quickbooks-desktop/quickbooks-desktop";
import store from "./store/store";
log.initialize(); log.initialize();
const isMac = process.platform === "darwin"; const isMac = process.platform === "darwin";
@@ -179,6 +179,12 @@ function createWindow(): void {
TestQB(); TestQB();
}, },
}, },
{
label: "Decode Hardcoded Estimate",
click: (): void => {
ImportJob(`C:\\EMS\\CCC\\9ee762f4.ENV`);
},
},
], ],
}, },
]; ];

View File

@@ -46,7 +46,7 @@ const App: React.FC = () => {
<HashRouter> <HashRouter>
<ErrorBoundary FallbackComponent={ErrorBoundaryFallback}> <ErrorBoundary FallbackComponent={ErrorBoundaryFallback}>
<NotificationProvider> <NotificationProvider>
<Skeleton loading={user === null} active> <Skeleton loading={user === false} active>
<Layout style={{ minHeight: "100vh" }}> <Layout style={{ minHeight: "100vh" }}>
{!user ? ( {!user ? (
<SignInForm /> <SignInForm />

View File

@@ -0,0 +1,29 @@
import {
ApolloClient,
ApolloLink,
HttpLink,
InMemoryCache,
} from "@apollo/client";
const httpLink: HttpLink = new HttpLink({
uri: import.meta.env.VITE_GRAPHQL_URL,
});
const middlewares = [];
const client: ApolloClient<any> = new ApolloClient({
link: ApolloLink.from(middlewares),
cache: new InMemoryCache(),
defaultOptions: {
watchQuery: {
fetchPolicy: "network-only",
},
query: {
fetchPolicy: "network-only",
},
mutate: {
errorPolicy: "none",
},
},
});
export default client;