74: SELECT replace(trim(to_char(fnd_number.canonical_to_number(l_time),'00.00')),'.',':') FROM dual;
75:
76: --
77: BEGIN
78: hr_utility.set_location('Entering '||g_package||'.calc_sch_based_dur',10);
79: l_return := -1;
80: p_duration := 0;
81: l_time_start := p_time_start;
82: l_time_end := p_time_end;
114: END IF;
115: */
116: --
117: -- Fetch the work schedule
118: hr_utility.set_location('calling hr_wrk_sch_pkg.get_per_asg_schedule',10);
119: --
120: hr_wrk_sch_pkg.get_per_asg_schedule
121: ( p_person_assignment_id => p_assignment_id
122: , p_period_start_date => l_start_date
131: );
132: --
133:
134: l_return := l_return_status;
135: hr_utility.set_location('l_return status :' || l_return_status,10);
136:
137: IF l_return_status = '0' THEN
138: --
139: -- Calculate duration
152: IF l_first_band THEN
153: l_first_band := FALSE;
154: l_ref_date := TRUNC(l_schedule(l_idx).START_DATE_TIME);
155:
156: hr_utility.set_location('start date time '|| l_schedule(l_idx).START_DATE_TIME,20);
157: hr_utility.set_location('end date time '|| l_schedule(l_idx).END_DATE_TIME,20);
158:
159: IF (TRUNC(l_schedule(l_idx).END_DATE_TIME) = TRUNC(l_schedule(l_idx).START_DATE_TIME)) THEN
160: p_duration := p_duration + (TRUNC(l_schedule(l_idx).END_DATE_TIME) - TRUNC(l_schedule(l_idx).START_DATE_TIME) + 1);
153: l_first_band := FALSE;
154: l_ref_date := TRUNC(l_schedule(l_idx).START_DATE_TIME);
155:
156: hr_utility.set_location('start date time '|| l_schedule(l_idx).START_DATE_TIME,20);
157: hr_utility.set_location('end date time '|| l_schedule(l_idx).END_DATE_TIME,20);
158:
159: IF (TRUNC(l_schedule(l_idx).END_DATE_TIME) = TRUNC(l_schedule(l_idx).START_DATE_TIME)) THEN
160: p_duration := p_duration + (TRUNC(l_schedule(l_idx).END_DATE_TIME) - TRUNC(l_schedule(l_idx).START_DATE_TIME) + 1);
161: ELSE
232: END IF;
233: END IF;
234: RETURN l_return;
235: --
236: hr_utility.set_location('Leaving '||g_package||'.calc_sch_based_dur',20);
237: EXCEPTION
238: --
239: WHEN e_bad_time_format THEN
240: hr_utility.set_location('Leaving '||g_package||'.calc_sch_based_dur',30);
236: hr_utility.set_location('Leaving '||g_package||'.calc_sch_based_dur',20);
237: EXCEPTION
238: --
239: WHEN e_bad_time_format THEN
240: hr_utility.set_location('Leaving '||g_package||'.calc_sch_based_dur',30);
241: hr_utility.set_location(SQLERRM,35);
242: RAISE;
243: --
244: WHEN OTHERS THEN
237: EXCEPTION
238: --
239: WHEN e_bad_time_format THEN
240: hr_utility.set_location('Leaving '||g_package||'.calc_sch_based_dur',30);
241: hr_utility.set_location(SQLERRM,35);
242: RAISE;
243: --
244: WHEN OTHERS THEN
245: hr_utility.set_location('Leaving '||g_package||'.calc_sch_based_dur',40);
241: hr_utility.set_location(SQLERRM,35);
242: RAISE;
243: --
244: WHEN OTHERS THEN
245: hr_utility.set_location('Leaving '||g_package||'.calc_sch_based_dur',40);
246: hr_utility.set_location(SQLERRM,45);
247: RAISE;
248: --
249:
242: RAISE;
243: --
244: WHEN OTHERS THEN
245: hr_utility.set_location('Leaving '||g_package||'.calc_sch_based_dur',40);
246: hr_utility.set_location(SQLERRM,45);
247: RAISE;
248: --
249:
250: RETURN l_return;