From e9d7f55899dd63b9ef3fee6ffb7879bb6ae3ecbe Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 30 Mar 2021 09:52:28 -0700 Subject: [PATCH] IO-774 IO-812 Part Tax and Glass Tax Total calculations --- bodyshop_translations.babel | 21 + .../jobs-create-jobs-info.component.jsx | 1 + .../jobs-detail-rates.component.jsx | 2 +- .../jobs-detail-rates.parts.component.jsx | 402 ++++++++++++++---- .../jobs-create/jobs-create.container.jsx | 8 + .../jobs-detail.page.component.jsx | 8 +- client/src/translations/en_us/common.json | 3 +- client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + server/job/job-totals.js | 12 +- 10 files changed, 371 insertions(+), 88 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 11c1c8799..0d2161130 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -13656,6 +13656,27 @@ + + PAP + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + PAR false diff --git a/client/src/components/jobs-create-jobs-info/jobs-create-jobs-info.component.jsx b/client/src/components/jobs-create-jobs-info/jobs-create-jobs-info.component.jsx index bcd1f490b..3e0771499 100644 --- a/client/src/components/jobs-create-jobs-info/jobs-create-jobs-info.component.jsx +++ b/client/src/components/jobs-create-jobs-info/jobs-create-jobs-info.component.jsx @@ -30,6 +30,7 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) { jobRO={false} expanded required={selected && true} + form={form} /> - + ); } diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx index 62d7e6202..6ecbf0657 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx @@ -5,12 +5,16 @@ import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; - const mapStateToProps = createStructuredSelector({ jobRO: selectJobReadOnly, }); -export function JobsDetailRatesParts({ jobRO, expanded, required = true }) { +export function JobsDetailRatesParts({ + jobRO, + expanded, + required = true, + form, +}) { const { t } = useTranslation(); return ( @@ -43,17 +47,27 @@ export function JobsDetailRatesParts({ jobRO, expanded, required = true }) { > - - + + {() => { + return ( + + + + ); + }} @@ -83,17 +97,27 @@ export function JobsDetailRatesParts({ jobRO, expanded, required = true }) { > - - + + {() => { + return ( + + + + ); + }} @@ -123,17 +147,27 @@ export function JobsDetailRatesParts({ jobRO, expanded, required = true }) { > - - + + {() => { + return ( + + + + ); + }} @@ -163,17 +197,27 @@ export function JobsDetailRatesParts({ jobRO, expanded, required = true }) { > - - + + {() => { + return ( + + + + ); + }} @@ -203,17 +247,27 @@ export function JobsDetailRatesParts({ jobRO, expanded, required = true }) { > - - + + {() => { + return ( + + + + ); + }} @@ -243,18 +297,128 @@ export function JobsDetailRatesParts({ jobRO, expanded, required = true }) { > + + {() => { + return ( + + + + ); + }} + + {" "} + + + + + + + + + + + + {() => { + return ( + + + + ); + }} + + {" "} + + + + + + + + + + + + + + + {() => { + return ( + + + + ); + }} + - - + + {() => { + return ( + + + + ); + }} @@ -323,18 +497,78 @@ export function JobsDetailRatesParts({ jobRO, expanded, required = true }) { > + + {() => { + return ( + + + + ); + }} + + + + + + + + + + + + + + {() => { + return ( + + + + ); + }} + !jl.removed); let ret = { @@ -322,6 +322,14 @@ function CalculateTaxesTotals(job, otherTotals) { let statePartsTax = Dinero(); let additionalItemsTax = Dinero(); + //Audatex sends additional glass part types. IO-774 + const BackupGlassTax = + job.parts_tax_rates.PAGD || + job.parts_tax_rates.PAGF || + job.parts_tax_rates.PAGP || + job.parts_tax_rates.PAGQ || + job.parts_tax_rates.PAGR; + job.joblines .filter((jl) => !jl.removed) .forEach((val) => { @@ -344,6 +352,8 @@ function CalculateTaxesTotals(job, otherTotals) { ((job.parts_tax_rates && job.parts_tax_rates[val.part_type] && job.parts_tax_rates[val.part_type].prt_tax_rt) || + (val.part_type.startsWith("PAG") && + BackupGlassTax.prt_tax_rt) || 0) * 100 ) );