Fixed totals calculations for jobs coming in from Mitchell.
This commit is contained in:
@@ -215,6 +215,13 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
|
|||||||
job.job_totals.parts.sublets.adjustments
|
job.job_totals.parts.sublets.adjustments
|
||||||
).toFormat()})`}</td>
|
).toFormat()})`}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{t("jobs.labels.additionaltotal")}</td>
|
||||||
|
<td className="currency">
|
||||||
|
{Dinero(job.job_totals.parts.additional).toFormat()}
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{t("jobs.labels.mapa")}</td>
|
<td>{t("jobs.labels.mapa")}</td>
|
||||||
<td className="currency">
|
<td className="currency">
|
||||||
|
|||||||
@@ -63,13 +63,15 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
if (!!!val.tax_part) return acc;
|
if (!!!val.tax_part) return acc;
|
||||||
// if (!!job.parts_tax_rates[val.part_type]) {
|
// if (!!job.parts_tax_rates[val.part_type]) {
|
||||||
// console.log("val.line_desc", val.line_desc);
|
// console.log("val.line_desc", val.line_desc);
|
||||||
|
|
||||||
return acc.add(
|
return acc.add(
|
||||||
Dinero({ amount: Math.round(val.act_price * 100) })
|
Dinero({ amount: Math.round(val.act_price * 100) })
|
||||||
.multiply(val.part_qty)
|
.multiply(val.part_qty)
|
||||||
.percentage(
|
.percentage(
|
||||||
((job.parts_tax_rates[val.part_type] &&
|
(!val.part_type && val.lbr_op === "OP13"
|
||||||
job.parts_tax_rates[val.part_type].prt_tax_rt) ||
|
? job.parts_tax_rates["PAN"].prt_tax_rt
|
||||||
0.07) * 100
|
: job.parts_tax_rates[val.part_type] &&
|
||||||
|
job.parts_tax_rates[val.part_type].prt_tax_rt) * 100
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
// } else {
|
// } else {
|
||||||
@@ -94,22 +96,18 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
Dinero({
|
Dinero({
|
||||||
amount: Math.round((job.storage_payable || 0) * 100),
|
amount: Math.round((job.storage_payable || 0) * 100),
|
||||||
}).percentage((job.tax_str_rt || 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),
|
local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100),
|
||||||
};
|
};
|
||||||
ret.total_repairs = ret.subtotal
|
ret.total_repairs = ret.subtotal
|
||||||
@@ -262,7 +260,7 @@ function CalculatePartsTotals(jobLines) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (value.part_type === null) return acc;
|
if (!value.part_type) return acc;
|
||||||
return {
|
return {
|
||||||
...acc,
|
...acc,
|
||||||
parts: {
|
parts: {
|
||||||
|
|||||||
Reference in New Issue
Block a user