Merged in feature/IO-2895-Adjustment-to-bottom (pull request #1654)
IO-2895 Adjustment to Bottom Line
This commit is contained in:
@@ -965,22 +965,17 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (job.adjustment_bottom_line) {
|
if (job.adjustment_bottom_line && job.adjustment_bottom_line !== 0) {
|
||||||
const subtotal_before_adjustment = subtotal.add(Dinero({ amount: Math.round(job.adjustment_bottom_line * -100) }));
|
for (let tyCounter = 1; tyCounter <= 5; tyCounter++) {
|
||||||
const percent_of_adjustment =
|
if (IsTrueOrYes(pfp["PAN"][`prt_tx_in${tyCounter}`])) {
|
||||||
Math.round(
|
//This amount is taxable for this type.
|
||||||
subtotal_before_adjustment.toUnit() /
|
taxableAmountsByTier[`ty${tyCounter}Tax`] = taxableAmountsByTier[`ty${tyCounter}Tax`].add(
|
||||||
(job.adjustment_bottom_line > 0 ? job.adjustment_bottom_line : job.adjustment_bottom_line * -1)
|
Dinero({
|
||||||
) / 100;
|
amount: Math.round(job.adjustment_bottom_line * 100)
|
||||||
|
})
|
||||||
Object.keys(taxableAmountsByTier).forEach((taxTierKey) => {
|
);
|
||||||
taxable_adjustment = taxableAmountsByTier[taxTierKey].multiply(percent_of_adjustment);
|
|
||||||
if (job.adjustment_bottom_line > 0) {
|
|
||||||
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].add(taxable_adjustment);
|
|
||||||
} else {
|
|
||||||
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].subtract(taxable_adjustment);
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const remainingTaxableAmounts = taxableAmountsByTier;
|
const remainingTaxableAmounts = taxableAmountsByTier;
|
||||||
|
|||||||
Reference in New Issue
Block a user