[Home] [Help]
PACKAGE BODY: APPS.PA_PAY_UTIL
Source
1 PACKAGE BODY PA_PAY_UTIL AS
2 /* $Header: PAPYUTLB.pls 120.1 2011/04/07 07:26:14 speddi noship $ */
3
4 PROCEDURE update_pa_audit
5 (
6 P_PAYROLL_ACTION_ID IN NUMBER
7 , P_PAYROLL_ID IN NUMBER
8 , P_TIME_PERIOD_ID IN VARCHAR2
9 , P_PERSON_ID IN NUMBER
10 , P_ASSIGNMENT_ID IN NUMBER
11 , X_RETURN_STATUS OUT NOCOPY VARCHAR2
12 ) IS
13 BEGIN
14 UPDATE PA_PAY_PROJ_STATUS_ALL
15 SET PAYROLL_STATUS_FLAG = 'R'
16 WHERE INTERFACE_RUN_ID IN
17 (SELECT INTERFACE_RUN_ID
18 FROM PA_PAY_AUDIT_ALL
19 WHERE BATCH_ID = P_PAYROLL_ACTION_ID
20 AND TIME_PERIOD_ID = P_TIME_PERIOD_ID
21 AND PAYROLL_ID = P_PAYROLL_ID
22 AND INT_EXT_INDICATOR = 'INT'
23 )
24 AND PERSON_ID = P_PERSON_ID
25 AND ASSIGNMENT_ID = P_ASSIGNMENT_ID ;
26
27 END update_pa_audit;
28
29 FUNCTION get_task(p_assignment_id NUMBER,
30 p_earned_date DATE)
31 return varchar2 IS
32
33 l_task_number pa_tasks.task_number%TYPE;
34
35 begin
36
37 if pa_pay_util.g_expenditure_item_id is not null then
38 select task_number
39 into l_task_number
40 from pa_tasks
41 where task_id = (select task_id
42 from pa_expenditure_items_all
43 where expenditure_item_id = pa_pay_util.g_expenditure_item_id);
44
45 return l_task_number;
46 else
47 return pa_pay_util.g_task_number;
48 end if;
49
50 exception
51 when no_data_found then
52 return null;
53 end get_task;
54
55 FUNCTION get_project(p_assignment_id NUMBER,
56 p_earned_date DATE)
57 return varchar2 IS
58
59 l_project_number pa_projects_all.segment1%TYPE;
60
61 begin
62 if pa_pay_util.g_expenditure_item_id is not null then
63 select segment1
64 into l_project_number
65 from pa_projects_all
66 where project_id = (select project_id
67 from pa_expenditure_items_all
68 where expenditure_item_id = pa_pay_util.g_expenditure_item_id);
69
70 return l_project_number;
71 else
72 return pa_pay_util.g_project_number;
73 end if;
74
75 exception
76 when no_data_found then
77 return null;
78 end get_project;
79
80 FUNCTION get_job(p_assignment_id NUMBER,
81 p_earned_date DATE)
82 return varchar2 IS
83
84 l_job_name per_jobs_v.name%TYPE;
85
86 begin
87 if pa_pay_util.g_expenditure_item_id is not null then
88 select name
89 into l_job_name
90 from per_jobs_v
91 where job_id = (select job_id
92 from pa_expenditure_items_all
93 where expenditure_item_id = pa_pay_util.g_expenditure_item_id);
94 return l_job_name;
95 else
96 return pa_pay_util.g_job_name;
97 end if;
98
99 exception
100 when no_data_found then
101 return null;
102 end get_job;
103
104 FUNCTION get_location (p_assignment_id NUMBER,
105 p_earned_date DATE)
106 return varchar2 IS
107
108 l_location_code hr_locations.location_code%TYPE;
109
110 begin
111 if pa_pay_util.g_expenditure_item_id is not null then
112 select location_code
113 into l_location_code
114 from hr_locations
115 where location_id = (select location_id
116 from pa_expenditure_items_all
117 where expenditure_item_id = pa_pay_util.g_expenditure_item_id);
118 return l_location_code;
119 else
120 return pa_pay_util.g_location_code;
121 end if;
122
123 exception
124 when no_data_found then
125 return null;
126 end get_location;
127
128 FUNCTION get_work_type(p_assignment_id NUMBER,
129 p_earned_date DATE)
130 return varchar2 IS
131
132 l_work_type_name pa_work_types_vl.name%TYPE;
133
134 begin
135 if pa_pay_util.g_expenditure_item_id is not null then
136 select name
137 into l_work_type_name
138 from pa_work_types_vl
139 where work_type_id = (select work_type_id
140 from pa_expenditure_items_all
141 where expenditure_item_id = pa_pay_util.g_expenditure_item_id);
142
143 return l_work_type_name;
144 else
145 return pa_pay_util.g_work_type_name;
146 end if;
147
148 exception
149 when no_data_found then
150 return null;
151 end get_work_type;
152
153 procedure set_global_ei(p_ei_id number) IS
154 begin
155 pa_pay_util.g_expenditure_item_id := p_ei_id;
156 end set_global_ei;
157
158 procedure get_hr_rate(p_person_id in NUMBER,
159 p_assignment_id in number,
160 p_ei_date in date,
161 p_ei_id in varchar2,
162 p_rbc_elem_type_id in number,
163 x_rate OUT NOCOPY varchar2) IS
164
165 l_bg_id number;
166 l_max_rate number;
167 l_mid_rate number;
168 l_min_rate number;
169 l_rate_factor_cnt number;
170 l_business_group_id number;
171 l_rbc_rate number;
172
173 l_ei_id number;
174
175 subtype l_rate_factors_type is pqh_rbc_rate_retrieval.g_rbc_factor_tbl;
176 l_rbc_factors l_rate_factors_type;
177 begin
178
179 if p_ei_id is null then
180 pa_pay_util.g_expenditure_item_id := NULL;
181 else
182 l_ei_id := to_number(p_ei_id);
183 set_global_ei(l_ei_id);
184 end if;
185
186 select business_group_id
187 into l_business_group_id
188 from pa_implementations;
189
190 pqh_rbc_rate_retrieval.determine_rbc_rate(
191 p_element_type_id => p_rbc_elem_type_id,
192 p_crit_rt_defn_id => NULL,
193 p_person_id => p_person_id,
194 p_assignment_id => p_assignment_id,
195 p_business_group_id => l_business_group_id,
196 p_effective_date => p_ei_date,
197 p_rate_factors => l_rbc_factors,
198 p_rate_factor_cnt => l_rate_factor_cnt,
199 p_min_rate => l_min_rate,
200 p_mid_rate => l_mid_rate,
201 p_max_rate => l_max_rate,
202 p_rate => l_rbc_rate);
203
204 x_rate := l_rbc_rate;
205
206 pa_pay_util.g_expenditure_item_id := NULL;
207 pa_pay_util.g_work_type_name := NULL;
208 pa_pay_util.g_task_number := NULL;
209 pa_pay_util.g_project_number := NULL;
210 pa_pay_util.g_location_code := NULL;
211 pa_pay_util.g_job_name := NULL;
212
213 exception
214 when others then
215 x_rate := NULL;
216 end get_hr_rate;
217
218 END;