From 0d317578b2672cae3f64feea033ee2642ffe5476 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 4 Mar 2021 13:23:52 -0800 Subject: [PATCH] Updates for audatex claims & mapa/mash calculations IO-718 --- client/src/graphql/jobs.queries.js | 2 ++ client/src/utils/RenderTemplate.js | 6 +++++- client/src/utils/TemplateConstants.js | 10 ++++++++++ server/job/job-totals.js | 16 +++++++++++----- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 5c429a431..df83e0fbd 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -346,6 +346,7 @@ export const GET_JOB_BY_PK = gql` inproduction vehicleid plate_no + plate_st v_vin v_model_yr v_model_desc @@ -357,6 +358,7 @@ export const GET_JOB_BY_PK = gql` vehicle { id plate_no + plate_st v_vin v_model_yr v_model_desc diff --git a/client/src/utils/RenderTemplate.js b/client/src/utils/RenderTemplate.js index 10127ac97..86101da37 100644 --- a/client/src/utils/RenderTemplate.js +++ b/client/src/utils/RenderTemplate.js @@ -42,7 +42,11 @@ export default async function RenderTemplate( try { const render = await jsreport.renderAsync(reportRequest); if (!renderAsHtml) { - render.download(Templates[templateObject.name].title || ""); + render.download( + (Templates[templateObject.name] && + Templates[templateObject.name].title) || + "" + ); } else { return new Promise((resolve, reject) => { resolve(render.toString()); diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index 47a4e5054..558d05393 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -378,3 +378,13 @@ export const TemplateList = (type, context) => { : {}), }; }; + +function getComponentPath(formItem) { + const { type } = formItem; + switch (type) { + case "checkbox": + return "/components/checkbox"; + default: + return null; + } +} diff --git a/server/job/job-totals.js b/server/job/job-totals.js index ec2e7be9d..51dc9be01 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -41,10 +41,10 @@ exports.totalsSsu = async function (req, res) { }, }); - res.status(200); + res.status(200).send(); } catch (error) { console.log(error); - res.status(503); + res.status(503).send(); } }; @@ -269,7 +269,13 @@ function IsAdditionalCost(jobLine) { //936008 is Paint/Materials //936007 is Shop/Materials - return !jobLine.db_ref || jobLine.db_ref.startsWith("9360"); + //Remove paint and shop mat lines. They're calculated under rates. + const isPaintOrShopMat = + jobLine.db_ref === "936008" || jobLine.db_ref === "936007"; + + return ( + !jobLine.db_ref || (jobLine.db_ref.startsWith("9360") && !isPaintOrShopMat) + ); } function CalculateAdditional(job) { @@ -305,7 +311,7 @@ function CalculateAdditional(job) { function CalculateTaxesTotals(job, otherTotals) { const subtotal = otherTotals.parts.parts.subtotal .add(otherTotals.parts.sublets.subtotal) - .add(otherTotals.rates.rates_subtotal) + .add(otherTotals.rates.subtotal) //No longer using just rates subtotal to include mapa/mash. .add(otherTotals.additional); // .add(Dinero({ amount: (job.towing_payable || 0) * 100 })) // .add(Dinero({ amount: (job.storage_payable || 0) * 100 })); @@ -350,7 +356,7 @@ function CalculateTaxesTotals(job, otherTotals) { statePartsTax, state_tax: statePartsTax .add( - otherTotals.rates.rates_subtotal.percentage((job.tax_lbr_rt || 0) * 100) + otherTotals.rates.subtotal.percentage((job.tax_lbr_rt || 0) * 100) // THis is currently using the lbr tax rate from PFH not PFL. ) .add( Dinero({