EPA trigger script fix
// ============================================================================
// SECTION 1: Hold Beginning Balance (Full BB on Hold Until next month)
// Action Code: MAV_DIR_BB_ACTION_1007
// ============================================================================
if (BBAction_c == 'MAV_DIR_BB_ACTION_1007') {
println("[EPA Trigger] Action: Hold Beginning Balance")
println("[EPA Trigger] IncentiveType: ${IncentiveType_c}")
println("[EPA Trigger] CED_c: ${CED_c}")
// Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF)
if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') {
if(ExpectedPaymentAmount_c == null || (ExpectedPaymentAmount_c != null && isAttributeChanged('ExpectedPaymentAmount_c') && ExpectedPaymentAmount_c < 0)){
throw new oracle.jbo.ValidationException("EPA : NULL / Negative Value Not Allowed!");
}
println("[EPA Trigger] MPAGenerated_c: ${MPAGenerated_c}")
MPAGenerated_c = ExpectedPaymentAmount_c -CED_c
println("[EPA Trigger] Section 1 completed successfully")
} else {
println("[EPA Trigger] IncentiveType not COMMISSION or BONUS - skipping")
}
}
// ============================================================================
// SECTION 2:REC Payout Adjustment (Analyst needs to fill in Expected Payout)
// Action Code: MAV_DIR_BB_ACTION_1008
// ============================================================================
if (BBAction_c == 'MAV_DIR_BB_ACTION_1008') {
println("[EPA Trigger] REC Payout Adjustment (Analyst needs to fill in Expected Payout) ")
println("[EPA Trigger] IncentiveType: ${IncentiveType_c}")
println("[EPA Trigger] CED_c: ${CED_c}")
// Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF)
if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') {
println("[EPA Trigger] MPAGenerated_c: ${MPAGenerated_c}")
MPAGenerated_c = ExpectedPaymentAmount_c -CED_c
if (MPAGenerated_c < 0 ||MPAGenerated_c == 0 ) {
MPAStatus_c = 'Auto approved'
}
if (MPAGenerated_c > 0 ) {
MPAStatus_c = 'Manual approved'
}
println("[EPA Trigger] Section 2 completed successfully")
} else {
println("[EPA Trigger] Section 2 IncentiveType not COMMISSION or BONUS - skipping")
}
}
Comments
Post a Comment