Monday, September 9, 2024

TCS Annual Salary Fast Formula

 TCS Annual Salary Fast Formula

https://youtu.be/hNX3MIH-PBw


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

FF Name: TILAK_TCS_TCS_ITEM_ANN_SALARY
Type   : Total Compensation Item
Developer: Tilak
Purpose: Get Annual Salary of the Employee 

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

 


/* Declare DBI */


DEFAULT FOR CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT is -1
DEFAULT FOR PER_ASG_LEGAL_ENTITY_ID  is -1
DEFAULT FOR CMP_ASSIGNMENT_SALARY_CURRENCY_CODE is 'x'

/* Declare IV */

INPUTS ARE  CMP_IV_PERIOD_START_DATE(DATE),
CMP_IV_PERIOD_END_DATE (DATE)



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


temp = SET_LOG('Entering Fromula TILAK_SAL_FF ' )
VALUES    =  ' '
COMPENSATION_DATES =  ' '
ASSIGNMENTS =      TO_CHAR(get_context(HR_ASSIGNMENT_ID, -1) )
LEGALEMPLOYERS =  TO_CHAR(PER_ASG_LEGAL_ENTITY_ID)
COMPENSATION_DATES =  TO_CHAR(CMP_IV_PERIOD_END_DATE , 'YYYY/MM/DD')
UNIT          = ' '
IF (CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT WAS NOT DEFAULTED ) THEN (
    VALUES  = TO_CHAR(CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT)
    UNIT   = CMP_ASSIGNMENT_SALARY_CURRENCY_CODE
)


temp =SET_LOG('Annual  Salary  ' || VALUES )
temp =SET_LOG('Assinment  ' || ASSIGNMENTS)
temp =SET_LOG('LE   ' || LEGALEMPLOYERS )
temp =SET_LOG('Date  ' || COMPENSATION_DATES )
temp =SET_LOG('Unit  ' || Unit )

temp =SET_LOG('Leaving Fromula TILAK_SAL_FF ' )

RETURN COMPENSATION_DATES, VALUES, UNIT, ASSIGNMENTS, LEGALEMPLOYERS

Friday, January 19, 2024

Calculating 13 or 14 months salary in TCS

Calculating 13 or 14 months salary in TCS

 

 

This is a sample formula for calculating 13 or 14 months salary for the Total Compensation Statement.

This is just a sample code, this may not work as it is for your needs, and you may need to change the logic as per your requirements.

 

Please see the YouTube Tutorial for an explanation of this code.

 

1)     Simple Sample Formula

Assume your salary is monthly, the salary has not changed during the statement period.
The 13th salary is added to the salary of December.

 

 

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

FF Name: TILAK_ARRAY_13MONTH_SAL_1

Type   : Total Compensation Item

Developer: Tilak

Purpose: Calculate 13-month salary and adding that in DEC month

 

 

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

 

/* Declare DBI */

 

 

DEFAULT FOR CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT is 0

DEFAULT FOR CMP_ASSIGNMENT_SALARY_ANNUALIZATION_FACTOR is 0

DEFAULT FOR PER_ASG_LEGAL_ENTITY_ID  is -1

DEFAULT FOR CMP_ASSIGNMENT_SALARY_DATE_FROM is   '1900/01/01' (date)

 

DEFAULT FOR COMPENSATION_DATES is EMPTY_TEXT_NUMBER

DEFAULT FOR VALUES         is EMPTY_TEXT_NUMBER

DEFAULT FOR ASSIGNMENTS    is EMPTY_TEXT_NUMBER

DEFAULT FOR LEGALEMPLOYERS is EMPTY_TEXT_NUMBER

 

/* Declare IV */

 

INPUTS ARE  CMP_IV_PERIOD_START_DATE(DATE),

         CMP_IV_PERIOD_END_DATE (DATE)

 

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

temp = SET_LOG('Entering Fromula TILAK_ARRAY_13MONTH_SAL_1 ' )

myAnnSalary = CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT

myAnnFactor = CMP_ASSIGNMENT_SALARY_ANNUALIZATION_FACTOR

 

