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