Fixed totals calculations for jobs coming in from Mitchell.

This commit is contained in:
Patrick Fic
2020-09-10 10:50:04 -07:00
parent 41117ff0c2
commit a0bb07abfd
2 changed files with 24 additions and 19 deletions

View File

@@ -215,6 +215,13 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
job.job_totals.parts.sublets.adjustments
).toFormat()})`}</td>
</tr>
<tr>
<td>{t("jobs.labels.additionaltotal")}</td>
<td className="currency">
{Dinero(job.job_totals.parts.additional).toFormat()}
</td>
<td></td>
</tr>
<tr>
<td>{t("jobs.labels.mapa")}</td>
<td className="currency">

View File

@@ -63,13 +63,15 @@ function CalculateTaxesTotals(job, otherTotals) {
if (!!!val.tax_part) return acc;
// if (!!job.parts_tax_rates[val.part_type]) {
// console.log("val.line_desc", val.line_desc);
return acc.add(
Dinero({ amount: Math.round(val.act_price * 100) })
.multiply(val.part_qty)
.percentage(
((job.parts_tax_rates[val.part_type] &&
job.parts_tax_rates[val.part_type].prt_tax_rt) ||
0.07) * 100
(!val.part_type && val.lbr_op === "OP13"
? job.parts_tax_rates["PAN"].prt_tax_rt
: job.parts_tax_rates[val.part_type] &&
job.parts_tax_rates[val.part_type].prt_tax_rt) * 100
)
);
// } else {
@@ -94,22 +96,18 @@ function CalculateTaxesTotals(job, otherTotals) {
Dinero({
amount: Math.round((job.storage_payable || 0) * 100),
}).percentage((job.tax_str_rt || 0) * 100)
)
// .add(
// otherTotals.rates.mapa.total.percentage(
// (job.tax_paint_mat_rt || 0) * 100
// )
// )
// .add(
// otherTotals.rates.mapa.total.percentage(
// (job.tax_paint_mat_rt || 0) * 100
// )
// )
.add(
otherTotals.rates.mash.total.percentage(
(job.tax_shop_mat_rt || 0) * 100
)
),
//Currently commented out for mitchell as these come over as line items usually instead.
// .add(
// otherTotals.rates.mapa.total.percentage(
// (job.tax_paint_mat_rt || 0) * 100
// )
// )
// .add(
// otherTotals.rates.mash.total.percentage(
// (job.tax_shop_mat_rt || 0) * 100
// )
// )
local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100),
};
ret.total_repairs = ret.subtotal
@@ -262,7 +260,7 @@ function CalculatePartsTotals(jobLines) {
};
default:
if (value.part_type === null) return acc;
if (!value.part_type) return acc;
return {
...acc,
parts: {