Professional Documents
Culture Documents
BG Absence Duration Formula
BG Absence Duration Formula
BG Absence Duration Formula
--
INPUTS:
--
DBI Required:
- asg_start_time : the assignment start time
--
Change History
hours to be defaulted if no
entered.
*/
date_start (date),
date_end (date),
time_start (text),
time_end (text),
ABS_INFORMATION_CATEGORY (text),
ABS_INFORMATION1 (text),
ABS_INFORMATION2 (text),
ABS_INFORMATION3 (text),
ABS_INFORMATION4 (text),
ABS_INFORMATION5 (text),
ABS_INFORMATION6 (text)
/* default values */
/* database items */
/* local variables */
number_of_days = 0
first_day_hours = 0
last_day_hours = 0
/* Defaults Section */
begin_day = '09:00'
end_day = '17:00'
duration = '0'
else
number_of_days = days_between(date_end,date_start)
/* absence in hours */
IF days_or_hours = 'H'
(
begin_day = asg_start_time
end_day = asg_end_time
else
begin_day = asg_pos_start_time
end_day = asg_pos_end_time
hours_per_day = ((to_num(substr(end_day,1,2))*60 +
to_num(substr(end_day,4,2))) -
(to_num(substr(begin_day,1,2))*60 +
to_num(substr(begin_day,4,2)))) / 60
IF number_of_days = 0 THEN
duration = to_char(((to_num(substr(time_end,1,2))*60 +
to_num(substr(time_end,4,2))) -
(to_num(substr(time_start,1,2))*60 +
to_num(substr(time_start,4,2)))) / 60)
first_day_hours =((to_num(substr(end_day,1,2))*60 +
to_num(substr(end_day,4,2))) -
(to_num(substr(time_start,1,2))*60 +
to_num(substr(time_start,4,2))) ) / 60
last_day_hours = ((to_num(substr(time_end,1,2))*60 +
to_num(substr(time_end,4,2))) -
(to_num(substr(begin_day,1,2))*60 +
to_num(substr(begin_day,4,2))))/60
if first_day_hours <=0
OR last_day_hours <= 0
first_day_hours = (24*60 -
(to_num(substr(time_start,1,2))*60 +
to_num(substr(time_start,4,2))))/60
last_day_hours = (to_num(substr(time_end,1,2))*60 +
to_num(substr(time_end,4,2)))/60
duration = to_char(first_day_hours+last_day_hours)
duration = to_char(to_num(duration) +
/* absence in days */
ELSE
duration = to_char(DAYS_BETWEEN(date_end,date_start) + 1)
if to_num(duration) = 0 then
duration = 'FAILED'
invalid_msg = 'HR_ABSENCE_CANNOT_BE_ZERO'
*/