From 78dd14af856d48b0a5795de94c82a62bbafc20eb Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 6 Jun 2022 14:32:59 -0700 Subject: [PATCH] IO-1921 Add shipping to reconciliation. --- .../job-bills-total/job-bills-total.component.jsx | 1 + .../job-reconciliation-modal.component.jsx | 3 ++- .../job-reconciliation-totals.utility.js | 8 +++++++- server/job/job-totals.js | 7 +++++++ 4 files changed, 17 insertions(+), 2 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 b1d4f33f5..701ebe1c6 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 @@ -86,6 +86,7 @@ export default function JobBillsTotalComponent({ const totalPartsSublet = Dinero(totals.parts.parts.total) .add(Dinero(totals.parts.sublets.total)) + .add(Dinero(totals.additional.shipping)) .add(Dinero(totals.additional.towing)); 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 cde3abc6c..8c83a504a 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 @@ -22,7 +22,8 @@ export default function JobReconciliationModalComponent({ job, bills }) { (j.part_type !== null && j.part_type !== "PAE") || (j.line_desc && j.line_desc.toLowerCase().includes("towing") && - j.lbr_op === "OP13") + j.lbr_op === "OP13") || + j.db_ref === "936004" //ADD SHIPPING LINE. ); return ( diff --git a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.utility.js b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.utility.js index 119878890..6a6e1a0f6 100644 --- a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.utility.js +++ b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.utility.js @@ -1,5 +1,6 @@ import i18next from "i18next"; import _ from "lodash"; + export const reconcileByAssocLine = ( jobLines, jobLineState, @@ -73,7 +74,12 @@ export const reconcileByPrice = ( jobLines.forEach((jl) => { const matchingBillLineIds = billLines - .filter((bl) => bl.actual_price === jl.act_price && bl.quantity === jl.part_qty && !jl.removed) + .filter( + (bl) => + bl.actual_price === jl.act_price && + bl.quantity === jl.part_qty && + !jl.removed + ) .map((bl) => bl.id); if (matchingBillLineIds.length > 1) { diff --git a/server/job/job-totals.js b/server/job/job-totals.js index 54b30a9d6..79a2337e1 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -523,6 +523,7 @@ function CalculateAdditional(job) { additionalCostItems: [], adjustments: null, towing: null, + shipping: Dinero(), storage: null, pvrt: null, total: null, @@ -530,6 +531,7 @@ function CalculateAdditional(job) { ret.towing = Dinero({ amount: Math.round((job.towing_payable || 0) * 100), }); + ret.additionalCosts = job.joblines .filter((jl) => !jl.removed && IsAdditionalCost(jl)) .reduce((acc, val) => { @@ -537,6 +539,11 @@ function CalculateAdditional(job) { amount: Math.round((val.act_price || 0) * 100), }).multiply(val.part_qty || 1); + if (val.db_ref === "936004") { + //Shipping line IO-1921. + ret.shipping = ret.shipping.add(lineValue); + } + if (val.line_desc.toLowerCase().includes("towing")) { ret.towing = lineValue; return acc;