DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_TIMECARD_APPROVAL

Source


1 package body hxc_timecard_approval as
2 /* $Header: hxctimeapprove.pkb 120.8 2006/09/08 08:59:11 rchennur noship $ */
3 
4   g_package varchar2(30) := 'hxc_timecard_approval.';
5   g_debug boolean := hr_utility.debug_enabled;
6 
7   TYPE application_period_table IS TABLE OF hxc_app_period_summary.APPLICATION_PERIOD_ID%TYPE;
8   TYPE tc_ap_links IS RECORD
9     (TIMECARD_ID			hxc_tc_ap_links.TIMECARD_ID%TYPE,
10      APPLICATION_PERIOD_ID		hxc_tc_ap_links.APPLICATION_PERIOD_ID%TYPE
11      );
12   TYPE tc_ap_links_table IS TABLE OF tc_ap_links INDEX BY BINARY_INTEGER;
13 
14   TYPE time_recipient_table IS TABLE OF HXC_TIME_RECIPIENTS.TIME_RECIPIENT_ID%TYPE INDEX BY BINARY_INTEGER;
15 
16   TYPE application_period_id_arr IS TABLE OF hxc_tc_ap_links.APPLICATION_PERIOD_ID%TYPE INDEX BY BINARY_INTEGER;
17 
18   TYPE time_building_block_id_arr IS TABLE OF hxc_ap_detail_links.TIME_BUILDING_BLOCK_ID%TYPE INDEX BY BINARY_INTEGER;
19 
20   TYPE time_building_block_ovn_arr IS TABLE OF hxc_ap_detail_links.TIME_BUILDING_BLOCK_OVN%TYPE INDEX BY BINARY_INTEGER;
21 
22   TYPE ap_detail_links_rec IS RECORD
23     (APPLICATION_PERIOD_ID		application_period_id_arr,
24      TIME_BUILDING_BLOCK_ID	time_building_block_id_arr,
25      TIME_BUILDING_BLOCK_OVN	time_building_block_ovn_arr
26      );
27 
28   TYPE timecard_info IS RECORD
29     (TIME_BUILDING_BLOCK_ID	HXC_TIME_BUILDING_BLOCKS.TIME_BUILDING_BLOCK_ID%TYPE,
30      OBJECT_VERSION_NUMBER	HXC_TIME_BUILDING_BLOCKS.OBJECT_VERSION_NUMBER%TYPE,
31      TYPE			HXC_TIME_BUILDING_BLOCKS.TYPE%TYPE,
32      START_TIME		HXC_TIME_BUILDING_BLOCKS.START_TIME%TYPE,
33      STOP_TIME		HXC_TIME_BUILDING_BLOCKS.STOP_TIME%TYPE,
34      RESOURCE_ID		HXC_TIME_BUILDING_BLOCKS.RESOURCE_ID%TYPE,
35      RESOURCE_TYPE		HXC_TIME_BUILDING_BLOCKS.RESOURCE_TYPE%TYPE,
36      APPROVAL_STYLE_ID	HXC_TIME_BUILDING_BLOCKS.APPROVAL_STYLE_ID%TYPE,
37      APPLICATION_SET_ID	HXC_TIME_BUILDING_BLOCKS.APPLICATION_SET_ID%TYPE,
38      CREATION_DATE		HXC_TIME_BUILDING_BLOCKS.CREATION_DATE%TYPE
39      );
40 
41   g_light_approval_style_id number	:= -99;
42 
43   Function get_item_key return number is
44     l_item_key number;
45   Begin
46       select hxc_approval_item_key_s.nextval
47         into l_item_key
48         from dual;
49 
50     return l_item_key;
51 
52   End get_item_key;
53 
54   Function is_timecard_resubmitted
55     (p_timecard_id in hxc_time_building_blocks.time_building_block_id%type,
56      p_timecard_ovn in hxc_time_building_blocks.object_version_number%type,
57      p_resource_id in hxc_time_building_blocks.resource_id%type,
58      p_start_time  in hxc_time_building_blocks.start_time%type,
59      p_stop_time   in hxc_time_building_blocks.stop_time%type
60      ) return varchar2 is
61 
62     cursor csr_resubmitted
63       (p_timecard_id IN HXC_TIME_BUILDING_BLOCKS.TIME_BUILDING_BLOCK_ID%TYPE,
64        p_max_ovn     IN HXC_TIME_BUILDING_BLOCKS.OBJECT_VERSION_NUMBER%TYPE
65        ) is
66       select 'YES'
67         from hxc_time_building_blocks
68        where time_building_block_id = p_timecard_id
69          and object_version_number <= p_max_ovn
70          and approval_status = 'SUBMITTED';
71 
72     cursor csr_further_check
73       (p_timecard_id in hxc_time_building_blocks.time_building_block_id%type,
74        p_resource_id in hxc_time_building_blocks.resource_id%type,
75        p_start_time in hxc_time_building_blocks.start_time%type,
76        p_stop_time in hxc_time_building_blocks.stop_time%type
77        ) is
78       select 'YES'
79         from hxc_time_building_blocks
80        where time_building_block_id <> p_timecard_id
81          and approval_status = 'SUBMITTED'
82          and start_time <= p_stop_time
83          and stop_time >= p_start_time
84          and resource_id = p_resource_id
85          and scope = 'TIMECARD';
86 
87     l_resubmitted varchar2(3) := 'NO';
88 
89   Begin
90 
91     open csr_resubmitted(p_timecard_id, p_timecard_ovn);
92     fetch csr_resubmitted into l_resubmitted;
93     if(csr_resubmitted%NOTFOUND) then
94       close csr_resubmitted;
95       open csr_further_check(p_timecard_id, p_resource_id, p_start_time, p_stop_time);
96       fetch csr_further_check into l_resubmitted;
97       if (csr_further_check%NOTFOUND) then
98         l_resubmitted := 'NO';
99       end if;
100       close csr_further_check;
101     else
102       close csr_resubmitted;
103     end if;
104 
105     return l_resubmitted;
106 
107   Exception
108     When others then
109       return l_resubmitted;
110 
111   End is_timecard_resubmitted;
112 
113   Procedure get_timecard_information
114     (p_blocks       in            hxc_block_table_type,
115      p_timecard_id     out nocopy hxc_time_building_blocks.time_building_block_id%type,
116      p_timecard_ovn    out nocopy hxc_time_building_blocks.object_version_number%type,
117      p_new_blocks      out nocopy varchar2,
118      p_timecard_info   out nocopy timecard_info
119      ) is
120     l_timecard_index number;
121   Begin
122     l_timecard_index := hxc_timecard_block_utils.find_active_timecard_index(p_blocks);
123     p_timecard_id  := p_blocks(l_timecard_index).time_building_block_id;
124     p_timecard_ovn := p_blocks(l_timecard_index).object_version_number;
125     p_new_blocks   := hxc_timecard_block_utils.any_new_blocks(p_blocks);
126     p_timecard_info.time_building_block_id	:= p_blocks(l_timecard_index).time_building_block_id;
127     p_timecard_info.object_version_number	:= p_blocks(l_timecard_index).object_version_number;
128     p_timecard_info.type			:= p_blocks(l_timecard_index).type;
129     p_timecard_info.start_time		:= to_date(p_blocks(l_timecard_index).start_time,'rrrr/mm/dd hh24:mi:ss');
130     p_timecard_info.stop_time		:= to_date(p_blocks(l_timecard_index).stop_time,'rrrr/mm/dd hh24:mi:ss');
131     p_timecard_info.resource_id		:= p_blocks(l_timecard_index).resource_id;
132     p_timecard_info.resource_type		:= p_blocks(l_timecard_index).resource_type;
133     p_timecard_info.approval_style_id	:= p_blocks(l_timecard_index).approval_style_id;
134     p_timecard_info.application_set_id	:= p_blocks(l_timecard_index).application_set_id;
135   End get_timecard_information;
136 
137 
138   Procedure light_approve_timecards
139     (p_tc_bb_id       IN            number,
140      p_tc_ovn         IN            number,
141      p_tc_resubmitted IN            varchar2,
142      p_blocks  	      IN	    hxc_block_table_type,
143      p_timecard_info  IN	    timecard_info
144      )is
145 
146     Cursor c_get_tc_ap_links
147     is
148       select timecard_id,
149              application_period_id
150         from hxc_tc_ap_links
151        where timecard_id = p_tc_bb_id;
152 
153     Cursor c_creation_date
154       (l_app_id hxc_time_building_blocks.time_building_block_id%TYPE,
155        l_app_ovn hxc_time_building_blocks.object_version_number%TYPE
156        ) is
157       select creation_date
158         from hxc_time_building_blocks
159        where time_building_block_id = l_app_id
160          and object_version_number = l_app_ovn;
161 
162     cursor c_app_period
163       (p_resource_id hxc_time_building_blocks.resource_id%TYPE,
164        p_start_time  hxc_time_building_blocks.start_time%TYPE,
165        p_stop_time   hxc_time_building_blocks.stop_time%TYPE,
166        p_time_recipient_id hxc_time_recipients.time_recipient_id%TYPE
167        ) is
168       select application_period_id
169         from hxc_app_period_summary
170        where resource_id = p_resource_id
171          and trunc(start_time) = trunc(p_start_time)
172          and trunc(stop_time) = trunc(p_stop_time)
173          and time_recipient_id  = p_time_recipient_id
174          and recipient_sequence IS NULL
175          and time_category_id IS NULL
176          and category_sequence IS NULL
177          and approval_comp_id IS NULL;
178 
179     cursor c_get_apps_from_app_set
180       (p_app_set number) is
181       select htr.time_recipient_id
182         from hxc_application_sets_v has,
183              hxc_application_set_comps_v hasc,
184              hxc_time_recipients htr
185        where has.application_set_id = p_app_set
186          and hasc.application_set_id = has.application_set_id
187          and hasc.time_recipient_id = htr.time_recipient_id;
188 
189     l_application_set_id  	HXC_APPLICATION_SETS_V.APPLICATION_SET_ID%TYPE;
190     l_appl_recipients 		time_recipient_table;
191     l_time_building_block_id	HXC_TIME_BUILDING_BLOCKS.TIME_BUILDING_BLOCK_ID%TYPE ;
192     l_object_version_number	HXC_TIME_BUILDING_BLOCKS.OBJECT_VERSION_NUMBER%TYPE ;
193     l_resource_id  		HXC_TIME_BUILDING_BLOCKS.RESOURCE_ID%TYPE ;
194     l_resource_type 		HXC_TIME_BUILDING_BLOCKS.RESOURCE_TYPE%TYPE ;
195     l_timecard_type 		HXC_TIME_BUILDING_BLOCKS.TYPE%TYPE ;
196     l_timecard_start_time 	HXC_TIME_BUILDING_BLOCKS.START_TIME%TYPE ;
197     l_timecard_stop_time  	HXC_TIME_BUILDING_BLOCKS.STOP_TIME%TYPE ;
198     l_period_start_date		HXC_TIME_BUILDING_BLOCKS.START_TIME%TYPE ;
199     l_period_end_date		HXC_TIME_BUILDING_BLOCKS.STOP_TIME%TYPE ;
200     l_tc_ap_links_table		tc_ap_links_table;
201     l_index 			number ;
202     l_assignment_periods        hxc_timecard_utilities.periods;
203     l_app_period_info 		application_period_table;
204     l_creation_date 		hxc_time_building_blocks.creation_date%TYPE := NULL;
205     l_dup_index			number;
206     l_detail_array		ap_detail_links_rec;
207     l_index_1			number;
208     l_index_2			number;
209     l_timecard_blocks  		hxc_timecard.block_list;
210     l_day_blocks       		hxc_timecard.block_list;
211     l_detail_blocks    		hxc_timecard.block_list;
212     l_proc                      varchar2(70);
213 
214   Begin
215     if g_debug then
216       l_proc := g_package||'light_approve_timecards';
217       hr_utility.set_location('Processing '||l_proc, 10);
218     end if;
219 
220     l_timecard_type	:=	p_timecard_info.TYPE;
221     l_timecard_start_time	:=	p_timecard_info.START_TIME;
222     l_timecard_stop_time	:=	p_timecard_info.STOP_TIME;
223     l_resource_id		:=	p_timecard_info.RESOURCE_ID;
224     l_resource_type	:=	p_timecard_info.RESOURCE_TYPE;
225     l_application_set_id	:=	p_timecard_info.APPLICATION_SET_ID;
226 
227 
228 /*Cancel all the previous notifications for this Timecard. The rationale
229 * is, this Timecard is going to be Light approved, which means there should
230 * be no open notifications for this Timecard. If the Timecard had previously
231 * been associated with some other Approval style, then the notifications
232 * generated, if any should be CANCELLED. */
233 
234 
235     if g_debug then
236       hr_utility.set_location('Processing '||l_proc, 20);
237     end if;
238 
239     hxc_find_notify_aprs_pkg.cancel_previous_notifications
240       (p_timecard_id => p_tc_bb_id);
241 
242 /*Remove existing records from hxc_tc_ap_links
243 * Most probably there wont be any records as they would have
244 * been deleted in the hxc_timecard package      */
245 
246     hxc_tc_ap_links_pkg.remove_timecard_links
247       (p_timecard_id => p_tc_bb_id );
248 
249     open c_get_apps_from_app_set(l_application_set_id );
250     fetch c_get_apps_from_app_set BULK COLLECT INTO l_appl_recipients;
251 
252     if l_appl_recipients.count > 0 then
253 /* Loop through all the recipient applications */
254       for l_index IN l_appl_recipients.first .. l_appl_recipients.last LOOP
255         if g_debug then
256           hr_utility.set_location('Processing '||l_proc, 30);
257         end if;
258         l_period_start_date	:= l_timecard_start_time;
259         l_period_end_date	:= l_timecard_stop_time;
260 /* Get any existing Application period for the same resource_id, recipient_id, start and stop time */
261         open c_app_period
262           (l_resource_id,
263            l_period_start_date,
264            l_period_end_date,
265            l_appl_recipients(l_index)
266            );
267 
268         fetch c_app_period bulk collect into l_app_period_info;
269         close c_app_period;
270 
271         if l_app_period_info.count > 0 then
272           if g_debug then
273             hr_utility.set_location('Processing '||l_proc, 40);
274           end if;
275 
276           for l_dup_index IN  l_app_period_info.first .. l_app_period_info.last loop
277             if g_debug then
278               hr_utility.set_location('Processing '||l_proc, 50);
279             end if;
280  /* Remove the existing record from hxc_ap_detail_links table */
281             hxc_ap_detail_links_pkg.delete_ap_detail_links(p_application_period_id => l_app_period_info(l_dup_index));
282 /* Remove the record from hxc_app_period_summary table */
283             hxc_app_period_summary_pkg.delete_summary_row(p_app_period_id => l_app_period_info(l_dup_index) );
284           End loop;
285         end if;
286       end loop;
287 
288     else
289       if g_debug then
290         hr_utility.set_location('Processing '||l_proc, 60);
291       end if;
292       fnd_message.set_name('HXC', 'HXC_APR_NO_APPL_SET_PREF');
293       fnd_message.raise_error;
294     end if;
295 
296 /* For each of the recipient Application present in the Application set of the person*/
297 /* We get the detail blocks of the Timecard from p_blocks */
298 
299     hxc_timecard_block_utils.sort_blocks
300       (p_blocks          => p_blocks,
301        p_timecard_blocks => l_timecard_blocks,
302        p_day_blocks      => l_day_blocks,
303        p_detail_blocks   => l_detail_blocks
304        );
305 
306 
307     l_index_1 := l_detail_blocks.first;
308     l_index_2  := 1;
309     loop
310       EXIT WHEN NOT l_detail_blocks.exists(l_index_1);
311       if g_debug then
312         hr_utility.set_location('Processing '||l_proc, 70);
313       end if;
314       l_detail_array.TIME_BUILDING_BLOCK_ID(l_index_2) := p_blocks(l_detail_blocks(l_index_1)).time_building_block_id  ;
315       l_detail_array.TIME_BUILDING_BLOCK_OVN(l_index_2) := p_blocks(l_detail_blocks(l_index_1)).object_version_number ;
316       l_index_2 := l_index_2 + 1;
317       l_index_1 := l_detail_blocks.next(l_index_1);
318     end loop;
319     if g_debug then
320       hr_utility.set_location('Processing '||l_proc, 80);
321     end if;
322 
323     for l_index IN l_appl_recipients.first .. l_appl_recipients.last LOOP
324      /* Call to create an Application period  in hxc_time_building blocks table */
325       l_time_building_block_id := null;
326       l_object_version_number  := null;
327 
328       if g_debug then
329         hr_utility.set_location('Processing '||l_proc, 90);
330       end if;
331 
332       hxc_building_block_api.create_building_block
333         (p_effective_date            => trunc(SYSDATE),
334          p_type                      => l_timecard_type,
335          p_measure                   => null,
336          p_unit_of_measure           => null,
337          p_start_time                => l_timecard_start_time,
338          p_stop_time                 => l_timecard_stop_time,
339          p_parent_building_block_id  => null,
340          p_parent_building_block_ovn => null,
341          p_scope                     => 'APPLICATION_PERIOD',
342          p_approval_style_id         => null,
343          p_approval_status           => 'APPROVED',
344          p_resource_id               => l_resource_id,
345          p_resource_type             => l_resource_type,
346          p_comment_text              => 'LIGHT_APPROVAL',
347          p_application_set_id        => null,
348          p_translation_display_key   => null,
349          p_time_building_block_id    => l_time_building_block_id,
350          p_object_version_number     => l_object_version_number
351          );
352 
353 
354 /* Get the creation date of the Timecard to populate in the hxc_app_period_summary table */
355       open c_creation_date(l_time_building_block_id , l_object_version_number );
356       fetch c_creation_date into l_creation_date;
357       close c_creation_date;
358       if g_debug then
359         hr_utility.set_location('Processing '||l_proc, 100);
360       end if;
361 
362    /* Call to create the Application period  in hxc_app_period_summary table */
363       hxc_app_period_summary_pkg.insert_summary_row
364         (p_application_period_id => l_time_building_block_id,
365          p_application_period_ovn=> l_object_version_number,
366          p_approval_status       => 'APPROVED',
367          p_time_recipient_id     => l_appl_recipients(l_index),
368          p_time_category_id      => NULL,
369          p_start_time	       => l_timecard_start_time,
370          p_stop_time	       => l_timecard_stop_time,
371          p_resource_id	       => l_resource_id,
372          p_recipient_sequence    => null,
373          p_category_sequence     => null,
374          p_creation_date         => l_creation_date,
375          p_notification_status   => 'FINISHED',
376          p_approver_id           => null,
377          p_approval_comp_id      => null,
378          p_approval_item_type    => NULL,
379          p_approval_process_name => NULL,
380          p_approval_item_key     => NULL,
381          p_data_set_id 	       => null	----- Passing data set id as null explicitly.,
382          );
383 
384 
385    /* Call to create the Timecard - Application period  link in hxc_yc_ap_links table */
386       hxc_tc_ap_links_pkg.insert_summary_row
387         (p_timecard_id           => p_tc_bb_id,
388          p_application_period_id => l_time_building_block_id
389          );
390 
391    /* Call to get all the detail records of the Timecard and populate the nested array l_detail_array */
392       --Fix the bug 4506258. Added the if condition to take care of empty PL/SQL table when empty TC is submitted
393       if(l_detail_array.time_building_block_id.count>0) then
394         For l_index_app IN l_detail_array.TIME_BUILDING_BLOCK_ID.first .. l_detail_array.TIME_BUILDING_BLOCK_ID.last LOOP
395           l_detail_array.application_period_id(l_index_app) :=   l_time_building_block_id ;
396         End loop;
397       end if;
398       if g_debug then
399         hr_utility.set_location('Processing '||l_proc, 110);
400       end if;
401    /* Bulk insert the nested array into the hxc_ap_detail_links table */
402       --Fix the bug 4506258. Added the if condition to take care of empty PL/SQL table when empty TC is submitted
403       if(l_detail_array.application_period_id.count>0) then
404         forall l_dup_index in l_detail_array.application_period_id.first .. l_detail_array.application_period_id.last
405           insert into hxc_ap_detail_links
406           values ( l_detail_array.APPLICATION_PERIOD_ID(l_dup_index),
407                    l_detail_array.TIME_BUILDING_BLOCK_ID(l_dup_index),
408                    l_detail_array.TIME_BUILDING_BLOCK_OVN(l_dup_index)
409                    );
410       end if;
411     end loop;
412     if g_debug then
413       hr_utility.set_location('Processing '||l_proc, 120);
414     end if;
415 
416       update hxc_timecard_summary
417          set approval_status = hxc_timecard.c_approved_status
418        where timecard_id = p_tc_bb_id;
419 
420     if g_debug then
421       hr_utility.set_location('Processing '||l_proc, 130);
422     end if;
423 
424   end light_approve_timecards;
425 
426   Function active_assignment_over_period
427     (p_timecard_info timecard_info,
428      p_timecard_props hxc_timecard_prop_table_type)
429     return Boolean is
430 
431     l_return     boolean := true;
432     l_types_done boolean := false;
433     l_pind       binary_integer;
434 
435   Begin
436     l_pind := p_timecard_props.last;
437     Loop
438       Exit when ((not p_timecard_props.exists(l_pind))
439                  or
440                  (not l_return)
441                  or
442                  (l_types_done)
443                  );
444       if(p_timecard_props(l_pind).property_name = 'ResourceAssignmentStatusType') then
445         if(p_timecard_props(l_pind).date_from <= p_timecard_info.stop_time) then
446           if(p_timecard_props(l_pind).date_to >= p_timecard_info.start_time) then
447             if(p_timecard_props(l_pind).property_value not in ('ACTIVE_ASSIGN','ACTIVE_CWK')) then
448               l_return := false;
449             end if;
450           end if;
451         end if;
452       else
453         l_types_done := true;
454       end if;
455       l_pind := l_pind - 1;
456     End Loop;
457 
458     return l_return;
459   end active_assignment_over_period;
460   -- 115.12
461   -- Added timecard properties and messages in case of
462   -- non active assignment
463   Function begin_approval
464     (p_blocks         in            hxc_block_table_type,
465      p_item_type      in            wf_items.item_type%type,
466      p_process_name   in            wf_process_activities.process_name%type,
467      p_resubmitted    in            varchar2,
468      p_timecard_props in            hxc_timecard_prop_table_type,
469      p_messages       in out nocopy hxc_message_table_type
470      ) return VARCHAR2 is
471 
472     l_item_key            number;
473     l_timecard_id         hxc_time_building_blocks.time_building_block_id%type;
474     l_timecard_ovn        hxc_time_building_blocks.object_version_number%type;
475     l_new_building_blocks varchar2(3) := 'NO';
476     l_proc                varchar2(70);
477     l_dummy		  varchar2(1);
478     l_active_asg          boolean := true;
479 
480     Cursor c_get_appr_style is
481       Select APPROVAL_STYLE_ID
482         from hxc_approval_styles
483        where NAME = 'Approval on Submit' ;
484 
485     l_timecard_info		timecard_info;
486 
487   Begin
488 
489     g_debug := hr_utility.debug_enabled;
490 
491     if g_debug then
492       l_proc := g_package||'begin_approval';
493       hr_utility.set_location('Processing '||l_proc, 10);
494     end if;
495 
496     get_timecard_information
497       (p_blocks       => p_blocks,
498        p_timecard_id  => l_timecard_id,
499        p_timecard_ovn => l_timecard_ovn,
500        p_new_blocks   => l_new_building_blocks,
501        p_timecard_info => l_timecard_info
502        );
503 
504     if g_debug then
505       hr_utility.set_location('Processing '||l_proc, 20);
506     end if;
507 
508     IF g_light_approval_style_id = -99 then
509       if g_debug then
510 	hr_utility.set_location('Processing '||l_proc, 30);
511       end if;
512 
513       open c_get_appr_style;
514       fetch c_get_appr_style into g_light_approval_style_id;
515       close c_get_appr_style ;
516 
517     end if;
518     -- 115.12 Call active assignment over period, if false
519     -- we must use approve on submit approval style
520     l_active_asg := active_assignment_over_period(l_timecard_info,p_timecard_props);
521 
522     If ((l_timecard_info.approval_style_id <> g_light_approval_style_id)
523        AND
524         (l_active_asg)) then
525 
526       if g_debug then
527 	hr_utility.set_location('Processing '||l_proc, 40);
528       end if;
529 
530       l_item_key := get_item_key;
531       hxc_approval_wf_pkg.start_approval_wf_process
532         (p_item_type      => p_item_type,
533          p_item_key       => to_char(l_item_key),
534          p_process_name   => p_process_name,
535          p_tc_bb_id       => l_timecard_id,
536          p_tc_ovn         => l_timecard_ovn,
537          p_tc_resubmitted => p_resubmitted,
538          p_bb_new         => l_new_building_blocks
539          );
540 
541     else
542       if g_debug then
543 	hr_utility.set_location('Processing '||l_proc, 50);
544       end if;
545       light_approve_timecards
546         (p_tc_bb_id       => l_timecard_id,
547          p_tc_ovn         => l_timecard_ovn,
548          p_tc_resubmitted => p_resubmitted,
549          p_blocks         => p_blocks,
550          p_timecard_info  => l_timecard_info
551          );
552     end if;
553     -- If the timekeeper has entered time for a suspended or
554     -- other non-active assignment, we should inform them
555     -- that the timecard has been auto-approved.
556     if(not l_active_asg) then
557       -- Add informational Message
558       hxc_timecard_message_helper.addErrorToCollection
559         (p_messages,
560          'HXC_366547_INACTIVE_ASG_APPR',
561          hxc_timecard.c_business_message,
562          null,
563          null,
564          hxc_timecard.c_hxc,
565          l_timecard_id,
566          l_timecard_ovn,
567          null,
568          null
569          );
570     end if;
571 
572     if g_debug then
573       hr_utility.set_location('Processing '||l_proc, 60);
574     end if;
575 
576     return to_char(l_item_key);
577 
578   End begin_approval;
579 
580 end hxc_timecard_approval;