IO-3001 Resolve towing totals issue.

This commit is contained in:
Patrick Fic
2024-11-19 10:59:59 -08:00
parent e363dca3f0
commit 2304e0bf02

View File

@@ -881,17 +881,21 @@ function CalculateTaxesTotals(job, otherTotals) {
}
});
//Add towing and storage taxable amounts
const stlTowing = job.cieca_stl?.data.find((c) => c.ttl_typecd === "OTTW");
const stlStorage = job.cieca_stl?.data.find((c) => c.ttl_typecd === "OTST");
const stlTowing = job.cieca_stl?.data.find((c) => c.ttl_typecd === "OTTW" || c.ttl_type === "OTTW");
const stlStorage = job.cieca_stl?.data.find((c) => c.ttl_typecd === "OTST" || c.ttl_type === "OTST");
if (stlTowing)
taxableAmounts.TOW = Dinero({
amount: Math.round(stlTowing.t_amt * 100)
});
taxableAmounts.TOW = taxableAmounts.TOW.add(
Dinero({
amount: Math.round(stlTowing.t_amt * 100)
})
);
if (stlStorage)
taxableAmounts.TOW = Dinero({
amount: Math.round(stlStorage.t_amt * 100)
});
taxableAmounts.TOW = taxableAmounts.TOW.add(
(taxableAmounts.TOW = Dinero({
amount: Math.round(stlStorage.t_amt * 100)
}))
);
const pfp = job.parts_tax_rates;
@@ -903,8 +907,8 @@ function CalculateTaxesTotals(job, otherTotals) {
}
});
// console.log("*** Taxable Amounts***");
// console.table(JSON.parse(JSON.stringify(taxableAmounts)));
console.log("*** Taxable Amounts***");
console.table(JSON.parse(JSON.stringify(taxableAmounts)));
//For the taxable amounts, figure out which tax type applies.
//Then sum up the total of that tax type and then calculate the thresholds.
@@ -1018,8 +1022,8 @@ function CalculateTaxesTotals(job, otherTotals) {
}
const remainingTaxableAmounts = taxableAmountsByTier;
// console.log("*** Taxable Amounts by Tier***");
// console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));
console.log("*** Taxable Amounts by Tier***");
console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));
Object.keys(taxableAmountsByTier).forEach((taxTierKey) => {
try {