IO-1606 IO-1607 IO-1752 Move towing rates.

This commit is contained in:
Patrick Fic
2022-03-08 14:47:01 -08:00
parent f11eb6406d
commit 2579558090
3 changed files with 19 additions and 9 deletions

View File

@@ -64,9 +64,9 @@ export default function JobBillsTotalComponent({
}) })
); );
const totalPartsSublet = Dinero(totals.parts.parts.total).add( const totalPartsSublet = Dinero(totals.parts.parts.total)
Dinero(totals.parts.sublets.total) .add(Dinero(totals.parts.sublets.total))
); .add(Dinero(totals.additional.towing));
const discrepancy = totalPartsSublet.subtract(billTotals); const discrepancy = totalPartsSublet.subtract(billTotals);

View File

@@ -18,7 +18,11 @@ export default function JobReconciliationModalComponent({ job, bills }) {
.flat() || []; .flat() || [];
const jobLineData = job.joblines.filter( const jobLineData = job.joblines.filter(
(j) => j.part_type !== null && j.part_type !== "PAE" (j) =>
(j.part_type !== null && j.part_type !== "PAE") ||
(j.line_desc &&
j.line_desc.toLowerCase().includes("towing") &&
j.lbr_op === "OP13")
); );
return ( return (

View File

@@ -418,21 +418,27 @@ function CalculateAdditional(job) {
pvrt: null, pvrt: null,
total: null, total: null,
}; };
ret.towing = Dinero({
amount: Math.round((job.towing_payable || 0) * 100),
});
ret.additionalCosts = job.joblines ret.additionalCosts = job.joblines
.filter((jl) => !jl.removed && IsAdditionalCost(jl)) .filter((jl) => !jl.removed && IsAdditionalCost(jl))
.reduce((acc, val) => { .reduce((acc, val) => {
const lineValue = Dinero({ const lineValue = Dinero({
amount: Math.round((val.act_price || 0) * 100), amount: Math.round((val.act_price || 0) * 100),
}).multiply(val.part_qty || 1); }).multiply(val.part_qty || 1);
ret.additionalCostItems.push({ key: val.line_desc, total: lineValue });
return acc.add(lineValue); if (val.line_desc.toLowerCase().includes("towing")) {
ret.towing = lineValue;
return acc;
} else {
ret.additionalCostItems.push({ key: val.line_desc, total: lineValue });
return acc.add(lineValue);
}
}, Dinero()); }, Dinero());
ret.adjustments = Dinero({ ret.adjustments = Dinero({
amount: Math.round((job.adjustment_bottom_line || 0) * 100), amount: Math.round((job.adjustment_bottom_line || 0) * 100),
}); });
ret.towing = Dinero({
amount: Math.round((job.towing_payable || 0) * 100),
});
ret.storage = Dinero({ ret.storage = Dinero({
amount: Math.round((job.storage_payable || 0) * 100), amount: Math.round((job.storage_payable || 0) * 100),
}); });