[Home] [Help]
PACKAGE BODY: APPS.HXC_TEMPLATE_SUMMARY_PKG
Source
1 PACKAGE BODY HXC_TEMPLATE_SUMMARY_PKG AS
2 /* $Header: hxctempsumpkg.pkb 120.1 2005/12/12 08:34:13 gkrishna noship $ */
3
4 PROCEDURE INSERT_SUMMARY_ROW(p_template_id in hxc_time_building_blocks.time_building_block_id%type,
5 p_template_ovn in hxc_time_building_blocks.OBJECT_VERSION_NUMBER%type,
6 p_template_name in hxc_template_summary.TEMPLATE_NAME%type,
7 p_description in hxc_template_summary.DESCRIPTION%type,
8 p_template_type in hxc_template_summary.TEMPLATE_TYPE%type,
9 p_layout_id in hxc_template_summary.LAYOUT_ID%type,
10 p_recurring_period_id in hxc_template_summary.RECURRING_PERIOD_ID%type,
11 p_business_group_id in hxc_template_summary.BUSINESS_GROUP_ID%type,
12 p_resource_id in hxc_template_summary.RESOURCE_ID%type
13 ) is
14
15 cursor c_template_info(p_template_id in hxc_time_building_blocks.time_building_block_id%type,p_template_ovn in hxc_time_building_blocks.object_version_number%type) is
16 select RESOURCE_ID,
17 start_time,
18 stop_time
19 from hxc_time_building_blocks htb
20 where time_building_block_id = p_template_id
21 and date_to = hr_general.end_of_time
22 and object_version_number = p_template_ovn
23 and scope = 'TIMECARD_TEMPLATE';
24
25 l_updatedby_id hxc_time_building_blocks.resource_id%type;
26 l_recorded_hours hxc_template_summary.recorded_hours%type :=0;
27 l_details hxc_timecard_summary_pkg.details;
28 l_created_by hxc_time_building_blocks.resource_id%type;
29 l_start_time hxc_time_building_blocks.start_time%type;
30 l_stop_time hxc_time_building_blocks.stop_time%type;
31 Begin
32
33 open c_template_info(p_template_id,p_template_ovn);
34 fetch c_template_info
35 into l_created_by,l_start_time,l_stop_time;
36
37 if(p_resource_id is not null) then
38 l_updatedby_id := p_resource_id; -- Normal Template Deposition.
39 else
40 l_updatedby_id := l_created_by; -- Template Summary Migration.
41 end if;
42
43
44 if(c_template_info%found) then
45
46 --
47 -- 2. Recorded Hours
48 --
49 hxc_timecard_summary_pkg.get_recorded_hours(p_template_id,p_template_ovn,l_recorded_hours,l_details);
50 --
51 --
52 -- Insert Summary Row
53 --
54
55 insert into hxc_template_summary
56 (TEMPLATE_ID,
57 TEMPLATE_OVN,
58 TEMPLATE_NAME,
59 DESCRIPTION,
60 TEMPLATE_TYPE,
61 RECORDED_HOURS,
62 LAYOUT_ID,
63 RESOURCE_ID,
64 LAST_UPDATED_BY_RESOURCE_ID,
65 RECURRING_PERIOD_ID,
66 BUSINESS_GROUP_ID,
67 START_TIME,
68 STOP_TIME)
69 values
70 (p_template_id
71 ,p_template_ovn
72 ,p_template_name
73 ,p_description
74 ,p_template_type
75 ,l_recorded_hours
76 ,p_layout_id
77 ,l_created_by
78 ,l_updatedby_id
79 ,to_number(p_recurring_period_id)
80 ,to_number(p_business_group_id)
81 ,l_start_time
82 ,l_stop_time);
83
84 else
85
86 FND_MESSAGE.set_name('HXC','HXC_NO_TEMPLATE_ID');
87 FND_MESSAGE.set_token('TEMPLATE__ID',to_char(p_template_id));
88 FND_MESSAGE.raise_error;
89
90 end if;
91
92 END INSERT_SUMMARY_ROW;
93
94 PROCEDURE UPDATE_SUMMARY_ROW(p_template_id in hxc_time_building_blocks.time_building_block_id%type) is
95
96 Begin
97
98 null;
99
100 END UPDATE_SUMMARY_ROW;
101
102 PROCEDURE DELETE_SUMMARY_ROW(p_template_id in hxc_time_building_blocks.time_building_block_id%type) is
103
104 Begin
105
106 delete from hxc_template_summary where template_id = p_template_id;
107
108 Exception
109 When others then
110 FND_MESSAGE.set_name('HXC','HXC_NO_TEMPLATE_ID');
111 FND_MESSAGE.raise_error;
112
113 END DELETE_SUMMARY_ROW;
114 END HXC_TEMPLATE_SUMMARY_PKG;