fixed

// ============================================================================ // 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] *** START Section 1: Hold Beginning Balance ***") println("[EPA Trigger] Action Code: ${BBAction_c}") println("[EPA Trigger] IncentiveType: ${IncentiveType_c}") println("[EPA Trigger] CED_c: ${CED_c}") println("[EPA Trigger] Current ExpectedPaymentAmount_c: ${ExpectedPaymentAmount_c}") // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') { println("[EPA Trigger] IncentiveType check passed.") // ** VALIDATION FOR SECTION 1 ** if (ExpectedPaymentAmount_c == null || ExpectedPaymentAmount_c < 0) { println("[EPA Trigger] ** VALIDATION FAILED ** ExpectedPaymentAmount_c is NULL or Negative: ${ExpectedPaymentAmount_c}") throw new oracle.jbo.ValidationException("EPA : NULL / Negative Value Not Allowed!"); } println("[EPA Trigger] Validation Passed. ExpectedPaymentAmount_c is valid.") // Calculate MPAGenerated_c MPAGenerated_c = ExpectedPaymentAmount_c - CED_c println("[EPA Trigger] Calculated 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 1 logic.") } println("[EPA Trigger] *** END Section 1 ***") } // ---------------------------------------------------------------------------- // ============================================================================ // 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] *** START Section 2: REC Payout Adjustment ***") println("[EPA Trigger] Action Code: ${BBAction_c}") println("[EPA Trigger] IncentiveType: ${IncentiveType_c}") println("[EPA Trigger] CED_c: ${CED_c}") println("[EPA Trigger] Current ExpectedPaymentAmount_c: ${ExpectedPaymentAmount_c}") // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') { println("[EPA Trigger] IncentiveType check passed.") // ** VALIDATION FIX APPLIED FOR SECTION 2 ** // Ensures validation fires for NULL or any NEGATIVE value before calculation. if (ExpectedPaymentAmount_c == null || ExpectedPaymentAmount_c < 0) { println("[EPA Trigger] ** VALIDATION FAILED ** ExpectedPaymentAmount_c is NULL or Negative: ${ExpectedPaymentAmount_c}") throw new oracle.jbo.ValidationException("EPA : NULL / Negative Value Not Allowed!"); } println("[EPA Trigger] Validation Passed. ExpectedPaymentAmount_c is valid.") // Calculate MPAGenerated_c MPAGenerated_c = ExpectedPaymentAmount_c - CED_c println("[EPA Trigger] Calculated MPAGenerated_c: ${MPAGenerated_c} (ExpectedPaymentAmount_c - CED_c)") // Set MPAStatus_c based on MPAGenerated_c if (MPAGenerated_c <= 0) { MPAStatus_c = 'Auto approved' println("[EPA Trigger] Setting MPAStatus_c to: Auto approved (since MPAGenerated_c <= 0)") } else { // MPAGenerated_c > 0 MPAStatus_c = 'Manual approved' println("[EPA Trigger] Setting MPAStatus_c to: Manual approved (since MPAGenerated_c > 0)") } println("[EPA Trigger] Section 2 completed successfully") } else { println("[EPA Trigger] Section 2 IncentiveType not COMMISSION or BONUS - skipping section 2 logic.") } println("[EPA Trigger] *** END Section 2 ***") }

Comments

Popular posts from this blog

dev7 from eror

EPA

Unified Currency Report- Krithika