IO-1738 PVRT Update
This commit is contained in:
@@ -33,10 +33,10 @@ export default function JobTotalsTableOther({ job }) {
|
|||||||
key: t("jobs.fields.storage_payable"),
|
key: t("jobs.fields.storage_payable"),
|
||||||
total: job.job_totals.additional.storage,
|
total: job.job_totals.additional.storage,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
key: t("jobs.fields.ca_bc_pvrt"),
|
// key: t("jobs.fields.ca_bc_pvrt"),
|
||||||
total: job.job_totals.additional.pvrt,
|
// total: job.job_totals.additional.pvrt,
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
}, [job.job_totals, t]);
|
}, [job.job_totals, t]);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,22 @@ import Dinero from "dinero.js";
|
|||||||
import React, { useMemo } from "react";
|
import React, { useMemo } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
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 { t } = useTranslation();
|
||||||
|
|
||||||
const data = useMemo(() => {
|
const data = useMemo(() => {
|
||||||
@@ -21,6 +36,14 @@ export default function JobTotalsTableTotals({ job }) {
|
|||||||
key: t("jobs.labels.state_tax_amt"),
|
key: t("jobs.labels.state_tax_amt"),
|
||||||
total: job.job_totals.totals.state_tax,
|
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"),
|
key: t("jobs.labels.federal_tax_amt"),
|
||||||
total: job.job_totals.totals.federal_tax,
|
total: job.job_totals.totals.federal_tax,
|
||||||
|
|||||||
@@ -442,8 +442,8 @@ function CalculateAdditional(job) {
|
|||||||
ret.total = ret.additionalCosts
|
ret.total = ret.additionalCosts
|
||||||
.add(ret.adjustments) //IO-813 Adjustment takes care of GST & PST at labor rate.
|
.add(ret.adjustments) //IO-813 Adjustment takes care of GST & PST at labor rate.
|
||||||
.add(ret.towing)
|
.add(ret.towing)
|
||||||
.add(ret.storage)
|
.add(ret.storage);
|
||||||
.add(ret.pvrt);
|
//.add(ret.pvrt);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -452,8 +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 }));
|
||||||
|
|
||||||
@@ -546,14 +546,15 @@ 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),
|
// .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
|
||||||
.add(ret.federal_tax)
|
.add(ret.federal_tax)
|
||||||
.add(ret.state_tax)
|
.add(ret.state_tax)
|
||||||
.add(ret.local_tax);
|
.add(ret.local_tax)
|
||||||
|
.add(otherTotals.additional.pvrt);
|
||||||
|
|
||||||
ret.custPayable = {
|
ret.custPayable = {
|
||||||
deductible: Dinero({ amount: Math.round((job.ded_amt || 0) * 100) }) || 0,
|
deductible: Dinero({ amount: Math.round((job.ded_amt || 0) * 100) }) || 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user