Merged in release/2022-02-18 (pull request #396)

Release/2022 02 18
This commit is contained in:
Patrick Fic
2022-02-15 21:47:22 +00:00
4 changed files with 26 additions and 14 deletions

View File

@@ -23,21 +23,20 @@ export function FormDatePicker({
onChange, onChange,
onBlur, onBlur,
onlyFuture, onlyFuture,
isDateOnly = true,
...restProps ...restProps
}) { }) {
const ref = useRef(); const ref = useRef();
const handleChange = (newDate) => { const handleChange = (newDate) => {
if (value !== newDate && onChange) { if (value !== newDate && onChange) {
onChange(isDateOnly ? newDate && newDate.format("YYYY-MM-DD") : newDate); onChange(newDate);
} }
}; };
const handleKeyDown = (e) => { const handleKeyDown = (e) => {
if (e.key.toLowerCase() === "t") { if (e.key.toLowerCase() === "t") {
if (onChange) { if (onChange) {
onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment()); onChange(moment());
// if (ref.current && ref.current.blur) ref.current.blur(); // if (ref.current && ref.current.blur) ref.current.blur();
} }
} else if (e.key.toLowerCase() === "enter") { } else if (e.key.toLowerCase() === "enter") {
@@ -65,8 +64,7 @@ export function FormDatePicker({
}); });
} }
if (_a.isValid() && onChange) if (_a.isValid() && onChange) onChange(_a);
onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a);
}; };
return ( return (

View File

@@ -26,7 +26,6 @@ const DateTimePicker = (
value={value} value={value}
onBlur={onBlur} onBlur={onBlur}
onChange={onChange} onChange={onChange}
isDateOnly={false}
/> />
<TimePicker <TimePicker

View File

@@ -31,8 +31,8 @@ async function JobCosting(req, res) {
res.status(200).json(ret); res.status(200).json(ret);
} catch (error) { } catch (error) {
logger.log("job-costing-error", "ERROR", req.user.email, jobid, { logger.log("job-costing-error", "ERROR", req.user.email, jobid, {
jobid, message: error.message,
error, stack: error.stack,
}); });
res.status(400).send(JSON.stringify(error)); res.status(400).send(JSON.stringify(error));
@@ -261,14 +261,17 @@ async function JobCostingMulti(req, res) {
}); });
} catch (error) { } catch (error) {
logger.log("job-costing-multi-error", "ERROR", req.user.email, [jobids], { logger.log("job-costing-multi-error", "ERROR", req.user.email, [jobids], {
jobids, message: error.message,
error, stack: error.stack,
}); });
res.status(400).send(JSON.stringify(error)); res.status(400).send(error);
} }
} }
function GenerateCostingData(job) { function GenerateCostingData(job) {
if (job.id === "b97353ef-24c8-4b3f-a6c1-2190391c823e") {
console.log("here");
}
const defaultProfits = const defaultProfits =
job.bodyshop.md_responsibility_centers.defaults.profits; job.bodyshop.md_responsibility_centers.defaults.profits;
const allCenters = _.union( const allCenters = _.union(
@@ -675,12 +678,16 @@ function GenerateCostingData(job) {
sale_labor_dinero: Dinero(), sale_labor_dinero: Dinero(),
sale_parts: Dinero().toFormat(), sale_parts: Dinero().toFormat(),
sale_parts_dinero: Dinero(), sale_parts_dinero: Dinero(),
sale_additional: Dinero(),
sale_additional_dinero: Dinero(),
sales: Dinero().toFormat(), sales: Dinero().toFormat(),
sales_dinero: Dinero(), sales_dinero: Dinero(),
cost_parts: Dinero().toFormat(), cost_parts: Dinero().toFormat(),
cost_parts_dinero: Dinero(), cost_parts_dinero: Dinero(),
cost_labor: Adjustment.toFormat(), cost_labor: Adjustment.toFormat(),
cost_labor_dinero: Adjustment, cost_labor_dinero: Adjustment,
cost_additional: Dinero(),
cost_additional_dinero: Dinero(),
costs: Adjustment.toFormat(), costs: Adjustment.toFormat(),
costs_dinero: Adjustment, costs_dinero: Adjustment,
gpdollars_dinero: Dinero(), gpdollars_dinero: Dinero(),

View File

@@ -452,7 +452,8 @@ function CalculateTaxesTotals(job, otherTotals) {
const subtotal = otherTotals.parts.parts.subtotal const subtotal = otherTotals.parts.parts.subtotal
.add(otherTotals.parts.sublets.subtotal) .add(otherTotals.parts.sublets.subtotal)
.add(otherTotals.rates.subtotal) //No longer using just rates subtotal to include mapa/mash. .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.towing_payable || 0) * 100 }))
// .add(Dinero({ amount: (job.storage_payable || 0) * 100 })); // .add(Dinero({ amount: (job.storage_payable || 0) * 100 }));
@@ -522,7 +523,13 @@ function CalculateTaxesTotals(job, otherTotals) {
let ret = { let ret = {
subtotal: subtotal, 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, statePartsTax,
state_tax: statePartsTax state_tax: statePartsTax
.add( .add(
@@ -539,7 +546,8 @@ function CalculateTaxesTotals(job, otherTotals) {
.add( .add(
otherTotals.additional.storage.percentage((job.tax_str_rt || 0) * 100) 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), local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100),
}; };
ret.total_repairs = ret.subtotal ret.total_repairs = ret.subtotal