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:
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
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;
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,
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
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;
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);
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,
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
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;
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);
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
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:
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,
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,
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;
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,
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:
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: --
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
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,
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
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;
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;
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;
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);
353: end if;
354: ---------------------end of new changes
355: if(length(l_comp_dates) > 0 and length(l_comp_values) > 0 ) then
356: loop
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);
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);
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:
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);
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);
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);
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);
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,
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
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;
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;
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);
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);
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:
479: elsif p_comp_typ_cd = 'NNMNTRY' then
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);
477: hr_utility.set_location('Back feed : '||thrd_pty_rec.displayed_name||': Currency '||p_thrd_pty_table(i).currency_cd,15);
478:
479: elsif p_comp_typ_cd = 'NNMNTRY' then
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;
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';
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;
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
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;
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;
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;
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';
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;
589:
590: l_assignment_rec csr_assignment_details%rowtype;
591: l_proc varchar2(60) := g_package||'get_person_details';
592: Begin
593: hr_utility.set_location('Entering'||l_proc,10);
594:
595: open csr_assignment_details;
596: fetch csr_assignment_details into l_assignment_rec;
597: if csr_assignment_details%notfound then
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:
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,
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;
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;
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
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;
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:
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,
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
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
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,
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);
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;
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
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;
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;
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
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;
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;
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;
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;
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);
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,
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
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
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 */
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);
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,
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;
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),
954: end if;
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,
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;
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:
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';
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;
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;
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,
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
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');
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);
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
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
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
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
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,
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,
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,
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,
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,
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,
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,
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:
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;