0% found this document useful (0 votes)
2 views

TCR Fast Formula for threshold

The document describes the 'WFM_THRESHOLD_TIME_CALCULATION_RULE_AP' formula, which is a time calculation rule that divides reported time into calculated attributes based on defined threshold hours. It processes time card data to categorize hours above and below the threshold, converting them into appropriate pay time types. The document includes details on input parameters, logging, and the main logic for calculating the output measures.

Uploaded by

Sovit Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

TCR Fast Formula for threshold

The document describes the 'WFM_THRESHOLD_TIME_CALCULATION_RULE_AP' formula, which is a time calculation rule that divides reported time into calculated attributes based on defined threshold hours. It processes time card data to categorize hours above and below the threshold, converting them into appropriate pay time types. The document includes details on input parameters, logging, and the main logic for calculating the output measures.

Uploaded by

Sovit Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

/* +======================================================================+

| Copyright (c) 2009 Oracle Corporation |


| Redwood Shores, California, USA |
| All rights reserved. |
+======================================================================+
*
* Formula Name : WFM_THRESHOLD_TIME_CALCULATION_RULE_AP
*
* Formula Type: Time Calculation rule
*
*
* Description: Divides reported daily or period time into calculated
* time attributes for hours above and below defined
* threshold hours. Reported time and specific time attribute
* results are inputs to the delivered formula. This formula
* uses an array to process time card data.
*
* Detail: Compares the total time category hours for the day or
* period to the threshold value. Hours above the threshold
* are converted to a single pay time type. Hours under the
* threshold either remain the same pay time type value or
* are converted into a new pay time type attribute.
*
*
*
* Change History
* --------------
*
* Who Ver Date Description
*----------------- ------ ------------
-----------------------------------------
* David Cohanoff 206.12 2013-FEB-10 Created.
* David Cohanoff 104.0525 2014-JAN-04 Modified for R9 - New
HWM_FF_UTIL.
* David Cohanoff 114.1117 2014-SEP-12 NEW AP Version.
* David Cohanoff 107.1205 2017-DEC-07 Updated .
*
*
***************************************************************************/
DEFAULT FOR HWM_CTXARY_RECORD_POSITIONS is EMPTY_TEXT_NUMBER
DEFAULT FOR HWM_CTXARY_HWM_MEASURE_DAY is EMPTY_NUMBER_NUMBER
DEFAULT FOR measure is EMPTY_NUMBER_NUMBER

INPUTS ARE
HWM_CTXARY_RECORD_POSITIONS,
HWM_CTXARY_HWM_MEASURE_DAY,
measure

/* Following 2 lines are required right after inputs for all OTL and HWM formulas
*/
ffs_id = GET_CONTEXT(HWM_FFS_ID, 0)
rule_id = GET_CONTEXT(HWM_RULE_ID, 0)
ffName = 'WFM_THRESHOLD_TIME_CALCULATION_RULE_AP' || ' - v115.1125 '
rLog = add_rlog (ffs_id, rule_id, '>>> Enter - ' || ffName )

/* ----------- constant values -------- */


/* ------------------------------------- */
NullDate = '01-JAN-1900'(DATE)
NullDateTime = '1900/01/01 00:00:00' (date)
NullText = '**FF_NULL**'

RecPositoinEoPeriod = 'END_PERIOD'
RecPositoinEoDay = 'END_DAY'
RecPositoinDetail = 'DETAIL'

sumLvlTimeCard = 'TIMECARD'
sumLvlDay = 'DAY'
sumLvlDetail = 'DETAIL'

TimeRecordType_MEASURE = 'MEASURE'
TimeRecordType_RANGE = 'RANGE'

/* ----------- Context value -------- */


/* ------------------------------------ */
measure_period = GET_CONTEXT(HWM_MEASURE_PERIOD, 0)

/* ----------- Rule Header parameters -------- */


/* -------------------------------------------- */
hSumLvl= Get_Hdr_Text(rule_id, 'RUN_SUMMATION_LEVEL', 'TIMECARD')
hExecType = Get_Hdr_Text(rule_id,'RULE_EXEC_TYPE', 'CREATE')

hCreateYn = 'N'
if (upper(hExecType) = 'CREATE' ) then (
hCreateYn = 'Y'
)

