Groovy

/* Comment out Vishal as code moved to Validation rules /*def allowedActions = [ "MAV_DIR_BB_ACTION_1003", "MAV_DIR_BB_ACTION_1000", "MAV_DIR_BB_ACTION_1001", "MAV_DIR_BB_ACTION_1002" ]y y //RUN ONLY WHEN ANALYST WORKS //if(!adf.context.getSecurityContext()?.getUserName().equals(getIntegrationUser()['user'])){ if(isAttributeChanged('BBAction_c')){ //VALIDATION FOR PREPOPULATED VALUES if(allowedActions.contains(BBAction_c)){ //throw new oracle.jbo.ValidationException("BB ACTION : You can not select default values!"); } else{ //MAKING REASON CODE AND COMMENT AS BLANK BBReasonCode_c = null; BBMPAComment_c = null; ExpectedPaymentAmount_c = 0; } }*/ //==== Vishal - checking first field levle trigger // Field-Level Trigger on BBAction_c // Trigger Name: BBAction_HoldBeginningBalance_AutoSet // Trigger Type: After Field Changed // Row 4 Condition: // - Incentive Type = COMMISSION or BONUS // - BBAction = Hold Beginning Balance (MAV_DIR_BB_ACTION_1007) // - NO other conditions (HRStatus, Country, SalesRP, Consent, CED, BB are all null) ///---1---// //--Approve Beginning Balance (Pay Full Amount) --// if (BBAction_c == 'MAV_DIR_BB_ACTION_1006') { // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') { BBReasonCode_c = null BBMPAComment_c =null /* MPAGenerated_c = null ExpectedPaymentAmount_c = null MPAStatus_c = null RecoverableFlagV1_c = null */ } } //--Approve Beginning Balance (Pay Full Amount) end --// ///---2---// //--Hold Beginning Balance (Full BB on Hold Until next month – no MPA required) --// if (BBAction_c == 'MAV_DIR_BB_ACTION_1007') { // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseBB = -1 * (BeginningBalance_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated_c != reverseBB) { MPAGenerated_c = reverseBB } ExpectedPaymentAmount_c = PTDEarnings_c // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Auto approved') { MPAStatus_c = 'Auto approved' } // Set RecoverableFlagV1_c to 'Y' if (RecoverableFlagV1_c != 'Y') { RecoverableFlagV1_c = 'Y' } } } //--Hold Beginning Balance (Full BB on Hold Until next month – no MPA required) end --// ///---3---// //--REC Payout Adjustment (Analyst needs to fill in Expected Payout) --// if (BBAction_c == 'MAV_DIR_BB_ACTION_1008') { // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseCED = -1 * (CED_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated_c != reverseCED) { MPAGenerated_c = reverseCED } ExpectedPaymentAmount_c = null /* -- need to clarify-- // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Auto approved') { MPAStatus_c = 'Auto approved' } */ // Set RecoverableFlagV1_c to 'Y' if (RecoverableFlagV1_c != 'Y') { RecoverableFlagV1_c = 'Y' } } } //--REC Payout Adjustment (Analyst needs to fill in Expected Payout) end --// ///---4---// //--NNREC Payout Adjustment (Analyst needs to fill in Expected Payout) --// if (BBAction_c == 'MAV_DIR_BB_ACTION_1009') { // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseCED = -1 * (CED_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated_c != reverseCED) { MPAGenerated_c = reverseCED } ExpectedPaymentAmount_c = null // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Manual approval') { MPAStatus_c = 'Manual approval' } // Set RecoverableFlagV1_c to 'Y' if (RecoverableFlagV1_c != 'N') { RecoverableFlagV1_c = 'N' } } } //--NNREC Payout Adjustment (Analyst needs to fill in Expected Payout) end --// ///---5---// //--NNREC Payout Adjustment (Analyst needs to fill in Expected Payout) --// if (BBAction_c == 'MAV_DIR_BB_ACTION_1010') { // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' ) { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseCED = -1 * (CED_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated_c != reverseCED) { MPAGenerated_c = reverseCED } ExpectedPaymentAmount_c = null // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Manual approval') { MPAStatus_c = 'Manual approval' } // Set RecoverableFlagV1_c to 'Y' if (RecoverableFlagV1_c != 'N') { RecoverableFlagV1_c = 'N' } } } //--NNREC Payout Adjustment (Analyst needs to fill in Expected Payout) end --// ///---6 and 7 ---// //--NNREC Payout Adjustment (Analyst needs to fill in Expected Payout) --// if (BBAction_c == 'MAV_DIR_BB_ACTION_1010') { // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'BONUS' ) { if ( HRStatus_c == 'T' && CED_c >0 ) { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseCED = -1 * (CED_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated_c != reverseCED) { MPAGenerated_c = reverseCED } ExpectedPaymentAmount_c = 0 // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Auto approval') { MPAStatus_c = 'Auto approval' } // Set RecoverableFlagV1_c to 'N' if (RecoverableFlagV1_c != 'N') { RecoverableFlagV1_c = 'N' } } /*-- HR status codition end **** 6 *** end */ /* -- HR status condition <> T ** 7**** */ if ( HRStatus_c != 'T' && CED_c <0 ) { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseCED = -1 * (CED_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated_c != reverseCED) { MPAGenerated_c = reverseCED } ExpectedPaymentAmount_c = null // analyst to input // Set MPAStatus_c to 'Manual approved' if (MPAStatus_c != 'Manual approval') { MPAStatus_c = 'Manual approval' } // Set RecoverableFlagV1_c to 'N' if (RecoverableFlagV1_c != 'N') { RecoverableFlagV1_c = 'N' } } /*-- HR status codition end **** 7 *** end */ } } //--NNREC Payout Adjustment (Analyst needs to fill in Expected Payout) end --// //---8----// //--NNREC Payout Adjustment (Analyst needs to fill in Expected Payout) --// if (BBAction_c == 'MAV_DIR_BB_ACTION_1011') { // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' && IncentiveType_c == 'BONUS' ) { if ( HRStatus_c == 'T' && EmploymentCountry_c != 'RO' && SalesRP_c == 'Y' && CED_c <0 ) { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseCED = -1 * (CED_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated_c != reverseCED) { MPAGenerated_c = reverseCED } ExpectedPaymentAmount_c = CED_c // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Manual approval') { MPAStatus_c = 'Manual approval' } // Set RecoverableFlagV1_c to 'Y' if (RecoverableFlagV1_c != 'Y') { RecoverableFlagV1_c = 'Y' } } /* ( HRStatus_c == 'T' && EmploymentCountry_c != 'RO' && SalesRP_c = 'Y' && CED_c <0 )*/ // --9 --- if ( HRStatus_c == 'A' && EmploymentCountry_c != 'RO' && SalesRP_c == 'N' && CED_c <0 ) { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseCED = -1 * (CED_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated_c != reverseCED) { MPAGenerated_c = reverseCED } ExpectedPaymentAmount_c = CED_c // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Manual approval') { MPAStatus_c = 'Manual approval' } // Set RecoverableFlagV1_c to 'Y' if (RecoverableFlagV1_c != 'Y') { RecoverableFlagV1_c = 'Y' } } /* ( HRStatus_c == 'T' && EmploymentCountry_c != 'RO' && SalesRP_c = 'Y' && CED_c <0 )*/ } } //---10----// //--NNREC Payout Adjustment (Analyst needs to fill in Expected Payout) --// if (BBAction_c == 'MAV_DIR_BB_ACTION_1012') { // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if ( IncentiveType_c == 'BONUS' ) { if ( HRStatus_c == 'A' && EmploymentCountry_c not in ('AT', 'BE', 'DE', 'GR', 'RU', 'UA') && SalesRP_c == 'Y' && BeginningBalance_c <0 ) { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c // def reverseCED = -1 * (CED_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) // if (MPAGenerated_c != reverseCED) { // MPAGenerated_c = reverseCED // } ExpectedPaymentAmount_c = null // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Manual approval') { MPAStatus_c = 'Manual approval' } // Set RecoverableFlagV1_c to 'Y' if (RecoverableFlagV1_c != 'Y') { RecoverableFlagV1_c = 'Y' } } /* ( HRStatus_c == 'T' && EmploymentCountry_c != 'RO' && SalesRP_c = 'Y' && CED_c <0 )*/ // --11 --- if ( HRStatus_c == 'A' && EmploymentCountry_c in ( 'KR', 'KZ' ) && SalesRP_c == 'Y' && BeginningBalance_c <0 ) { BBReasonCode_c = null BBMPAComment_c =null // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseCED = -1 * (CED_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated_c != reverseCED) { MPAGenerated_c = reverseCED } ExpectedPaymentAmount_c = CED_c // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Manual approval') { MPAStatus_c = 'Manual approval' } // Set RecoverableFlagV1_c to 'Y' if (RecoverableFlagV1_c != 'Y') { RecoverableFlagV1_c = 'Y' } } /* ( HRStatus_c == 'T' && EmploymentCountry_c != 'RO' && SalesRP_c = 'Y' && CED_c <0 )*/ } }

Comments

Popular posts from this blog

dev7 from eror

EPA

Unified Currency Report- Krithika