[Home] [Help]
PACKAGE BODY: APPS.PQP_DET_SHD
Source
1 Package Body pqp_det_shd as
2 /* $Header: pqdetrhi.pkb 115.8 2003/02/17 22:14:03 tmehra ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqp_det_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'PQP_ANALYZED_ALIEN_DATA_FK1') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 ElsIf (p_constraint_name = 'PQP_ANALYZED_ALIEN_DETAILS_PK') Then
42 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('STEP','10');
45 hr_utility.raise_error;
46 Else
47 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
48 hr_utility.set_message_token('PROCEDURE', l_proc);
49 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50 hr_utility.raise_error;
51 End If;
52 --
53 hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60 (
61 p_analyzed_data_details_id in number,
62 p_object_version_number in number
63 ) Return Boolean Is
64 --
65 --
66 -- Cursor selects the 'current' row from the HR Schema
67 --
68 Cursor C_Sel1 is
69 select
70 analyzed_data_details_id,
71 analyzed_data_id,
72 income_code,
73 withholding_rate,
74 income_code_sub_type,
75 exemption_code,
76 maximum_benefit_amount,
77 retro_lose_ben_amt_flag,
78 date_benefit_ends,
79 retro_lose_ben_date_flag,
80 nra_exempt_from_ss,
81 nra_exempt_from_medicare,
82 student_exempt_from_ss,
83 student_exempt_from_medicare,
84 addl_withholding_flag,
85 constant_addl_tax,
86 addl_withholding_amt,
87 addl_wthldng_amt_period_type,
88 personal_exemption,
89 addl_exemption_allowed,
90 treaty_ben_allowed_flag,
91 treaty_benefits_start_date,
92 object_version_number,
93 retro_loss_notification_sent,
94 current_analysis,
95 forecast_income_code
96 from pqp_analyzed_alien_details
97 where analyzed_data_details_id = p_analyzed_data_details_id;
98 --
99 l_proc varchar2(72) := g_package||'api_updating';
100 l_fct_ret boolean;
101 --
102 Begin
103 hr_utility.set_location('Entering:'||l_proc, 5);
104 --
105 If (
106 p_analyzed_data_details_id is null and
107 p_object_version_number is null
108 ) Then
109 --
110 -- One of the primary key arguments is null therefore we must
111 -- set the returning function value to false
112 --
113 l_fct_ret := false;
114 Else
115 If (
116 p_analyzed_data_details_id = g_old_rec.analyzed_data_details_id and
117 p_object_version_number = g_old_rec.object_version_number
118 ) Then
119 hr_utility.set_location(l_proc, 10);
120 --
121 -- The g_old_rec is current therefore we must
122 -- set the returning function to true
123 --
124 l_fct_ret := true;
125 Else
126 --
127 -- Select the current row into g_old_rec
128 --
129 Open C_Sel1;
130 Fetch C_Sel1 Into g_old_rec;
131 If C_Sel1%notfound Then
132 Close C_Sel1;
133 --
134 -- The primary key is invalid therefore we must error
135 --
136 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
137 hr_utility.raise_error;
138 End If;
139 Close C_Sel1;
140 If (p_object_version_number <> g_old_rec.object_version_number) Then
141 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
142 hr_utility.raise_error;
143 End If;
144 hr_utility.set_location(l_proc, 15);
145 l_fct_ret := true;
146 End If;
147 End If;
148 hr_utility.set_location(' Leaving:'||l_proc, 20);
149 Return (l_fct_ret);
150 --
151 End api_updating;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |---------------------------------< lck >----------------------------------|
155 -- ----------------------------------------------------------------------------
156 Procedure lck
157 (
158 p_analyzed_data_details_id in number,
159 p_object_version_number in number
160 ) is
161 --
162 -- Cursor selects the 'current' row from the HR Schema
163 --
164 Cursor C_Sel1 is
165 select analyzed_data_details_id,
166 analyzed_data_id,
167 income_code,
168 withholding_rate,
169 income_code_sub_type,
170 exemption_code,
171 maximum_benefit_amount,
172 retro_lose_ben_amt_flag,
173 date_benefit_ends,
174 retro_lose_ben_date_flag,
175 nra_exempt_from_ss,
176 nra_exempt_from_medicare,
177 student_exempt_from_ss,
178 student_exempt_from_medicare,
179 addl_withholding_flag,
180 constant_addl_tax,
181 addl_withholding_amt,
182 addl_wthldng_amt_period_type,
183 personal_exemption,
184 addl_exemption_allowed,
185 treaty_ben_allowed_flag,
186 treaty_benefits_start_date,
187 object_version_number,
188 retro_loss_notification_sent,
189 current_analysis,
190 forecast_income_code
191 from pqp_analyzed_alien_details
192 where analyzed_data_details_id = p_analyzed_data_details_id
193 for update nowait;
194 --
195 l_proc varchar2(72) := g_package||'lck';
196 --
197 Begin
198 hr_utility.set_location('Entering:'||l_proc, 5);
199 --
200 -- Add any mandatory argument checking here:
201 -- Example:
202 -- hr_api.mandatory_arg_error
203 -- (p_api_name => l_proc,
204 -- p_argument => 'object_version_number',
205 -- p_argument_value => p_object_version_number);
206 --
207 Open C_Sel1;
208 Fetch C_Sel1 Into g_old_rec;
209 If C_Sel1%notfound then
210 Close C_Sel1;
211 --
212 -- The primary key is invalid therefore we must error
213 --
214 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
215 hr_utility.raise_error;
216 End If;
217 Close C_Sel1;
218 If (p_object_version_number <> g_old_rec.object_version_number) Then
219 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
220 hr_utility.raise_error;
221 End If;
222 --
223 hr_utility.set_location(' Leaving:'||l_proc, 10);
224 --
225 -- We need to trap the ORA LOCK exception
226 --
227 Exception
228 When HR_Api.Object_Locked then
229 --
230 -- The object is locked therefore we need to supply a meaningful
231 -- error message.
232 --
233 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
234 hr_utility.set_message_token('TABLE_NAME', 'pqp_analyzed_alien_details');
235 hr_utility.raise_error;
236 End lck;
237 --
238 -- ----------------------------------------------------------------------------
239 -- |-----------------------------< convert_args >-----------------------------|
240 -- ----------------------------------------------------------------------------
241 Function convert_args
242 (
243 p_analyzed_data_details_id in number,
244 p_analyzed_data_id in number,
245 p_income_code in varchar2,
246 p_withholding_rate in number,
247 p_income_code_sub_type in varchar2,
248 p_exemption_code in varchar2,
249 p_maximum_benefit_amount in number,
250 p_retro_lose_ben_amt_flag in varchar2,
251 p_date_benefit_ends in date,
252 p_retro_lose_ben_date_flag in varchar2,
253 p_nra_exempt_from_ss in varchar2,
254 p_nra_exempt_from_medicare in varchar2,
255 p_student_exempt_from_ss in varchar2,
256 p_student_exempt_from_medi in varchar2,
257 p_addl_withholding_flag in varchar2,
258 p_constant_addl_tax in number,
259 p_addl_withholding_amt in number,
260 p_addl_wthldng_amt_period_type in varchar2,
261 p_personal_exemption in number,
262 p_addl_exemption_allowed in number,
263 p_treaty_ben_allowed_flag in varchar2,
264 p_treaty_benefits_start_date in date,
265 p_object_version_number in number,
266 p_retro_loss_notification_sent in varchar2,
267 p_current_analysis in varchar2,
268 p_forecast_income_code in varchar2
269 )
270 Return g_rec_type is
271 --
272 l_rec g_rec_type;
273 l_proc varchar2(72) := g_package||'convert_args';
274 --
275 Begin
276 --
277 hr_utility.set_location('Entering:'||l_proc, 5);
278 --
279 -- Convert arguments into local l_rec structure.
280 --
281 l_rec.analyzed_data_details_id := p_analyzed_data_details_id;
282 l_rec.analyzed_data_id := p_analyzed_data_id;
283 l_rec.income_code := p_income_code;
284 l_rec.withholding_rate := p_withholding_rate;
285 l_rec.income_code_sub_type := p_income_code_sub_type;
286 l_rec.exemption_code := p_exemption_code;
287 l_rec.maximum_benefit_amount := p_maximum_benefit_amount;
288 l_rec.retro_lose_ben_amt_flag := p_retro_lose_ben_amt_flag;
289 l_rec.date_benefit_ends := p_date_benefit_ends;
290 l_rec.retro_lose_ben_date_flag := p_retro_lose_ben_date_flag;
291 l_rec.nra_exempt_from_ss := p_nra_exempt_from_ss;
292 l_rec.nra_exempt_from_medicare := p_nra_exempt_from_medicare;
293 l_rec.student_exempt_from_ss := p_student_exempt_from_ss;
294 l_rec.student_exempt_from_medicare := p_student_exempt_from_medi;
295 l_rec.addl_withholding_flag := p_addl_withholding_flag;
296 l_rec.constant_addl_tax := p_constant_addl_tax;
297 l_rec.addl_withholding_amt := p_addl_withholding_amt;
298 l_rec.addl_wthldng_amt_period_type := p_addl_wthldng_amt_period_type;
299 l_rec.personal_exemption := p_personal_exemption;
300 l_rec.addl_exemption_allowed := p_addl_exemption_allowed;
301 l_rec.treaty_ben_allowed_flag := p_treaty_ben_allowed_flag;
302 l_rec.treaty_benefits_start_date := p_treaty_benefits_start_date;
303 l_rec.object_version_number := p_object_version_number;
304 l_rec.retro_loss_notification_sent := p_retro_loss_notification_sent;
305 l_rec.current_analysis := p_current_analysis ;
306 l_rec.forecast_income_code := p_forecast_income_code ;
307 --
308 -- Return the plsql record structure.
309 --
310 hr_utility.set_location(' Leaving:'||l_proc, 10);
311 Return(l_rec);
312 --
313 End convert_args;
314 --
315 end pqp_det_shd;