IO-3001 Additional tax changes.
This commit is contained in:
@@ -49,7 +49,7 @@ exports.totalsSsu = async function (req, res) {
|
||||
} catch (error) {
|
||||
logger.log("job-totals-ssu-USA-error", "ERROR", req?.user?.email, id, {
|
||||
jobid: id,
|
||||
error
|
||||
error: error.message
|
||||
});
|
||||
res.status(503).send();
|
||||
}
|
||||
@@ -75,7 +75,7 @@ async function TotalsServerSide(req, res) {
|
||||
: job.cieca_ttl.data.n_ttl_amt - job.cieca_ttl.data.g_tax;
|
||||
const ttlDifference = emsTotal - ret.totals.subtotal.getAmount() / 100;
|
||||
|
||||
if (Math.abs(ttlDifference) > 0.00) {
|
||||
if (Math.abs(ttlDifference) > 0.0) {
|
||||
//If difference is greater than a pennny, we need to adjust it.
|
||||
ret.totals.ttl_adjustment = Dinero({ amount: Math.round(ttlDifference * 100) });
|
||||
ret.totals.subtotal = ret.totals.subtotal.add(ret.totals.ttl_adjustment);
|
||||
@@ -97,7 +97,7 @@ async function TotalsServerSide(req, res) {
|
||||
100;
|
||||
const ttlTaxDifference = emsTaxTotal - totalUsTaxes;
|
||||
|
||||
if (Math.abs(ttlTaxDifference) > 0.00) {
|
||||
if (Math.abs(ttlTaxDifference) > 0.0) {
|
||||
//If difference is greater than a pennny, we need to adjust it.
|
||||
ret.totals.ttl_tax_adjustment = Dinero({ amount: Math.round(ttlTaxDifference * 100) });
|
||||
ret.totals.total_repairs = ret.totals.total_repairs.add(ret.totals.ttl_tax_adjustment);
|
||||
@@ -998,7 +998,7 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
logger.log("job-totals-USA Key with issue", "error", null, null, {
|
||||
logger.log("job-totals-USA Key with issue", "error", null, job.id, {
|
||||
key
|
||||
});
|
||||
}
|
||||
@@ -1028,7 +1028,7 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
for (let threshCounter = 1; threshCounter <= 5; threshCounter++) {
|
||||
const thresholdAmount = parseFloat(job.cieca_pft[`ty${tyCounter}_thres${threshCounter}`]) || 0;
|
||||
const thresholdTaxRate = parseFloat(job.cieca_pft[`ty${tyCounter}_rate${threshCounter}`]) || 0;
|
||||
|
||||
// console.log(taxTierKey, tyCounter, threshCounter, thresholdAmount, thresholdTaxRate);
|
||||
let taxableAmountInThisThreshold;
|
||||
if (
|
||||
thresholdAmount === 9999.99 ||
|
||||
@@ -1052,11 +1052,8 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
taxableAmountInThisThreshold = Dinero({
|
||||
amount: Math.round(thresholdAmount * 100)
|
||||
});
|
||||
remainingTaxableAmounts[taxTierKey] = remainingTaxableAmounts[taxTierKey].subtract(
|
||||
Dinero({
|
||||
amount: Math.round(taxableAmountInThisThreshold * 100)
|
||||
})
|
||||
);
|
||||
remainingTaxableAmounts[taxTierKey] =
|
||||
remainingTaxableAmounts[taxTierKey].subtract(taxableAmountInThisThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1065,8 +1062,8 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
totalTaxByTier[taxTierKey] = totalTaxByTier[taxTierKey].add(taxAmountToAdd);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.log("job-totals-USA - PFP Calculation Error", "error", null, null, {
|
||||
error
|
||||
logger.log("job-totals-USA - PFP Calculation Error", "error", null, job.id, {
|
||||
error: error.message
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user