From 57d8ca582919a78673cc8106d3f4667fd5052d7a Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 19 May 2023 09:39:37 -0700 Subject: [PATCH] IO-2293 Autohouse & Job Costing Dinero Type Casting All type cast to Dinero round to integer to prevent cast errors --- server/data/autohouse.js | 15 +++++++++------ server/job/job-costing.js | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/server/data/autohouse.js b/server/data/autohouse.js index 947c8d218..c0af1cef3 100644 --- a/server/data/autohouse.js +++ b/server/data/autohouse.js @@ -792,10 +792,11 @@ const CreateCosts = (job) => { job.bodyshop.md_responsibility_centers.defaults.costs.MAPA ].add( Dinero({ - amount: + amount: Math.round( (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mapa * 100) || - 0, + 0 + ), }).multiply(job.job_totals.rates.mapa.hours) ); } @@ -806,10 +807,11 @@ const CreateCosts = (job) => { job.bodyshop.md_responsibility_centers.defaults.costs.MAPA ].add( Dinero({ - amount: + amount: Math.round( (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mapa * 100) || - 0, + 0 + ), }).multiply(job.job_totals.rates.mapa.hours) ); } @@ -829,10 +831,11 @@ const CreateCosts = (job) => { job.bodyshop.md_responsibility_centers.defaults.costs.MASH ].add( Dinero({ - amount: + amount: Math.round( (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mash * 100) || - 0, + 0 + ), }).multiply(job.job_totals.rates.mash.hours) ); } diff --git a/server/job/job-costing.js b/server/job/job-costing.js index 2096ac7d1..e7568fa72 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -642,10 +642,11 @@ function GenerateCostingData(job) { job.bodyshop.md_responsibility_centers.defaults.costs.MAPA ].add( Dinero({ - amount: + amount: Math.round( (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mapa * 100) || - 0, + 0 + ), }).multiply(materialsHours.mapaHrs) ); } @@ -656,10 +657,11 @@ function GenerateCostingData(job) { job.bodyshop.md_responsibility_centers.defaults.costs.MAPA ].add( Dinero({ - amount: + amount: Math.round( (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mapa * 100) || - 0, + 0 + ), }).multiply(materialsHours.mapaHrs) ); } @@ -680,10 +682,11 @@ function GenerateCostingData(job) { job.bodyshop.md_responsibility_centers.defaults.costs.MASH ].add( Dinero({ - amount: + amount: Math.round( (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mash * 100) || - 0, + 0 + ), }).multiply(materialsHours.mashHrs) ); }