feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration / RRScratch2 / Math Adjustments / DMS State cleaning on Page load
This commit is contained in:
@@ -584,19 +584,22 @@ function applyRomeProfileAdjustments({
|
||||
}
|
||||
});
|
||||
|
||||
// Labor / materials adjustments
|
||||
// Labor / materials adjustments (match CDK semantics: check `adjustment`, add `adjustments`)
|
||||
Object.keys(rateMap).forEach((key) => {
|
||||
const rate = rateMap[key];
|
||||
if (!rate || !rate.adjustment) return;
|
||||
|
||||
const adjMoney = Dinero(rate.adjustment);
|
||||
if (adjMoney.isZero()) return;
|
||||
const checkMoney = Dinero(rate.adjustment);
|
||||
if (checkMoney.isZero()) return;
|
||||
|
||||
const accountName = selectedDmsAllocationConfig.profits[key.toUpperCase()];
|
||||
const otherAccount = bodyshop.md_responsibility_centers.profits.find((c) => c.name === accountName);
|
||||
|
||||
if (otherAccount) {
|
||||
const bucket = ensureCenterBucket(profitCenterHash, accountName);
|
||||
|
||||
// Note: we intentionally use `rate.adjustments` here to mirror CDK behaviour
|
||||
const adjMoney = Dinero(rate.adjustments);
|
||||
bucket.extrasSale = bucket.extrasSale.add(adjMoney);
|
||||
|
||||
debugLog("Added rate adjustment", {
|
||||
|
||||
Reference in New Issue
Block a user