Monday, January 13, 2025

TCS Stock Item in Criteria Item That uses Fast Formula

/**************************************************

FF Name: Tilak_TCS_ITEM_STOCK
Type   : Total Compensation Item
Developer: Tilak
Purpose: Find a stock type for a given employee

**************************************************/

/* Declare DBI */

DEFAULT_DATA_VALUE FOR CMP_ASSIGNMENT_RGE_SALARY_CHANGE_AMOUNT IS 0
DEFAULT FOR PER_ASG_LEGAL_ENTITY_ID is -1
DEFAULT_DATA_VALUE FOR
CMP_STOCK_DATA_RGE_ASG_ASSIGNMENT_ID is -1
DEFAULT_DATA_VALUE FOR  CMP_STOCK_DATA_RGE_ASG_GRANT_TYPE    is 'XXX'
DEFAULT_DATA_VALUE FOR  CMP_STOCK_DATA_RGE_ASG_ORIGINAL_SHARES_GRANTED is -1


DEFAULT FOR COMPENSATION_DATES is ' '
DEFAULT FOR VALUES             is ' '
DEFAULT FOR ASSIGNMENTS        is ' '
DEFAULT FOR LEGALEMPLOYERS     is ' '

/* Declare IV */ 


INPUTS ARE CMP_IV_PERSON_ID , CMP_IV_PERIOD_START_DATE(DATE), CMP_IV_PERIOD_END_DATE (DATE),
CMP_IVR_ASSIGNMENT_ID(NUMBER_NUMBER) , CMP_IVR_TERM_ID(NUMBER_NUMBER),
CMP_IVR_PAY_ASSIGNMENT_ID (NUMBER_NUMBER),
CMP_IVR_PAY_TERM_ID(NUMBER_NUMBER), CMP_IVR_PAY_RELATION_ID(NUMBER_NUMBER) 


/***************** Main ************************/

temp = SET_LOG('Entering Fromula Tilak_TCS_ITEM_STOCK ' )
asgId  = get_context(HR_ASSIGNMENT_ID, -1)
leId   = PER_ASG_LEGAL_ENTITY_ID
perId  = get_context(PERSON_ID, -1)

temp =SET_LOG('Assinment  ' || TO_CHAR(asgId) )
temp =SET_LOG('LE   ' || TO_CHAR(leId) )
temp =SET_LOG('person   ' || TO_CHAR(perId) )
stdt  = get_context(START_DATE,  '1900/01/01' (date))
etdt  = get_context(END_DATE,  '1900/01/01' (date))

temp =SET_LOG('start date   ' || TO_CHAR(stdt) )
temp =SET_LOG('End date   ' || TO_CHAR(etdt) )

index = CMP_STOCK_DATA_RGE_ASG_ASSIGNMENT_ID.FIRST(-1) 

temp  = SET_LOG( ' first index ' + TO_CHAR(index ))

COMPENSATION_DATES = to_CHAR(etdt , 'YYYY/MM/DD')
VALUES             = 'N'   
ASSIGNMENTS        = TO_CHAR(asgId)
LEGALEMPLOYERS     = TO_CHAR(leId)

WHILE (CMP_IVR_ASSIGNMENT_ID.EXISTS(index))
LOOP (
  ltype =  CMP_STOCK_DATA_RGE_ASG_GRANT_TYPE[index]
  lshare = CMP_STOCK_DATA_RGE_ASG_ORIGINAL_SHARES_GRANTED[index]  temp  = SET_LOG( 'shares' + TO_CHAR(lshare ))
temp  = SET_LOG( 'TYpr ' +  ltype )
  if ( ltype = 'ISO' AND lshare > 0 ) THEN 
  (
     VALUES = 'Y' 
     EXIT 
   )

index  = CMP_STOCK_DATA_RGE_ASG_ASSIGNMENT_ID.NEXT(index ,-1)
)

temp = SET_LOG('LEAVING Fromula Tilak_TCS_ITEM_STOCK ' + VALUES )

RETURN COMPENSATION_DATES, VALUES, ASSIGNMENTS, LEGALEMPLOYERS

No comments:

Post a Comment