From b37970a6df88062fbd5e2a98a7ed7af063c5e185 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 11 Aug 2021 13:50:37 -0700 Subject: [PATCH 1/4] IO-1300 Line Desc Null for Job costing --- server/job/job-costing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/job/job-costing.js b/server/job/job-costing.js index e9de9b5ff..dfd547175 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -605,7 +605,7 @@ const formatGpPercent = (gppercent) => { const getAdditionalCostCenter = (jl, profitCenters) => { console.log("Checking additional cost center", jl.line_desc); if (!jl.part_type && !jl.mod_lbr_ty) { - const lineDesc = jl.line_desc.toLowerCase(); + const lineDesc = jl.line_desc ? jl.line_desc.toLowerCase() : ""; //This logic is covered prior and assigned based on the labor type of the lines // if (lineDesc.includes("shop materials")) { // return profitCenters["MASH"]; From dd59f3d02638261b80d47b0e35452543bd84f52c Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 12 Aug 2021 09:46:50 -0700 Subject: [PATCH 2/4] IO-1286 Retry Supplement Importing fix. --- .../jobs-available-table.container.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx index 01bf3203e..07f8aa75e 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx @@ -187,7 +187,9 @@ export function JobsAvailableContainer({ setJobModalVisible(false); setInsertLoading(true); - const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk); + + const estData = estDataRaw.data.available_jobs_by_pk; + if (!(estData && estData.est_data)) { //We don't have the right data. Error! setInsertLoading(false); @@ -196,7 +198,7 @@ export function JobsAvailableContainer({ }); } else { //create upsert job - let supp = _.cloneDeep(estData.est_data); + let supp = replaceEmpty({ ...estData.est_data }); delete supp.owner; delete supp.vehicle; @@ -208,7 +210,7 @@ export function JobsAvailableContainer({ let suppDelta = await GetSupplementDelta( client, selectedJob, - estData.est_data.joblines.data + supp.joblines.data ); delete supp.joblines; @@ -380,10 +382,10 @@ export default connect( )(JobsAvailableContainer); function replaceEmpty(someObj, replaceValue = null) { - const replacer = (key, value) => (value === "" ? replaceValue : value); + const replacer = (key, value) => + value === "" ? replaceValue || null : value; //^ because you seem to want to replace (strings) "null" or "undefined" too - console.log(someObj); const temp = JSON.stringify(someObj, replacer); - console.log(`temp`, temp); + console.log("Parsed", JSON.parse(temp)); return JSON.parse(temp); } From c1d7168260631108cc6fdfdf98eb94d52beeb117 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 12 Aug 2021 09:52:44 -0700 Subject: [PATCH 3/4] Resolve CI issue. --- .../jobs-available-table/jobs-available-table.container.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx index 07f8aa75e..5eef71012 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx @@ -8,7 +8,6 @@ import { import { Col, notification, Row } from "antd"; import Axios from "axios"; import Dinero from "dinero.js"; -import _ from "lodash"; import moment from "moment"; import queryString from "query-string"; import React, { useCallback, useEffect, useState } from "react"; From d2b2a5399de3836d5939c483201a0fb95b504adb Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Fri, 20 Aug 2021 08:07:01 -0700 Subject: [PATCH 4/4] IO-1327 Resolve dinero error on bill posting --- .../components/bill-form/bill-form.totals.utility.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/client/src/components/bill-form/bill-form.totals.utility.js b/client/src/components/bill-form/bill-form.totals.utility.js index 11cb7c481..df84ec86e 100644 --- a/client/src/components/bill-form/bill-form.totals.utility.js +++ b/client/src/components/bill-form/bill-form.totals.utility.js @@ -1,13 +1,8 @@ import Dinero from "dinero.js"; export const CalculateBillTotal = (invoice) => { - const { - total, - billlines, - federal_tax_rate, - local_tax_rate, - state_tax_rate, - } = invoice; + const { total, billlines, federal_tax_rate, local_tax_rate, state_tax_rate } = + invoice; //TODO Determine why this recalculates so many times. let subtotal = Dinero({ amount: 0 }); @@ -20,8 +15,7 @@ export const CalculateBillTotal = (invoice) => { billlines.forEach((i) => { if (!!i) { const itemTotal = Dinero({ - amount: - Math.round(((i.actual_cost || 0) * 100 + Number.EPSILON) * 100) / 100, + amount: Math.round((i.actual_cost || 0) * 100), }).multiply(i.quantity || 1); subtotal = subtotal.add(itemTotal);