DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SA_RULES

Source


1 package body pay_sa_rules as
2 /* $Header: pysarule.pkb 115.0 2003/12/24 01:39:13 abppradh noship $ */
3 
4 --
5 --
6 -- private globals used for caching in get_dynamic_org_meth
7   TYPE g_org_meth_map_rec IS RECORD (
8     estab_id           pay_assignment_actions.tax_unit_id%TYPE,
9     gen_org_paymeth_id pay_org_payment_methods_f.ORG_PAYMENT_METHOD_ID%TYPE,
10     new_org_paymeth_id pay_org_payment_methods_f.ORG_PAYMENT_METHOD_ID%TYPE,
11     err_name           fnd_new_messages.MESSAGE_NAME%TYPE,
12     opm_name_token     varchar2(80),
13     org_name_token     varchar2(60),
14     org_type_token     varchar2(20));
15   TYPE g_org_meth_map_typ IS TABLE OF g_org_meth_map_rec
16     Index by BINARY_INTEGER;
17   g_org_meth_map_tbl     g_org_meth_map_typ;
18   g_assignment_action_id pay_assignment_actions.assignment_action_id%TYPE;
19   g_estab_id             pay_assignment_actions.tax_unit_id%TYPE;
20 -- end of private globals used for caching in get_dynamic_org_meth
21 
22 
23   procedure get_source_text_context
24     (p_asg_act_id number
25     ,p_ee_id number
26     ,p_source_text in out nocopy varchar2)
27   is
28     l_joiner         varchar2(1) := 'N';
29   begin
30     hr_utility.set_location('PAY_SA_RULES.get_source_text_context',1);
31     begin
32       select 'Y'
33       into   l_joiner
34       from   pay_assignment_actions aa
35              ,pay_payroll_actions pa
36              ,per_all_assignments_f asg
37              ,per_periods_of_service pos
38       where  aa.assignment_action_id = p_asg_act_id
39       and    pa.payroll_action_id    = aa.payroll_action_id
40       and    aa.assignment_id = asg.assignment_id
41       and    asg.period_of_service_id = pos.period_of_service_id
42       and    trunc(POS.date_start, 'MM') = trunc(PA.effective_date, 'MM')
43       and    pa.effective_date between ASg.effective_start_date
44                                and ASg.effective_end_date;
45     exception
46       when others then
47         l_joiner := 'N';
48     end;
49     p_source_text := l_joiner;
50     hr_utility.set_location('pay_sa_RULES.get_source_text_context='||
51                                p_source_text,2);
52 
53   end get_source_text_context;
54 
55 
56   procedure get_source_text2_context
57     (p_asg_act_id number
58     ,p_ee_id number
59     ,p_source_text2 in out nocopy varchar2)
60   is
61     l_leaver     varchar2(1) := 'N';
62   begin
63     hr_utility.set_location('PAY_SA_RULES.get_source_text_context',1);
64     begin
65       select 'Y'
66       into   l_leaver
67       from   pay_assignment_actions aa
68              ,pay_payroll_actions pa
69              ,per_all_assignments_f asg
70              ,per_periods_of_service POS
71       where  aa.assignment_action_id = p_asg_act_id
72       and    pa.payroll_action_id    = aa.payroll_action_id
73       and    aa.assignment_id = asg.assignment_id
74       and    asg.period_of_service_id = pos.period_of_service_id
75       and    trunc(NVL(POS.actual_termination_date , TO_DATE('31/12/4712','DD/MM/YYYY')), 'MM') = trunc(PA.effective_date, 'MM')
76       and  pa.effective_date between ASg.effective_start_date
77                                 and ASg.effective_end_date;
78     exception
79       when otherS then
80         l_leaver := 'N';
81     end;
82     p_source_text2 := l_leaver;
83     hr_utility.set_location('pay_sa_RULES.get_source_text_context='||
84                                p_source_text2,2);
85 
86   end get_source_text2_context;
87 
88 
89   procedure get_source_number_context
90     (p_asg_act_id number
91     ,p_ee_id number
92     ,p_source_number in out nocopy varchar2)
93   is
94     l_nationality_cd     varchar2(30);
95   begin
96     begin
97       select nationality
98       into   l_nationality_cd
99       from   pay_assignment_actions aa
100              ,pay_payroll_actions pa
101              ,per_all_assignments_f asg
102              ,per_all_people_f per
103       where  aa.assignment_action_id = p_asg_act_id
104       and    pa.payroll_action_id    = aa.payroll_action_id
105       and    aa.assignment_id = asg.assignment_id
106       and    asg.person_id = per.person_id
107       and    pa.effective_date between ASg.effective_start_date
108                                and ASg.effective_end_date
109       and    pa.effective_date between PER.effective_start_date
110                                and PER.effective_end_date;
111 
112       if l_nationality_cd = UPPER(FND_PROFILE.VALUE('PER_LOCAL_NATIONALITY')) then
113         p_source_number := 1;
114       else
115         p_source_number := 2;
116       end if;
117 
118     exception
119       when others then
120         p_source_number := 0;
121     end;
122     hr_utility.set_location('Leaving get_source_number_context.',10);
123 
124   end get_source_number_context;
125 end pay_sa_rules;