From 76fb8f453d55f7378d603ac13623c76277540e7d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 7 Feb 2022 18:31:06 -0800 Subject: [PATCH 1/3] 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 2/3] 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"]; From 634adb6e9a8baf3673cb0a0eb3bd86c34298ccd8 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 8 Feb 2022 09:47:58 -0800 Subject: [PATCH 3/3] Resolve monthly employee efficiency for infinity. --- .../monthly-employee-efficiency.component.jsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 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 a177771c3..c4aa9ec6b 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 @@ -54,7 +54,9 @@ export default function DashboardMonthlyEmployeeEfficiency({ const theValue = { date: moment(val).format("DD"), - ...dailyHrs, + // ...dailyHrs, + actual: dailyHrs.actual.toFixed(1), + productive: dailyHrs.productive.toFixed(1), dailyEfficiency: isNaN(dailyEfficiency) ? 0 : dailyEfficiency.toFixed(1), accActual: acc.length > 0 @@ -67,12 +69,18 @@ export default function DashboardMonthlyEmployeeEfficiency({ : dailyHrs.productive, accEfficiency: 0, }; - theValue.accEfficiency = ( + + theValue.accEfficiency = ((theValue.accProductive - theValue.accActual) / - (theValue.accActual || 1) + + (theValue.accActual || 0) + 1) * - 100 - ).toFixed(1); + 100; + + if (isNaN(theValue.accEfficiency)) { + theValue.accEfficiency = 0; + } else { + theValue.accEfficiency = theValue.accEfficiency.toFixed(1); + } return [...acc, theValue]; }, []); @@ -131,6 +139,7 @@ export default function DashboardMonthlyEmployeeEfficiency({ //stackId="day" barSize={20} fill="#102568" + format={"0.0"} />