[Home] [Help]
PACKAGE BODY: APPS.PAY_JP_BEE_UTILITY_PKG
Source
1 package body pay_jp_bee_utility_pkg as
2 /* $Header: pyjpbeeu.pkb 115.1 2002/12/06 11:52:12 ytohya noship $ */
3 --
4 -- Constants
5 --
6 c_package constant varchar2(31) := 'pay_jp_bee_utility_pkg.';
7 c_prompt_lookup_type constant hr_lookups.lookup_type%TYPE := 'JP_BEE_UTIL_PROMPT';
8 -- ----------------------------------------------------------------------------
9 -- |---------------------------< entry_value_tbl >----------------------------|
10 -- ----------------------------------------------------------------------------
11 function entry_value_tbl(
12 p_value1 varchar2 default hr_api.g_varchar2,
13 p_value2 varchar2 default hr_api.g_varchar2,
14 p_value3 varchar2 default hr_api.g_varchar2,
15 p_value4 varchar2 default hr_api.g_varchar2,
16 p_value5 varchar2 default hr_api.g_varchar2,
17 p_value6 varchar2 default hr_api.g_varchar2,
18 p_value7 varchar2 default hr_api.g_varchar2,
19 p_value8 varchar2 default hr_api.g_varchar2,
20 p_value9 varchar2 default hr_api.g_varchar2,
21 p_value10 varchar2 default hr_api.g_varchar2,
22 p_value11 varchar2 default hr_api.g_varchar2,
23 p_value12 varchar2 default hr_api.g_varchar2,
24 p_value13 varchar2 default hr_api.g_varchar2,
25 p_value14 varchar2 default hr_api.g_varchar2,
26 p_value15 varchar2 default hr_api.g_varchar2) return t_varchar2_tbl
27 is
28 l_entry_value_tbl t_varchar2_tbl;
29 --
30 procedure set_entry_value(
31 p_index in number,
32 p_value in varchar2)
33 is
34 begin
35 if (p_value is null) or (p_value <> hr_api.g_varchar2) then
36 l_entry_value_tbl(p_index) := p_value;
37 end if;
38 end set_entry_value;
39 begin
40 set_entry_value(1, p_value1);
41 set_entry_value(2, p_value2);
42 set_entry_value(3, p_value3);
43 set_entry_value(4, p_value4);
44 set_entry_value(5, p_value5);
45 set_entry_value(6, p_value6);
46 set_entry_value(7, p_value7);
47 set_entry_value(8, p_value8);
48 set_entry_value(9, p_value9);
49 set_entry_value(10, p_value10);
50 set_entry_value(11, p_value11);
51 set_entry_value(12, p_value12);
52 set_entry_value(13, p_value13);
53 set_entry_value(14, p_value14);
54 set_entry_value(15, p_value15);
55 --
56 return l_entry_value_tbl;
57 end entry_value_tbl;
58 -- ----------------------------------------------------------------------------
59 -- |---------------------------< chk_upload_date >----------------------------|
60 -- ----------------------------------------------------------------------------
61 procedure chk_upload_date(
62 p_time_period_id in number,
63 p_upload_date in date,
64 p_period_start_date out nocopy date,
65 p_period_end_date out nocopy date)
66 is
67 l_proc varchar2(61) := c_package || 'chk_upload_date';
68 cursor csr_time_period is
69 select start_date,
70 end_date
71 from per_time_periods
72 where time_period_id = p_time_period_id;
73 begin
74 hr_utility.set_location('Entering : ' || l_proc, 10);
75 --
76 -- p_upload_date must be within the payroll period specified.
77 -- Here checks whether p_upload_date is really within current payroll period.
78 --
79 open csr_time_period;
80 fetch csr_time_period into p_period_start_date, p_period_end_date;
81 if (csr_time_period%NOTFOUND)
82 or not (p_upload_date between p_period_start_date and p_period_end_date) then
83 close csr_time_period;
84 fnd_message.set_name('PAY', 'PAY_JP_BEE_UTIL_INV_UPLD_DATE');
85 fnd_message.set_token('UPLOAD_DATE', fnd_date.date_to_chardate(p_upload_date));
86 fnd_message.set_token('PERIOD_START_DATE', fnd_date.date_to_chardate(p_period_start_date));
87 fnd_message.set_token('PERIOD_END_DATE', fnd_date.date_to_chardate(p_period_end_date));
88 fnd_message.raise_error;
89 end if;
90 close csr_time_period;
91 --
92 hr_utility.set_location('Leaving : ' || l_proc, 20);
93 end chk_upload_date;
94 -- ----------------------------------------------------------------------------
95 -- |----------------------< chk_date_effective_changes >----------------------|
96 -- ----------------------------------------------------------------------------
97 procedure chk_date_effective_changes(
98 p_action_if_exists in varchar2,
99 p_reject_if_future_changes in varchar2,
100 p_date_effective_changes in out nocopy varchar2)
101 is
102 l_proc varchar2(61) := c_package || 'chk_date_effective_changes';
103 begin
104 hr_utility.set_location('Entering : ' || l_proc, 10);
105 --
106 -- Date Effective Changes is available only when "Update",
107 -- not available when "Insert" and "Reject".
108 --
109 if p_action_if_exists in ('I', 'R') then
110 p_date_effective_changes := null;
111 --
112 -- 1. Date Effective Changes is null for "Update" case, set to "Update/Change Insert"
113 -- 2. Date Effective Changes "Override" is available only when Reject If Future Changes is set to "No".
114 -- If set to "Yes", set Date Effective Changes to "Update/Change Insert".
115 --
116 elsif (p_date_effective_changes is null)
117 or ((p_reject_if_future_changes = 'Y') and (p_date_effective_changes = 'O')) then
118 p_date_effective_changes := 'U';
119 end if;
120 --
121 hr_utility.set_location('Leaving : ' || l_proc, 20);
122 end chk_date_effective_changes;
123 -- ----------------------------------------------------------------------------
124 -- |--------------------------------< get_iv >--------------------------------|
125 -- ----------------------------------------------------------------------------
126 procedure get_iv(
127 p_element_type_id in number,
128 p_effective_date in date,
129 p_eev_rec out nocopy t_eev_rec)
130 is
131 l_proc varchar2(61) := c_package || 'get_iv';
132 --
133 cursor csr_iv is
134 select ivtl.name,
135 iv.mandatory_flag,
136 iv.hot_default_flag,
137 iv.lookup_type,
138 iv.default_value,
139 null,
140 null
141 from pay_input_values_f_tl ivtl,
142 pay_input_values_f iv
143 where iv.element_type_id = p_element_type_id
144 and p_effective_date
145 between iv.effective_start_date and iv.effective_end_date
146 and ivtl.input_value_id = iv.input_value_id
147 and ivtl.language = userenv('LANG')
148 order by iv.display_sequence;
149 begin
150 hr_utility.set_location('Entering : ' || l_proc, 10);
151 --
152 open csr_iv;
153 fetch csr_iv bulk collect into
154 p_eev_rec.name_tbl,
155 p_eev_rec.mandatory_flag_tbl,
156 p_eev_rec.hot_default_flag_tbl,
157 p_eev_rec.lookup_type_tbl,
158 p_eev_rec.default_value_tbl,
159 p_eev_rec.liv_default_value_tbl,
160 p_eev_rec.entry_value_tbl;
161 close csr_iv;
162 --
163 /*
164 for i in 1..p_eev_rec.entry_value_tbl.count loop
165 hr_utility.trace('**********');
166 hr_utility.trace('name : ' || p_eev_rec.name_tbl(i));
167 hr_utility.trace('mandatory_flag : ' || p_eev_rec.mandatory_flag_tbl(i));
168 hr_utility.trace('hot_default_flag : ' || p_eev_rec.hot_default_flag_tbl(i));
169 hr_utility.trace('lookup_type : ' || p_eev_rec.lookup_type_tbl(i));
170 hr_utility.trace('default_value : ' || p_eev_rec.default_value_tbl(i));
171 -- hr_utility.trace('liv_default_value : ' || p_eev_rec.liv_default_value_tbl(i));
172 -- hr_utility.trace('entry_value : ' || p_eev_rec.entry_value_tbl(i));
173 end loop;
174 */
175 --
176 hr_utility.set_location('Leaving : ' || l_proc, 20);
177 end get_iv;
178 -- ----------------------------------------------------------------------------
179 -- |--------------------------------< get_ee >--------------------------------|
180 -- ----------------------------------------------------------------------------
181 procedure get_ee(
182 p_assignment_id in number,
183 p_element_type_id in number,
184 p_effective_date in date,
185 p_ee_rec out nocopy t_ee_rec,
186 p_eev_rec out nocopy t_eev_rec)
187 is
188 l_proc varchar2(61) := c_package || 'get_ee';
189 --
190 cursor csr_ee is
191 select /*+ ORDERED */
192 ee.element_entry_id,
193 ee.effective_start_date,
194 ee.effective_end_date,
195 ee.element_link_id,
196 ee.cost_allocation_keyflex_id,
197 cak.concatenated_segments,
198 cak.segment1,
199 cak.segment2,
200 cak.segment3,
201 cak.segment4,
202 cak.segment5,
203 cak.segment6,
204 cak.segment7,
205 cak.segment8,
206 cak.segment9,
207 cak.segment10,
208 cak.segment11,
209 cak.segment12,
210 cak.segment13,
211 cak.segment14,
212 cak.segment15,
213 cak.segment16,
214 cak.segment17,
215 cak.segment18,
216 cak.segment19,
217 cak.segment20,
218 cak.segment21,
219 cak.segment22,
220 cak.segment23,
221 cak.segment24,
222 cak.segment25,
223 cak.segment26,
224 cak.segment27,
225 cak.segment28,
226 cak.segment29,
227 cak.segment30,
228 ee.reason,
229 ee.attribute_category,
230 ee.attribute1,
231 ee.attribute2,
232 ee.attribute3,
233 ee.attribute4,
234 ee.attribute5,
235 ee.attribute6,
236 ee.attribute7,
237 ee.attribute8,
238 ee.attribute9,
239 ee.attribute10,
240 ee.attribute11,
241 ee.attribute12,
242 ee.attribute13,
243 ee.attribute14,
244 ee.attribute15,
245 ee.attribute16,
246 ee.attribute17,
247 ee.attribute18,
248 ee.attribute19,
249 ee.attribute20,
250 ee.entry_information_category,
251 ee.entry_information1,
252 ee.entry_information2,
253 ee.entry_information3,
254 ee.entry_information4,
255 ee.entry_information5,
256 ee.entry_information6,
257 ee.entry_information7,
258 ee.entry_information8,
259 ee.entry_information9,
260 ee.entry_information10,
261 ee.entry_information11,
262 ee.entry_information12,
263 ee.entry_information13,
264 ee.entry_information14,
265 ee.entry_information15,
266 ee.entry_information16,
267 ee.entry_information17,
268 ee.entry_information18,
269 ee.entry_information19,
270 ee.entry_information20,
271 ee.entry_information21,
272 ee.entry_information22,
273 ee.entry_information23,
274 ee.entry_information24,
275 ee.entry_information25,
276 ee.entry_information26,
277 ee.entry_information27,
278 ee.entry_information28,
279 ee.entry_information29,
280 ee.entry_information30,
281 ee.date_earned,
282 ee.personal_payment_method_id,
283 ee.subpriority
284 from per_all_assignments_f asg,
285 pay_element_links_f el,
286 pay_element_entries_f ee,
287 pay_cost_allocation_keyflex cak
288 where asg.assignment_id = p_assignment_id
289 and p_effective_date
290 between asg.effective_start_date and asg.effective_end_date
291 and el.element_type_id = p_element_type_id
292 and el.business_group_id + 0 = asg.business_group_id
293 and p_effective_date
294 between el.effective_start_date and el.effective_end_date
295 and ee.assignment_id = asg.assignment_id
296 and ee.element_link_id = el.element_link_id
297 and p_effective_date
298 between ee.effective_start_date and ee.effective_end_date
299 and ee.entry_type = 'E'
300 and cak.cost_allocation_keyflex_id(+) = ee.cost_allocation_keyflex_id;
301 cursor csr_eev is
302 select /*+ ORDERED */
303 ivtl.name,
304 iv.mandatory_flag,
305 iv.hot_default_flag,
306 iv.lookup_type,
307 iv.default_value,
308 liv.default_value,
309 eev.screen_entry_value
310 from pay_element_entry_values_f eev,
311 pay_link_input_values_f liv,
312 pay_input_values_f iv,
313 pay_input_values_f_tl ivtl
314 where eev.element_entry_id = p_ee_rec.element_entry_id
315 and eev.effective_start_date = p_ee_rec.effective_start_date
316 and eev.effective_end_date = p_ee_rec.effective_end_date
317 and liv.element_link_id = p_ee_rec.element_link_id
318 and liv.input_value_id = eev.input_value_id
319 and p_effective_date
320 between liv.effective_start_date and liv.effective_end_date
321 and iv.input_value_id = liv.input_value_id
322 and p_effective_date
323 between iv.effective_start_date and iv.effective_end_date
324 and ivtl.input_value_id = iv.input_value_id
325 and ivtl.language = userenv('LANG')
326 order by iv.display_sequence;
327 begin
328 hr_utility.set_location('Entering : ' || l_proc, 10);
329 --
330 open csr_ee;
331 fetch csr_ee into p_ee_rec;
332 --
333 hr_utility.trace('element_entry_id : ' || to_char(p_ee_rec.element_entry_id));
334 hr_utility.trace('effective_start_date : ' || to_char(p_ee_rec.effective_start_date));
335 hr_utility.trace('effective_end_date : ' || to_char(p_ee_rec.effective_end_date));
336 hr_utility.trace('element_link_id : ' || to_char(p_ee_rec.element_link_id));
337 --
338 -- If element entry exists, derive element entry values
339 --
340 if csr_ee%FOUND then
341 hr_utility.set_location(l_proc, 15);
342 --
343 open csr_eev;
344 fetch csr_eev bulk collect into
345 p_eev_rec.name_tbl,
346 p_eev_rec.mandatory_flag_tbl,
347 p_eev_rec.hot_default_flag_tbl,
348 p_eev_rec.lookup_type_tbl,
349 p_eev_rec.default_value_tbl,
350 p_eev_rec.liv_default_value_tbl,
351 p_eev_rec.entry_value_tbl;
352 close csr_eev;
353 --
354 /*
355 for i in 1..p_eev_rec.entry_value_tbl.count loop
356 hr_utility.trace('**********');
357 hr_utility.trace('name : ' || p_eev_rec.name_tbl(i));
358 hr_utility.trace('mandatory_flag : ' || p_eev_rec.mandatory_flag_tbl(i));
359 hr_utility.trace('hot_default_flag : ' || p_eev_rec.hot_default_flag_tbl(i));
360 hr_utility.trace('lookup_type : ' || p_eev_rec.lookup_type_tbl(i));
361 hr_utility.trace('default_value : ' || p_eev_rec.default_value_tbl(i));
362 hr_utility.trace('liv_default_value : ' || p_eev_rec.liv_default_value_tbl(i));
363 hr_utility.trace('entry_value : ' || p_eev_rec.entry_value_tbl(i));
364 end loop;
365 */
366 --
367 -- If element entry does not exist, derive input values definition.
368 -- Note link input value default value is not derived because element link is unknown.
369 -- It is not smart way to derive element_link_id here which should be done BEE validation process.
370 --
371 else
372 hr_utility.set_location(l_proc, 16);
373 --
374 p_ee_rec := null;
375 --
376 get_iv(
377 p_element_type_id => p_element_type_id,
378 p_effective_date => p_effective_date,
379 p_eev_rec => p_eev_rec);
380 end if;
381 close csr_ee;
382 --
383 hr_utility.set_location('Leaving : ' || l_proc, 20);
384 end get_ee;
385 -- ----------------------------------------------------------------------------
386 -- |-------------------------------< set_eev >--------------------------------|
387 -- ----------------------------------------------------------------------------
388 procedure set_eev(
389 p_ee_rec in t_ee_rec,
390 p_eev_rec in t_eev_rec,
391 p_value_if_null_tbl in t_varchar2_tbl,
392 p_new_value_tbl in out nocopy t_varchar2_tbl,
393 p_is_different out nocopy boolean)
394 is
395 l_proc varchar2(61) := c_package || 'set_eev';
396 --
397 l_index number;
398 l_default_value pay_input_values_f.default_value%TYPE;
399 l_entry_value pay_element_entry_values_f.screen_entry_value%TYPE;
400 l_new_value pay_element_entry_values_f.screen_entry_value%TYPE;
401 begin
402 hr_utility.set_location('Entering : ' || l_proc, 10);
403 --
404 -- If element entry does not exist.
405 -- In this case, delete the entry from PL/SQL table for non-enterable input values.
406 --
407 if p_ee_rec.element_entry_id is null then
408 p_is_different := true;
409 l_index := p_new_value_tbl.first;
410 while l_index is not null loop
411 hr_utility.trace('Set IV' || to_char(l_index));
412 --
413 if p_eev_rec.mandatory_flag_tbl(l_index) = 'X' then
414 hr_utility.trace('entry_value not enterable.');
415 --
416 -- delete the entry from PL/SQL table.
417 --
418 p_new_value_tbl.delete(l_index);
419 end if;
420 --
421 l_index := p_new_value_tbl.next(l_index);
422 end loop;
423 --
424 -- If element entry exists.
425 -- Compare each new_value with the current entry_value.
426 --
427 else
428 p_is_different := false;
429 for i in 1..p_eev_rec.mandatory_flag_tbl.count loop
430 hr_utility.trace('Compare IV' || to_char(i));
431 --
432 -- Current entry_value is inherited in the following cases.
433 -- 1. The input value is not user enterable.
434 -- 2. The entry_value is not target to be transfered.
435 -- Note that current value will be inherited regardless of BEE value
436 -- for non-enterable input value.
437 --
438 if p_eev_rec.mandatory_flag_tbl(i) = 'X' then
439 hr_utility.trace('entry_value not enterable.');
440 --
441 -- delete the entry from PL/SQL table.
442 -- If the entry does not exist, nothing happens.
443 --
444 p_new_value_tbl.delete(i);
445 elsif not p_new_value_tbl.exists(i) then
446 hr_utility.trace('entry_value not target.');
447 p_new_value_tbl(i) := p_eev_rec.entry_value_tbl(i);
448 else
449 if p_eev_rec.hot_default_flag_tbl(i) = 'Y' then
450 l_default_value := nvl(p_eev_rec.liv_default_value_tbl(i), p_eev_rec.default_value_tbl(i));
451 l_entry_value := nvl(nvl(p_eev_rec.entry_value_tbl(i), l_default_value), p_value_if_null_tbl(i));
452 l_new_value := nvl(nvl(p_new_value_tbl(i), l_default_value), p_value_if_null_tbl(i));
453 else
454 l_default_value := p_eev_rec.liv_default_value_tbl(i);
455 l_entry_value := nvl(p_eev_rec.entry_value_tbl(i), p_value_if_null_tbl(i));
456 l_new_value := nvl(p_new_value_tbl(i), p_value_if_null_tbl(i));
457 end if;
458 --
459 -- If new_value is different from current entry_value,
460 -- override it with the new_value. Or inherit the existing value.
461 --
462 if l_new_value <> l_entry_value then
463 hr_utility.trace('IV different');
464 --
465 p_is_different := true;
466 --
467 -- Set new entry value to PL/SQL table l_entry_value
468 -- When the following condition, entry_value can be null.
469 -- 1. When entry value is the same value as hot defaulted value.
470 -- 2. When entry value is the same value as "value when null"
471 -- and default_value is also null.
472 --
473 if p_new_value_tbl(i) is not null then
474 if ((p_eev_rec.hot_default_flag_tbl(i) = 'Y') and (l_new_value = l_default_value))
475 or ((p_eev_rec.mandatory_flag_tbl(i) = 'N') and (l_default_value is null) and (l_new_value = p_value_if_null_tbl(i))) then
476 p_new_value_tbl(i) := null;
477 end if;
478 end if;
479 else
480 hr_utility.trace('IV same');
481 p_new_value_tbl(i) := p_eev_rec.entry_value_tbl(i);
482 end if;
483 end if;
484 end loop;
485 end if;
486 --
487 hr_utility.set_location('Leaving : ' || l_proc, 20);
488 end set_eev;
489 -- ----------------------------------------------------------------------------
490 -- |---------------------------------< log >----------------------------------|
491 -- ----------------------------------------------------------------------------
492 procedure log(
493 p_full_name in varchar2,
494 p_assignment_number in varchar2,
495 p_application_short_name in varchar2,
496 p_message_name in varchar2,
497 p_token1 in varchar2 default null,
498 p_value1 in varchar2 default null,
499 p_token2 in varchar2 default null,
500 p_value2 in varchar2 default null,
501 p_token3 in varchar2 default null,
502 p_value3 in varchar2 default null,
503 p_token4 in varchar2 default null,
504 p_value4 in varchar2 default null,
505 p_token5 in varchar2 default null,
506 p_value5 in varchar2 default null)
507 is
508 l_message_text varchar2(2000);
509 --
510 procedure set_token(
511 p_token in varchar2,
512 p_value in varchar2)
513 is
514 begin
515 if p_token is not null then
516 fnd_message.set_token(p_token, p_value);
517 end if;
518 end set_token;
519 begin
520 --
521 -- Write log header
522 --
523 if g_num_of_logs = 0 then
524 fnd_file.put_line(fnd_file.log,
525 rtrim(
526 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'FULL_NAME'), 30) || ' ' ||
527 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'ASSIGNMENT_NUMBER'), 15) || ' ' ||
528 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'LOG'), 85)
529 ));
530 fnd_file.put_line(fnd_file.log,
531 rpad('-', 30, '-') || ' ' ||
532 rpad('-', 15, '-') || ' ' ||
533 rpad('-', 85, '-')
534 );
535 end if;
536 --
537 g_num_of_logs := g_num_of_logs + 1;
538 --
539 -- Derive message text from fnd_new_messages
540 --
541 fnd_message.set_name(p_application_short_name, p_message_name);
542 set_token(p_token1, p_value1);
543 set_token(p_token2, p_value2);
544 set_token(p_token3, p_value3);
545 set_token(p_token4, p_value4);
546 set_token(p_token5, p_value5);
547 l_message_text := fnd_message.get;
548 --
549 -- Write message text
550 --
551 fnd_file.put_line(fnd_file.log,
552 rtrim(
553 rpad(p_full_name, 30) || ' ' ||
554 rpad(p_assignment_number, 15) || ' ' ||
555 rpad(l_message_text, 85)
556 ));
557 end log;
558 -- ----------------------------------------------------------------------------
559 -- |---------------------------------< out >----------------------------------|
560 -- ----------------------------------------------------------------------------
561 procedure out(
562 p_full_name in varchar2,
563 p_assignment_number in varchar2,
564 p_effective_date in date,
565 p_change_type in varchar2,
566 p_eev_rec in t_eev_rec,
567 p_new_value_tbl in t_varchar2_tbl,
568 p_write_all in boolean)
569 is
570 l_index number;
571 l_old_value hr_lookups.meaning%type;
572 l_new_value hr_lookups.meaning%type;
573 l_break boolean := true;
574 begin
575 --
576 -- Write output header
577 --
578 if g_num_of_outs = 0 then
579 fnd_file.put_line(fnd_file.output,
580 rtrim(
581 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'FULL_NAME'), 30) || ' ' ||
582 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'ASSIGNMENT_NUMBER'), 15) || ' ' ||
583 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'CHANGE_DATE'), 11) || ' ' ||
584 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'CHANGE_TYPE'), 4) || ' ' ||
585 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'INPUT_VALUE'), 14) || ' ' ||
586 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'BEFORE_CHANGE'), 26) || ' ' ||
587 rpad(hr_general.decode_lookup(c_prompt_lookup_type, 'AFTER_CHANGE'), 26)
588 ));
589 fnd_file.put_line(fnd_file.output,
590 rpad('-', 30, '-') || ' ' ||
591 rpad('-', 15, '-') || ' ' ||
592 rpad('-', 11, '-') || ' ' ||
593 rpad('-', 4, '-') || ' ' ||
594 rpad('-', 14, '-') || ' ' ||
595 rpad('-', 26, '-') || ' ' ||
596 rpad('-', 26, '-')
597 );
598 end if;
599 --
600 g_num_of_outs := g_num_of_outs + 1;
601 --
602 l_index := p_new_value_tbl.first;
603 while l_index is not null loop
604 l_old_value := p_eev_rec.entry_value_tbl(l_index);
605 l_new_value := p_new_value_tbl(l_index);
606 --
607 -- The data is written in the following cases.
608 -- 1. p_write_all is set to "True".
609 -- 2. new_value is different from old_value.
610 --
611 if (p_write_all)
612 or (nvl(l_new_value, hr_api.g_varchar2) <> nvl(l_old_value, hr_api.g_varchar2)) then
613 if p_eev_rec.lookup_type_tbl(l_index) is not null then
614 l_old_value := hr_general.decode_lookup(p_eev_rec.lookup_type_tbl(l_index), l_old_value);
615 l_new_value := hr_general.decode_lookup(p_eev_rec.lookup_type_tbl(l_index), l_new_value);
616 end if;
617 --
618 -- Write output data.
619 -- The heading some items are only written in the first record
620 -- which is similar to "BREAK ON" on SQL*Plus.
621 --
622 if l_break then
623 l_break := false;
624 --
625 fnd_file.put_line(fnd_file.output,
626 rtrim(
627 rpad(p_full_name, 30) || ' ' ||
628 rpad(p_assignment_number, 15) || ' ' ||
629 rpad(fnd_date.date_to_chardate(p_effective_date), 11) || ' ' ||
630 rpad(hr_general.decode_lookup(c_prompt_lookup_type, p_change_type), 4) || ' ' ||
631 rpad(p_eev_rec.name_tbl(l_index), 14) || ' ' ||
632 rpad(nvl(l_old_value, ' '), 26) || ' ' ||
633 rpad(nvl(l_new_value, ' '), 26)
634 ));
635 else
636 fnd_file.put_line(fnd_file.output,
637 rtrim(
638 rpad(' ', 30) || ' ' ||
639 rpad(' ', 15) || ' ' ||
640 rpad(' ', 11) || ' ' ||
641 rpad(' ', 4) || ' ' ||
642 rpad(p_eev_rec.name_tbl(l_index), 14) || ' ' ||
643 rpad(nvl(l_old_value, ' '), 26) || ' ' ||
644 rpad(nvl(l_new_value, ' '), 26)
645 ));
646 end if;
647 end if;
648 --
649 l_index := p_new_value_tbl.next(l_index);
650 end loop;
651 end out;
652 -- ----------------------------------------------------------------------------
653 -- |--------------------------< create_batch_line >---------------------------|
654 -- ----------------------------------------------------------------------------
655 procedure create_batch_line(
656 p_batch_id in number,
657 p_assignment_id in number,
658 p_assignment_number in varchar2,
659 p_element_type_id in number,
660 p_element_name in varchar2,
661 p_effective_date in date,
662 p_ee_rec in t_ee_rec,
663 p_eev_rec in t_eev_rec,
664 p_batch_line_id out nocopy number,
665 p_object_version_number out nocopy number)
666 is
667 l_proc varchar2(61) := c_package || 'create_batch_line';
668 l_bee_rowid rowid;
669 l_value_1 pay_batch_lines.value_1%TYPE;
670 l_value_2 pay_batch_lines.value_2%TYPE;
671 l_value_3 pay_batch_lines.value_3%TYPE;
672 l_value_4 pay_batch_lines.value_4%TYPE;
673 l_value_5 pay_batch_lines.value_5%TYPE;
674 l_value_6 pay_batch_lines.value_6%TYPE;
675 l_value_7 pay_batch_lines.value_7%TYPE;
676 l_value_8 pay_batch_lines.value_8%TYPE;
677 l_value_9 pay_batch_lines.value_9%TYPE;
678 l_value_10 pay_batch_lines.value_10%TYPE;
679 l_value_11 pay_batch_lines.value_11%TYPE;
680 l_value_12 pay_batch_lines.value_12%TYPE;
681 l_value_13 pay_batch_lines.value_13%TYPE;
682 l_value_14 pay_batch_lines.value_14%TYPE;
683 l_value_15 pay_batch_lines.value_15%TYPE;
684 --
685 function decode_entry_value(p_index in number) return varchar2
686 is
687 l_value pay_batch_lines.value_1%TYPE;
688 begin
689 if p_eev_rec.entry_value_tbl.exists(p_index) then
690 if p_eev_rec.lookup_type_tbl(p_index) is null then
691 l_value := p_eev_rec.entry_value_tbl(p_index);
692 else
693 l_value := hr_general.decode_lookup(p_eev_rec.lookup_type_tbl(p_index), p_eev_rec.entry_value_tbl(p_index));
694 end if;
695 --
696 hr_utility.trace(rpad('value_' || to_char(p_index), 8) || ' : ' || l_value);
697 end if;
698 --
699 return l_value;
700 end decode_entry_value;
701 begin
702 hr_utility.set_location('Entering : ' || l_proc, 10);
703 --
704 l_value_1 := decode_entry_value(1);
705 l_value_2 := decode_entry_value(2);
706 l_value_3 := decode_entry_value(3);
707 l_value_4 := decode_entry_value(4);
708 l_value_5 := decode_entry_value(5);
709 l_value_6 := decode_entry_value(6);
710 l_value_7 := decode_entry_value(7);
711 l_value_8 := decode_entry_value(8);
712 l_value_9 := decode_entry_value(9);
713 l_value_10 := decode_entry_value(10);
714 l_value_11 := decode_entry_value(11);
715 l_value_12 := decode_entry_value(12);
716 l_value_13 := decode_entry_value(13);
717 l_value_14 := decode_entry_value(14);
718 l_value_15 := decode_entry_value(15);
719 --
720 -- Create BEE Line into PAY_BATCH_LINES
721 --
722 pay_batch_element_entry_api.create_batch_line(
723 p_validate => false,
724 p_session_date => p_effective_date,
725 p_batch_id => p_batch_id,
726 p_assignment_id => p_assignment_id,
727 p_assignment_number => p_assignment_number,
728 p_attribute_category => p_ee_rec.attribute_category,
729 p_attribute1 => p_ee_rec.attribute1,
730 p_attribute2 => p_ee_rec.attribute2,
731 p_attribute3 => p_ee_rec.attribute3,
732 p_attribute4 => p_ee_rec.attribute4,
733 p_attribute5 => p_ee_rec.attribute5,
734 p_attribute6 => p_ee_rec.attribute6,
735 p_attribute7 => p_ee_rec.attribute7,
736 p_attribute8 => p_ee_rec.attribute8,
737 p_attribute9 => p_ee_rec.attribute9,
738 p_attribute10 => p_ee_rec.attribute10,
739 p_attribute11 => p_ee_rec.attribute11,
740 p_attribute12 => p_ee_rec.attribute12,
741 p_attribute13 => p_ee_rec.attribute13,
742 p_attribute14 => p_ee_rec.attribute14,
743 p_attribute15 => p_ee_rec.attribute15,
744 p_attribute16 => p_ee_rec.attribute16,
745 p_attribute17 => p_ee_rec.attribute17,
746 p_attribute18 => p_ee_rec.attribute18,
747 p_attribute19 => p_ee_rec.attribute19,
748 p_attribute20 => p_ee_rec.attribute20,
749 p_entry_information_category => p_ee_rec.entry_information_category,
750 p_entry_information1 => p_ee_rec.entry_information1,
751 p_entry_information2 => p_ee_rec.entry_information2,
752 p_entry_information3 => p_ee_rec.entry_information3,
753 p_entry_information4 => p_ee_rec.entry_information4,
754 p_entry_information5 => p_ee_rec.entry_information5,
755 p_entry_information6 => p_ee_rec.entry_information6,
756 p_entry_information7 => p_ee_rec.entry_information7,
757 p_entry_information8 => p_ee_rec.entry_information8,
758 p_entry_information9 => p_ee_rec.entry_information9,
759 p_entry_information10 => p_ee_rec.entry_information10,
760 p_entry_information11 => p_ee_rec.entry_information11,
761 p_entry_information12 => p_ee_rec.entry_information12,
762 p_entry_information13 => p_ee_rec.entry_information13,
763 p_entry_information14 => p_ee_rec.entry_information14,
764 p_entry_information15 => p_ee_rec.entry_information15,
765 p_entry_information16 => p_ee_rec.entry_information16,
766 p_entry_information17 => p_ee_rec.entry_information17,
767 p_entry_information18 => p_ee_rec.entry_information18,
768 p_entry_information19 => p_ee_rec.entry_information19,
769 p_entry_information20 => p_ee_rec.entry_information20,
770 p_entry_information21 => p_ee_rec.entry_information21,
771 p_entry_information22 => p_ee_rec.entry_information22,
772 p_entry_information23 => p_ee_rec.entry_information23,
773 p_entry_information24 => p_ee_rec.entry_information24,
774 p_entry_information25 => p_ee_rec.entry_information25,
775 p_entry_information26 => p_ee_rec.entry_information26,
776 p_entry_information27 => p_ee_rec.entry_information27,
777 p_entry_information28 => p_ee_rec.entry_information28,
778 p_entry_information29 => p_ee_rec.entry_information29,
779 p_entry_information30 => p_ee_rec.entry_information30,
780 p_date_earned => p_ee_rec.date_earned,
781 p_personal_payment_method_id => p_ee_rec.personal_payment_method_id,
782 p_subpriority => p_ee_rec.subpriority,
783 p_concatenated_segments => p_ee_rec.concatenated_segments ,
784 p_cost_allocation_keyflex_id => p_ee_rec.cost_allocation_keyflex_id,
785 p_effective_date => p_effective_date,
786 p_element_name => p_element_name,
787 p_element_type_id => p_element_type_id,
788 p_entry_type => 'E',
789 p_reason => p_ee_rec.reason,
790 p_segment1 => p_ee_rec.segment1,
791 p_segment2 => p_ee_rec.segment2,
792 p_segment3 => p_ee_rec.segment3,
793 p_segment4 => p_ee_rec.segment4,
794 p_segment5 => p_ee_rec.segment5,
795 p_segment6 => p_ee_rec.segment6,
796 p_segment7 => p_ee_rec.segment7,
797 p_segment8 => p_ee_rec.segment8,
798 p_segment9 => p_ee_rec.segment9,
799 p_segment10 => p_ee_rec.segment10,
800 p_segment11 => p_ee_rec.segment11,
801 p_segment12 => p_ee_rec.segment12,
802 p_segment13 => p_ee_rec.segment13,
803 p_segment14 => p_ee_rec.segment14,
804 p_segment15 => p_ee_rec.segment15,
805 p_segment16 => p_ee_rec.segment16,
806 p_segment17 => p_ee_rec.segment17,
807 p_segment18 => p_ee_rec.segment18,
808 p_segment19 => p_ee_rec.segment19,
809 p_segment20 => p_ee_rec.segment20,
810 p_segment21 => p_ee_rec.segment21,
811 p_segment22 => p_ee_rec.segment22,
812 p_segment23 => p_ee_rec.segment23,
813 p_segment24 => p_ee_rec.segment24,
814 p_segment25 => p_ee_rec.segment25,
815 p_segment26 => p_ee_rec.segment26,
816 p_segment27 => p_ee_rec.segment27,
817 p_segment28 => p_ee_rec.segment28,
818 p_segment29 => p_ee_rec.segment29,
819 p_segment30 => p_ee_rec.segment30,
820 p_value_1 => l_value_1,
821 p_value_2 => l_value_2,
822 p_value_3 => l_value_3,
823 p_value_4 => l_value_4,
824 p_value_5 => l_value_5,
825 p_value_6 => l_value_6,
826 p_value_7 => l_value_7,
827 p_value_8 => l_value_8,
828 p_value_9 => l_value_9,
829 p_value_10 => l_value_10,
830 p_value_11 => l_value_11,
831 p_value_12 => l_value_12,
832 p_value_13 => l_value_13,
833 p_value_14 => l_value_14,
834 p_value_15 => l_value_15,
835 p_batch_line_id => p_batch_line_id,
836 p_object_version_number => p_object_version_number);
837 --
838 hr_utility.set_location('Leaving : ' || l_proc, 20);
839 end create_batch_line;
840 --
841 end pay_jp_bee_utility_pkg;