/*

myAnnFactor = 13 

 

IF CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT WAS DEFAULTED THEN

(

   temp =SET_LOG('No Salary Found using 13K for testing ' )

   myAnnSalary = 13000

)

*/

 

asgId  = get_context(HR_ASSIGNMENT_ID, -1)

leId   = PER_ASG_LEGAL_ENTITY_ID

 

myMonthSalary  = myAnnSalary / myAnnFactor

temp =SET_LOG('Annual  Salary  ' || TO_CHAR(myAnnSalary) )

temp =SET_LOG('Monthly Salary  ' || TO_CHAR(myMonthSalary) )

temp =SET_LOG('Assinment  ' || TO_CHAR(asgId) )

temp =SET_LOG('LE   ' || TO_CHAR(leId) )

 

/* Asuumed Salary is first of Every Month First the first date within the period */

firstDate = TRUNC(CMP_IV_PERIOD_START_DATE, 'MM')

endDate   = CMP_IV_PERIOD_END_DATE

 

temp =SET_LOG('first Date  ' || TO_CHAR(firstDate) )

temp =SET_LOG('Last Date ' || TO_CHAR(endDate) )

 

index = 1

IF (firstDate < CMP_IV_PERIOD_START_DATE) then

(

  firstDate = ADD_MONTHS(firstDate, 1)

)

 

/* Create Row */

WHILE firstDate <= endDate

LOOP(

temp =SET_LOG('Processing Date  ' || TO_CHAR(firstDate) )

COMPENSATION_DATES[index] = to_char(firstDate, 'YYYY/MM/DD')

ASSIGNMENTS[index]    = to_char(asgId)

LEGALEMPLOYERS[index] = to_char(leId)

VALUES[index]                = to_char(myMonthSalary)

IF ( TO_CHAR(firstDate, 'MM') = '12' ) then

(

     VALUES[index]                = to_char(myMonthSalary  * 2)

  )

 

  

   index = index + 1

   firstDate = add_months(firstDate, 1)

)

 

 

temp =SET_LOG('Leaving Fromula TILAK_ARRAY_13MONTH_SAL_1 ' )

RETURN COMPENSATION_DATES, VALUES, ASSIGNMENTS, LEGALEMPLOYERS

 

         2) This Formula assumes that the salary might be changed within the period 
             Th 13th month salary is added as an entry on December 


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

FF Name: TILAK_ARRAY_13MONTH_SAL_2 

Type   : Total Compensation Item

Developer: Tilak

Purpose: Calculate 13-month salary and adding that in DEC month


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


/* Declare DBI */ 



DEFAULT FOR CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT is 0

DEFAULT FOR CMP_ASSIGNMENT_SALARY_ANNUALIZATION_FACTOR is 0

DEFAULT FOR PER_ASG_LEGAL_ENTITY_ID  is -1 

DEFAULT FOR CMP_ASSIGNMENT_SALARY_DATE_FROM is   '1900/01/01' (date)


DEFAULT FOR COMPENSATION_DATES is EMPTY_TEXT_NUMBER 

DEFAULT FOR VALUES             is EMPTY_TEXT_NUMBER 

DEFAULT FOR ASSIGNMENTS        is EMPTY_TEXT_NUMBER 

DEFAULT FOR LEGALEMPLOYERS     is EMPTY_TEXT_NUMBER 


/* Declare IV */ 


INPUTS ARE  CMP_IV_PERIOD_START_DATE(DATE), 

            CMP_IV_PERIOD_END_DATE (DATE)


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

temp = SET_LOG('Entering Fromula TILAK_ARRAY_13MONTH_SAL_1 ' )

myAnnSalary = CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT 

myAnnFactor = CMP_ASSIGNMENT_SALARY_ANNUALIZATION_FACTOR



asgId  = get_context(HR_ASSIGNMENT_ID, -1)

leId   = PER_ASG_LEGAL_ENTITY_ID 


temp =SET_LOG('Assinment  ' || TO_CHAR(asgId) )

temp =SET_LOG('LE   ' || TO_CHAR(leId) )


/* Asuumed Salary is first of Every Month First the first date within the period */ 

