From 2e7d8df781b3aa3e9e23ab462c2e042444ad1bd5 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 15 Feb 2022 09:13:10 -0800 Subject: [PATCH 1/3] Revert "Potential resolution to date time issues post 4pm." This reverts commit e79b9f90846e5ec6dd32a6144fc5ab2fd69b445b. --- .../form-date-picker/form-date-picker.component.jsx | 8 +++----- .../form-date-time-picker.component.jsx | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/client/src/components/form-date-picker/form-date-picker.component.jsx b/client/src/components/form-date-picker/form-date-picker.component.jsx index e9ace8082..3a9fe2553 100644 --- a/client/src/components/form-date-picker/form-date-picker.component.jsx +++ b/client/src/components/form-date-picker/form-date-picker.component.jsx @@ -23,21 +23,20 @@ export function FormDatePicker({ onChange, onBlur, onlyFuture, - isDateOnly = true, ...restProps }) { const ref = useRef(); const handleChange = (newDate) => { if (value !== newDate && onChange) { - onChange(isDateOnly ? newDate && newDate.format("YYYY-MM-DD") : newDate); + onChange(newDate); } }; const handleKeyDown = (e) => { if (e.key.toLowerCase() === "t") { if (onChange) { - onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment()); + onChange(moment()); // if (ref.current && ref.current.blur) ref.current.blur(); } } else if (e.key.toLowerCase() === "enter") { @@ -65,8 +64,7 @@ export function FormDatePicker({ }); } - if (_a.isValid() && onChange) - onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a); + if (_a.isValid() && onChange) onChange(_a); }; return ( diff --git a/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx b/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx index cc4e53eb0..34131d479 100644 --- a/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx +++ b/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx @@ -26,7 +26,6 @@ const DateTimePicker = ( value={value} onBlur={onBlur} onChange={onChange} - isDateOnly={false} /> Date: Tue, 15 Feb 2022 12:16:08 -0800 Subject: [PATCH 2/3] Job costing additional fix. --- server/job/job-costing.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/server/job/job-costing.js b/server/job/job-costing.js index 34a8bf732..205e39537 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -31,8 +31,8 @@ async function JobCosting(req, res) { res.status(200).json(ret); } catch (error) { logger.log("job-costing-error", "ERROR", req.user.email, jobid, { - jobid, - error, + message: error.message, + stack: error.stack, }); res.status(400).send(JSON.stringify(error)); @@ -261,14 +261,17 @@ async function JobCostingMulti(req, res) { }); } catch (error) { logger.log("job-costing-multi-error", "ERROR", req.user.email, [jobids], { - jobids, - error, + message: error.message, + stack: error.stack, }); - res.status(400).send(JSON.stringify(error)); + res.status(400).send(error); } } function GenerateCostingData(job) { + if (job.id === "b97353ef-24c8-4b3f-a6c1-2190391c823e") { + console.log("here"); + } const defaultProfits = job.bodyshop.md_responsibility_centers.defaults.profits; const allCenters = _.union( @@ -675,12 +678,16 @@ function GenerateCostingData(job) { sale_labor_dinero: Dinero(), sale_parts: Dinero().toFormat(), sale_parts_dinero: Dinero(), + sale_additional: Dinero(), + sale_additional_dinero: Dinero(), sales: Dinero().toFormat(), sales_dinero: Dinero(), cost_parts: Dinero().toFormat(), cost_parts_dinero: Dinero(), cost_labor: Adjustment.toFormat(), cost_labor_dinero: Adjustment, + cost_additional: Dinero(), + cost_additional_dinero: Dinero(), costs: Adjustment.toFormat(), costs_dinero: Adjustment, gpdollars_dinero: Dinero(), From 066f395a40c52cd9fd0838666209b0d534a98ff8 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 15 Feb 2022 13:41:35 -0800 Subject: [PATCH 3/3] IO-1738 Remove PVRT from subtotal. --- server/job/job-totals.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server/job/job-totals.js b/server/job/job-totals.js index 57fe94c87..b0a9cfed1 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -452,7 +452,8 @@ function CalculateTaxesTotals(job, otherTotals) { const subtotal = otherTotals.parts.parts.subtotal .add(otherTotals.parts.sublets.subtotal) .add(otherTotals.rates.subtotal) //No longer using just rates subtotal to include mapa/mash. - .add(otherTotals.additional.total); + .add(otherTotals.additional.total) + .subtract(otherTotals.additional.pvrt); // .add(Dinero({ amount: (job.towing_payable || 0) * 100 })) // .add(Dinero({ amount: (job.storage_payable || 0) * 100 })); @@ -522,7 +523,13 @@ function CalculateTaxesTotals(job, otherTotals) { let ret = { subtotal: subtotal, - federal_tax: subtotal.percentage((job.federal_tax_rate || 0) * 100), + federal_tax: subtotal + .percentage((job.federal_tax_rate || 0) * 100) + .add( + otherTotals.additional.pvrt.percentage( + (job.federal_tax_rate || 0) * 100 + ) + ), statePartsTax, state_tax: statePartsTax .add( @@ -539,7 +546,8 @@ function CalculateTaxesTotals(job, otherTotals) { .add( otherTotals.additional.storage.percentage((job.tax_str_rt || 0) * 100) ) - .add(additionalItemsTax), + .add(additionalItemsTax) + .add(otherTotals.additional.pvrt), local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100), }; ret.total_repairs = ret.subtotal