[Home] [Help]
PACKAGE BODY: APPS.PAY_TXR_SHD
Source
1 Package Body pay_txr_shd as
2 /* $Header: pytxrrhi.pkb 120.0 2005/05/29 09:09 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_txr_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 If (p_constraint_name = 'PAY_TAXABILITY_RULES_FK1') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 ElsIf (p_constraint_name = 'PAY_TAXABILITY_RULES_FK2') Then
27 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('STEP','10');
30 fnd_message.raise_error;
31 ElsIf (p_constraint_name = 'PAY_TAXABILITY_RULES_FK3') Then
32 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33 fnd_message.set_token('PROCEDURE', l_proc);
34 fnd_message.set_token('STEP','15');
35 fnd_message.raise_error;
36 ElsIf (p_constraint_name = 'PAY_TAXABILITY_RULES_UK') Then
37 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38 fnd_message.set_token('PROCEDURE', l_proc);
39 fnd_message.set_token('STEP','20');
40 fnd_message.raise_error;
41 /*
42 ElsIf (p_constraint_name = 'PAY_TAXABILITY_RULES_PK') Then
43 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44 fnd_message.set_token('PROCEDURE', l_proc);
45 fnd_message.set_token('STEP','15');
46 fnd_message.raise_error;
47 ElsIf (p_constraint_name = 'PAY_TXR_TAX_TYPE_CHK') Then
48 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
49 fnd_message.set_token('PROCEDURE', l_proc);
50 fnd_message.set_token('STEP','20');
51 fnd_message.raise_error;
52 */
53 Else
54 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
55 fnd_message.set_token('PROCEDURE', l_proc);
56 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
57 fnd_message.raise_error;
58 End If;
59 --
60 End constraint_error;
61 --
62 -- ----------------------------------------------------------------------------
63 -- |-----------------------------< api_updating >-----------------------------|
64 -- ----------------------------------------------------------------------------
65 Function api_updating
66 (p_jurisdiction_code in varchar2
67 ,p_tax_type in varchar2 default null
68 ,p_tax_category in varchar2 default null
69 ,p_classification_id in number default null
70 ,p_taxability_rules_date_id in number
71 ,p_secondary_classification_id in number default null
72 )
73 Return Boolean Is
74 --
75 --
76 -- Cursor selects the 'current' row from the HR Schema
77 --
78 Cursor C_Sel1 is
79 select
80 jurisdiction_code
81 ,tax_type
82 ,tax_category
83 ,classification_id
84 ,taxability_rules_date_id
85 ,legislation_code
86 ,status
87 ,secondary_classification_id
88 from pay_taxability_rules
89 where jurisdiction_code = p_jurisdiction_code
90 and nvl(tax_type, 'X') = nvl(p_tax_type ,'X')
91 and nvl(tax_category, 'X') = nvl(p_tax_category ,'X')
92 and nvl(classification_id, 0) = nvl(p_classification_id, 0)
93 and nvl(secondary_classification_id, 0) =
94 nvl(p_secondary_classification_id, 0)
95 and taxability_rules_date_id = p_taxability_rules_date_id;
96 --
97 l_fct_ret boolean;
98 --
99 Begin
100 --
101 If (p_jurisdiction_code is null and
102 -- p_tax_type is null and
103 -- p_tax_category is null and
104 -- p_classification_id is null and
105 p_taxability_rules_date_id is null
106 ) Then
107 --
108 -- One of the primary key arguments is null therefore we must
109 -- set the returning function value to false
110 --
111 l_fct_ret := false;
112 Else
113 If (p_jurisdiction_code
114 = pay_txr_shd.g_old_rec.jurisdiction_code and
115 nvl(p_tax_type, 'X')
116 = nvl(pay_txr_shd.g_old_rec.tax_type, 'X') and
117 nvl(p_tax_category, 'X')
118 = nvl(pay_txr_shd.g_old_rec.tax_category, 'X') and
119 nvl(p_classification_id, 0)
120 = nvl(pay_txr_shd.g_old_rec.classification_id, 0) and
121 nvl(p_secondary_classification_id, 0)
122 = nvl(pay_txr_shd.g_old_rec.secondary_classification_id, 0) and
123 p_taxability_rules_date_id
124 = pay_txr_shd.g_old_rec.taxability_rules_date_id
125 ) Then
126 --
127 -- The g_old_rec is current therefore we must
128 -- set the returning function to true
129 --
130 l_fct_ret := true;
131 Else
132 --
133 -- Select the current row into g_old_rec
134 --
135 Open C_Sel1;
136 Fetch C_Sel1 Into pay_txr_shd.g_old_rec;
137 If C_Sel1%notfound Then
138 Close C_Sel1;
139 --
140 -- The primary key is invalid therefore we must error
141 --
142 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
143 fnd_message.raise_error;
144 End If;
145 Close C_Sel1;
146 --
147 l_fct_ret := true;
148 End If;
149 End If;
150 Return (l_fct_ret);
151 --
152 End api_updating;
153 --
154 -- ----------------------------------------------------------------------------
155 -- |---------------------------------< lck >----------------------------------|
156 -- ----------------------------------------------------------------------------
157 Procedure lck
158 (p_jurisdiction_code in varchar2
159 ,p_tax_type in varchar2 default null
160 ,p_tax_category in varchar2 default null
161 ,p_classification_id in number default null
162 ,p_taxability_rules_date_id in number
163 ,p_secondary_classification_id in number default null
164 ) is
165 --
166 -- Cursor selects the 'current' row from the HR Schema
167 --
168 Cursor C_Sel1 is
169 select
170 jurisdiction_code
171 ,tax_type
172 ,tax_category
173 ,classification_id
174 ,taxability_rules_date_id
175 ,legislation_code
176 ,status
177 ,secondary_classification_id
178 from pay_taxability_rules
179 where jurisdiction_code = p_jurisdiction_code
180 and nvl(tax_type, 'X') = nvl(p_tax_type, 'X')
181 and nvl(tax_category, 'X') = nvl(p_tax_category, 'X')
182 and nvl(classification_id, 0) = nvl(p_classification_id, 0)
183 and nvl(secondary_classification_id, 0) =
184 nvl(p_secondary_classification_id, 0)
185 and taxability_rules_date_id = p_taxability_rules_date_id
186 for update nowait;
187 --
188 l_proc varchar2(72) := g_package||'lck';
189 --
190 Begin
191 hr_utility.set_location('Entering:'||l_proc, 5);
192 --
193 hr_api.mandatory_arg_error
194 (p_api_name => l_proc
195 ,p_argument => 'JURISDICTION_CODE'
196 ,p_argument_value => p_jurisdiction_code
197 );
198 hr_utility.set_location(l_proc,6);
199 /* hr_api.mandatory_arg_error
200 (p_api_name => l_proc
201 ,p_argument => 'TAX_TYPE'
202 ,p_argument_value => p_tax_type
203 );
204 hr_utility.set_location(l_proc,7);
205 hr_api.mandatory_arg_error
206 (p_api_name => l_proc
207 ,p_argument => 'TAX_CATEGORY'
208 ,p_argument_value => p_tax_category
209 );
210 hr_utility.set_location(l_proc,8);
211 hr_api.mandatory_arg_error
212 (p_api_name => l_proc
213 ,p_argument => 'CLASSIFICATION_ID'
214 ,p_argument_value => p_classification_id
215 );
216 */
217 hr_utility.set_location(l_proc,9);
218 hr_api.mandatory_arg_error
219 (p_api_name => l_proc
220 ,p_argument => 'TAXABILITY_RULES_DATE_ID'
221 ,p_argument_value => p_taxability_rules_date_id
222 );
223 --
224 Open C_Sel1;
225 Fetch C_Sel1 Into pay_txr_shd.g_old_rec;
226 If C_Sel1%notfound then
227 Close C_Sel1;
228 --
229 -- The primary key is invalid therefore we must error
230 --
231 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
232 fnd_message.raise_error;
233 End If;
234 Close C_Sel1;
235 --
236 --
237 hr_utility.set_location(' Leaving:'||l_proc, 10);
238 --
239 -- We need to trap the ORA LOCK exception
240 --
241 Exception
242 When HR_Api.Object_Locked then
243 --
244 -- The object is locked therefore we need to supply a meaningful
245 -- error message.
246 --
247 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
248 fnd_message.set_token('TABLE_NAME', 'pay_taxability_rules');
249 fnd_message.raise_error;
250 End lck;
251 --
252 -- ----------------------------------------------------------------------------
253 -- |-----------------------------< convert_args >-----------------------------|
254 -- ----------------------------------------------------------------------------
255 Function convert_args
256 (p_jurisdiction_code in varchar2
257 ,p_tax_type in varchar2 default null
258 ,p_tax_category in varchar2 default null
259 ,p_classification_id in number default null
260 ,p_taxability_rules_date_id in number
261 ,p_legislation_code in varchar2
262 ,p_status in varchar2
263 ,p_secondary_classification_id in number default null
264 )
265 Return g_rec_type is
266 --
267 l_rec g_rec_type;
268 --
269 Begin
270 --
271 -- Convert arguments into local l_rec structure.
272 --
273 hr_utility.trace('Entering Convert arguments');
274 hr_utility.trace('p_jurisdiction_code = '||p_jurisdiction_code);
275
276 l_rec.jurisdiction_code := p_jurisdiction_code;
277 hr_utility.trace('Assigned p_jurisdiction_code = '||l_rec.jurisdiction_code);
278 l_rec.tax_type := p_tax_type;
279 l_rec.tax_category := p_tax_category;
280 l_rec.classification_id := p_classification_id;
281 l_rec.taxability_rules_date_id := p_taxability_rules_date_id;
282 l_rec.legislation_code := p_legislation_code;
283 l_rec.status := p_status;
284 l_rec.secondary_classification_id := p_secondary_classification_id;
285 --Before
286 -- Return the plsql record structure.
287 --
288 hr_utility.trace('Leaving Convert arguments');
289 Return(l_rec);
290 --
291
292 Exception
293 When Others THEN
294 hr_utility.trace('Error in Convert arguments = '||SQLERRM);
295
296 End convert_args;
297 --
298 end pay_txr_shd;