[Home] [Help]
PACKAGE BODY: APPS.HXC_TERG_UPL_PKG
Source
1 PACKAGE BODY hxc_terg_upl_pkg AS
2 /* $Header: hxctergupl.pkb 115.0 2003/03/23 20:52:14 gpaytonm noship $ */
3 PROCEDURE load_time_entry_rule_group (
4 p_time_entry_rule_group_name in VARCHAR2,
5 p_owner in VARCHAR2,
6 p_custom in VARCHAR2) IS
7 l_time_entry_rule_group_id number;
8 l_ovn number;
9
10 BEGIN
11 SELECT TIME_ENTRY_RULE_GROUP_ID,
12 OBJECT_VERSION_NUMBER
13 INTO l_time_entry_rule_group_id,
14 l_ovn
15 FROM HXC_TIME_ENTRY_RULE_GROUPS_V
16 WHERE TIME_ENTRY_RULE_GROUP_NAME = p_time_entry_rule_group_name;
17
18 EXCEPTION WHEN NO_DATA_FOUND
19 THEN
20 hxc_heg_ins.ins (
21 p_name => p_time_entry_rule_group_name
22 ,p_entity_type => 'TIME_ENTRY_RULES'
23 ,p_entity_group_id => l_time_entry_rule_group_id
24 ,p_object_version_number => l_ovn);
25
26 end load_time_entry_rule_group;
27
28 PROCEDURE load_time_entry_rule_grp_comp (
29 p_time_entry_rule_name in VARCHAR2,
30 p_time_entry_group_name in VARCHAR2,
31 p_outcome in VARCHAR2,
32 p_owner in VARCHAR2,
33 p_custom in VARCHAR2) IS
34 l_time_entry_rule_group_id number;
35 l_time_entry_rule_comp_id number;
36 l_ovn number;
37 l_entity_id number;
38 l_entity_type varchar2(80) := 'TIME_ENTRY_RULES';
39 l_attribute_category varchar2(30);
40 l_outcome varchar2(150);
41 l_attribute2 varchar2(150);
42 l_attribute3 varchar2(150);
43 l_attribute4 varchar2(150);
44 l_attribute5 varchar2(150);
45 l_attribute6 varchar2(150);
46 l_attribute7 varchar2(150);
47 l_attribute8 varchar2(150);
48 l_attribute9 varchar2(150);
49 l_attribute10 varchar2(150);
50 l_attribute11 varchar2(150);
51 l_attribute12 varchar2(150);
52 l_attribute13 varchar2(150);
53 l_attribute14 varchar2(150);
54 l_attribute15 varchar2(150);
55 l_attribute16 varchar2(150);
56 l_attribute17 varchar2(150);
57 l_attribute18 varchar2(150);
58 l_attribute19 varchar2(150);
59 l_attribute20 varchar2(150);
60 l_attribute21 varchar2(150);
61 l_attribute22 varchar2(150);
62 l_attribute23 varchar2(150);
63 l_attribute24 varchar2(150);
64 l_attribute25 varchar2(150);
65 l_attribute26 varchar2(150);
66 l_attribute27 varchar2(150);
67 l_attribute28 varchar2(150);
68 l_attribute29 varchar2(150);
69 l_attribute30 varchar2(150);
70
71 function get_time_entry_group_id (p_time_entry_group_name in varchar2) return number is
72 CURSOR csr_get_time_entry_grp_id is
73 /*select time_entry_rule_group_id
74 from hxc_time_entry_rule_groups_v
75 where time_entry_rule_group_name = p_time_entry_group_name;*/
76 select entity_group_id
77 from hxc_entity_groups
78 where entity_type = 'TIME_ENTRY_RULES'
79 and name = p_time_entry_group_name;
80 l_time_entry_group_id number;
81 begin
82 open csr_get_time_entry_grp_id;
83 fetch csr_get_time_entry_grp_id into l_time_entry_group_id;
84 close csr_get_time_entry_grp_id;
85
86 return l_time_entry_group_id;
87 end;
88
89 function get_time_entry_rule_id (p_time_entry_rule_name in VARCHAR2) return number is
90
91 CURSOR csr_get_ter_id is
92 select time_entry_rule_id
93 from hxc_time_entry_rules
94 where name = p_time_entry_rule_name;
95 l_ter_id number;
96 begin
97 open csr_get_ter_id;
98 fetch csr_get_ter_id into l_ter_id;
99 close csr_get_ter_id;
100
101 return l_ter_id;
102 end;
103
104 function get_lookup_code (p_meaning in varchar2) return varchar2 is
105 cursor csr_get_lookup_code is
106 select lookup_code
107 from hr_lookups
108 where lookup_type = 'HXC_TIME_ENTRY_RULE_OUTCOME' and
109 meaning = p_meaning;
110 l_lookup_code varchar2(30);
111 begin
112 open csr_get_lookup_code;
113 fetch csr_get_lookup_code into l_lookup_code;
114 close csr_get_lookup_code;
115
116 return l_lookup_code;
117 end;
118 BEGIN
119 l_time_entry_rule_group_id := get_time_entry_group_id (p_time_entry_group_name);
120 l_entity_id := get_time_entry_rule_id (p_time_entry_rule_name);
121 SELECT htc.ENTITY_GROUP_COMP_ID ,
122 htc.ENTITY_GROUP_ID ,
123 htc.ENTITY_ID ,
124 htc.ENTITY_TYPE ,
125 htc.ATTRIBUTE_CATEGORY ,
126 htc.ATTRIBUTE1 ,
127 htc.ATTRIBUTE2 ,
128 htc.ATTRIBUTE3 ,
129 htc.ATTRIBUTE4 ,
130 htc.ATTRIBUTE5 ,
131 htc.ATTRIBUTE6 ,
132 htc.ATTRIBUTE7 ,
133 htc.ATTRIBUTE8 ,
134 htc.ATTRIBUTE9 ,
135 htc.ATTRIBUTE10 ,
136 htc.ATTRIBUTE11 ,
137 htc.ATTRIBUTE12 ,
138 htc.ATTRIBUTE13 ,
139 htc.ATTRIBUTE14 ,
140 htc.ATTRIBUTE15 ,
141 htc.ATTRIBUTE16 ,
142 htc.ATTRIBUTE17 ,
143 htc.ATTRIBUTE18 ,
144 htc.ATTRIBUTE19 ,
145 htc.ATTRIBUTE20 ,
146 htc.ATTRIBUTE21 ,
147 htc.ATTRIBUTE22 ,
148 htc.ATTRIBUTE23 ,
149 htc.ATTRIBUTE24 ,
150 htc.ATTRIBUTE25 ,
151 htc.ATTRIBUTE26 ,
152 htc.ATTRIBUTE27 ,
153 htc.ATTRIBUTE28 ,
154 htc.ATTRIBUTE29 ,
155 htc.ATTRIBUTE30 ,
156 htc.OBJECT_VERSION_NUMBER
157 INTO l_time_entry_rule_comp_id ,
158 l_time_entry_rule_group_id ,
159 l_entity_id ,
160 l_entity_type,
161 l_attribute_category,
162 l_outcome,
163 l_attribute2,
164 l_attribute3,
165 l_attribute4,
166 l_attribute5,
167 l_attribute6,
168 l_attribute7,
169 l_attribute8,
170 l_attribute9,
171 l_attribute10,
172 l_attribute11,
173 l_attribute12,
174 l_attribute13,
175 l_attribute14,
176 l_attribute15,
177 l_attribute16,
178 l_attribute17,
179 l_attribute18,
180 l_attribute19,
181 l_attribute20,
182 l_attribute21,
183 l_attribute22,
184 l_attribute23,
185 l_attribute24,
186 l_attribute25,
187 l_attribute26,
188 l_attribute27,
189 l_attribute28,
190 l_attribute29,
191 l_attribute30,
192 l_ovn
193 FROM HXC_ENTITY_GROUPS HTE,
194 HXC_ENTITY_GROUP_COMPS HTC
195 WHERE HTC.ENTITY_GROUP_ID = HTE.ENTITY_GROUP_ID AND
196 HTE.ENTITY_GROUP_ID = l_time_entry_rule_group_id AND
197 HTC.ENTITY_ID = l_entity_id ;
198
199 EXCEPTION
200 WHEN NO_DATA_FOUND then
201 l_outcome := get_lookup_code (p_outcome);
202 hxc_egc_ins.ins (
203 p_effective_date => to_date('01-01-1900','dd-mm-rrrr')
204 ,p_entity_group_id => l_time_entry_rule_group_id
205 ,p_entity_id => l_entity_id
206 ,p_entity_type => l_entity_type
207 ,p_attribute_category => l_attribute_category
208 ,p_attribute1 => l_outcome
209 ,p_attribute2 => l_attribute2
210 ,p_attribute3 => l_attribute3
211 ,p_attribute4 => l_attribute4
212 ,p_attribute5 => l_attribute5
213 ,p_attribute6 => l_attribute6
214 ,p_attribute7 => l_attribute7
215 ,p_attribute8 => l_attribute8
216 ,p_attribute9 => l_attribute9
217 ,p_attribute10 => l_attribute10
218 ,p_attribute11 => l_attribute11
219 ,p_attribute12 => l_attribute12
220 ,p_attribute13 => l_attribute13
221 ,p_attribute14 => l_attribute14
222 ,p_attribute15 => l_attribute15
223 ,p_attribute16 => l_attribute16
224 ,p_attribute17 => l_attribute17
225 ,p_attribute18 => l_attribute18
226 ,p_attribute19 => l_attribute19
227 ,p_attribute20 => l_attribute20
228 ,p_attribute21 => l_attribute21
229 ,p_attribute22 => l_attribute22
230 ,p_attribute23 => l_attribute23
231 ,p_attribute24 => l_attribute24
232 ,p_attribute25 => l_attribute25
233 ,p_attribute26 => l_attribute26
234 ,p_attribute27 => l_attribute27
235 ,p_attribute28 => l_attribute28
236 ,p_attribute29 => l_attribute29
237 ,p_attribute30 => l_attribute30
238 ,p_entity_group_comp_id => l_time_entry_rule_comp_id
239 ,p_object_version_number => l_ovn
240 ,p_called_from_form => 'N' );
241 END load_time_entry_rule_grp_comp;
242
243 END hxc_terg_upl_pkg;