firstDate = TRUNC(CMP_IV_PERIOD_START_DATE, 'MM') 

endDate   = CMP_IV_PERIOD_END_DATE 


temp =SET_LOG('first Date  ' || TO_CHAR(firstDate) )

temp =SET_LOG('Last Date    ' || TO_CHAR(endDate) )


index     = 1

IF (firstDate < CMP_IV_PERIOD_START_DATE) then

(

  firstDate = ADD_MONTHS(firstDate, 1)

)


/* Create Row */ 

WHILE firstDate <= endDate

LOOP(

     myMonthSalary = 0 

    /* Get the salary on the date */

    CHANGE_CONTEXTS(EFFECTIVE_DATE=firstDate)

     (

      myAnnSalary = CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT 

      myAnnFactor = CMP_ASSIGNMENT_SALARY_ANNUALIZATION_FACTOR

       myMonthSalary  = myAnnSalary / myAnnFactor

      

      temp =SET_LOG('Annual  Salary  ' || TO_CHAR(myAnnSalary) )

      temp =SET_LOG('Monthly Salary  ' || TO_CHAR(myMonthSalary) )

 

    )


    if  (myMonthSalary != 0 ) THEN 

    (  

       temp =SET_LOG('Processing Date  ' || TO_CHAR(firstDate) ) 

       temp =SET_LOG('Processing Date  ' || TO_CHAR(firstDate) ) 

       COMPENSATION_DATES[index] = to_char(firstDate, 'YYYY/MM/DD')

       ASSIGNMENTS[index]        = to_char(asgId)

       LEGALEMPLOYERS[index]     = to_char(leId)

       VALUES[index]                    = to_char(myMonthSalary) 


      /* add one more row for Dec */


      IF ( TO_CHAR(firstDate, 'MM') = '12' ) then

      (

         index = index + 1 

         COMPENSATION_DATES[index] = to_char(firstDate, 'YYYY/MM/DD')

         ASSIGNMENTS[index]        = to_char(asgId)

         LEGALEMPLOYERS[index]     = to_char(leId)

         VALUES[index]                    = to_char(myMonthSalary) 

      )


      index = index + 1

    ) 

   firstDate = add_months(firstDate, 1) 

)



temp =SET_LOG('Leaving Fromula TILAK_ARRAY_13MONTH_SAL_1 ' )

RETURN COMPENSATION_DATES, VALUES, ASSIGNMENTS, LEGALEMPLOYERS






This is only a sample formula and is meant to be a guideline. If you are using any of the above code, you need to test it to check  if it matches your specific requirements.

Friday, May 12, 2023

Orcle VBCS Codes

 

Oracle VBCS Code 



Exporting VBCS table to XL Shhet

define(['xlsx'], function(XLSX) {
'use strict';

class PageModule {
}

PageModule.prototype.downloadXLS = function (sdp){
var elt = document.getElementById(sdp);
var wb = XLSX.utils.table_to_book(elt, { sheet: "sheet1" });
return XLSX.writeFile(wb, 'MySheetName.xlsx');

}

return PageModule;
});

Friday, January 27, 2023

HCM - Multi Facet Advance Search Part 2





MetaType Default Value (Text Box)


{ "facetArray": [ { "id": "PlanTypeCd", "Default": true, "DisplayName": "Plan Type", "Type": "Facet", "FacetType": "StaticList", "ElasticAggregationsEnabled": false, "ElasticFacetName": "PlanTypeCd", "labelMapping": [ { "label": "Plan Type A", "value": "A" }, { "label": "Plan Type Q", "value": "Q" }, { "label": "Plan Type N", "value": "N" } ] }, { "id": "StatusCd", "Default": true, "DisplayName": "Plan Status", "Type": "Text", "FacetType": "Text", "ElasticAggregationsEnabled": false, "ElasticFacetName": "StatusCd", "ToolTip": "Status" } ] }

MetaType Default Value (Check Box and Multi Select)



