From 821b044515e8e1e050fd40ee21384687b41020c7 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 17 Jan 2022 11:48:12 -0800 Subject: [PATCH] IO-1606 Include additional costs in reconciliation. --- .../job-bills-total.component.jsx | 6 +++--- .../job-reconciliation-modal.component.jsx | 20 ++++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/client/src/components/job-bills-total/job-bills-total.component.jsx b/client/src/components/job-bills-total/job-bills-total.component.jsx index 8f8ba31e6..f4dbb80ea 100644 --- a/client/src/components/job-bills-total/job-bills-total.component.jsx +++ b/client/src/components/job-bills-total/job-bills-total.component.jsx @@ -64,9 +64,9 @@ export default function JobBillsTotalComponent({ }) ); - const totalPartsSublet = Dinero(totals.parts.parts.total).add( - Dinero(totals.parts.sublets.total) - ); + const totalPartsSublet = Dinero(totals.parts.parts.total) + .add(Dinero(totals.parts.sublets.total)) + .add(Dinero(totals.additional.additionalCosts)); const discrepancy = totalPartsSublet.subtract(billTotals); diff --git a/client/src/components/job-reconciliation-modal/job-reconciliation-modal.component.jsx b/client/src/components/job-reconciliation-modal/job-reconciliation-modal.component.jsx index f817a4e73..39da47462 100644 --- a/client/src/components/job-reconciliation-modal/job-reconciliation-modal.component.jsx +++ b/client/src/components/job-reconciliation-modal/job-reconciliation-modal.component.jsx @@ -18,7 +18,8 @@ export default function JobReconciliationModalComponent({ job, bills }) { .flat() || []; const jobLineData = job.joblines.filter( - (j) => j.part_type !== null && j.part_type !== "PAE" + (j) => + (j.part_type !== null && j.part_type !== "PAE") || IsAdditionalCost(j) ); return ( @@ -50,3 +51,20 @@ export default function JobReconciliationModalComponent({ job, bills }) { ); } + +function IsAdditionalCost(jobLine) { + //May be able to use db_ref here to help. + //936012 is Haz Waste Dispoal + //936008 is Paint/Materials + //936007 is Shop/Materials + + //Remove paint and shop mat lines. They're calculated under rates. + const isPaintOrShopMat = + jobLine.db_ref === "936008" || jobLine.db_ref === "936007"; + + return ( + (jobLine.lbr_op === "OP13" || //Added to resolve manual job lines coming into other totals because they have no reference. + (jobLine.db_ref && jobLine.db_ref.startsWith("9360"))) && + !isPaintOrShopMat + ); +}