l_status = add_rlog (ffs_id , rule_id ,'Rule Header and Context:' ||


' , ffs_id =' || TO_CHAR( ffs_id ) ||
' , rule_id =' || TO_CHAR( rule_id ) ||
' , measure_period=' || TO_CHAR( measure_period )
||
' , hSumLvl=' || hSumLvl ||
' , hExecType=' || hExecType ||
' , hCreateYn=' || hCreateYn )

/* ----------- Rule input parameters -------- */


/* ------------------------------------------- */
pCategoryId = get_rvalue_number (rule_id ,'WORKED_TIME_CONDITION', 0)
pMaxHrs = get_rvalue_number (rule_id ,'DEFINED_LIMIT', 0)

l_status = add_rlog (ffs_id , rule_id , 'Rule Parameters: ' ||


' , pMaxHrs=' || TO_CHAR( pMaxHrs ) ||
' , pCategoryId =' || TO_CHAR( pCategoryId ) )

/* ----------- initialize output variables -------- */


/* ------------------------------------------------- */
out_measure_ary_under = EMPTY_NUMBER_NUMBER
out_measure_ary_over = EMPTY_NUMBER_NUMBER

/* ----------- Temp Workarea variables -------- */


/* --------------------------------------------- */
wMaAry = HWM_CTXARY_RECORD_POSITIONS.count
rLog = add_rlog (ffs_id, rule_id, 'Start bulk process - wMaAry=' ||
TO_CHAR( wMaAry ) )
wkTotalHrsDay = 0
wkTotalHrsTc = 0
nidx = 0

/* ----------- Loop through current Time Card(POJO) Main Logic -------- */


/* -------------------------------------------------------------------- */
WHILE (nidx < wMaAry ) LOOP
(
nidx = nidx + 1
tcMeasure = 0
tcMeasureDay = 0

tcRecPosition = HWM_CTXARY_RECORD_POSITIONS[nidx]
if (MEASURE.exists(nidx) ) then ( tcMeasure = MEASURE[nidx] )
if (HWM_CTXARY_HWM_MEASURE_DAY.exists(nidx) ) then ( tcMeasureDay =
HWM_CTXARY_HWM_MEASURE_DAY[nidx] )

ocMeasure_under = -9999
ocMeasure_over = -9999
CALL_FORMULA ('WFM_THRESHOLD_TIME_CALCULATION_RULE_SUB'
, ffs_id > 'ffs_id'
, rule_id > 'rule_id'
, hSumLvl > 'hSumLvl'
, hCreateYn > 'hCreateYn'
, measure_period > 'measurePeriod'
, tcMeasureDay > 'measureDay'
, tcRecPosition > 'recPosition'
, wkTotalHrsDay > 'wkTotalHrsDay'
, wkTotalHrsTc > 'wkTotalHrsTc'
, tcMeasure > 'measure'
, pMaxHrs > 'pMaxHrs'
, ocMeasure_under < 'out_measure_under' DEFAULT -9999

, ocMeasure_over < 'out_measure_over' DEFAULT -9999


, wkTotalHrsDay < 'oTotalHrsDay' DEFAULT 0
, wkTotalHrsTc < 'oTotalHrsTc' DEFAULT 0 )

rLog = add_rlog (ffs_id, rule_id, '>>> CALL_FORMULA Result: ' ||


' , tcMeasureDay =' || TO_CHAR( tcMeasureDay ) ||
' , ocMeasure_under =' || TO_CHAR( ocMeasure_under ) ||

' , ocMeasure_over =' || TO_CHAR( ocMeasure_over ) ||


' , wkTotalHrsDay =' || TO_CHAR( wkTotalHrsDay ) ||
' , wkTotalHrsTc =' || TO_CHAR( wkTotalHrsTc ) )

if (ocMeasure_under <> -9999 ) Then (


out_measure_ary_under[nidx] = ocMeasure_under
)
if (ocMeasure_over <> -9999 ) Then (
out_measure_ary_over[nidx] = ocMeasure_over
)

if (nidx > 1000 ) Then ( /* endless loop? Stop process */


ex = raise_error (ffs_id, rule_id, 'Formula ' || ffName || '
terminated due to possible end-less loop.' )
)
)

rLog = add_rlog (ffs_id, rule_id, '<< Exit - ' || ffName )

RETURN out_measure_ary_under, out_measure_ary_over

You might also like