{ "facetArray": [ { "id": "PlanTypeCd", "Default": true, "DisplayName": "Plan Type", "Type": "Facet", "FacetType": "CheckBox", "ElasticAggregationsEnabled": false, "ElasticFacetName": "PlanTypeCd", "KeyAttribute": "LookupCode", "DisplayAttribute": "Meaning", "Endpoint": "oracle_hcm_compensationworkforcesetupUI:commonLookupsLOV/getall_commonLookupsLOV", "Finder": "LookupTypeFinder;LookupType=CMP_MD_STATUS", "Fields": "LookupCode,Meaning", "OrderBy":"Meaning" }, { "id": "StatusCd", "Default": true, "DisplayName": "Plan Status", "Type": "Facet", "FacetType": "StaticList", "ElasticAggregationsEnabled": false, "ElasticFacetName": "StatusCd", "labelMapping": [ { "label": "Active", "value": "A" }, { "label": "In Progress", "value": "I" } ] } ] }

Meta Data Default (LOV Multi Select and QParam)

{
    "facetArray": [
        {
            "id": "PlanTypeCd",
            "Default": true,
            "DisplayName": "Plan Type",
            "Type": "Facet",
            "FacetType": "MultiSelectLOV",
            "ElasticAggregationsEnabled": false,
            "ElasticFacetName": "PlanTypeCd",
            "KeyAttribute": "LookupCode",
            "DisplayAttribute": "Meaning",
            "Endpoint": "oracle_hcm_compensationworkforcesetupUI:commonLookupsLOV/getall_commonLookupsLOV",
            "Finder": "LookupTypeFinder;LookupType=ORA_HRX_GB_CSP_SCHCAT",
            "Fields": "LookupCode,Meaning",
            "QParam": "LookupCode IN ('A', 'Q', 'N', 'C' )",
            "OrderBy":"Meaning"
        },
        {
            "id": "StatusCd",
            "Default": true,
            "DisplayName": "Plan Status",
            "Type": "Facet",
            "FacetType": "StaticList",
            "ElasticAggregationsEnabled": false,
            "ElasticFacetName": "StatusCd",
            "labelMapping": [
                {
                    "label": "Active",
                    "value": "A"
                },
                {
                    "label": "In Progress",
                    "value": "I"
                }
            ]
        }
    ]
}                                




Possible Facet Types Date
DateRange
CheckBox MultiSelectLOV RadioButton StaticList Text Flag


Date
  id = 'dateId';
             Default = true;
             DisplayName = "Search Dae";
             Type = 'Date';
             ElasticFacetName = 'currentDate';
             ToolTip = "Search Date";
DateRange

          id = 'dateRangeId';
          Default = true;
          DisplayName = "Date Range ";
          Type = 'DateRange';
          ElasticFacetName = "Date Range";
          StartDateToolTip = "Start Date";
          timePeriod.EndDateToolTip = "End Date";



The changed Code Take care of Text Facet

PageModule.prototype.getSearchObject = function (searchObject) {

//Deleting as its not supported in rest input payload
delete searchObject.securityFilters;
//The below searchFieldsArray is not necessary if the query is null. This has been added since teh REST been used in this example is not working fine without this. Hence added.
if (!(searchObject && searchObject.query)) {
searchObject.query = '';
}

if (!(searchObject && searchObject.limit)) {
searchObject.limit = 25;
}


var c = {};
c.PlanTypeCd = '';
c.StatusCd = '';
c.PlanName = '%' + searchObject.query + '%';

if (searchObject) {
if (searchObject.filters && searchObject.filters.length > 0) {
for (var i = 0; i < searchObject.filters.length; ++i) {
var a = searchObject.filters[i];
let value = '';
let name = a.name[0];
let term = a.terms ;
/* for a text */
if (a.term){
term = a.term ;
}
if (a.value && a.value.length > 0){
value = "'" + a.value[0] + "'";
}
/* when type has checkbox-multi select */
if (term && term.length > 0){
for (var k = 0; k < term.length; ++k) {
let condValue = term[k]
value += ( value? ",": "")+ "'"+ condValue +"'";
}
}


if (name == "PlanTypeCd") {
c.PlanTypeCd = value;
}
if (name == "StatusCd") {
c.StatusCd = value;
}

}
}

}

return c;
};