From eb05a746c4df51698c827740b2b9901e2ec2c213 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 7 Feb 2022 10:38:05 -0800 Subject: [PATCH 1/4] Resolve dashboard/reporting discrepancy. --- .../projected-monthly-sales.component.jsx | 24 ++++++++++++------- .../dashboard-grid.component.jsx | 15 ++++++------ client/src/translations/en_us/common.json | 2 +- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/client/src/components/dashboard-components/pojected-monthly-sales/projected-monthly-sales.component.jsx b/client/src/components/dashboard-components/pojected-monthly-sales/projected-monthly-sales.component.jsx index abe4b9485..ba461678f 100644 --- a/client/src/components/dashboard-components/pojected-monthly-sales/projected-monthly-sales.component.jsx +++ b/client/src/components/dashboard-components/pojected-monthly-sales/projected-monthly-sales.component.jsx @@ -31,16 +31,24 @@ export default function DashboardProjectedMonthlySales({ data, ...cardProps }) { } export const DashboardProjectedMonthlySalesGql = ` - projected_monthly_sales: jobs(where: {_or: [{_and: [{date_invoiced: {_gte: "${moment() - .startOf("month") - .format("YYYY-MM-DD")}"}}, {date_invoiced: {_lte: "${moment() - .endOf("month") - .format("YYYY-MM-DD")}"}}]}, {_and: [{scheduled_completion: {_gte: "${moment() + projected_monthly_sales: jobs(where: { + voided: {_eq: false}, + _or: [ + {_and: [{date_invoiced: {_gte: "${moment() + .startOf("month").startOf('day').toISOString()}"}}, {date_invoiced: {_lte: "${moment() + .endOf("month").endOf('day').toISOString()}"}}]}, + + {_and: [ + {date_invoiced: {_is_null: true}}, + {scheduled_completion: {_gte: "${moment() .startOf("month") - .format("YYYY-MM-DD")}"}}, {scheduled_completion: {_lte: "${moment() - .endOf("month") - .format("YYYY-MM-DD")}"}}]}]}) { + .startOf('day').toISOString()}"}}, {scheduled_completion: {_lte: "${moment() + .endOf("month").endOf('day').toISOString()}"}}]} + +]}) { id + ro_number + voided date_invoiced job_totals } diff --git a/client/src/components/dashboard-grid/dashboard-grid.component.jsx b/client/src/components/dashboard-grid/dashboard-grid.component.jsx index f1b2f3c22..39a5432c2 100644 --- a/client/src/components/dashboard-grid/dashboard-grid.component.jsx +++ b/client/src/components/dashboard-grid/dashboard-grid.component.jsx @@ -280,12 +280,13 @@ const createDashboardQuery = (state) => { return gql` query QUERY_DASHBOARD_DETAILS { ${componentBasedAdditions || ""} - monthly_sales: jobs(where: {_and: [{date_invoiced: {_gte: "${moment() - .startOf("month") - .format("YYYY-MM-DD")}"}}, {date_invoiced: {_lte: "${moment() - .endOf("month") - .format("YYYY-MM-DD")}"}}]}) { + monthly_sales: jobs(where: {_and: [ + { voided: {_eq: false}}, + {date_invoiced: {_gte: "${moment() + .startOf("month").startOf('day').toISOString()}"}}, {date_invoiced: {_lte: "${moment() + .endOf("month").endOf('day').toISOString()}"}}]}) { id + ro_number date_invoiced job_totals rate_la1 @@ -333,14 +334,14 @@ const createDashboardQuery = (state) => { part_qty part_type } - labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" } }) { + labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }) { aggregate { sum { mod_lb_hrs } } } - larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) { + larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } }) { aggregate { sum { mod_lb_hrs diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 5d75851df..1461ccc73 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2230,7 +2230,7 @@ "gsr_by_csr": "Gross Sales by CSR", "gsr_by_delivery_date": "Gross Sales by Delivery Date", "gsr_by_estimator": "Gross Sales by Estimator", - "gsr_by_exported_date": "Gross Sales by Export Date", + "gsr_by_exported_date": "Exported Gross Sales", "gsr_by_ins_co": "Gross Sales by Insurance Company", "gsr_by_make": "Gross Sales by Vehicle Make", "gsr_by_referral": "Gross Sales by Referral Source", From 356928ce774e76455a17178ed23cda9500d970de Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 7 Feb 2022 15:04:07 -0800 Subject: [PATCH 2/4] Resolve double partner notification. --- client/src/components/partner-ping/partner-ping.component.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/partner-ping/partner-ping.component.jsx b/client/src/components/partner-ping/partner-ping.component.jsx index a1d13d76b..c61848dce 100644 --- a/client/src/components/partner-ping/partner-ping.component.jsx +++ b/client/src/components/partner-ping/partner-ping.component.jsx @@ -27,11 +27,11 @@ export function PartnerPingComponent({ bodyshop, setPartnerVersion }) { useEffect(() => { // Create an scoped async function in the hook async function checkPartnerStatus() { + if (!bodyshop) return; try { //if (process.env.NODE_ENV === "development") return; const PartnerResponse = await axios.post("http://localhost:1337/ping/"); const { appver, qbpath } = PartnerResponse.data; - if (!bodyshop) return; setPartnerVersion(appver); console.log({ appver, qbpath }); if ( From 76fb8f453d55f7378d603ac13623c76277540e7d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 7 Feb 2022 18:31:06 -0800 Subject: [PATCH 3/4] Updated projected monthly sales. --- .../projected-monthly-sales.component.jsx | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/client/src/components/dashboard-components/pojected-monthly-sales/projected-monthly-sales.component.jsx b/client/src/components/dashboard-components/pojected-monthly-sales/projected-monthly-sales.component.jsx index ba461678f..10b268f0d 100644 --- a/client/src/components/dashboard-components/pojected-monthly-sales/projected-monthly-sales.component.jsx +++ b/client/src/components/dashboard-components/pojected-monthly-sales/projected-monthly-sales.component.jsx @@ -34,16 +34,43 @@ export const DashboardProjectedMonthlySalesGql = ` projected_monthly_sales: jobs(where: { voided: {_eq: false}, _or: [ - {_and: [{date_invoiced: {_gte: "${moment() - .startOf("month").startOf('day').toISOString()}"}}, {date_invoiced: {_lte: "${moment() - .endOf("month").endOf('day').toISOString()}"}}]}, - + {_and: [ + {date_invoiced:{_is_null: false }}, + {date_invoiced: {_gte: "${moment() + .startOf("month") + .startOf("day") + .toISOString()}"}}, {date_invoiced: {_lte: "${moment() + .endOf("month") + .endOf("day") + .toISOString()}"}}]}, + { + +_and:[ + {date_invoiced:{_is_null: true }}, + {actual_completion: {_gte: "${moment() + .startOf("month") + .startOf("day") + .toISOString()}"}}, {actual_completion: {_lte: "${moment() + .endOf("month") + .endOf("day") + .toISOString()}"}} + +] + }, + {_and: [ {date_invoiced: {_is_null: true}}, + {actual_completion: {_is_null: true}} {scheduled_completion: {_gte: "${moment() - .startOf("month") - .startOf('day').toISOString()}"}}, {scheduled_completion: {_lte: "${moment() - .endOf("month").endOf('day').toISOString()}"}}]} + .startOf("month") + .startOf("day") + .toISOString()}"}}, {scheduled_completion: {_lte: "${moment() + .endOf("month") + .endOf("day") + .toISOString()}"}} + + +]} ]}) { id From 14e9ac2cdb3c8f43aecb4cf63ad7abd0e51013a7 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 7 Feb 2022 18:50:18 -0800 Subject: [PATCH 4/4] IO-1714 Resolve monthly efficiency component. --- .../monthly-employee-efficiency.component.jsx | 6 +++--- server/job/job-costing.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/components/dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component.jsx b/client/src/components/dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component.jsx index e90220698..a177771c3 100644 --- a/client/src/components/dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component.jsx +++ b/client/src/components/dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component.jsx @@ -40,7 +40,7 @@ export default function DashboardMonthlyEmployeeEfficiency({ (dayAcc, dayVal) => { return { actual: dayAcc.actual + dayVal.actualhrs, - productive: dayAcc.actual + dayVal.productivehrs, + productive: dayAcc.productive + dayVal.productivehrs, }; }, { actual: 0, productive: 0 } @@ -50,7 +50,7 @@ export default function DashboardMonthlyEmployeeEfficiency({ } const dailyEfficiency = - ((dailyHrs.productive - dailyHrs.actual) / dailyHrs.productive + 1) * 100; + ((dailyHrs.productive - dailyHrs.actual) / dailyHrs.actual + 1) * 100; const theValue = { date: moment(val).format("DD"), @@ -69,7 +69,7 @@ export default function DashboardMonthlyEmployeeEfficiency({ }; theValue.accEfficiency = ( ((theValue.accProductive - theValue.accActual) / - (theValue.accProductive || 1) + + (theValue.accActual || 1) + 1) * 100 ).toFixed(1); diff --git a/server/job/job-costing.js b/server/job/job-costing.js index e5c4c5883..99870eefe 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -667,7 +667,7 @@ const formatGpPercent = (gppercent) => { //Verify that this stays in line with jobs-close-auto-allocate logic from the application. const getAdditionalCostCenter = (jl, profitCenters) => { if (!jl.part_type && !jl.mod_lbr_ty) { - const lineDesc = jl.line_desc.toLowerCase(); + const lineDesc = jl.line_desc ? jl.line_desc.toLowerCase() : ""; if (lineDesc.includes("shop mat")) { return profitCenters["MASH"];