[Home] [Help]
PACKAGE BODY: APPS.BEN_TCS_COMPENSATION
Source
1 PACKAGE BODY BEN_TCS_COMPENSATION as
2 /* $Header: betcscmp.pkb 120.12.12010000.4 2008/11/11 09:08:00 vkodedal ship $ */
3 g_period_table period_table;
4 g_status varchar2(3) ;
5 g_package varchar2(30) := 'BEN_TCS_COMPENSATION';
6
7 PROCEDURE WRITE (p_string IN VARCHAR2)
8 IS
9 BEGIN
10 ben_batch_utils.WRITE (p_string);
11 END WRITE ;
12
13 procedure delete_rows is
14 l_proc varchar2(60) := g_package||'delete_rows';
15 begin
16 hr_utility.set_location('Entering into '||l_proc,10);
17 g_period_table.delete;
18 hr_utility.set_location('Leaving '||l_proc,10);
19 end delete_rows;
20
21 Procedure Insert_period( p_period_start_date in date,
22 p_period_end_date in date
23 ) is
24
25 l_number_of_rows number;
26 l_flag varchar2(1);
27 l_next_row number;
28 l_proc varchar2(60) := g_package||'Insert_period';
29 Begin
30 hr_utility.set_location('Entering into '||l_proc,10);
31
32 l_next_row := NVL(g_period_table.LAST, 0) + 1;
33 g_period_table(l_next_row).start_date := p_period_start_date;
34 g_period_table(l_next_row).end_date := p_period_end_date;
35
36 hr_utility.set_location('Leaving '||l_proc,10);
37 end Insert_period;
38
39 procedure get_salary_basis_details ( p_input_value_id in number,
40 p_effective_date in date,
41 p_period_start_date in date,
42 p_assignment_id in number,
43 p_pay_basis_id out nocopy number,
44 p_rate_basis out nocopy varchar2,
45 p_PAY_ANN_FACTOR out nocopy number,
46 p_name out nocopy varchar2
47 ) is
48
49 l_proc varchar2(1000) := g_package||'get_salary_basis_details';
50
51 cursor csr_salary_basis_details is
52 select pay.pay_basis_id,
53 pay_basis,
54 PAY_ANNUALIZATION_FACTOR,
55 name
56 from per_pay_bases pay,
57 per_all_assignments_f asg
58 where pay.input_value_id = p_input_value_id
59 and pay.business_group_id = asg.business_group_id
60 and pay.pay_basis_id = asg.pay_basis_id
61 and asg.assignment_id = p_assignment_id
62 and p_period_start_date <= asg.effective_end_date
63 and p_effective_date >= asg.effective_start_date;
64
65 l_salary_rec csr_salary_basis_details%ROWTYPE;
66
67 begin
68 hr_utility.set_location('Entering: '||l_proc,30);
69
70 open csr_salary_basis_details;
71 fetch csr_salary_basis_details into l_salary_rec;
72 if csr_salary_basis_details%notfound then
73 g_status := '1B';
74 hr_utility.set_location('No Salary basis linked to input value id passed ', 40);
75 end if;
76 close csr_salary_basis_details;
77 p_pay_basis_id := l_salary_rec.pay_basis_id;
78 p_rate_basis := l_salary_rec.pay_basis;
79 p_PAY_ANN_FACTOR :=l_salary_rec.PAY_ANNUALIZATION_FACTOR;
80 p_name :=l_salary_rec.name ;
81
82 hr_utility.set_location('Leaving: '||l_proc,30);
83 exception
84 when no_data_found then
85 g_status := '1B';
86 hr_utility.set_location('No Salary basis linked to input value id passed ', 40);
87 end get_salary_basis_details;
88
89
90 procedure element_entry(p_assignment_id in number,
91 p_element_type_id in number,
92 p_input_value_id in number,
93 p_perd_st_dt in date,
94 p_perd_en_dt in date,
95 p_summary out nocopy period_table,
96 p_actual_uom in varchar2,
97 p_lookup_type in varchar2,
98 p_value_set_id in varchar2 ,
99 p_actual_currency_code in varchar2 ) is
100 cursor csr_elmnt_entry is
101 select ee.effective_start_date ee_esd,
102 ee.effective_end_date ee_eed,
103 ee.CREATOR_TYPE creator_type,
104 eev.screen_entry_value eev_amt,
105 eev.ELEMENT_ENTRY_VALUE_ID eev_id
106 from pay_element_entries_f ee,
107 pay_element_entry_values_f eev
108 where ee.assignment_id = p_assignment_id
109 and ee.element_type_id = p_element_type_id
110 and ee.effective_start_date < p_perd_en_dt
111 and ee.effective_end_date > p_perd_st_dt
112 and ee.element_entry_id = eev.element_entry_id
113 and eev.input_value_id = p_input_value_id
114 and eev.effective_start_date = ee.effective_start_date
115 and eev.effective_end_date = ee.effective_end_date
116 and eev.screen_entry_value is not null
117 order by ee.effective_start_date;
118
119 i integer;
120 l_proc varchar2(60) := g_package||'element_entry';
121 begin
122 hr_utility.set_location('Entering'||l_proc,10);
123 hr_utility.set_location('Elmnt_id'||p_element_type_id,10);
124 hr_utility.set_location('iv_id'||p_input_value_id,10);
125 i := 0;
126 for elmnt_entry_row in csr_elmnt_entry loop
127 i := i + 1;
128 hr_utility.set_location('ee being recorded :'||elmnt_entry_row.eev_amt,10);
129
130 p_summary(i).start_date := elmnt_entry_row.ee_esd;
131 p_summary(i).end_date := elmnt_entry_row.ee_eed;
132 if p_value_set_id is null and p_lookup_type is null then
133 p_summary(i).value := elmnt_entry_row.eev_amt;
134 /* p_summary(i).value := hr_chkfmt.changeformat(
135 elmnt_entry_row.eev_amt,
136 p_actual_uom,
137 p_actual_currency_code);*/
138 elsif p_lookup_type is not null then
139 p_summary(i).value := hr_general.decode_lookup(
140 p_lookup_type,
141 elmnt_entry_row.eev_amt) ;
142 elsif p_value_set_id is not null then
143 p_summary(i).value := pay_input_values_pkg.decode_vset_value(
144 p_value_set_id,
145 elmnt_entry_row.eev_amt);
146 end if ;
147 p_summary(i).creator_type := elmnt_entry_row.creator_type;
148 p_summary(i).output_key := elmnt_entry_row.eev_id;
149
150 end loop;
151 hr_utility.set_location('p summary count '||p_summary.count,45);
152 hr_utility.set_location('# of entries'||to_char(i),20);
153 hr_utility.set_location('Leaving'||l_proc,10);
154 end element_entry;
155
156 procedure bnfts_entries (p_person_id in number,
157 p_perd_st_dt in date,
158 p_perd_en_dt in date,
159 p_input_value_id in number,
160 p_comp_typ_cd in varchar2,
161 p_currency_cd in varchar2,
162 p_uom in varchar2,
163 p_bnfts_table out nocopy period_table) is
164
165 cursor bnfts_rows is
166 select pbb.effective_start_date,
167 pbb.effective_end_date,
168 pbb.per_bnfts_bal_id,
169 pbb.val,
170 bb.uom,
171 bb.nnmntry_uom
172 from ben_bnfts_bal_f bb,
173 ben_per_bnfts_bal_f pbb
174 where bb.bnfts_bal_id = p_input_value_id
175 and pbb.bnfts_bal_id = bb.bnfts_bal_id
176 and pbb.person_id = p_person_id
177 and pbb.effective_start_date between p_perd_st_dt and p_perd_en_dt
178 and bb.effective_start_date < p_perd_en_dt
179 and bb.effective_end_date > p_perd_st_dt
180 and pbb.val is not null;
181 l_proc varchar2(1000) := g_package||'bnfts_entries';
182 i integer := 0;
183 Begin
184 hr_utility.set_location('Entering '||l_proc,20);
185 for bnfts_rec in bnfts_rows loop
186 i := i + 1;
187 p_bnfts_table(i).start_date := bnfts_rec.effective_start_date;
188 p_bnfts_table(i).end_date := bnfts_rec.effective_end_date;
189 p_bnfts_table(i).value := fnd_number.number_to_canonical(bnfts_rec.val) ;
190 p_bnfts_table(i).output_key := bnfts_rec.per_bnfts_bal_id;
191
192 if p_comp_typ_cd = 'MNTRY' then
193 p_bnfts_table(i).currency_cd := nvl(p_currency_cd,bnfts_rec.uom);
194 elsif p_comp_typ_cd = 'NNMNTRY' then
195 p_bnfts_table(i).uom := nvl(p_uom,bnfts_rec.nnmntry_uom);
196 end if;
197 p_bnfts_table(i).actual_uom := bnfts_rec.nnmntry_uom;
198 end loop;
199 exception
200 when others then
201 g_status := '3';
202
203 hr_utility.set_location('Leaving '||l_proc,20);
204 end bnfts_entries;
205
206 procedure rule_entries (p_assignment_id in number,
207 p_perd_start_date in date,
208 p_perd_end_date in date,
209 p_date_earned in date,
210 p_input_value_id in number,
211 p_comp_typ_cd in varchar2,
212 p_currency_cd in varchar2,
213 p_uom in varchar2,
214 p_rule_table out nocopy period_table) is
215
216 l_inputs ff_exec.inputs_t;
217 l_outputs ff_exec.outputs_t;
218 -- vkodedal modified the length of varchar Bug# 6992595
219 l_comp_dates varchar2(2000);
220 l_comp_values varchar2(2000);
221 --
222 l_proc varchar2(100) := g_package || 'get_commitment_from_formula';
223 --
224 l_input_count number;
225 i_dt number := 1;
226 j_dt number;
227 i_vl number := 1;
228 j_vl number;
229 -- vkodedal modified the length of varchar Bug# 6992595
230 l_date varchar2(2000);
231 l_value varchar2(2000);
232
233 k number := 1;
234 z number := 1;
235 ---- vkodedal new variables to store additional dates and values 14-May-2008 Bug# 6992595
236 l_comp_dates1 varchar2(1000);
237 l_comp_values1 varchar2(1000);
238 l_comp_dates2 varchar2(1000);
239 l_comp_values2 varchar2(1000);
240 l_comp_dates3 varchar2(1000);
241 l_comp_values3 varchar2(1000);
242
243 begin
244 hr_utility.set_location ('Entering: '||l_proc,05);
245 --
246 -- Initialise the formula .
247 --
248
249
250 ff_exec.init_formula
251 (p_formula_id => p_input_value_id,
252 p_effective_date => p_date_earned,
253 p_inputs => l_inputs,
254 p_outputs => l_outputs);
255
256 hr_utility.set_location ('Set Context '||l_proc,10);
257 hr_utility.set_location ('Set Context :'||l_inputs.first|| ' : ' || l_inputs.last,10);
258 --
259 for l_count in nvl(l_inputs.first,0)..nvl(l_inputs.last,-1) loop
260 --
261 if l_inputs(l_count).name = 'ASSIGNMENT_ID' then
262 --
263 l_inputs(l_count).value := p_assignment_id;
264 --
265 --
266 elsif l_inputs(l_count).name = 'PERIOD_START_DATE' then
267 --
268 l_inputs(l_count).value := fnd_date.date_to_canonical(p_perd_start_date);
269
270 elsif l_inputs(l_count).name = 'PERIOD_END_DATE' then
271 --
272 l_inputs(l_count).value := fnd_date.date_to_canonical(p_perd_end_date);
273 --
274 elsif l_inputs(l_count).name = 'DATE_EARNED' then
275
276 l_inputs(l_count).value := fnd_date.date_to_canonical(p_date_earned);
277 --
278 end if;
279 --
280 end loop;
281
282 hr_utility.set_location ('Run formula: '||l_proc,15);
283 --
284 -- We have loaded the input record . Now run the formula.
285 --
286 ff_exec.run_formula(p_inputs => l_inputs,
287 p_outputs => l_outputs);
288
289 hr_utility.set_location ('After Run formula: '||l_outputs.first || ' : ' ||l_outputs.last ,15);
290 --
291 --
292 -- Loop through the returned table and make sure that the returned
293 -- values have been found
294 -- vkodedal Bug 6992595 added variables & modified condition
295 --
296 for l_count in l_outputs.first..l_outputs.last loop
297 --
298 --
299 hr_utility.set_location ('After Run formula:'||l_outputs(l_count).name ,15);
300 --
301 if l_outputs(l_count).name = 'COMPENSATION_DATES' then
302 --
303 l_comp_dates := l_outputs(l_count).value;
304 --
305 Elsif l_outputs(l_count).name = 'COMPENSATION_DATES1' then
306 --
307 l_comp_dates1 := l_outputs(l_count).value;
308 --
309 Elsif l_outputs(l_count).name = 'COMPENSATION_DATES2' then
310 --
311 l_comp_dates2 := l_outputs(l_count).value;
312 --
313 Elsif l_outputs(l_count).name = 'COMPENSATION_DATES3' then
314 --
315 l_comp_dates3 := l_outputs(l_count).value;
316 --
317 Elsif l_outputs(l_count).name = 'VALUES' then
318 --
319 l_comp_values := l_outputs(l_count).value;
320 --
321 Elsif l_outputs(l_count).name = 'VALUES1' then
322 --
323 l_comp_values1 := l_outputs(l_count).value;
324 --
325 Elsif l_outputs(l_count).name = 'VALUES2' then
326 --
327 l_comp_values2 := l_outputs(l_count).value;
328 --
329 Elsif l_outputs(l_count).name = 'VALUES3' then
330 --
331 l_comp_values3 := l_outputs(l_count).value;
332 --
333 end if;
334 --
335 end loop;
336 -- vkodedal Bug 6992595 -- new changes
337 if(length(l_comp_dates1) > 0 and length(l_comp_values1) > 0 ) then
338 l_comp_dates :=l_comp_dates||';'||l_comp_dates1;
339 l_comp_values :=l_comp_values||';'||l_comp_values1;
340 hr_utility.set_location ('Dates from Additional variable 1 appended.',17);
341 end if;
342
343 if(length(l_comp_dates2) > 0 and length(l_comp_values2) > 0 ) then
344 l_comp_dates :=l_comp_dates||';'||l_comp_dates2;
345 l_comp_values :=l_comp_values||';'||l_comp_values2;
346 hr_utility.set_location ('Dates from Additional variable 2 appended.',18);
347 end if;
348
349 if(length(l_comp_dates3) > 0 and length(l_comp_values3) > 0 ) then
350 l_comp_dates :=l_comp_dates||';'||l_comp_dates3;
351 l_comp_values :=l_comp_values||';'||l_comp_values3;
352 hr_utility.set_location ('Dates from Additional variable 3 appended.',19);
356 loop
353 end if;
354 ---------------------end of new changes
355 if(length(l_comp_dates) > 0 and length(l_comp_values) > 0 ) then
357 j_dt := instr(l_comp_dates,';',1,k);
358 j_vl := instr(l_comp_values,';',1,k);
359 l_date := substr(l_comp_dates,i_dt,j_dt-i_dt);
360 l_value := substr(l_comp_values,i_vl,j_vl-i_vl);
361 if j_dt <> 0 then
362 i_dt := j_dt+1;
363 else
364 if i_dt < length(l_comp_dates) then
365 l_date := substr(l_comp_dates,i_dt);
366 end if;
367 i_dt := length(l_comp_dates) + 1;
368 end if;
369 if j_vl <> 0 then
370 i_vl := j_vl+1;
371 else
372 if i_vl < length(l_comp_values) then
373 l_value := substr(l_comp_values,i_vl);
374 end if;
375 i_vl := length(l_comp_values) +1;
376 end if;
377 if z > 1 then
378 p_rule_table(z-1).end_date :=to_date(l_date,'yyyy/mm/dd')-1;
379 end if;
380
381 IF ( to_date(l_date,'yyyy/mm/dd') >= p_perd_start_date and to_date(l_date,'yyyy/mm/dd')<= p_perd_end_date ) THEN
382 p_rule_table(z).start_date :=to_date(l_date,'yyyy/mm/dd');
383 -- p_bnfts_table(i).end_date := bnfts_rec.effective_end_date;
384 p_rule_table(z).value := l_value;
385 p_rule_table(z).output_key := z;
386 if p_comp_typ_cd = 'MNTRY' then
387 p_rule_table(z).currency_cd := p_currency_cd;
388 elsif p_comp_typ_cd = 'NNMNTRY' then
389 p_rule_table(z).uom := p_uom;
390 end if;
391 z := z +1;
392 END IF;
393 hr_utility.set_location('value of l_date '||l_date, 30);
394 hr_utility.set_location('value of j_dt '||j_dt, 30);
395 hr_utility.set_location('new value of i_dt '||i_dt, 30);
396 hr_utility.set_location('value of l_value '||l_value, 30);
397 hr_utility.set_location('value of j_vl '||j_vl, 30);
398 hr_utility.set_location('new value of i_vl '||i_vl, 30);
399
400 /* write('value of l_date '||l_date);
401 write('value of j_dt '||j_dt);
402 write('new value of i_dt '||i_dt);
403 write('value of l_value '||l_value);
404 write('value of j_vl '||j_vl);
405 write('new value of i_vl '||i_vl); */
406 k := k+1;
407 /*WRITE (i_dt);
408 WRITE(length(l_comp_dates));*/
409 exit when i_vl > length(l_comp_values);
410 exit when i_dt > length(l_comp_dates);
411 end loop;
412 end if ;
413 hr_utility.set_location('Leaving '||l_proc,20);
414 exception
415 when others then
416 g_status := '5';
417 WRITE('error in date format:' || sqlerrm);
418 hr_utility.set_location('exception '||sqlerrm,20);
419 end rule_entries;
420
421 procedure thrd_pty_entries (p_assignment_id in number,
422 p_perd_start_date in date,
423 p_perd_end_date in date,
424 p_input_value_id in number,
425 p_comp_typ_cd in varchar2,
426 p_currency_cd in varchar2,
427 p_uom in varchar2,
428 p_thrd_pty_table out nocopy period_table) is
429 cursor thrd_pty_rows is
430 -- 08-Apr-2008 vkodedal 6945274 - currency issue -3rd party payroll
431 -- get the currency from element when it's not available from balance types table
432 select pr.processing_date period_start_date,
433 pr.processing_date period_end_date,
434 ba.run_amount amount ,
435 bt.uom,
436 bt.currency,
437 ba.balance_amount_id,
438 pe.input_currency_code,
439 pi.uom input_value_uom,
440 bt.displayed_name
441 from
442 per_bf_balance_types bt,
443 per_bf_processed_assignments pa,
444 per_bf_balance_amounts ba,
445 per_bf_payroll_runs pr,
446 pay_element_types_f pe,
447 pay_input_values_f pi
448 where
449 pa.assignment_id = p_assignment_id
450 and pa.payroll_run_id = pr.payroll_run_id
451 and bt.input_value_id = p_input_value_id
452 and ba.balance_type_id = bt.balance_type_id
453 and ba.processed_assignment_id = pa.processed_assignment_id
454 and pr.processing_date between p_perd_start_date and p_perd_end_date
455 and ba.run_amount is not null
456 and pi.input_value_id = bt.input_value_id(+)
457 and pe.element_type_id = pi.element_type_id(+)
458 and trunc(sysdate) between pe.EFFECTIVE_START_DATE(+) and pe.EFFECTIVE_END_DATE(+)
459 and trunc(sysdate) between pi.EFFECTIVE_START_DATE(+) and pi.EFFECTIVE_END_DATE(+);
460
461 i integer := 1;
462 l_proc varchar2(1000) := g_package||'thrd_pty_entries';
463 begin
464 hr_utility.set_location('entering '||l_proc,10);
465 hr_utility.set_location('inside cost entries with iv'||p_input_value_id,10);
466 hr_utility.set_location('asg id'||p_assignment_id,11);
467 hr_utility.set_location('date range is '||to_char(p_perd_start_date,'dd/mm/yyyy')||' - '||to_char(p_perd_end_date,'dd/mm/yyyy'),12);
468 for thrd_pty_rec in thrd_pty_rows loop
469 p_thrd_pty_table(i).start_date := thrd_pty_rec.period_start_date;
470 p_thrd_pty_table(i).end_date := thrd_pty_rec.period_end_date;
471 p_thrd_pty_table(i).value := fnd_number.number_to_canonical(thrd_pty_rec.amount);
472
473 if p_comp_typ_cd = 'MNTRY' then
474 --- vkodedal 6945274 - currency issue -3rd party payroll
475 ---p_thrd_pty_table(i).currency_cd := nvl(p_currency_cd,thrd_pty_rec.currency);
479 elsif p_comp_typ_cd = 'NNMNTRY' then
476 p_thrd_pty_table(i).currency_cd := nvl(p_currency_cd,nvl(thrd_pty_rec.currency,thrd_pty_rec.input_currency_code));
477 hr_utility.set_location('Back feed : '||thrd_pty_rec.displayed_name||': Currency '||p_thrd_pty_table(i).currency_cd,15);
478
480 p_thrd_pty_table(i).uom := nvl(p_uom,nvl(thrd_pty_rec.uom,thrd_pty_rec.input_value_uom));
481 hr_utility.set_location('UOM '||p_thrd_pty_table(i).uom,16);
482 end if;
483 p_thrd_pty_table(i).output_key := thrd_pty_rec.balance_amount_id;
484 p_thrd_pty_table(i).actual_uom := thrd_pty_rec.uom;
485 i := i + 1;
486 end loop;
487 hr_utility.set_location('# of entries'||i,30);
488 hr_utility.set_location('Leaving '||l_proc,10);
489 exception
490 when others then
491 g_status := '4';
492 end thrd_pty_entries;
493
494 procedure cost_entries (p_assignment_id in number,
495 p_perd_start_date in date,
496 p_perd_end_date in date,
497 p_input_value_id in number,
498 p_comp_typ_cd in varchar2,
499 p_currency_cd in varchar2,
500 p_uom in varchar2,
501 p_cost_table out nocopy period_table) is
502 cursor cost_rows is
503 SELECT ppa2.effective_date
504 ,ppa2.date_earned
505 ,paaf.assignment_id
506 ,pivf.element_type_id
507 ,pc.input_value_id
508 ,pc.debit_or_credit
509 ,pec.costing_debit_or_credit
510 ,pc.costed_value
511 ,petf.output_currency_code
512 ,pc.cost_id
513 FROM per_all_assignments_f paaf,
514 pay_assignment_actions paa,
515 pay_assignment_actions paa2,
516 pay_payroll_actions ppa,
517 pay_payroll_actions ppa2,
518 pay_run_results ppr,
519 pay_costs pc,
520 pay_input_values_f pivf,
521 pay_element_types_f petf ,
522 pay_element_classifications_vl pec
523 WHERE paaf.assignment_id = paa2.assignment_id
524 AND paa2.assignment_id = paa.assignment_id
525 AND paa2.payroll_action_id = ppa2.payroll_action_id
526 AND paa2.assignment_action_id = ppr.assignment_action_id
527 AND ppr.run_result_id = pc.run_result_id
528 AND paa.payroll_action_id = ppa.payroll_action_id
529 AND paa.assignment_action_id = pc.assignment_action_id
530 AND nvl(pc.distributed_input_value_id, pc.input_value_id) = pivf.input_value_id
531 and pivf.input_value_id = p_input_value_id
532 and petf.element_type_id = pivf.element_type_id
533 AND ppa.action_type IN ('C', 'S')
534 AND pc.balance_or_cost = 'C'
535 AND pec.classification_id = petf.classification_id
536 AND ppa2.effective_date BETWEEN paaf.effective_start_date AND paaf.effective_end_date
537 AND ppa2.effective_date BETWEEN pivf.effective_start_date AND pivf.effective_end_date
538 AND ppa2.effective_date BETWEEN petf.effective_start_date AND petf.effective_end_date
539 AND paa2.assignment_id = p_assignment_id
540 AND ppa2.effective_date BETWEEN p_perd_start_date AND p_perd_end_date
541 AND pc.costed_value is not null;
542 i integer := 0;
543 l_amt number;
544 l_proc varchar2(1000) := g_package||' cost_entries';
545 begin
546 hr_utility.set_location('entering '||l_proc,10);
547 hr_utility.set_location('inside cost entries with iv'||p_input_value_id,10);
548 hr_utility.set_location('asg id'||p_assignment_id,11);
549 hr_utility.set_location('date range is '||to_char(p_perd_start_date,'dd/mm/yyyy')||' - '||to_char(p_perd_end_date,'dd/mm/yyyy'),12);
550 for cost_rec in cost_rows loop
551 i := i + 1;
552 p_cost_table(i).start_date := cost_rec.effective_date;
553 p_cost_table(i).end_date := cost_rec.effective_date;
554 if ( cost_rec.debit_or_credit = 'D' AND cost_rec.costing_debit_or_credit = 'C' ) OR
555 ( cost_rec.debit_or_credit = 'C' AND cost_rec.costing_debit_or_credit = 'D') then
556 l_amt := -1 * cost_rec.costed_value;
557 else
558 l_amt := cost_rec.costed_value;
559 end if;
560 p_cost_table(i).value := fnd_number.number_to_canonical(l_amt);
561 if p_comp_typ_cd = 'MNTRY' then
562 p_cost_table(i).currency_cd := nvl(p_currency_cd,cost_rec.output_currency_code);
563 elsif p_comp_typ_cd = 'NNMNTRY' then
564 p_cost_table(i).uom := p_uom;
565 end if;
566
567 p_cost_table(i).output_key := cost_rec.cost_id;
568
569 end loop;
570 hr_utility.set_location('# of entries'||i,30);
571 hr_utility.set_location('Leaving '||l_proc,10);
572 exception
573 when others then
574 g_status := '2';
575 end cost_entries;
576
577 procedure get_assignment_details( p_person_id in number,
578 p_effective_date in date,
579 p_assignment_id in number,
580 p_payroll_id out nocopy number,
581 p_salary_basis_id out nocopy number
582 ) is
583
584 cursor csr_assignment_details is
585 Select * from per_all_assignments_f
586 where person_id = p_person_id
587 and p_effective_date between effective_start_date and effective_end_date
588 and assignment_id = p_assignment_id ;
589
593 hr_utility.set_location('Entering'||l_proc,10);
590 l_assignment_rec csr_assignment_details%rowtype;
591 l_proc varchar2(60) := g_package||'get_person_details';
592 Begin
594
595 open csr_assignment_details;
596 fetch csr_assignment_details into l_assignment_rec;
597 if csr_assignment_details%notfound then
598 hr_utility.set_location('invalid Person id passed',10);
599
600 end if;
601 close csr_assignment_details;
602
603 p_payroll_id := l_assignment_rec.payroll_id;
604 p_salary_basis_id:= l_assignment_rec.pay_basis_id;
605 hr_utility.set_location('Leaving'||l_proc,10);
606 end get_assignment_details;
607
608
609 procedure get_element_details(p_item_key in number,
610 p_effective_date in date,
611 p_comp_type_cd in varchar2,
612 p_element_type_id out nocopy number,
613 p_processing_type out nocopy varchar2,
614 p_input_currency_code in out nocopy varchar2,
615 p_uom in out nocopy varchar2,
616 p_actual_uom out nocopy varchar2,
617 p_lookup_type out nocopy varchar2,
618 p_value_set_id out nocopy varchar2 ,
619 p_actual_currency_code out nocopy varchar2,
620 p_period_start_date in date ) is
621
622 cursor csr_element_details is
623 select inv.input_value_id input_value_id,
624 elm.element_type_id element_type_id,
625 elm.processing_type processing_type,
626 elm.INPUT_CURRENCY_CODE inp_cur_code,
627 inv.uom uom , inv.lookup_type ,inv.value_set_id
628 from pay_input_values_f inv, pay_element_types_f elm
629 where elm.element_type_id = inv.element_type_id
630 and inv.input_value_id = p_item_key
631 and inv.effective_start_date <= p_effective_date
632 and inv.effective_end_date >= p_period_start_date
633 and elm.effective_start_date <= p_effective_date
634 and elm.effective_end_date >= p_period_start_date ;
635 --and p_effective_date between inv.effective_start_date and inv.effective_end_date
636 --and p_effective_date between elm.effective_start_date and elm.effective_end_date;
637
638 l_element_rec csr_element_details%rowtype;
639 l_proc varchar2(60) := g_package||'get_element_details';
640 Begin
641
642 hr_utility.set_location('Entering'||l_proc,10);
643 hr_utility.set_location('date'||p_effective_date,1900);
644 hr_utility.set_location('item'||p_item_key,190);
645
646 open csr_element_details;
647 fetch csr_element_details into l_element_rec;
648 if csr_element_details%notfound then
649 g_status := '1A';
650 hr_utility.set_location('Wrong input_value_id passed for Element Entry ', 40);
651 end if;
652 close csr_element_details;
653
654 p_element_type_id := l_element_rec.element_type_id;
655 p_processing_type := l_element_rec.processing_type;
656 p_lookup_type := l_element_rec.lookup_type;
657 p_value_set_id := l_element_rec.value_set_id ;
658 p_actual_currency_code := l_element_rec.inp_cur_code;
659
660 if (p_comp_type_cd = 'MNTRY' and p_input_currency_code is null) then
661 p_input_currency_code := l_element_rec.inp_cur_code;
662 elsif (p_comp_type_cd = 'NNMNTRY' and p_uom is null) then
663 p_uom := l_element_rec.uom;
664 end if;
665
666 p_actual_uom := l_element_rec.uom;
667
668 hr_utility.set_location('p_actual_uom'||p_actual_uom,10);
669
670 hr_utility.set_location('Leaving'||l_proc,10);
671 end get_element_details;
672
673 procedure get_pay_periods( p_perd_st_dt in date,
674 p_perd_en_dt in date,
675 p_frequency in varchar2
676 ) is
677 period_start_date date;
678 period_end_Date date;
679 flag varchar2(1) := 'Y' ;
680 l_proc varchar2(60) := g_package||'get_pay_periods';
681 begin
682 hr_utility.set_location('Entering'||l_proc,10);
683 period_start_date := p_perd_st_dt;
684 period_end_date := p_perd_en_dt;
685 hr_utility.set_location('freq_cd'||p_frequency,10);
686 if p_frequency = 'ANN' then
687 while flag = 'Y'
688 loop
689 if months_between(p_perd_en_dt,period_start_date) < 12 then
690 flag := 'N';
691 Insert_period ( p_period_start_date => period_start_date,
692 p_period_end_date => p_perd_en_dt
693 );
694 else
695 period_end_date := add_months(period_start_date,12) - 1;
696 Insert_period ( p_period_start_date => period_start_date,
697 p_period_end_date => period_end_date
698 );
699 period_start_date := period_end_date + 1;
700 end if;
701 end loop;
702 elsif p_frequency = 'MON' then
703 while flag = 'Y'
704 loop
705 if months_between(p_perd_en_dt,period_start_date) < 1 then
706 flag := 'N';
707 Insert_period ( p_period_start_date => period_start_date,
708 p_period_end_date => p_perd_en_dt
709 );
710 else
711 period_end_date := add_months(period_start_date,1) - 1;
712 Insert_period ( p_period_start_date => period_start_date,
713 p_period_end_date => period_end_date
714 );
718 elsif p_frequency = 'DA' then
715 period_start_date := period_end_date + 1;
716 end if;
717 end loop;
719 while flag = 'Y'
720 loop
721 if ((p_perd_en_dt - period_start_date) < 1) then
722 flag := 'N';
723 Insert_period ( p_period_start_date => period_start_date,
724 p_period_end_date => p_perd_en_dt
725 );
726 else
727 period_end_date := period_start_date;
728 Insert_period ( p_period_start_date => period_start_date,
729 p_period_end_date => period_end_date
730 );
731 period_start_date := period_end_date + 1;
732 end if;
733 end loop;
734 end if;
735 hr_utility.set_location('Leaving'||l_proc,10);
736 end get_pay_periods;
737
738
739 procedure get_payroll_periods(p_assignment_id in number,
740 p_perd_st_dt in date,
741 p_perd_en_dt in date,
742 p_value in varchar2,
743 p_output_key in number,
744 p_currency_cd in varchar2,
745 p_uom in varchar2,
746 p_creator_type in varchar2,
747 p_actual_uom in varchar2,
748 p_salary_basis in varchar2 default 'N'
749 ) is
750
751 cursor csr_asg_payroll is
752 select distinct asg.payroll_id,
753 asg.effective_start_date,
754 asg.effective_end_date,number_per_fiscal_year
755 from per_all_assignments_f asg,
756 pay_payrolls_f pay ,per_time_period_types period,PER_ASSIGNMENT_STATUS_TYPES status
757 where assignment_id = p_assignment_id
758 --vkodedal = is added to fix payroll period issue 07-Sep-07
759 and asg.effective_start_date <= p_perd_en_dt
760 and asg.effective_end_date >= p_perd_st_dt
761 and asg.payroll_id is not null
762 and pay.payroll_id = asg.payroll_id
763 and pay.effective_end_date = (select max(effective_end_date) from pay_payrolls_f where payroll_id =
764 asg.payroll_id )
765 and period.period_type = pay.period_type
766 AND nvl(status.business_group_id,asg.business_group_id) = asg.business_group_id
767 AND status.active_flag = 'Y'
768 AND asg.ASSIGNMENT_STATUS_TYPE_ID = status.ASSIGNMENT_STATUS_TYPE_ID
769 AND status.per_system_status IN ('ACTIVE_ASSIGN' , 'ACTIVE_CWK');
770
771 cursor csr_payroll_periods (p_pay_id number, p_psd date, p_ped date )is
772 Select * from PER_TIME_PERIODS_V
773 where payroll_id = p_pay_id
774 and not(start_date > p_ped)
775 and not(end_date < p_psd );
776
777 l_payroll_periods csr_payroll_periods%rowtype;
778 l_asg_payroll csr_asg_payroll%rowtype;
779 l_start_date date;
780 l_end_date date;
781 l_next_row number;
782 l_proc varchar2(60) := g_package||'get_payroll_periods';
783 l_asg_pay varchar2(1) := 'N';
784 l_value varchar2(240);
785 begin
786 hr_utility.set_location('Entering'||l_proc,10);
787 hr_utility.set_location(l_proc||' '||p_perd_st_dt,10);
788 hr_utility.set_location(l_proc||' '||p_perd_en_dt,10);
789 hr_utility.set_location(l_proc||' '||p_value,10);
790 hr_utility.set_location('Entering'||l_proc,10);
791 open csr_asg_payroll;
792 loop
793 fetch csr_asg_payroll into l_asg_payroll;
794 exit when csr_asg_payroll%notfound;
795 l_asg_pay := 'Y';
796 if l_asg_payroll.effective_start_date < p_perd_st_dt then
797 l_start_date := p_perd_st_dt;
798 else
799 l_start_date := l_asg_payroll.effective_start_date;
800 end if;
801
802 if l_asg_payroll.effective_end_date > p_perd_en_dt then
803 l_end_date := p_perd_en_dt;
804 else
805 l_end_date := l_asg_payroll.effective_end_date;
806 end if;
807 if (p_salary_basis = 'Y' ) then
808
809 l_value := fnd_number.number_to_canonical(fnd_number.canonical_to_number(p_value)/l_asg_payroll.number_per_fiscal_year );
810 else
811 l_value := p_value;
812 end if;
813 hr_utility.set_location('l_start_date '||l_start_date, 57);
814 hr_utility.set_location('l_end_date '||l_end_date, 57);
815 hr_utility.set_location('payroll_id '||l_asg_payroll.payroll_id, 57);
816 open csr_payroll_periods(l_asg_payroll.payroll_id, l_start_date, l_end_date);
817 loop
818 fetch csr_payroll_periods into l_payroll_periods;
819 exit when csr_payroll_periods%notfound;
820 if l_payroll_periods.end_date <= p_perd_en_dt then
821 if( NVL(g_period_table.LAST, 0) > 0 and l_payroll_periods.end_date = g_period_table(NVL(g_period_table.LAST, 0)).end_date) then
822 hr_utility.set_location('Entry already created for this period '||l_payroll_periods.end_date ,10);
823 else
824 -- if l_payroll_periods.end_date <= l_end_date then
825 hr_utility.set_location('into the if statment '||p_value,10);
826 l_next_row := NVL(g_period_table.LAST, 0) + 1;
827 g_period_table(l_next_row).start_date := l_payroll_periods.start_date;
828 g_period_table(l_next_row).end_date := l_payroll_periods.end_date;
829 g_period_table(l_next_row).value := l_value;
830 g_period_table(l_next_row).currency_cd := p_currency_cd;
831 g_period_table(l_next_row).uom := p_uom;
832 g_period_table(l_next_row).output_key := p_output_key;
833 g_period_table(l_next_row).creator_type := p_creator_type;
837
834 g_period_table(l_next_row).actual_uom := p_actual_uom;
835 end if;
836 end if;
838 end loop;
839 close csr_payroll_periods;
840 end loop;
841 if l_asg_pay = 'N' then
842 g_status := '1C';
843 hr_utility.set_location('No payroll attached to the assignment',10);
844 end if;
845
846 close csr_asg_payroll;
847 hr_utility.set_location('Leaving'||l_proc,10);
848 end get_payroll_periods;
849
850
851 procedure pay_details (p_elm_table in period_table,
852 p_source_key in number,
853 p_assignment_id in number,
854 p_effective_date in date,
855 p_perd_st_dt in date,
856 p_perd_en_dt in date,
857 p_currency_cd in varchar2,
858 p_uom in varchar2,
859 p_actual_uom in varchar2
860 ) is
861
862 l_number_of_rows number;
863 l_perd_amount number;
864 l_elm_rows number;
865 l_proc varchar2(60) := g_package||'pay_details';
866 l_esd date;
867 l_eed date;
868 l_pay_basis_id number;
869 l_rate_basis varchar2(2000);
870 l_pay_ann_factor number;
871 l_name varchar2(2000);
872 l_no_of_periods number;
873 l_value number;
874 l_next_row number;
875 l_salary_basis varchar2(1);
876
877 Begin
878 hr_utility.set_location('Entering'||l_proc,10);
879 l_number_of_rows := p_elm_table.count;
880 for ee_row in 1..l_number_of_rows
881 loop
882 if p_elm_table(ee_row).end_date > p_perd_en_dt then
883 l_eed := p_perd_en_dt;
884 else
885 l_eed := p_elm_table(ee_row).end_date;
886 end if;
887
888 if p_elm_table(ee_row).start_date < p_perd_st_dt then
889 l_esd := p_perd_st_dt;
890 else
891 l_esd := p_elm_table(ee_row).start_date;
892 end if;
893
894 hr_utility.set_location('value'||p_elm_table(ee_row).value, 40);
895 hr_utility.set_location('stend1'||l_eed, 40);
896 hr_utility.set_location('start1'||l_esd, 40);
897 if p_elm_table(ee_row).creator_type = 'SP' then
898 /* Get the pay basis id, pay annulization factor and rate basis from
899 per pay bases depending on input_value_id */
900 hr_utility.set_location('Creator for element_entry is salary proposal', 40);
901 get_salary_basis_details ( p_input_value_id => p_source_key,
902 p_effective_date => p_effective_date,
903 p_period_start_date => p_perd_st_dt ,
904 p_assignment_id => p_assignment_id,
905 p_pay_basis_id => l_pay_basis_id,
906 p_rate_basis => l_rate_basis,
907 p_PAY_ANN_FACTOR => l_pay_ann_factor,
908 p_name => l_name
909 );
910
911 if g_status = '0' then
912 if l_pay_ann_factor is not null then
913 hr_utility.set_location('Annulization factor is not null', 30);
914 l_salary_basis := 'Y';
915 if l_pay_ann_factor <= 0 then
916 l_pay_ann_factor := 1;
917 end if;
918 IF l_rate_basis = 'HOURLY' THEN
919 --Bug 7537970 - pass element entry start date not period start date to get fte factor
920 l_pay_ann_factor := l_pay_ann_factor *PER_SALADMIN_UTILITY.get_fte_factor(p_assignment_id,l_esd);
921 END If;
922 l_value := l_pay_ann_factor * fnd_number.canonical_to_number(p_elm_table(ee_row).value);
923 else
924 l_value := p_elm_table(ee_row).value;
925 l_salary_basis := 'N';
926 end if ;
927 hr_utility.set_location('Annulization factor is null', 30);
928 get_payroll_periods(p_assignment_id => p_assignment_id,
929 p_perd_st_dt => l_esd,
930 p_perd_en_dt => l_eed,
931 p_value => fnd_number.number_to_canonical(l_value),
932 p_output_key => p_elm_table(ee_row).output_key,
933 p_currency_cd => p_currency_cd,
934 p_uom => p_uom,
935 p_creator_type => p_elm_table(ee_row).creator_type,
936 p_actual_uom => p_actual_uom,
937 p_salary_basis => l_salary_basis
938 );
939
940 -- end if;
941 end if;
942
943 else
944 get_payroll_periods(p_assignment_id => p_assignment_id,
945 p_perd_st_dt => l_esd,
946 p_perd_en_dt => l_eed,
947 p_value => p_elm_table(ee_row).value,
948 p_output_key => p_elm_table(ee_row).output_key,
949 p_currency_cd => p_currency_cd,
950 p_uom => p_uom,
954 end if;
951 p_creator_type => p_elm_table(ee_row).creator_type,
952 p_actual_uom => p_actual_uom
953 );
955
956 end loop;
957
958 hr_utility.set_location('Leaving'||l_proc,10);
959
960 End pay_details;
961
962 procedure populate_result_table(p_elm_table in period_table,
963 p_currency_cd in varchar2,
964 p_uom in varchar2,
965 p_actual_uom in varchar2
966 ) is
967 l_number_of_rows number;
968 l_next_row number;
969 Begin
970 l_number_of_rows := p_elm_table.count;
971 hr_utility.set_location('number of rows in p_elm_table '||p_elm_table.count,46);
972 for ee_row in 1..l_number_of_rows
973 loop
974
975 l_next_row := NVL(g_period_table.LAST, 0) + 1;
976 g_period_table(l_next_row).start_date := p_elm_table(ee_row).start_date;
977 g_period_table(l_next_row).end_date := p_elm_table(ee_row).end_date;
978 g_period_table(l_next_row).value := p_elm_table(ee_row).value;
979 g_period_table(l_next_row).currency_cd := p_currency_cd;
980 g_period_table(l_next_row).uom := p_uom;
981 g_period_table(l_next_row).actual_uom := p_actual_uom;
982 g_period_table(l_next_row).output_key := p_elm_table(ee_row).output_key;
983 g_period_table(l_next_row).creator_type := p_elm_table(ee_row).creator_type;
984
985 end loop;
986 end populate_result_table;
987
988 procedure get_value_for_item(p_source_cd in varchar2,
989 p_source_key in varchar2,
990 p_perd_st_dt in date,
991 p_perd_en_dt in date,
992 p_person_id in number,
993 p_assignment_id in number,
994 p_effective_date in date,
995 p_comp_typ_cd in varchar2,
996 p_currency_cd in varchar2,
997 p_uom in varchar2,
998 p_result out nocopy period_table,
999 p_status out nocopy varchar2) is
1000
1001 /* cursor csr_item is select * from ben_tcs_item
1002 where item_id = p_comp_item_id; */
1003 -- l_item_rec csr_item%rowtype;
1004
1005 l_element_id number;
1006 l_input_value_id number;
1007 l_proc_type varchar2(30);
1008 l_lookup_type varchar2(240);
1009 l_value_set_id varchar2(240);
1010 l_actual_currency_code varchar2(30);
1011 l_el_curr_cd pay_element_types_f.input_currency_code%type;
1012 l_summary period_table;
1013 l_uom pay_input_values_f.uom%type;
1014 l_proc varchar2(60) := g_package||'get_value_for_item';
1015 l_actual_uom pay_input_values_f.uom%type;
1016
1017 begin
1018 hr_utility.set_location('Entering'||l_proc,10);
1019 hr_utility.set_location('For Person '||p_person_id,499);
1020 hr_utility.set_location('For Assignment id'||p_assignment_id,499);
1021 hr_utility.set_location('For p_perd_en_dt '||p_perd_en_dt,499);
1022
1023 g_status := '0';
1024 l_el_curr_cd := p_currency_cd;
1025 l_uom := p_uom;
1026 if p_source_cd = 'EE' then
1027
1028 hr_utility.set_location('source is element entry',20);
1029
1030 get_element_details(p_item_key => p_source_key,
1031 p_effective_date => p_effective_date,
1032 p_comp_type_cd => p_comp_typ_cd,
1033 p_element_type_id => l_element_id,
1034 p_processing_type => l_proc_type,
1035 p_input_currency_code => l_el_curr_cd,
1036 p_uom => l_uom,
1037 p_actual_uom => l_actual_uom,
1038 p_lookup_type => l_lookup_type ,
1039 p_value_set_id => l_value_set_id ,
1040 p_actual_currency_code=> l_actual_currency_code,
1041 p_period_start_date => p_perd_st_dt
1042 );
1043
1044
1045 hr_utility.set_location('element processing type is '||l_proc_type,31);
1046 hr_utility.set_location('element uom is '||l_uom,31);
1047 hr_utility.set_location('element input currency code is '||l_el_curr_cd,31);
1048
1049 IF (g_status = '1A' )THEN
1050 WRITE(' The Input Value is not valid as of the Period End Date');
1051 hr_utility.set_location('1a' ,99);
1052 END IF;
1053
1054
1055 if g_status = '0' then
1056 delete_rows;
1057 element_entry(p_assignment_id => p_assignment_id,
1058 p_element_type_id => l_element_id,
1059 p_input_value_id => p_source_key,
1060 p_perd_st_dt => p_perd_st_dt,
1061 p_perd_en_dt => p_perd_en_dt,
1062 p_summary => l_summary,
1063 p_actual_uom => l_actual_uom,
1064 p_lookup_type => l_lookup_type,
1065 p_value_set_id => l_value_set_id ,
1066 p_actual_currency_code=> l_actual_currency_code );
1067
1068 hr_utility.set_location('summary table count '||l_summary.count, 30);
1069 hr_utility.set_location('l_proc_type '||l_proc_type, 30);
1070 hr_utility.set_location('l_uom '||l_uom, 30);
1071
1072 --commented for Bug#5098869
1073 -- if l_proc_type ='R' and l_uom is null then
1074 -- added for for Bug#5098869
1075
1076 if ( l_summary.count > 0) then
1077 if l_proc_type ='R' then
1078 hr_utility.set_location('Processing type is Recurring ', 30);
1079 hr_utility.set_location('st'||p_perd_st_dt ||'end'||p_perd_en_dt,40);
1080
1081 pay_details ( p_elm_table => l_summary,
1082 p_source_key => p_source_key,
1083 p_assignment_id => p_assignment_id,
1084 p_effective_date => p_effective_date,
1085 p_perd_st_dt => p_perd_st_dt,
1086 p_perd_en_dt => p_perd_en_dt,
1087 p_currency_cd => l_el_curr_cd,
1088 p_uom => l_uom,
1089 p_actual_uom => l_actual_uom
1090 );
1091 elsif l_proc_type ='N' then
1092
1093 hr_utility.set_location('Processing tye is N '||l_summary.count, 30);
1094
1095 populate_result_table(p_elm_table => l_summary,
1096 p_currency_cd => l_el_curr_cd,
1097 p_uom => l_uom,
1098 p_actual_uom => l_actual_uom
1099 );
1100 end if;
1101 end if;
1102
1103 if g_status = '0' then
1104 p_result := g_period_table;
1105 end if;
1106
1107 end if;
1108
1109 elsif p_source_cd = 'PAYCOSTG' then
1110
1111 hr_utility.set_location('source is Payroll Costing',20);
1112
1113 cost_entries (p_assignment_id => p_assignment_id,
1114 p_perd_start_date => p_perd_st_dt,
1115 p_perd_end_date => p_perd_en_dt,
1116 p_input_value_id => p_source_key,
1117 p_comp_typ_cd => p_comp_typ_cd,
1118 p_currency_cd => p_currency_cd,
1119 p_uom => p_uom,
1120 p_cost_table => p_result);
1121
1122 elsif p_source_cd = 'BB' then
1123
1124 hr_utility.set_location('source is Benefit balances',20);
1125
1126 bnfts_entries(p_person_id => p_person_id,
1127 p_perd_st_dt => p_perd_st_dt,
1128 p_perd_en_dt => p_perd_en_dt,
1129 p_input_value_id => p_source_key,
1130 p_comp_typ_cd => p_comp_typ_cd,
1131 p_currency_cd => p_currency_cd,
1132 p_uom => p_uom,
1133 p_bnfts_table => p_result
1134 );
1135
1136 elsif p_source_cd = 'THRDPTYPAY' then
1137
1138 hr_utility.set_location('source is Third Party payroll',20);
1139
1140 thrd_pty_entries(p_assignment_id => p_assignment_id,
1141 p_perd_start_date => p_perd_st_dt,
1142 p_perd_end_date => p_perd_en_dt,
1143 p_input_value_id => p_source_key,
1144 p_comp_typ_cd => p_comp_typ_cd,
1145 p_currency_cd => p_currency_cd,
1146 p_uom => p_uom,
1147 p_thrd_pty_table => p_result);
1148
1149 elsif p_source_cd = 'RULE' then
1150
1151 hr_utility.set_location('source is Rule',20);
1152
1153 rule_entries(p_assignment_id => p_assignment_id,
1154 p_perd_start_date => p_perd_st_dt,
1155 p_perd_end_date => p_perd_en_dt,
1156 p_date_earned => p_effective_date,
1157 p_input_value_id => p_source_key,
1158 p_comp_typ_cd => p_comp_typ_cd,
1159 p_currency_cd => p_currency_cd,
1160 p_uom => p_uom,
1161 p_rule_table => p_result);
1162 else
1163 hr_utility.set_location('Invalid Source Code '||p_source_cd, 200);
1164 g_status := '6';
1165
1166 end if;
1167
1168 IF ( g_status = '1A' ) THEN
1169 p_status := '0' ;
1170 ELSE
1171 p_status := g_status;
1172 END IF;
1173
1174 hr_utility.set_location('Leaving'||l_proc,10);
1175
1176 end get_value_for_item;
1177 end BEN_TCS_COMPENSATION;