IO-1738 PVRT Update

This commit is contained in:
Patrick Fic
2022-02-16 16:45:49 -08:00
parent 2c1c11828d
commit b842cee076
3 changed files with 36 additions and 12 deletions

View File

@@ -33,10 +33,10 @@ export default function JobTotalsTableOther({ job }) {
key: t("jobs.fields.storage_payable"),
total: job.job_totals.additional.storage,
},
{
key: t("jobs.fields.ca_bc_pvrt"),
total: job.job_totals.additional.pvrt,
},
// {
// key: t("jobs.fields.ca_bc_pvrt"),
// total: job.job_totals.additional.pvrt,
// },
];
}, [job.job_totals, t]);

View File

@@ -3,7 +3,22 @@ import Dinero from "dinero.js";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
export default function JobTotalsTableTotals({ job }) {
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(JobTotalsTableTotals);
export function JobTotalsTableTotals({ bodyshop, job }) {
const { t } = useTranslation();
const data = useMemo(() => {
@@ -21,6 +36,14 @@ export default function JobTotalsTableTotals({ job }) {
key: t("jobs.labels.state_tax_amt"),
total: job.job_totals.totals.state_tax,
},
...(bodyshop.region_config === "CA_BC"
? [
{
key: t("jobs.fields.ca_bc_pvrt"),
total: job.job_totals.additional.pvrt,
},
]
: []),
{
key: t("jobs.labels.federal_tax_amt"),
total: job.job_totals.totals.federal_tax,

View File

@@ -442,8 +442,8 @@ function CalculateAdditional(job) {
ret.total = ret.additionalCosts
.add(ret.adjustments) //IO-813 Adjustment takes care of GST & PST at labor rate.
.add(ret.towing)
.add(ret.storage)
.add(ret.pvrt);
.add(ret.storage);
//.add(ret.pvrt);
return ret;
}
@@ -452,8 +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)
.subtract(otherTotals.additional.pvrt);
.add(otherTotals.additional.total);
// .add(Dinero({ amount: (job.towing_payable || 0) * 100 }))
// .add(Dinero({ amount: (job.storage_payable || 0) * 100 }));
@@ -546,14 +546,15 @@ function CalculateTaxesTotals(job, otherTotals) {
.add(
otherTotals.additional.storage.percentage((job.tax_str_rt || 0) * 100)
)
.add(additionalItemsTax)
.add(otherTotals.additional.pvrt),
.add(additionalItemsTax),
// .add(otherTotals.additional.pvrt),
local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100),
};
ret.total_repairs = ret.subtotal
.add(ret.federal_tax)
.add(ret.state_tax)
.add(ret.local_tax);
.add(ret.local_tax)
.add(otherTotals.additional.pvrt);
ret.custPayable = {
deductible: Dinero({ amount: Math.round((job.ded_amt || 0) * 100) }) || 0,