[Home] [Help]
PACKAGE BODY: APPS.PN_INDEX_RENT_PVT
Source
1 PACKAGE BODY pn_index_rent_pvt AS
2 /* $Header: PNIRPVTB.pls 120.1 2010/12/15 10:40:35 seevivek noship $ */
3
4 g_pkg_name VARCHAR2 (30);
5 g_program_unit VARCHAR2 (30);
6 g_debug_mode VARCHAR2 (30) := NVL (fnd_profile.VALUE ('PN_DEBUG_MODE'), 'N');
7 g_module_name VARCHAR2 (2) := 'PN';
8
9 -----------------------------------------------------------------------------------
10 -- Debug procedure to print the debug log messages bases on the debug level setting
11 -----------------------------------------------------------------------------------
12 PROCEDURE DEBUG (
13 p_log_message IN VARCHAR2
14 , p_log_level IN NUMBER)
15 IS
16 BEGIN
17
18 --pvt_debug(g_pkg_name||'Inside pvt_debug',3);
19 IF g_debug_mode = 'Y'
20 THEN
21 pn_debug.g_err_stage := p_log_message;
22 pn_debug.WRITE (g_module_name
23 , pn_debug.g_err_stage
24 , p_log_level);
25 ELSE
26 NULL;
27 END IF;
28 END DEBUG;
29
30 ------------------------------------------------------------------
31 -- Function to check enabled DFF attributes and return their count
32 ------------------------------------------------------------------
33 FUNCTION get_attribute_status( p_desc_name VARCHAR2)
34 RETURN NUMBER
35 AS
36 l_count NUMBER :=0;
37 BEGIN
38 SELECT count(1)
39 INTO l_count
40 FROM fnd_descr_flex_col_usage_vl
41 WHERE descriptive_flexfield_name = UPPER(trim(p_desc_name))
42 AND enabled_flag = 'Y'
43 AND display_flag = 'Y';
44 RETURN l_count;
45 EXCEPTION
46 WHEN OTHERS THEN
47 l_count:=0;
48 RETURN l_count;
49 END get_attribute_status;
50
51 --------------------------------------------------------------------------
52 -- Procedure to validate constraint DFF attributes and return status S/E.
53 --------------------------------------------------------------------------
54 PROCEDURE validate_constraints_desc_flex (
55 p_index_constraint_tbl IN OUT NOCOPY index_constraint_tbl
56 , x_return_status OUT NOCOPY VARCHAR2
57 , x_msg_count OUT NOCOPY NUMBER
58 , x_msg_data OUT NOCOPY VARCHAR2)
59
60 IS
61
62 BEGIN
63
64 x_return_status := fnd_api.g_ret_sts_success;
65
66 FOR i in 1..p_index_constraint_tbl.count
67 LOOP
68 IF (p_index_constraint_tbl(i).attribute_category = pn_index_rent_utils.g_pn_miss_char)
69 THEN
70 p_index_constraint_tbl(i).attribute_category := NULL;
71 END IF;
72
73 IF (p_index_constraint_tbl(i).attribute1 = pn_index_rent_utils.g_pn_miss_char)
74 THEN
75 p_index_constraint_tbl(i).attribute1 := NULL;
76 END IF;
77
78 IF (p_index_constraint_tbl(i).attribute2 = pn_index_rent_utils.g_pn_miss_char)
79 THEN
80 p_index_constraint_tbl(i).attribute2 := NULL;
81 END IF;
82
83 IF (p_index_constraint_tbl(i).attribute3 = pn_index_rent_utils.g_pn_miss_char)
84 THEN
85 p_index_constraint_tbl(i).attribute3 := NULL;
86 END IF;
87
88 IF (p_index_constraint_tbl(i).attribute4 = pn_index_rent_utils.g_pn_miss_char)
89 THEN
90 p_index_constraint_tbl(i).attribute4 := NULL;
91 END IF;
92
93 IF (p_index_constraint_tbl(i).attribute5 = pn_index_rent_utils.g_pn_miss_char)
94 THEN
95 p_index_constraint_tbl(i).attribute5 := NULL;
96 END IF;
97
98 IF (p_index_constraint_tbl(i).attribute6 = pn_index_rent_utils.g_pn_miss_char)
99 THEN
100 p_index_constraint_tbl(i).attribute6 := NULL;
101 END IF;
102
103 IF (p_index_constraint_tbl(i).attribute7 = pn_index_rent_utils.g_pn_miss_char)
104 THEN
105 p_index_constraint_tbl(i).attribute7 := NULL;
106 END IF;
107
108 IF (p_index_constraint_tbl(i).attribute8 = pn_index_rent_utils.g_pn_miss_char)
109 THEN
110 p_index_constraint_tbl(i).attribute8 := NULL;
111 END IF;
112
113 IF (p_index_constraint_tbl(i).attribute9 = pn_index_rent_utils.g_pn_miss_char)
114 THEN
115 p_index_constraint_tbl(i).attribute9 := NULL;
116 END IF;
117
118 IF (p_index_constraint_tbl(i).attribute10 = pn_index_rent_utils.g_pn_miss_char)
119 THEN
120 p_index_constraint_tbl(i).attribute10 := NULL;
121 END IF;
122
123 IF (p_index_constraint_tbl(i).attribute11 = pn_index_rent_utils.g_pn_miss_char)
124 THEN
125 p_index_constraint_tbl(i).attribute11 := NULL;
126 END IF;
127
128 IF (p_index_constraint_tbl(i).attribute12 = pn_index_rent_utils.g_pn_miss_char)
129 THEN
130 p_index_constraint_tbl(i).attribute12 := NULL;
131 END IF;
132
133 IF (p_index_constraint_tbl(i).attribute13 = pn_index_rent_utils.g_pn_miss_char)
134 THEN
135 p_index_constraint_tbl(i).attribute13 := NULL;
136 END IF;
137
138 IF (p_index_constraint_tbl(i).attribute14 = pn_index_rent_utils.g_pn_miss_char)
139 THEN
140 p_index_constraint_tbl(i).attribute14 := NULL;
141 END IF;
142
143 IF (p_index_constraint_tbl(i).attribute15 = pn_index_rent_utils.g_pn_miss_char)
144 THEN
145 p_index_constraint_tbl(i).attribute15 := NULL;
146 END IF;
147
148
149 IF (get_attribute_status('PN_INDEX_CONSTRAINTS') > 0)
150 THEN
151 IF NOT ((p_index_constraint_tbl(i).attribute_category = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute_category IS NULL)
152 AND (p_index_constraint_tbl(i).attribute1 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute1 IS NULL)
153 AND (p_index_constraint_tbl(i).attribute2 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute2 IS NULL)
154 AND (p_index_constraint_tbl(i).attribute3 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute3 IS NULL)
155 AND (p_index_constraint_tbl(i).attribute4 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute4 IS NULL)
156 AND (p_index_constraint_tbl(i).attribute5 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute5 IS NULL)
157 AND (p_index_constraint_tbl(i).attribute6 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute6 IS NULL)
158 AND (p_index_constraint_tbl(i).attribute7 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute7 IS NULL)
159 AND (p_index_constraint_tbl(i).attribute8 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute8 IS NULL)
160 AND (p_index_constraint_tbl(i).attribute9 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute9 IS NULL)
161 AND (p_index_constraint_tbl(i).attribute10 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute10 IS NULL)
162 AND (p_index_constraint_tbl(i).attribute11 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute11 IS NULL)
163 AND (p_index_constraint_tbl(i).attribute12 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute12 IS NULL)
164 AND (p_index_constraint_tbl(i).attribute13 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute13 IS NULL)
165 AND (p_index_constraint_tbl(i).attribute14 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute14 IS NULL)
166 AND (p_index_constraint_tbl(i).attribute15 = pn_index_rent_utils.g_pn_miss_char OR p_index_constraint_tbl(i).attribute15 IS NULL)
167 )
168 THEN
169
170 pn_lease_utils.validate_desc_flex (p_api_name => g_pkg_name||'.'||g_program_unit
171 , p_application_short_name => 'PN'
172 , p_desc_flex_name => 'PN_INDEX_CONSTRAINTS'
173 , p_desc_segment1 => p_index_constraint_tbl(i).attribute1
174 , p_desc_segment2 => p_index_constraint_tbl(i).attribute2
175 , p_desc_segment3 => p_index_constraint_tbl(i).attribute3
176 , p_desc_segment4 => p_index_constraint_tbl(i).attribute4
177 , p_desc_segment5 => p_index_constraint_tbl(i).attribute5
178 , p_desc_segment6 => p_index_constraint_tbl(i).attribute6
179 , p_desc_segment7 => p_index_constraint_tbl(i).attribute7
180 , p_desc_segment8 => p_index_constraint_tbl(i).attribute8
181 , p_desc_segment9 => p_index_constraint_tbl(i).attribute9
182 , p_desc_segment10 => p_index_constraint_tbl(i).attribute10
183 , p_desc_segment11 => p_index_constraint_tbl(i).attribute11
184 , p_desc_segment12 => p_index_constraint_tbl(i).attribute12
185 , p_desc_segment13 => p_index_constraint_tbl(i).attribute13
186 , p_desc_segment14 => p_index_constraint_tbl(i).attribute14
187 , p_desc_segment15 => p_index_constraint_tbl(i).attribute15
188 , p_desc_context => p_index_constraint_tbl(i).attribute_category
189 , p_resp_appl_id => fnd_global.resp_appl_id
190 , p_resp_id => fnd_global.resp_id
191 , p_return_status => x_return_status
192 );
193 IF (x_return_status = fnd_api.g_ret_sts_error)
194 THEN
195 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
196 fnd_message.set_token('ERR_MSG', 'Index Rent constraints descriptive flexfield validation failed due to an error');
197 fnd_msg_pub.ADD;
198 RAISE fnd_api.g_exc_error;
199 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
200 THEN
201 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
202 fnd_message.set_token('ERR_MSG', 'Index Rent constraints descriptive flexfield validation failed due to an unexpected error');
203 fnd_msg_pub.ADD;
204 RAISE fnd_api.g_exc_unexpected_error;
205 END IF;
206 END IF;
207 END IF; -- End of attributes valitions in Index Rent Constraints attributes
208 END LOOP;
209
210 END validate_constraints_desc_flex;
211
212 --------------------------------------------------------------------------
213 -- Procedure to validate Index DFF attributes and return status S/E.
214 --------------------------------------------------------------------------
215 PROCEDURE validate_index_desc_flex (
216 p_rent_index_rec IN OUT NOCOPY rent_index_rec
217 , x_return_status OUT NOCOPY VARCHAR2
218 , x_msg_count OUT NOCOPY NUMBER
219 , x_msg_data OUT NOCOPY VARCHAR2)
220
221 IS
222
223 BEGIN
224
225 IF (p_rent_index_rec.attribute_category = pn_index_rent_utils.g_pn_miss_char)
226 THEN
227 p_rent_index_rec.attribute_category := NULL;
228 END IF;
229
230 IF (p_rent_index_rec.attribute1 = pn_index_rent_utils.g_pn_miss_char)
231 THEN
232 p_rent_index_rec.attribute1 := NULL;
233 END IF;
234
235 IF (p_rent_index_rec.attribute2 = pn_index_rent_utils.g_pn_miss_char)
236 THEN
237 p_rent_index_rec.attribute2 := NULL;
238 END IF;
239
240 IF (p_rent_index_rec.attribute3 = pn_index_rent_utils.g_pn_miss_char)
241 THEN
242 p_rent_index_rec.attribute3 := NULL;
243 END IF;
244
245 IF (p_rent_index_rec.attribute4 = pn_index_rent_utils.g_pn_miss_char)
246 THEN
247 p_rent_index_rec.attribute4 := NULL;
248 END IF;
249
250 IF (p_rent_index_rec.attribute5 = pn_index_rent_utils.g_pn_miss_char)
251 THEN
252 p_rent_index_rec.attribute5 := NULL;
253 END IF;
254
255 IF (p_rent_index_rec.attribute6 = pn_index_rent_utils.g_pn_miss_char)
256 THEN
257 p_rent_index_rec.attribute6 := NULL;
258 END IF;
259
260 IF (p_rent_index_rec.attribute7 = pn_index_rent_utils.g_pn_miss_char)
261 THEN
262 p_rent_index_rec.attribute7 := NULL;
263 END IF;
264
265 IF (p_rent_index_rec.attribute8 = pn_index_rent_utils.g_pn_miss_char)
266 THEN
267 p_rent_index_rec.attribute8 := NULL;
268 END IF;
269
270 IF (p_rent_index_rec.attribute9 = pn_index_rent_utils.g_pn_miss_char)
271 THEN
272 p_rent_index_rec.attribute9 := NULL;
273 END IF;
274
275 IF (p_rent_index_rec.attribute10 = pn_index_rent_utils.g_pn_miss_char)
276 THEN
277 p_rent_index_rec.attribute10 := NULL;
278 END IF;
279
280 IF (p_rent_index_rec.attribute11 = pn_index_rent_utils.g_pn_miss_char)
281 THEN
282 p_rent_index_rec.attribute11 := NULL;
283 END IF;
284
285 IF (p_rent_index_rec.attribute12 = pn_index_rent_utils.g_pn_miss_char)
286 THEN
287 p_rent_index_rec.attribute12 := NULL;
288 END IF;
289
290 IF (p_rent_index_rec.attribute13 = pn_index_rent_utils.g_pn_miss_char)
291 THEN
292 p_rent_index_rec.attribute13 := NULL;
293 END IF;
294
295 IF (p_rent_index_rec.attribute14 = pn_index_rent_utils.g_pn_miss_char)
296 THEN
297 p_rent_index_rec.attribute14 := NULL;
298 END IF;
299
300 IF (p_rent_index_rec.attribute15 = pn_index_rent_utils.g_pn_miss_char)
301 THEN
302 p_rent_index_rec.attribute15 := NULL;
303 END IF;
304
305
306 IF (get_attribute_status('PN_INDEX_RENT') > 0)
307 THEN
308 IF NOT ((p_rent_index_rec.attribute_category = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute_category IS NULL)
309 AND (p_rent_index_rec.attribute1 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute1 IS NULL)
310 AND (p_rent_index_rec.attribute2 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute2 IS NULL)
311 AND (p_rent_index_rec.attribute3 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute3 IS NULL)
312 AND (p_rent_index_rec.attribute4 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute4 IS NULL)
313 AND (p_rent_index_rec.attribute5 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute5 IS NULL)
314 AND (p_rent_index_rec.attribute6 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute6 IS NULL)
315 AND (p_rent_index_rec.attribute7 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute7 IS NULL)
316 AND (p_rent_index_rec.attribute8 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute8 IS NULL)
317 AND (p_rent_index_rec.attribute9 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute9 IS NULL)
318 AND (p_rent_index_rec.attribute10 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute10 IS NULL)
319 AND (p_rent_index_rec.attribute11 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute11 IS NULL)
320 AND (p_rent_index_rec.attribute12 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute12 IS NULL)
321 AND (p_rent_index_rec.attribute13 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute13 IS NULL)
322 AND (p_rent_index_rec.attribute14 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute14 IS NULL)
323 AND (p_rent_index_rec.attribute15 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.attribute15 IS NULL)
324 )
325 THEN
326
327 pn_lease_utils.validate_desc_flex ( p_api_name => g_pkg_name||'.'||g_program_unit
328 , p_application_short_name => 'PN'
329 , p_desc_flex_name => 'PN_INDEX_RENT'
330 , p_desc_segment1 => p_rent_index_rec.attribute1
331 , p_desc_segment2 => p_rent_index_rec.attribute2
332 , p_desc_segment3 => p_rent_index_rec.attribute3
333 , p_desc_segment4 => p_rent_index_rec.attribute4
334 , p_desc_segment5 => p_rent_index_rec.attribute5
335 , p_desc_segment6 => p_rent_index_rec.attribute6
336 , p_desc_segment7 => p_rent_index_rec.attribute7
337 , p_desc_segment8 => p_rent_index_rec.attribute8
338 , p_desc_segment9 => p_rent_index_rec.attribute9
339 , p_desc_segment10 => p_rent_index_rec.attribute10
340 , p_desc_segment11 => p_rent_index_rec.attribute11
341 , p_desc_segment12 => p_rent_index_rec.attribute12
342 , p_desc_segment13 => p_rent_index_rec.attribute13
343 , p_desc_segment14 => p_rent_index_rec.attribute14
344 , p_desc_segment15 => p_rent_index_rec.attribute15
345 , p_desc_context => p_rent_index_rec.attribute_category
346 , p_resp_appl_id => fnd_global.resp_appl_id
347 , p_resp_id => fnd_global.resp_id
348 , p_return_status => x_return_status
349 );
350 IF (x_return_status = fnd_api.g_ret_sts_error)
351 THEN
352 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
353 fnd_message.set_token('ERR_MSG', 'Index Rent descriptive flexfield validation failed due to an error');
354 fnd_msg_pub.ADD;
355 RAISE fnd_api.g_exc_error;
356 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
357 THEN
358 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
359 fnd_message.set_token('ERR_MSG', 'Index Rent descriptive flexfield validation failed due to an unexpected error');
360 fnd_msg_pub.ADD;
361 RAISE fnd_api.g_exc_unexpected_error;
362 END IF;
363 END IF;
364 END IF; -- End of attributes valitions in Index Rent attribute
365
366
367 IF (p_rent_index_rec.agreement_category = pn_index_rent_utils.g_pn_miss_char)
368 THEN
369 p_rent_index_rec.agreement_category := NULL;
370 END IF;
371
372 IF (p_rent_index_rec.agreement_attribute1 = pn_index_rent_utils.g_pn_miss_char)
373 THEN
374 p_rent_index_rec.agreement_attribute1 := NULL;
375 END IF;
376
377 IF (p_rent_index_rec.agreement_attribute2 = pn_index_rent_utils.g_pn_miss_char)
378 THEN
379 p_rent_index_rec.agreement_attribute2 := NULL;
380 END IF;
381
382 IF (p_rent_index_rec.agreement_attribute3 = pn_index_rent_utils.g_pn_miss_char)
383 THEN
384 p_rent_index_rec.agreement_attribute3 := NULL;
385 END IF;
386
387 IF (p_rent_index_rec.agreement_attribute4 = pn_index_rent_utils.g_pn_miss_char)
388 THEN
389 p_rent_index_rec.agreement_attribute4 := NULL;
390 END IF;
391
392 IF (p_rent_index_rec.agreement_attribute5 = pn_index_rent_utils.g_pn_miss_char)
393 THEN
394 p_rent_index_rec.agreement_attribute5 := NULL;
395 END IF;
396
397 IF (p_rent_index_rec.agreement_attribute6 = pn_index_rent_utils.g_pn_miss_char)
398 THEN
399 p_rent_index_rec.agreement_attribute6 := NULL;
400 END IF;
401
402 IF (p_rent_index_rec.agreement_attribute7 = pn_index_rent_utils.g_pn_miss_char)
403 THEN
404 p_rent_index_rec.agreement_attribute7 := NULL;
405 END IF;
406
407 IF (p_rent_index_rec.agreement_attribute8 = pn_index_rent_utils.g_pn_miss_char)
408 THEN
409 p_rent_index_rec.agreement_attribute8 := NULL;
410 END IF;
411
412 IF (p_rent_index_rec.agreement_attribute9 = pn_index_rent_utils.g_pn_miss_char)
413 THEN
414 p_rent_index_rec.agreement_attribute9 := NULL;
415 END IF;
416
417 IF (p_rent_index_rec.agreement_attribute10 = pn_index_rent_utils.g_pn_miss_char)
418 THEN
419 p_rent_index_rec.agreement_attribute10 := NULL;
420 END IF;
421
422 IF (p_rent_index_rec.agreement_attribute11 = pn_index_rent_utils.g_pn_miss_char)
423 THEN
424 p_rent_index_rec.agreement_attribute11 := NULL;
425 END IF;
426
427 IF (p_rent_index_rec.agreement_attribute12 = pn_index_rent_utils.g_pn_miss_char)
428 THEN
429 p_rent_index_rec.agreement_attribute12 := NULL;
430 END IF;
431
432 IF (p_rent_index_rec.agreement_attribute13 = pn_index_rent_utils.g_pn_miss_char)
433 THEN
434 p_rent_index_rec.agreement_attribute13 := NULL;
435 END IF;
436
437 IF (p_rent_index_rec.agreement_attribute14 = pn_index_rent_utils.g_pn_miss_char)
438 THEN
439 p_rent_index_rec.agreement_attribute14 := NULL;
440 END IF;
441
442 IF (p_rent_index_rec.agreement_attribute15 = pn_index_rent_utils.g_pn_miss_char)
443 THEN
444 p_rent_index_rec.agreement_attribute15 := NULL;
445 END IF;
446
447
448 IF (get_attribute_status('PN_INDEX_AGREEMENT') > 0)
449 THEN
450 IF NOT ((p_rent_index_rec.agreement_category = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_category IS NULL)
451 AND (p_rent_index_rec.agreement_attribute1 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute1 IS NULL)
452 AND (p_rent_index_rec.agreement_attribute2 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute2 IS NULL)
453 AND (p_rent_index_rec.agreement_attribute3 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute3 IS NULL)
454 AND (p_rent_index_rec.agreement_attribute4 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute4 IS NULL)
455 AND (p_rent_index_rec.agreement_attribute5 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute5 IS NULL)
456 AND (p_rent_index_rec.agreement_attribute6 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute6 IS NULL)
457 AND (p_rent_index_rec.agreement_attribute7 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute7 IS NULL)
458 AND (p_rent_index_rec.agreement_attribute8 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute8 IS NULL)
459 AND (p_rent_index_rec.agreement_attribute9 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute9 IS NULL)
460 AND (p_rent_index_rec.agreement_attribute10 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute10 IS NULL)
461 AND (p_rent_index_rec.agreement_attribute11 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute11 IS NULL)
462 AND (p_rent_index_rec.agreement_attribute12 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute12 IS NULL)
463 AND (p_rent_index_rec.agreement_attribute13 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute13 IS NULL)
464 AND (p_rent_index_rec.agreement_attribute14 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute14 IS NULL)
465 AND (p_rent_index_rec.agreement_attribute15 = pn_index_rent_utils.g_pn_miss_char OR p_rent_index_rec.agreement_attribute15 IS NULL)
466 )
467 THEN
468
469 pn_lease_utils.validate_desc_flex ( p_api_name => g_pkg_name||'.'||g_program_unit
470 , p_application_short_name => 'PN'
471 , p_desc_flex_name => 'PN_INDEX_AGREEMENT'
472 , p_desc_segment1 => p_rent_index_rec.agreement_attribute1
473 , p_desc_segment2 => p_rent_index_rec.agreement_attribute2
474 , p_desc_segment3 => p_rent_index_rec.agreement_attribute3
475 , p_desc_segment4 => p_rent_index_rec.agreement_attribute4
476 , p_desc_segment5 => p_rent_index_rec.agreement_attribute5
477 , p_desc_segment6 => p_rent_index_rec.agreement_attribute6
478 , p_desc_segment7 => p_rent_index_rec.agreement_attribute7
479 , p_desc_segment8 => p_rent_index_rec.agreement_attribute8
480 , p_desc_segment9 => p_rent_index_rec.agreement_attribute9
481 , p_desc_segment10 => p_rent_index_rec.agreement_attribute10
482 , p_desc_segment11 => p_rent_index_rec.agreement_attribute11
483 , p_desc_segment12 => p_rent_index_rec.agreement_attribute12
484 , p_desc_segment13 => p_rent_index_rec.agreement_attribute13
485 , p_desc_segment14 => p_rent_index_rec.agreement_attribute14
486 , p_desc_segment15 => p_rent_index_rec.agreement_attribute15
487 , p_desc_context => p_rent_index_rec.agreement_category
488 , p_resp_appl_id => fnd_global.resp_appl_id
489 , p_resp_id => fnd_global.resp_id
490 , p_return_status => x_return_status
491 );
492 IF (x_return_status = fnd_api.g_ret_sts_error)
493 THEN
494 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
495 fnd_message.set_token('ERR_MSG', 'Index Rent agreement descriptive flexfield validation failed due to an error');
496 fnd_msg_pub.ADD;
497 RAISE fnd_api.g_exc_error;
498 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
499 THEN
500 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
501 fnd_message.set_token('ERR_MSG', 'Index Rent agreement descriptive flexfield validation failed due to an unexpected error');
502 fnd_msg_pub.ADD;
503 RAISE fnd_api.g_exc_unexpected_error;
504 END IF;
505 END IF;
506 END IF; -- End of attributes valitions in Index Rent agreement attribute
507
508
509 END validate_index_desc_flex;
510
511 ---------------------------------------------------
512 -- Procedure to initialize index constraint record.
513 ---------------------------------------------------
514 PROCEDURE init_index_constraint_rec (
515 p_index_constraint_rec IN OUT NOCOPY index_constraint_rec
516 , x_return_status OUT NOCOPY VARCHAR2
517 , x_msg_count OUT NOCOPY NUMBER
518 , x_msg_data OUT NOCOPY VARCHAR2)
519 IS
520 BEGIN
521 g_program_unit := 'INIT_INDEX_CONSTRAINT_REC';
522
523 x_return_status := fnd_api.g_ret_sts_success;
524
525 IF p_index_constraint_rec.index_constraint_id = pn_index_rent_utils.g_pn_miss_num
526 THEN
527 p_index_constraint_rec.index_constraint_id := NULL;
528 END IF;
529
530 IF p_index_constraint_rec.index_lease_id = pn_index_rent_utils.g_pn_miss_num
531 THEN
532 p_index_constraint_rec.index_lease_id := NULL;
533 END IF;
534
535 IF p_index_constraint_rec.index_lease_number = pn_index_rent_utils.g_pn_miss_char
536 THEN
537 p_index_constraint_rec.index_lease_number := NULL;
538 END IF;
539
540 IF p_index_constraint_rec.SCOPE = pn_index_rent_utils.g_pn_miss_char
541 THEN
542 p_index_constraint_rec.SCOPE := NULL;
543 END IF;
544
545 IF p_index_constraint_rec.scope_meaning = pn_index_rent_utils.g_pn_miss_char
546 THEN
547 p_index_constraint_rec.scope_meaning := NULL;
548 END IF;
549
550 IF p_index_constraint_rec.minimum_amount = pn_index_rent_utils.g_pn_miss_num
551 THEN
552 p_index_constraint_rec.minimum_amount := NULL;
553 END IF;
554
555 IF p_index_constraint_rec.maximum_amount = pn_index_rent_utils.g_pn_miss_num
556 THEN
557 p_index_constraint_rec.maximum_amount := NULL;
558 END IF;
559
560 IF p_index_constraint_rec.minimum_percent = pn_index_rent_utils.g_pn_miss_num
561 THEN
562 p_index_constraint_rec.minimum_percent := NULL;
563 END IF;
564
565 IF p_index_constraint_rec.maximum_percent = pn_index_rent_utils.g_pn_miss_num
566 THEN
567 p_index_constraint_rec.maximum_percent := NULL;
568 END IF;
569
570 IF p_index_constraint_rec.last_update_date = pn_index_rent_utils.g_pn_miss_date
571 THEN
572 p_index_constraint_rec.last_update_date := NULL;
573 END IF;
574
575 IF p_index_constraint_rec.last_updated_by = pn_index_rent_utils.g_pn_miss_num
576 THEN
577 p_index_constraint_rec.last_updated_by := NULL;
578 END IF;
579
580 IF p_index_constraint_rec.creation_date = pn_index_rent_utils.g_pn_miss_date
581 THEN
582 p_index_constraint_rec.creation_date := NULL;
583 END IF;
584
585 IF p_index_constraint_rec.created_by = pn_index_rent_utils.g_pn_miss_num
586 THEN
587 p_index_constraint_rec.created_by := NULL;
588 END IF;
589
590 IF p_index_constraint_rec.last_update_login = pn_index_rent_utils.g_pn_miss_num
591 THEN
592 p_index_constraint_rec.last_update_login := NULL;
593 END IF;
594
595 IF p_index_constraint_rec.attribute_category = pn_index_rent_utils.g_pn_miss_char
596 THEN
597 p_index_constraint_rec.attribute_category := NULL;
598 END IF;
599
600 IF p_index_constraint_rec.attribute1 = pn_index_rent_utils.g_pn_miss_char
601 THEN
602 p_index_constraint_rec.attribute1 := NULL;
603 END IF;
604
605 IF p_index_constraint_rec.attribute2 = pn_index_rent_utils.g_pn_miss_char
606 THEN
607 p_index_constraint_rec.attribute2 := NULL;
608 END IF;
609
610 IF p_index_constraint_rec.attribute3 = pn_index_rent_utils.g_pn_miss_char
611 THEN
612 p_index_constraint_rec.attribute3 := NULL;
613 END IF;
614
615 IF p_index_constraint_rec.attribute4 = pn_index_rent_utils.g_pn_miss_char
616 THEN
617 p_index_constraint_rec.attribute4 := NULL;
618 END IF;
619
620 IF p_index_constraint_rec.attribute5 = pn_index_rent_utils.g_pn_miss_char
621 THEN
622 p_index_constraint_rec.attribute5 := NULL;
623 END IF;
624
625 IF p_index_constraint_rec.attribute6 = pn_index_rent_utils.g_pn_miss_char
626 THEN
627 p_index_constraint_rec.attribute6 := NULL;
628 END IF;
629
630 IF p_index_constraint_rec.attribute7 = pn_index_rent_utils.g_pn_miss_char
631 THEN
632 p_index_constraint_rec.attribute7 := NULL;
633 END IF;
634
635 IF p_index_constraint_rec.attribute8 = pn_index_rent_utils.g_pn_miss_char
636 THEN
637 p_index_constraint_rec.attribute8 := NULL;
638 END IF;
639
640 IF p_index_constraint_rec.attribute9 = pn_index_rent_utils.g_pn_miss_char
641 THEN
642 p_index_constraint_rec.attribute9 := NULL;
643 END IF;
644
645 IF p_index_constraint_rec.attribute10 = pn_index_rent_utils.g_pn_miss_char
646 THEN
647 p_index_constraint_rec.attribute10 := NULL;
648 END IF;
649
650 IF p_index_constraint_rec.attribute11 = pn_index_rent_utils.g_pn_miss_char
651 THEN
652 p_index_constraint_rec.attribute11 := NULL;
653 END IF;
654
655 IF p_index_constraint_rec.attribute12 = pn_index_rent_utils.g_pn_miss_char
656 THEN
657 p_index_constraint_rec.attribute12 := NULL;
658 END IF;
659
660 IF p_index_constraint_rec.attribute13 = pn_index_rent_utils.g_pn_miss_char
661 THEN
662 p_index_constraint_rec.attribute13 := NULL;
663 END IF;
664
665 IF p_index_constraint_rec.attribute14 = pn_index_rent_utils.g_pn_miss_char
666 THEN
667 p_index_constraint_rec.attribute14 := NULL;
668 END IF;
669
670 IF p_index_constraint_rec.attribute15 = pn_index_rent_utils.g_pn_miss_char
671 THEN
672 p_index_constraint_rec.attribute15 := NULL;
673 END IF;
674
675 IF p_index_constraint_rec.org_id = pn_index_rent_utils.g_pn_miss_num
676 THEN
677 p_index_constraint_rec.org_id := NULL;
678 END IF;
679 EXCEPTION
680 WHEN fnd_api.g_exc_error
681 THEN
682 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
683 || g_pkg_name
684 || g_program_unit
685 || '-'
686 || SQLERRM
687 , 5);
688 x_return_status := fnd_api.g_ret_sts_error;
689
690 WHEN OTHERS
691 THEN
692 pn_index_rent_pvt.DEBUG ( 'Exception in '
693 || g_pkg_name
694 || g_program_unit
695 || '-'
696 || SQLERRM
697 , 5);
698 x_return_status := fnd_api.g_ret_sts_unexp_error;
699 END init_index_constraint_rec;
700
701 ---------------------------------------------------
702 -- Procedure to initialize index rent record.
703 ---------------------------------------------------
704 PROCEDURE init_index_rent_rec (
705 p_rent_index_rec IN OUT NOCOPY rent_index_rec
706 , x_return_status OUT NOCOPY VARCHAR2
707 , x_msg_count OUT NOCOPY NUMBER
708 , x_msg_data OUT NOCOPY VARCHAR2)
709 IS
710 BEGIN
711 g_program_unit := 'INIT_INDEX_RENT_REC';
712 x_return_status := fnd_api.g_ret_sts_success;
713
714 IF p_rent_index_rec.index_lease_id = pn_index_rent_utils.g_pn_miss_num
715 THEN
716 p_rent_index_rec.index_lease_id := NULL;
717 END IF;
718
719 IF p_rent_index_rec.org_id = pn_index_rent_utils.g_pn_miss_num
720 THEN
721 p_rent_index_rec.org_id := NULL;
722 END IF;
723
724 IF p_rent_index_rec.lease_id = pn_index_rent_utils.g_pn_miss_num
725 THEN
726 p_rent_index_rec.lease_id := NULL;
727 END IF;
728
729 IF p_rent_index_rec.lease_num = pn_index_rent_utils.g_pn_miss_char
730 THEN
731 p_rent_index_rec.lease_num := NULL;
732 END IF;
733
734 IF p_rent_index_rec.lease_name = pn_index_rent_utils.g_pn_miss_char
735 THEN
736 p_rent_index_rec.lease_name := NULL;
737 END IF;
738
739 IF p_rent_index_rec.index_type = pn_index_rent_utils.g_pn_miss_char
740 THEN
741 p_rent_index_rec.index_type := NULL;
742 END IF;
743
744 IF p_rent_index_rec.index_id = pn_index_rent_utils.g_pn_miss_num
745 THEN
746 p_rent_index_rec.index_id := NULL;
747 END IF;
748
749 IF p_rent_index_rec.commencement_date = pn_index_rent_utils.g_pn_miss_date
750 THEN
751 p_rent_index_rec.commencement_date := NULL;
752 END IF;
753
754 IF p_rent_index_rec.termination_date = pn_index_rent_utils.g_pn_miss_date
755 THEN
756 p_rent_index_rec.termination_date := NULL;
757 END IF;
758
759 IF p_rent_index_rec.index_lease_number = pn_index_rent_utils.g_pn_miss_char
760 THEN
761 p_rent_index_rec.index_lease_number := NULL;
762 END IF;
763
764 IF p_rent_index_rec.last_update_date = pn_index_rent_utils.g_pn_miss_date
765 THEN
766 p_rent_index_rec.last_update_date := NULL;
767 END IF;
768
769 IF p_rent_index_rec.last_updated_by = pn_index_rent_utils.g_pn_miss_num
770 THEN
771 p_rent_index_rec.last_updated_by := NULL;
772 END IF;
773
774 IF p_rent_index_rec.creation_date = pn_index_rent_utils.g_pn_miss_date
775 THEN
776 p_rent_index_rec.creation_date := NULL;
777 END IF;
778
779 IF p_rent_index_rec.created_by = pn_index_rent_utils.g_pn_miss_num
780 THEN
781 p_rent_index_rec.created_by := NULL;
782 END IF;
783
784 IF p_rent_index_rec.location_id = pn_index_rent_utils.g_pn_miss_num
785 THEN
786 p_rent_index_rec.location_id := NULL;
787 END IF;
788
789 IF p_rent_index_rec.location_code = pn_index_rent_utils.g_pn_miss_char
790 THEN
791 p_rent_index_rec.location_code := NULL;
792 END IF;
793
794 IF p_rent_index_rec.term_template_name = pn_index_rent_utils.g_pn_miss_char
795 THEN
796 p_rent_index_rec.term_template_name := NULL;
797 END IF;
798
799 IF p_rent_index_rec.term_template_id = pn_index_rent_utils.g_pn_miss_num
800 THEN
801 p_rent_index_rec.term_template_id := NULL;
802 END IF;
803
804 IF p_rent_index_rec.abstracted_by = pn_index_rent_utils.g_pn_miss_num
805 THEN
806 p_rent_index_rec.abstracted_by := NULL;
807 END IF;
808
809 IF p_rent_index_rec.abstracted_by_username = pn_index_rent_utils.g_pn_miss_char
810 THEN
811 p_rent_index_rec.abstracted_by_username := NULL;
812 END IF;
813
814 IF p_rent_index_rec.assessment_date = pn_index_rent_utils.g_pn_miss_date
815 THEN
816 p_rent_index_rec.assessment_date := NULL;
817 END IF;
818
819 IF p_rent_index_rec.assessment_interval = pn_index_rent_utils.g_pn_miss_num
820 THEN
821 p_rent_index_rec.assessment_interval := NULL;
822 END IF;
823
824 IF p_rent_index_rec.spread_frequency = pn_index_rent_utils.g_pn_miss_char
825 THEN
826 p_rent_index_rec.spread_frequency := NULL;
827 END IF;
828
829 IF p_rent_index_rec.spread_frequency_meaning = pn_index_rent_utils.g_pn_miss_char
830 THEN
831 p_rent_index_rec.spread_frequency_meaning := NULL;
832 END IF;
833
834 IF p_rent_index_rec.relationship_default = pn_index_rent_utils.g_pn_miss_char
835 THEN
836 p_rent_index_rec.relationship_default := NULL;
837 END IF;
838
839 IF p_rent_index_rec.relationship_default_meaning = pn_index_rent_utils.g_pn_miss_char
840 THEN
841 p_rent_index_rec.relationship_default_meaning := NULL;
842 END IF;
843
844 IF p_rent_index_rec.basis_percent_default = pn_index_rent_utils.g_pn_miss_num
845 THEN
846 p_rent_index_rec.basis_percent_default := NULL;
847 END IF;
848
849 IF p_rent_index_rec.initial_basis = pn_index_rent_utils.g_pn_miss_num
850 THEN
851 p_rent_index_rec.initial_basis := NULL;
852 END IF;
853
854 IF p_rent_index_rec.base_index = pn_index_rent_utils.g_pn_miss_num
855 THEN
856 p_rent_index_rec.base_index := NULL;
857 END IF;
858
859 IF p_rent_index_rec.base_index_line_id = pn_index_rent_utils.g_pn_miss_num
860 THEN
861 p_rent_index_rec.base_index_line_id := NULL;
862 END IF;
863
864 IF p_rent_index_rec.index_finder_method = pn_index_rent_utils.g_pn_miss_char
865 THEN
866 p_rent_index_rec.index_finder_method := NULL;
867 END IF;
868
869 IF p_rent_index_rec.index_finder_method_meaning = pn_index_rent_utils.g_pn_miss_char
870 THEN
871 p_rent_index_rec.index_finder_method_meaning := NULL;
872 END IF;
873
874 IF p_rent_index_rec.index_finder_months = pn_index_rent_utils.g_pn_miss_num
875 THEN
876 p_rent_index_rec.index_finder_months := NULL;
877 END IF;
878
879 IF p_rent_index_rec.negative_rent_type = pn_index_rent_utils.g_pn_miss_char
880 THEN
881 p_rent_index_rec.negative_rent_type := NULL;
882 END IF;
883
884 IF p_rent_index_rec.negative_rent_type_meaning = pn_index_rent_utils.g_pn_miss_char
885 THEN
886 p_rent_index_rec.negative_rent_type_meaning := NULL;
887 END IF;
888
889 IF p_rent_index_rec.increase_on = pn_index_rent_utils.g_pn_miss_char
890 THEN
891 p_rent_index_rec.increase_on := NULL;
892 END IF;
893
894 IF p_rent_index_rec.increase_on_meaning = pn_index_rent_utils.g_pn_miss_char
895 THEN
896 p_rent_index_rec.increase_on_meaning := NULL;
897 END IF;
898
899 IF p_rent_index_rec.basis_type = pn_index_rent_utils.g_pn_miss_char
900 THEN
901 p_rent_index_rec.basis_type := NULL;
902 END IF;
903
904 IF p_rent_index_rec.basis_type_meaning = pn_index_rent_utils.g_pn_miss_char
905 THEN
906 p_rent_index_rec.basis_type_meaning := NULL;
907 END IF;
908
909 IF p_rent_index_rec.reference_period = pn_index_rent_utils.g_pn_miss_char
910 THEN
911 p_rent_index_rec.reference_period := NULL;
912 END IF;
913
914 IF p_rent_index_rec.reference_period_meaning = pn_index_rent_utils.g_pn_miss_char
915 THEN
916 p_rent_index_rec.reference_period_meaning := NULL;
917 END IF;
918
919 IF p_rent_index_rec.base_year = pn_index_rent_utils.g_pn_miss_date
920 THEN
921 p_rent_index_rec.base_year := NULL;
922 END IF;
923
924 IF p_rent_index_rec.leased_area = pn_index_rent_utils.g_pn_miss_num
925 THEN
926 p_rent_index_rec.leased_area := NULL;
927 END IF;
928
929 IF p_rent_index_rec.rounding_flag = pn_index_rent_utils.g_pn_miss_char
930 THEN
931 p_rent_index_rec.rounding_flag := NULL;
932 END IF;
933
934 IF p_rent_index_rec.aggregation_flag = pn_index_rent_utils.g_pn_miss_char
935 THEN
936 p_rent_index_rec.aggregation_flag := NULL;
937 END IF;
938
939 IF p_rent_index_rec.gross_flag = pn_index_rent_utils.g_pn_miss_char
940 THEN
941 p_rent_index_rec.gross_flag := NULL;
942 END IF;
943
944 IF p_rent_index_rec.last_update_login = pn_index_rent_utils.g_pn_miss_num
945 THEN
946 p_rent_index_rec.last_update_login := NULL;
947 END IF;
948
949 IF p_rent_index_rec.attribute_category = pn_index_rent_utils.g_pn_miss_char
950 THEN
951 p_rent_index_rec.attribute_category := NULL;
952 END IF;
953
954 IF p_rent_index_rec.attribute1 = pn_index_rent_utils.g_pn_miss_char
955 THEN
956 p_rent_index_rec.attribute1 := NULL;
957 END IF;
958
959 IF p_rent_index_rec.attribute2 = pn_index_rent_utils.g_pn_miss_char
960 THEN
961 p_rent_index_rec.attribute2 := NULL;
962 END IF;
963
964 IF p_rent_index_rec.attribute3 = pn_index_rent_utils.g_pn_miss_char
965 THEN
966 p_rent_index_rec.attribute3 := NULL;
967 END IF;
968
969 IF p_rent_index_rec.attribute4 = pn_index_rent_utils.g_pn_miss_char
970 THEN
971 p_rent_index_rec.attribute4 := NULL;
972 END IF;
973
974 IF p_rent_index_rec.attribute5 = pn_index_rent_utils.g_pn_miss_char
975 THEN
976 p_rent_index_rec.attribute5 := NULL;
977 END IF;
978
979 IF p_rent_index_rec.attribute6 = pn_index_rent_utils.g_pn_miss_char
980 THEN
981 p_rent_index_rec.attribute6 := NULL;
982 END IF;
983
984 IF p_rent_index_rec.attribute7 = pn_index_rent_utils.g_pn_miss_char
985 THEN
986 p_rent_index_rec.attribute7 := NULL;
987 END IF;
988
989 IF p_rent_index_rec.attribute8 = pn_index_rent_utils.g_pn_miss_char
990 THEN
991 p_rent_index_rec.attribute8 := NULL;
992 END IF;
993
994 IF p_rent_index_rec.attribute9 = pn_index_rent_utils.g_pn_miss_char
995 THEN
996 p_rent_index_rec.attribute9 := NULL;
997 END IF;
998
999 IF p_rent_index_rec.attribute10 = pn_index_rent_utils.g_pn_miss_char
1000 THEN
1001 p_rent_index_rec.attribute10 := NULL;
1002 END IF;
1003
1004 IF p_rent_index_rec.attribute11 = pn_index_rent_utils.g_pn_miss_char
1005 THEN
1006 p_rent_index_rec.attribute11 := NULL;
1007 END IF;
1008
1009 IF p_rent_index_rec.attribute12 = pn_index_rent_utils.g_pn_miss_char
1010 THEN
1011 p_rent_index_rec.attribute12 := NULL;
1012 END IF;
1013
1014 IF p_rent_index_rec.attribute13 = pn_index_rent_utils.g_pn_miss_char
1015 THEN
1016 p_rent_index_rec.attribute13 := NULL;
1017 END IF;
1018
1019 IF p_rent_index_rec.attribute14 = pn_index_rent_utils.g_pn_miss_char
1020 THEN
1021 p_rent_index_rec.attribute14 := NULL;
1022 END IF;
1023
1024 IF p_rent_index_rec.attribute15 = pn_index_rent_utils.g_pn_miss_char
1025 THEN
1026 p_rent_index_rec.attribute15 := NULL;
1027 END IF;
1028
1029 IF p_rent_index_rec.agreement_category = pn_index_rent_utils.g_pn_miss_char
1030 THEN
1031 p_rent_index_rec.agreement_category := NULL;
1032 END IF;
1033
1034 IF p_rent_index_rec.agreement_attribute1 = pn_index_rent_utils.g_pn_miss_char
1035 THEN
1036 p_rent_index_rec.agreement_attribute1 := NULL;
1037 END IF;
1038
1039 IF p_rent_index_rec.agreement_attribute2 = pn_index_rent_utils.g_pn_miss_char
1040 THEN
1041 p_rent_index_rec.agreement_attribute2 := NULL;
1042 END IF;
1043
1044 IF p_rent_index_rec.agreement_attribute3 = pn_index_rent_utils.g_pn_miss_char
1045 THEN
1046 p_rent_index_rec.agreement_attribute3 := NULL;
1047 END IF;
1048
1049 IF p_rent_index_rec.agreement_attribute4 = pn_index_rent_utils.g_pn_miss_char
1050 THEN
1051 p_rent_index_rec.agreement_attribute4 := NULL;
1052 END IF;
1053
1054 IF p_rent_index_rec.agreement_attribute5 = pn_index_rent_utils.g_pn_miss_char
1055 THEN
1056 p_rent_index_rec.agreement_attribute5 := NULL;
1057 END IF;
1058
1059 IF p_rent_index_rec.agreement_attribute6 = pn_index_rent_utils.g_pn_miss_char
1060 THEN
1061 p_rent_index_rec.agreement_attribute6 := NULL;
1062 END IF;
1063
1064 IF p_rent_index_rec.agreement_attribute7 = pn_index_rent_utils.g_pn_miss_char
1065 THEN
1066 p_rent_index_rec.agreement_attribute7 := NULL;
1067 END IF;
1068
1069 IF p_rent_index_rec.agreement_attribute8 = pn_index_rent_utils.g_pn_miss_char
1070 THEN
1071 p_rent_index_rec.agreement_attribute8 := NULL;
1072 END IF;
1073
1074 IF p_rent_index_rec.agreement_attribute9 = pn_index_rent_utils.g_pn_miss_char
1075 THEN
1076 p_rent_index_rec.agreement_attribute9 := NULL;
1077 END IF;
1078
1079 IF p_rent_index_rec.agreement_attribute10 = pn_index_rent_utils.g_pn_miss_char
1080 THEN
1081 p_rent_index_rec.agreement_attribute10 := NULL;
1082 END IF;
1083
1084 IF p_rent_index_rec.agreement_attribute11 = pn_index_rent_utils.g_pn_miss_char
1085 THEN
1086 p_rent_index_rec.agreement_attribute11 := NULL;
1087 END IF;
1088
1089 IF p_rent_index_rec.agreement_attribute12 = pn_index_rent_utils.g_pn_miss_char
1090 THEN
1091 p_rent_index_rec.agreement_attribute12 := NULL;
1092 END IF;
1093
1094 IF p_rent_index_rec.agreement_attribute13 = pn_index_rent_utils.g_pn_miss_char
1095 THEN
1096 p_rent_index_rec.agreement_attribute13 := NULL;
1097 END IF;
1098
1099 IF p_rent_index_rec.agreement_attribute14 = pn_index_rent_utils.g_pn_miss_char
1100 THEN
1101 p_rent_index_rec.agreement_attribute14 := NULL;
1102 END IF;
1103
1104 IF p_rent_index_rec.agreement_attribute15 = pn_index_rent_utils.g_pn_miss_char
1105 THEN
1106 p_rent_index_rec.agreement_attribute15 := NULL;
1107 END IF;
1108
1109 IF p_rent_index_rec.currency_code = pn_index_rent_utils.g_pn_miss_char
1110 THEN
1111 p_rent_index_rec.currency_code := NULL;
1112 END IF;
1113
1114 IF p_rent_index_rec.carry_forward_flag = pn_index_rent_utils.g_pn_miss_char
1115 THEN
1116 p_rent_index_rec.carry_forward_flag := NULL;
1117 END IF;
1118
1119 IF p_rent_index_rec.retain_initial_basis_flag = pn_index_rent_utils.g_pn_miss_char
1120 THEN
1121 p_rent_index_rec.retain_initial_basis_flag := NULL;
1122 END IF;
1123
1124 IF p_rent_index_rec.vr_nbp_flag = pn_index_rent_utils.g_pn_miss_char
1125 THEN
1126 p_rent_index_rec.vr_nbp_flag := NULL;
1127 END IF;
1128
1129 IF p_rent_index_rec.index_multiplier = pn_index_rent_utils.g_pn_miss_num
1130 THEN
1131 p_rent_index_rec.index_multiplier := NULL;
1132 END IF;
1133
1134 IF p_rent_index_rec.proration_rule = pn_index_rent_utils.g_pn_miss_char
1135 THEN
1136 p_rent_index_rec.proration_rule := NULL;
1137 END IF;
1138
1139 IF p_rent_index_rec.proration_rule_meaning = pn_index_rent_utils.g_pn_miss_char
1140 THEN
1141 p_rent_index_rec.proration_rule_meaning := NULL;
1142 END IF;
1143
1144 IF p_rent_index_rec.proration_period_start_date = pn_index_rent_utils.g_pn_miss_date
1145 THEN
1146 p_rent_index_rec.proration_period_start_date := NULL;
1147 END IF;
1148 EXCEPTION
1149 WHEN fnd_api.g_exc_error
1150 THEN
1151 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
1152 || g_pkg_name
1153 || g_program_unit
1154 || '-'
1155 || SQLERRM
1156 , 5);
1157 x_return_status := fnd_api.g_ret_sts_error;
1158
1159 WHEN OTHERS
1160 THEN
1161 pn_index_rent_pvt.DEBUG ( 'Exception in '
1162 || g_pkg_name
1163 || g_program_unit
1164 || '-'
1165 || SQLERRM
1166 , 5);
1167 x_return_status := fnd_api.g_ret_sts_unexp_error;
1168 END init_index_rent_rec;
1169
1170 -----------------------------------------------------------------------------------------
1171 -- Procedure to update pn_index_leases_all table with the provided index rent new values.
1172 -----------------------------------------------------------------------------------------
1173 PROCEDURE update_index_rent_row (
1174 p_rent_index_rec IN OUT NOCOPY rent_index_rec
1175 , x_return_status OUT NOCOPY VARCHAR2
1176 , x_msg_count OUT NOCOPY NUMBER
1177 , x_msg_data OUT NOCOPY VARCHAR2)
1178 IS
1179 l_rowid VARCHAR2 (18) := NULL;
1180 BEGIN
1181 g_program_unit := 'UPDATE_INDENT_RENT_ROW';
1182 x_return_status := fnd_api.g_ret_sts_success;
1183
1184 pn_index_rent_pvt.DEBUG ( g_pkg_name
1185 || g_program_unit
1186 || ' Calling pn_index_leases_pkg.update_row'
1187 , 3);
1188 pn_index_leases_pkg.update_row
1189 (x_rowid => l_rowid
1190 , x_index_lease_id => p_rent_index_rec.index_lease_id
1191 , x_lease_id => p_rent_index_rec.lease_id
1192 , x_index_id => p_rent_index_rec.index_id
1193 , x_commencement_date => p_rent_index_rec.commencement_date
1194 , x_termination_date => p_rent_index_rec.termination_date
1195 , x_index_lease_number => p_rent_index_rec.index_lease_number
1196 , x_last_update_date => NVL (p_rent_index_rec.last_update_date, TRUNC(SYSDATE))
1197 , x_last_updated_by => NVL (p_rent_index_rec.last_updated_by
1198 , fnd_global.user_id)
1199 , x_location_id => p_rent_index_rec.location_id
1200 , x_term_template_id => p_rent_index_rec.term_template_id
1201 , x_abstracted_by => p_rent_index_rec.abstracted_by
1202 , x_assessment_date => p_rent_index_rec.assessment_date
1203 , x_assessment_interval => p_rent_index_rec.assessment_interval
1204 , x_spread_frequency => p_rent_index_rec.spread_frequency
1205 , x_relationship_default => p_rent_index_rec.relationship_default
1206 , x_basis_percent_default => p_rent_index_rec.basis_percent_default
1207 , x_initial_basis => p_rent_index_rec.initial_basis
1208 , x_base_index => p_rent_index_rec.base_index
1209 , x_base_index_line_id => p_rent_index_rec.base_index_line_id
1210 , x_index_finder_method => p_rent_index_rec.index_finder_method
1211 , x_index_finder_months => p_rent_index_rec.index_finder_months
1212 , x_negative_rent_type => p_rent_index_rec.negative_rent_type
1213 , x_increase_on => p_rent_index_rec.increase_on
1214 , x_basis_type => p_rent_index_rec.basis_type
1215 , x_reference_period => p_rent_index_rec.reference_period
1216 , x_base_year => p_rent_index_rec.base_year
1217 , x_leased_area => p_rent_index_rec.leased_area
1218 , x_rounding_flag => p_rent_index_rec.rounding_flag
1219 , x_aggregation_flag => p_rent_index_rec.aggregation_flag
1220 , x_gross_flag => NVL (p_rent_index_rec.gross_flag, 'N')
1221 , x_last_update_login => NVL (p_rent_index_rec.last_update_login
1222 , fnd_global.user_id)
1223 , x_attribute_category => p_rent_index_rec.attribute_category
1224 , x_attribute1 => p_rent_index_rec.attribute1
1225 , x_attribute2 => p_rent_index_rec.attribute2
1226 , x_attribute3 => p_rent_index_rec.attribute3
1227 , x_attribute4 => p_rent_index_rec.attribute4
1228 , x_attribute5 => p_rent_index_rec.attribute5
1229 , x_attribute6 => p_rent_index_rec.attribute6
1230 , x_attribute7 => p_rent_index_rec.attribute7
1231 , x_attribute8 => p_rent_index_rec.attribute8
1232 , x_attribute9 => p_rent_index_rec.attribute9
1233 , x_attribute10 => p_rent_index_rec.attribute10
1234 , x_attribute11 => p_rent_index_rec.attribute11
1235 , x_attribute12 => p_rent_index_rec.attribute12
1236 , x_attribute13 => p_rent_index_rec.attribute13
1237 , x_attribute14 => p_rent_index_rec.attribute14
1238 , x_attribute15 => p_rent_index_rec.attribute15
1239 , x_agreement_category => p_rent_index_rec.agreement_category
1240 , x_agreement_attribute1 => p_rent_index_rec.agreement_attribute1
1241 , x_agreement_attribute2 => p_rent_index_rec.agreement_attribute2
1242 , x_agreement_attribute3 => p_rent_index_rec.agreement_attribute3
1243 , x_agreement_attribute4 => p_rent_index_rec.agreement_attribute4
1244 , x_agreement_attribute5 => p_rent_index_rec.agreement_attribute5
1245 , x_agreement_attribute6 => p_rent_index_rec.agreement_attribute6
1246 , x_agreement_attribute7 => p_rent_index_rec.agreement_attribute7
1247 , x_agreement_attribute8 => p_rent_index_rec.agreement_attribute8
1248 , x_agreement_attribute9 => p_rent_index_rec.agreement_attribute9
1249 , x_agreement_attribute10 => p_rent_index_rec.agreement_attribute10
1250 , x_agreement_attribute11 => p_rent_index_rec.agreement_attribute11
1251 , x_agreement_attribute12 => p_rent_index_rec.agreement_attribute12
1252 , x_agreement_attribute13 => p_rent_index_rec.agreement_attribute13
1253 , x_agreement_attribute14 => p_rent_index_rec.agreement_attribute14
1254 , x_agreement_attribute15 => p_rent_index_rec.agreement_attribute15
1255 , x_currency_code => p_rent_index_rec.currency_code
1256 , x_carry_forward_flag => NVL (p_rent_index_rec.carry_forward_flag, 'N')
1257 , x_retain_initial_basis_flag => p_rent_index_rec.retain_initial_basis_flag
1258 , x_vr_nbp_flag => p_rent_index_rec.vr_nbp_flag
1259 , x_index_multiplier => p_rent_index_rec.index_multiplier
1260 , x_proration_rule => p_rent_index_rec.proration_rule
1261 , x_proration_period_start_date => p_rent_index_rec.proration_period_start_date);
1262
1263 pn_index_rent_pvt.DEBUG ( g_pkg_name
1264 || g_program_unit
1265 || ' pn_index_leases_pkg.update_row successful index_lease_id:'|| p_rent_index_rec.index_lease_id
1266 , 3);
1267 IF p_rent_index_rec.index_lease_id>0
1268 THEN
1269 x_return_status := fnd_api.g_ret_sts_success;
1270 ELSE
1271 RAISE fnd_api.g_exc_error;
1272 END IF;
1273 EXCEPTION
1274 WHEN fnd_api.g_exc_error
1275 THEN
1276 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
1277 || g_pkg_name
1278 || g_program_unit
1279 || '-'
1280 || SQLERRM
1281 , 5);
1282 x_return_status := fnd_api.g_ret_sts_error;
1283
1284 WHEN OTHERS
1285 THEN
1286 pn_index_rent_pvt.DEBUG ( 'Exception in '
1287 || g_pkg_name
1288 || g_program_unit
1289 || '-'
1290 || SQLERRM
1291 , 5);
1292 x_return_status := fnd_api.g_ret_sts_unexp_error;
1293 END update_index_rent_row;
1294 ------------------------------------------------------------------------
1295 -- Procedure to insert index rent record into pn_index_leases_all table
1296 ------------------------------------------------------------------------
1297 PROCEDURE insert_index_rent_row (
1298 p_rent_index_rec IN OUT NOCOPY rent_index_rec
1299 , x_return_status OUT NOCOPY VARCHAR2
1300 , x_msg_count OUT NOCOPY NUMBER
1301 , x_msg_data OUT NOCOPY VARCHAR2)
1302 IS
1303 l_rowid VARCHAR2 (18) := NULL;
1304 BEGIN
1305 g_program_unit := 'INSERT_INDEX_RENT_ROW';
1306 x_return_status := fnd_api.g_ret_sts_success;
1307 init_index_rent_rec (p_rent_index_rec => p_rent_index_rec
1308 , x_return_status => x_return_status
1309 , x_msg_count => x_msg_count
1310 , x_msg_data => x_msg_count);
1311
1312 pn_index_rent_pvt.DEBUG ( g_pkg_name
1313 || g_program_unit
1314 || ' Calling pn_index_leases_pkg.insert_row'
1315 , 3);
1316 pn_index_leases_pkg.insert_row
1317 (x_rowid => l_rowid
1318 , x_org_id => p_rent_index_rec.org_id
1319 , x_index_lease_id => p_rent_index_rec.index_lease_id
1320 , x_lease_id => p_rent_index_rec.lease_id
1321 , x_index_id => p_rent_index_rec.index_id
1322 , x_commencement_date => p_rent_index_rec.commencement_date
1323 , x_termination_date => p_rent_index_rec.termination_date
1324 , x_index_lease_number => p_rent_index_rec.index_lease_number
1325 , x_last_update_date => NVL (p_rent_index_rec.last_update_date
1326 , TRUNC(SYSDATE))
1327 , x_last_updated_by => NVL (p_rent_index_rec.last_updated_by
1328 , fnd_global.user_id)
1329 , x_creation_date => NVL (p_rent_index_rec.creation_date, TRUNC(SYSDATE))
1330 , x_created_by => NVL (p_rent_index_rec.created_by
1331 , fnd_global.user_id)
1332 , x_location_id => p_rent_index_rec.location_id
1333 , x_term_template_id => p_rent_index_rec.term_template_id
1334 , x_abstracted_by => p_rent_index_rec.abstracted_by
1335 , x_assessment_date => p_rent_index_rec.assessment_date
1336 , x_assessment_interval => p_rent_index_rec.assessment_interval
1337 , x_spread_frequency => p_rent_index_rec.spread_frequency
1338 , x_relationship_default => p_rent_index_rec.relationship_default
1339 , x_basis_percent_default => p_rent_index_rec.basis_percent_default
1340 , x_initial_basis => p_rent_index_rec.initial_basis
1341 , x_base_index => p_rent_index_rec.base_index
1342 , x_base_index_line_id => p_rent_index_rec.base_index_line_id
1343 , x_index_finder_method => p_rent_index_rec.index_finder_method
1344 , x_index_finder_months => p_rent_index_rec.index_finder_months
1345 , x_negative_rent_type => p_rent_index_rec.negative_rent_type
1346 , x_increase_on => p_rent_index_rec.increase_on
1347 , x_basis_type => p_rent_index_rec.basis_type
1348 , x_reference_period => p_rent_index_rec.reference_period
1349 , x_base_year => p_rent_index_rec.base_year
1350 , x_leased_area => p_rent_index_rec.leased_area
1351 , x_rounding_flag => p_rent_index_rec.rounding_flag
1352 , x_aggregation_flag => p_rent_index_rec.aggregation_flag
1353 , x_gross_flag => NVL (p_rent_index_rec.gross_flag, 'N')
1354 , x_last_update_login => NVL (p_rent_index_rec.last_update_login
1355 , fnd_global.user_id)
1356 , x_attribute_category => p_rent_index_rec.attribute_category
1357 , x_attribute1 => p_rent_index_rec.attribute1
1358 , x_attribute2 => p_rent_index_rec.attribute2
1359 , x_attribute3 => p_rent_index_rec.attribute3
1360 , x_attribute4 => p_rent_index_rec.attribute4
1361 , x_attribute5 => p_rent_index_rec.attribute5
1362 , x_attribute6 => p_rent_index_rec.attribute6
1363 , x_attribute7 => p_rent_index_rec.attribute7
1364 , x_attribute8 => p_rent_index_rec.attribute8
1365 , x_attribute9 => p_rent_index_rec.attribute9
1366 , x_attribute10 => p_rent_index_rec.attribute10
1367 , x_attribute11 => p_rent_index_rec.attribute11
1368 , x_attribute12 => p_rent_index_rec.attribute12
1369 , x_attribute13 => p_rent_index_rec.attribute13
1370 , x_attribute14 => p_rent_index_rec.attribute14
1371 , x_attribute15 => p_rent_index_rec.attribute15
1372 , x_agreement_category => p_rent_index_rec.agreement_category
1373 , x_agreement_attribute1 => p_rent_index_rec.agreement_attribute1
1374 , x_agreement_attribute2 => p_rent_index_rec.agreement_attribute2
1375 , x_agreement_attribute3 => p_rent_index_rec.agreement_attribute3
1376 , x_agreement_attribute4 => p_rent_index_rec.agreement_attribute4
1377 , x_agreement_attribute5 => p_rent_index_rec.agreement_attribute5
1378 , x_agreement_attribute6 => p_rent_index_rec.agreement_attribute6
1379 , x_agreement_attribute7 => p_rent_index_rec.agreement_attribute7
1380 , x_agreement_attribute8 => p_rent_index_rec.agreement_attribute8
1381 , x_agreement_attribute9 => p_rent_index_rec.agreement_attribute9
1382 , x_agreement_attribute10 => p_rent_index_rec.agreement_attribute10
1383 , x_agreement_attribute11 => p_rent_index_rec.agreement_attribute11
1384 , x_agreement_attribute12 => p_rent_index_rec.agreement_attribute12
1385 , x_agreement_attribute13 => p_rent_index_rec.agreement_attribute13
1386 , x_agreement_attribute14 => p_rent_index_rec.agreement_attribute14
1387 , x_agreement_attribute15 => p_rent_index_rec.agreement_attribute15
1388 , x_currency_code => p_rent_index_rec.currency_code
1389 , x_carry_forward_flag => NVL (p_rent_index_rec.carry_forward_flag, 'N')
1390 , x_retain_initial_basis_flag => p_rent_index_rec.retain_initial_basis_flag
1391 , x_vr_nbp_flag => p_rent_index_rec.vr_nbp_flag
1392 , x_index_multiplier => p_rent_index_rec.index_multiplier
1393 , x_proration_rule => p_rent_index_rec.proration_rule
1394 , x_proration_period_start_date => p_rent_index_rec.proration_period_start_date);
1395
1396
1397 --IF l_rowid IS NOT NULL
1398 --THEN
1399 pn_index_rent_pvt.DEBUG ( g_pkg_name
1400 || g_program_unit
1401 || ' pn_index_leases_pkg.insert_row successful. index_lease_id:'|| p_rent_index_rec.index_lease_id
1402 , 3);
1403
1404 --ELSE
1405 -- RAISE fnd_api.g_exc_error;
1406 --END IF;
1407 IF p_rent_index_rec.index_lease_id>0
1408 THEN
1409 x_return_status := fnd_api.g_ret_sts_success;
1410 ELSE
1411 RAISE fnd_api.g_exc_error;
1412 END IF;
1413 EXCEPTION
1414 WHEN fnd_api.g_exc_error
1415 THEN
1416 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
1417 || g_pkg_name
1418 || g_program_unit
1419 || '-'
1420 || SQLERRM
1421 , 5);
1422 x_return_status := fnd_api.g_ret_sts_error;
1423
1424 WHEN OTHERS
1425 THEN
1426 pn_index_rent_pvt.DEBUG ( 'Exception in '
1427 || g_pkg_name
1428 || g_program_unit
1429 || '-'
1430 || SQLERRM
1431 , 5);
1432 x_return_status := fnd_api.g_ret_sts_unexp_error;
1433 END insert_index_rent_row;
1434
1435 -----------------------------------------------------------------------------------------
1436 -- Procedure to get the changed index rent fields for updating pn_index_leases_all table
1437 -----------------------------------------------------------------------------------------
1438 PROCEDURE get_changed_index_rent_rec (
1439 p_rent_index_rec IN OUT NOCOPY rent_index_rec
1440 , x_return_status OUT NOCOPY VARCHAR2
1441 , x_msg_count OUT NOCOPY VARCHAR2
1442 , x_msg_data OUT NOCOPY VARCHAR2)
1443 IS
1444 CURSOR c_old_index_rent_values (
1445 p_index_lease_id IN NUMBER)
1446 IS
1447 SELECT index_lease_id
1448 , lease_id
1449 , index_id
1450 , commencement_date
1451 , termination_date
1452 , index_lease_number
1453 , location_id
1454 , term_template_id
1455 , abstracted_by
1456 , assessment_date
1457 , assessment_interval
1458 , spread_frequency
1459 , relationship_default
1460 , basis_percent_default
1461 , initial_basis
1462 , base_index
1463 , base_index_line_id
1464 , index_finder_method
1465 , index_finder_months
1466 , negative_rent_type
1467 , increase_on
1468 , basis_type
1469 , reference_period
1470 , base_year
1471 , leased_area
1472 , rounding_flag
1473 , last_update_date
1474 , last_updated_by
1475 , creation_date
1476 , created_by
1477 , last_update_login
1478 , attribute_category
1479 , attribute1
1480 , attribute2
1481 , attribute3
1482 , attribute4
1483 , attribute5
1484 , attribute6
1485 , attribute7
1486 , attribute8
1487 , attribute9
1488 , attribute10
1489 , attribute11
1490 , attribute12
1491 , attribute13
1492 , attribute14
1493 , attribute15
1494 , agreement_category
1495 , agreement_attribute1
1496 , agreement_attribute2
1497 , agreement_attribute3
1498 , agreement_attribute4
1499 , agreement_attribute5
1500 , agreement_attribute6
1501 , agreement_attribute7
1502 , agreement_attribute8
1503 , agreement_attribute9
1504 , agreement_attribute10
1505 , agreement_attribute11
1506 , agreement_attribute12
1507 , agreement_attribute13
1508 , agreement_attribute14
1509 , agreement_attribute15
1510 , org_id
1511 , aggregation_flag
1512 , gross_flag
1513 , currency_code
1514 , carry_forward_flag
1515 , retain_initial_basis_flag
1516 , index_multiplier
1517 , constraint_proration
1518 , vr_nbp_flag
1519 , proration_rule
1520 , proration_period_start_date
1521 FROM pn_index_leases_all
1522 WHERE index_lease_id = p_index_lease_id;
1523
1524 l_rent_index_rec_old pn_index_leases_all%ROWTYPE;
1525 BEGIN
1526 g_program_unit := 'GET_CHANGED_INDEX_RENT_REC';
1527 x_return_status := fnd_api.g_ret_sts_success;
1528 pn_index_rent_pvt.DEBUG ( g_pkg_name
1529 || g_program_unit
1530 || ' Inside get_changed_index_rent_rec '
1531 , 3);
1532
1533 OPEN c_old_index_rent_values (p_rent_index_rec.index_lease_id);
1534
1535 FETCH c_old_index_rent_values
1536 INTO l_rent_index_rec_old;
1537
1538 IF (c_old_index_rent_values%NOTFOUND)
1539 THEN
1540 x_return_status := fnd_api.g_ret_sts_error;
1541
1542 pn_index_rent_pvt.DEBUG ( g_pkg_name
1543 || g_program_unit
1544 || ' Cursor c_old_index_rent_values failed to return the existing record '
1545 , 3);
1546 --ELSE
1547 -- x_return_status := fnd_api.g_ret_sts_success;
1548 END IF;
1549
1550 IF p_rent_index_rec.lease_id IS NULL OR p_rent_index_rec.lease_id =pn_index_rent_utils.g_pn_miss_num
1551 THEN
1552
1553 p_rent_index_rec.lease_id := l_rent_index_rec_old.lease_id;
1554 END IF;
1555
1556
1557 IF p_rent_index_rec.index_lease_id IS NULL OR p_rent_index_rec.index_lease_id =pn_index_rent_utils.g_pn_miss_num
1558 THEN
1559 p_rent_index_rec.index_lease_id := l_rent_index_rec_old.index_lease_id;
1560 END IF;
1561
1562 IF p_rent_index_rec.index_id IS NULL OR p_rent_index_rec.index_id =pn_index_rent_utils.g_pn_miss_num
1563 THEN
1564 p_rent_index_rec.index_id := l_rent_index_rec_old.index_id;
1565 END IF;
1566
1567
1568 IF p_rent_index_rec.commencement_date IS NULL OR p_rent_index_rec.commencement_date = pn_index_rent_utils.g_pn_miss_date
1569 THEN
1570 p_rent_index_rec.commencement_date := l_rent_index_rec_old.commencement_date;
1571 END IF;
1572
1573 IF p_rent_index_rec.termination_date IS NULL OR p_rent_index_rec.termination_date = pn_index_rent_utils.g_pn_miss_date
1574 THEN
1575 p_rent_index_rec.termination_date := l_rent_index_rec_old.termination_date;
1576 END IF;
1577
1578
1579 IF p_rent_index_rec.termination_date <>l_rent_index_rec_old.termination_date
1580 THEN
1581 IF pn_index_lease_common_pkg.find_if_period_exists(p_rent_index_rec.index_lease_id) IS NOT NULL
1582 OR pn_index_lease_common_pkg.find_if_period_exists(p_rent_index_rec.index_lease_id)<> pn_index_rent_utils.g_pn_miss_num
1583 THEN
1584
1585 pn_index_rent_periods_pkg.process_new_termination_date( p_index_lease_id => p_rent_index_rec.index_lease_id,
1586 p_new_termination_date => p_rent_index_rec.termination_date,
1587 p_ignore_approved_terms => 'N',
1588 p_msg => x_return_status);
1589 END IF;
1590 END IF;
1591
1592 IF p_rent_index_rec.index_lease_number IS NULL OR p_rent_index_rec.index_lease_number = pn_index_rent_utils.g_pn_miss_char
1593 THEN
1594 p_rent_index_rec.index_lease_number := l_rent_index_rec_old.index_lease_number;
1595 END IF;
1596
1597 IF p_rent_index_rec.index_lease_number IS NULL OR p_rent_index_rec.index_lease_number = pn_index_rent_utils.g_pn_miss_char
1598 THEN
1599 p_rent_index_rec.index_lease_number := l_rent_index_rec_old.index_lease_number;
1600 END IF;
1601
1602
1603 /*
1604 IF p_rent_index_rec.location_id IS NULL OR p_rent_index_rec.location_id = pn_index_rent_utils.g_pn_miss_num
1605 THEN
1606 --IF NVL (p_rent_index_rec.index_lease_number, '~') =
1607 -- NVL (l_rent_index_rec_old.index_lease_number, '~')
1608 --THEN
1609 p_rent_index_rec.location_id := l_rent_index_rec_old.location_id;
1610 --END IF;
1611 END IF;
1612
1613 IF p_rent_index_rec.term_template_id IS NULL OR p_rent_index_rec.term_template_id = pn_index_rent_utils.g_pn_miss_num
1614 THEN
1615 --IF NVL (p_rent_index_rec.index_lease_number, '~') =
1616 -- NVL (l_rent_index_rec_old.index_lease_number, '~')
1617 --THEN
1618 p_rent_index_rec.term_template_id := l_rent_index_rec_old.term_template_id;
1619 --END IF;
1620 END IF;
1621 */
1622 IF p_rent_index_rec.location_id IS NOT NULL AND p_rent_index_rec.location_id <> pn_index_rent_utils.g_pn_miss_num
1623 THEN
1624 IF p_rent_index_rec.index_lease_id IS NOT NULL AND p_rent_index_rec.index_lease_id <> pn_index_rent_utils.g_pn_miss_num
1625 AND (pn_index_lease_common_pkg.find_if_period_exists(l_rent_index_rec_old.index_lease_id) IS NOT NULL)
1626 THEN
1627
1628 IF p_rent_index_rec.location_id<> l_rent_index_rec_old.location_id
1629 THEN
1630 PN_INDEX_LEASE_COMMON_PKG.update_location_for_ir_terms(l_rent_index_rec_old.index_lease_id,
1631 l_rent_index_rec_old.location_id,
1632 x_return_status);
1633 IF (x_return_status <> 'SUCCESS_FIRE_RECALC' AND
1634 x_return_status <> 'S') THEN
1635 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
1636 fnd_message.set_token('ERR_MSG', 'Update location for IR terms failed with status: '||x_return_status);
1637 fnd_msg_pub.ADD;
1638 RAISE fnd_api.g_exc_error;
1639 END IF;
1640 END IF;
1641 END IF;
1642 ELSE
1643 p_rent_index_rec.location_id := l_rent_index_rec_old.location_id;
1644
1645 END IF;
1646
1647 IF p_rent_index_rec.term_template_id IS NOT NULL AND p_rent_index_rec.term_template_id <> pn_index_rent_utils.g_pn_miss_num
1648 THEN
1649 IF p_rent_index_rec.index_lease_id IS NOT NULL AND p_rent_index_rec.index_lease_id <> pn_index_rent_utils.g_pn_miss_num
1650 AND (pn_index_lease_common_pkg.find_if_period_exists(l_rent_index_rec_old.index_lease_id) IS NOT NULL)
1651 THEN
1652
1653 IF p_rent_index_rec.location_id<> l_rent_index_rec_old.location_id
1654 THEN
1655 PN_INDEX_LEASE_COMMON_PKG.update_location_for_ir_terms(l_rent_index_rec_old.index_lease_id,
1656 l_rent_index_rec_old.location_id,
1657 x_return_status);
1658 IF (x_return_status <> 'SUCCESS_FIRE_RECALC' AND
1659 x_return_status <> 'S') THEN
1660 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
1661 fnd_message.set_token('ERR_MSG', 'Update location for IR terms failed with status: '||x_return_status);
1662 fnd_msg_pub.ADD;
1663 RAISE fnd_api.g_exc_error;
1664 END IF;
1665 END IF;
1666 END IF;
1667
1668 -- Below ESLE condition has been commented by Vivek on 27NOV2010
1669 --ELSE
1670
1671 -- p_rent_index_rec.term_template_id := l_rent_index_rec_old.term_template_id;
1672
1673 END IF;
1674
1675
1676 IF p_rent_index_rec.abstracted_by IS NULL OR p_rent_index_rec.abstracted_by = pn_index_rent_utils.g_pn_miss_num
1677 THEN
1678 p_rent_index_rec.abstracted_by := l_rent_index_rec_old.abstracted_by;
1679 END IF;
1680
1681 IF p_rent_index_rec.assessment_date IS NULL OR p_rent_index_rec.assessment_date = pn_index_rent_utils.g_pn_miss_date
1682 THEN
1683 p_rent_index_rec.assessment_date := l_rent_index_rec_old.assessment_date;
1684 END IF;
1685
1686 IF p_rent_index_rec.assessment_interval IS NULL OR p_rent_index_rec.assessment_interval = pn_index_rent_utils.g_pn_miss_num
1687 THEN
1688 p_rent_index_rec.assessment_interval := l_rent_index_rec_old.assessment_interval;
1689 END IF;
1690
1691 IF p_rent_index_rec.spread_frequency IS NULL OR p_rent_index_rec.spread_frequency = pn_index_rent_utils.g_pn_miss_char
1692 THEN
1693 p_rent_index_rec.spread_frequency := l_rent_index_rec_old.spread_frequency;
1694 END IF;
1695
1696 IF p_rent_index_rec.relationship_default IS NULL OR p_rent_index_rec.relationship_default = pn_index_rent_utils.g_pn_miss_char
1697 THEN
1698 p_rent_index_rec.relationship_default := l_rent_index_rec_old.relationship_default;
1699 END IF;
1700
1701 IF p_rent_index_rec.basis_percent_default IS NULL OR p_rent_index_rec.basis_percent_default = pn_index_rent_utils.g_pn_miss_num
1702 THEN
1703 p_rent_index_rec.basis_percent_default := l_rent_index_rec_old.basis_percent_default;
1704 END IF;
1705
1706 IF p_rent_index_rec.initial_basis IS NULL OR p_rent_index_rec.initial_basis = pn_index_rent_utils.g_pn_miss_num
1707 THEN
1708 IF NVL (p_rent_index_rec.initial_basis, -1) = NVL (l_rent_index_rec_old.initial_basis
1709 , -1)
1710 THEN
1711 p_rent_index_rec.initial_basis := l_rent_index_rec_old.initial_basis;
1712 END IF;
1713 END IF;
1714
1715 IF p_rent_index_rec.base_index IS NULL OR p_rent_index_rec.base_index = pn_index_rent_utils.g_pn_miss_num
1716 THEN
1717 p_rent_index_rec.base_index := l_rent_index_rec_old.base_index;
1718 END IF;
1719
1720 IF p_rent_index_rec.base_index_line_id IS NULL OR p_rent_index_rec.base_index_line_id = pn_index_rent_utils.g_pn_miss_num
1721 THEN
1722 p_rent_index_rec.base_index_line_id := l_rent_index_rec_old.base_index_line_id;
1723 END IF;
1724
1725 IF p_rent_index_rec.index_finder_method IS NULL OR p_rent_index_rec.index_finder_method = pn_index_rent_utils.g_pn_miss_char
1726 THEN
1727 p_rent_index_rec.index_finder_method := l_rent_index_rec_old.index_finder_method;
1728 END IF;
1729
1730 IF p_rent_index_rec.index_finder_months IS NULL OR p_rent_index_rec.index_finder_months = pn_index_rent_utils.g_pn_miss_num
1731 THEN
1732 p_rent_index_rec.index_finder_months := l_rent_index_rec_old.index_finder_months;
1733 END IF;
1734
1735 IF p_rent_index_rec.negative_rent_type IS NULL OR p_rent_index_rec.negative_rent_type = pn_index_rent_utils.g_pn_miss_char
1736 THEN
1737 p_rent_index_rec.negative_rent_type := l_rent_index_rec_old.negative_rent_type;
1738 END IF;
1739
1740 IF p_rent_index_rec.increase_on IS NULL OR p_rent_index_rec.increase_on = pn_index_rent_utils.g_pn_miss_char
1741 THEN
1742
1743 IF p_rent_index_rec.gross_flag IS NULL OR p_rent_index_rec.gross_flag = pn_index_rent_utils.g_pn_miss_char
1744 THEN
1745 p_rent_index_rec.increase_on := l_rent_index_rec_old.increase_on;
1746
1747 ELSE
1748 p_rent_index_rec.increase_on := NULL;
1749 END IF;
1750
1751 END IF;
1752
1753 IF p_rent_index_rec.basis_type IS NULL OR p_rent_index_rec.basis_type = pn_index_rent_utils.g_pn_miss_char
1754 THEN
1755 p_rent_index_rec.basis_type := l_rent_index_rec_old.basis_type;
1756 END IF;
1757
1758 IF p_rent_index_rec.reference_period IS NULL OR p_rent_index_rec.reference_period = pn_index_rent_utils.g_pn_miss_char
1759 THEN
1760 p_rent_index_rec.reference_period := l_rent_index_rec_old.reference_period;
1761 END IF;
1762
1763 IF p_rent_index_rec.base_year IS NULL OR p_rent_index_rec.base_year = pn_index_rent_utils.g_pn_miss_date
1764 THEN
1765 p_rent_index_rec.base_year := l_rent_index_rec_old.base_year;
1766 END IF;
1767
1768 IF p_rent_index_rec.leased_area IS NULL OR p_rent_index_rec.leased_area = pn_index_rent_utils.g_pn_miss_num
1769 THEN
1770 p_rent_index_rec.leased_area := l_rent_index_rec_old.leased_area;
1771 END IF;
1772
1773 IF p_rent_index_rec.rounding_flag IS NULL OR p_rent_index_rec.rounding_flag = pn_index_rent_utils.g_pn_miss_char
1774 THEN
1775 p_rent_index_rec.rounding_flag := l_rent_index_rec_old.rounding_flag;
1776 END IF;
1777
1778 IF p_rent_index_rec.attribute_category IS NULL OR p_rent_index_rec.attribute_category = pn_index_rent_utils.g_pn_miss_char
1779 THEN
1780 p_rent_index_rec.attribute_category := l_rent_index_rec_old.attribute_category;
1781
1782 END IF;
1783
1784 IF p_rent_index_rec.attribute1 IS NULL OR p_rent_index_rec.attribute1 = pn_index_rent_utils.g_pn_miss_char
1785 THEN
1786 p_rent_index_rec.attribute1 := l_rent_index_rec_old.attribute1;
1787 END IF;
1788
1789 IF p_rent_index_rec.attribute2 IS NULL OR p_rent_index_rec.attribute2 = pn_index_rent_utils.g_pn_miss_char
1790 THEN
1791 p_rent_index_rec.attribute2 := l_rent_index_rec_old.attribute2;
1792 END IF;
1793
1794 IF p_rent_index_rec.attribute3 IS NULL OR p_rent_index_rec.attribute3 = pn_index_rent_utils.g_pn_miss_char
1795 THEN
1796 p_rent_index_rec.attribute3 := l_rent_index_rec_old.attribute3;
1797 END IF;
1798
1799 IF p_rent_index_rec.attribute4 IS NULL OR p_rent_index_rec.attribute4 = pn_index_rent_utils.g_pn_miss_char
1800 THEN
1801 p_rent_index_rec.attribute4 := l_rent_index_rec_old.attribute4;
1802 END IF;
1803
1804 IF p_rent_index_rec.attribute5 IS NULL OR p_rent_index_rec.attribute5 = pn_index_rent_utils.g_pn_miss_char
1805 THEN
1806 p_rent_index_rec.attribute5 := l_rent_index_rec_old.attribute5;
1807 END IF;
1808
1809 IF p_rent_index_rec.attribute6 IS NULL OR p_rent_index_rec.attribute6 = pn_index_rent_utils.g_pn_miss_char
1810 THEN
1811 p_rent_index_rec.attribute6 := l_rent_index_rec_old.attribute6;
1812 END IF;
1813
1814 IF p_rent_index_rec.attribute7 IS NULL OR p_rent_index_rec.attribute7 = pn_index_rent_utils.g_pn_miss_char
1815 THEN
1816 p_rent_index_rec.attribute7 := l_rent_index_rec_old.attribute7;
1817 END IF;
1818
1819 IF p_rent_index_rec.attribute8 IS NULL OR p_rent_index_rec.attribute8 =pn_index_rent_utils.g_pn_miss_char
1820 THEN
1821 p_rent_index_rec.attribute8 := l_rent_index_rec_old.attribute8;
1822 END IF;
1823
1824 IF p_rent_index_rec.attribute9 IS NULL OR p_rent_index_rec.attribute9 = pn_index_rent_utils.g_pn_miss_char
1825 THEN
1826 p_rent_index_rec.attribute9 := l_rent_index_rec_old.attribute9;
1827 END IF;
1828
1829 IF p_rent_index_rec.attribute10 IS NULL OR p_rent_index_rec.attribute10 = pn_index_rent_utils.g_pn_miss_char
1830 THEN
1831 p_rent_index_rec.attribute10 := l_rent_index_rec_old.attribute10;
1832 END IF;
1833
1834 IF p_rent_index_rec.attribute11 IS NULL OR p_rent_index_rec.attribute11 = pn_index_rent_utils.g_pn_miss_char
1835 THEN
1836 p_rent_index_rec.attribute11 := l_rent_index_rec_old.attribute11;
1837 END IF;
1838
1839 IF p_rent_index_rec.attribute12 IS NULL OR p_rent_index_rec.attribute12 = pn_index_rent_utils.g_pn_miss_char
1840 THEN
1841 p_rent_index_rec.attribute12 := l_rent_index_rec_old.attribute12;
1842 END IF;
1843
1844 IF p_rent_index_rec.attribute13 IS NULL OR p_rent_index_rec.attribute13 = pn_index_rent_utils.g_pn_miss_char
1845 THEN
1846 p_rent_index_rec.attribute13 := l_rent_index_rec_old.attribute13;
1847 END IF;
1848
1849 IF p_rent_index_rec.attribute14 IS NULL OR p_rent_index_rec.attribute14 = pn_index_rent_utils.g_pn_miss_char
1850 THEN
1851 p_rent_index_rec.attribute14 := l_rent_index_rec_old.attribute14;
1852 END IF;
1853
1854 IF p_rent_index_rec.attribute15 IS NULL OR p_rent_index_rec.attribute15 = pn_index_rent_utils.g_pn_miss_char
1855 THEN
1856 p_rent_index_rec.attribute15 := l_rent_index_rec_old.attribute15;
1857 END IF;
1858
1859 IF p_rent_index_rec.agreement_category IS NULL OR p_rent_index_rec.agreement_category = pn_index_rent_utils.g_pn_miss_char
1860 THEN
1861 p_rent_index_rec.agreement_category := l_rent_index_rec_old.agreement_category;
1862 END IF;
1863
1864 IF p_rent_index_rec.agreement_attribute1 IS NULL OR p_rent_index_rec.agreement_attribute1 = pn_index_rent_utils.g_pn_miss_char
1865 THEN
1866 p_rent_index_rec.agreement_attribute1 := l_rent_index_rec_old.agreement_attribute1;
1867 END IF;
1868
1869 IF p_rent_index_rec.agreement_attribute2 IS NULL OR p_rent_index_rec.agreement_attribute2 = pn_index_rent_utils.g_pn_miss_char
1870 THEN
1871 p_rent_index_rec.agreement_attribute2 := l_rent_index_rec_old.agreement_attribute2;
1872 END IF;
1873
1874 IF p_rent_index_rec.agreement_attribute3 IS NULL OR p_rent_index_rec.agreement_attribute3 = pn_index_rent_utils.g_pn_miss_char
1875 THEN
1876 p_rent_index_rec.agreement_attribute3 := l_rent_index_rec_old.agreement_attribute3;
1877 END IF;
1878
1879 IF p_rent_index_rec.agreement_attribute4 IS NULL OR p_rent_index_rec.agreement_attribute4 = pn_index_rent_utils.g_pn_miss_char
1880 THEN
1881 p_rent_index_rec.agreement_attribute4 := l_rent_index_rec_old.agreement_attribute4;
1882 END IF;
1883
1884 IF p_rent_index_rec.agreement_attribute5 IS NULL OR p_rent_index_rec.agreement_attribute5 = pn_index_rent_utils.g_pn_miss_char
1885 THEN
1886 p_rent_index_rec.agreement_attribute5 := l_rent_index_rec_old.agreement_attribute5;
1887 END IF;
1888
1889 IF p_rent_index_rec.agreement_attribute6 IS NULL OR p_rent_index_rec.agreement_attribute6 = pn_index_rent_utils.g_pn_miss_char
1890 THEN
1891 p_rent_index_rec.agreement_attribute6 := l_rent_index_rec_old.agreement_attribute6;
1892 END IF;
1893
1894 IF p_rent_index_rec.agreement_attribute7 IS NULL OR p_rent_index_rec.agreement_attribute7 = pn_index_rent_utils.g_pn_miss_char
1895 THEN
1896 p_rent_index_rec.agreement_attribute7 := l_rent_index_rec_old.agreement_attribute7;
1897 END IF;
1898
1899 IF p_rent_index_rec.agreement_attribute8 IS NULL OR p_rent_index_rec.agreement_attribute8 = pn_index_rent_utils.g_pn_miss_char
1900 THEN
1901 p_rent_index_rec.agreement_attribute8 := l_rent_index_rec_old.agreement_attribute8;
1902 END IF;
1903
1904 IF p_rent_index_rec.agreement_attribute9 IS NULL OR p_rent_index_rec.agreement_attribute9 = pn_index_rent_utils.g_pn_miss_char
1905 THEN
1906 p_rent_index_rec.agreement_attribute9 := l_rent_index_rec_old.agreement_attribute9;
1907
1908 END IF;
1909
1910 IF p_rent_index_rec.agreement_attribute10 IS NULL OR p_rent_index_rec.agreement_attribute10 = pn_index_rent_utils.g_pn_miss_char
1911 THEN
1912 p_rent_index_rec.agreement_attribute10 := l_rent_index_rec_old.agreement_attribute10;
1913
1914 END IF;
1915
1916 IF p_rent_index_rec.agreement_attribute11 IS NULL OR p_rent_index_rec.agreement_attribute11 = pn_index_rent_utils.g_pn_miss_char
1917 THEN
1918 p_rent_index_rec.agreement_attribute11 := l_rent_index_rec_old.agreement_attribute11;
1919
1920 END IF;
1921
1922 IF p_rent_index_rec.agreement_attribute12 IS NULL OR p_rent_index_rec.agreement_attribute12 = pn_index_rent_utils.g_pn_miss_char
1923 THEN
1924 p_rent_index_rec.agreement_attribute12 := l_rent_index_rec_old.agreement_attribute12;
1925 END IF;
1926
1927 IF p_rent_index_rec.agreement_attribute13 IS NULL OR p_rent_index_rec.agreement_attribute13 = pn_index_rent_utils.g_pn_miss_char
1928 THEN
1929 p_rent_index_rec.agreement_attribute13 := l_rent_index_rec_old.agreement_attribute13;
1930
1931 END IF;
1932
1933 IF p_rent_index_rec.agreement_attribute14 IS NULL OR p_rent_index_rec.agreement_attribute14 = pn_index_rent_utils.g_pn_miss_char
1934 THEN
1935 p_rent_index_rec.agreement_attribute14 := l_rent_index_rec_old.agreement_attribute14;
1936 END IF;
1937
1938 IF p_rent_index_rec.agreement_attribute15 IS NULL OR p_rent_index_rec.agreement_attribute15 = pn_index_rent_utils.g_pn_miss_char
1939 THEN
1940 p_rent_index_rec.agreement_attribute15 := l_rent_index_rec_old.agreement_attribute15;
1941 END IF;
1942
1943
1944 IF p_rent_index_rec.org_id IS NULL OR p_rent_index_rec.org_id = pn_index_rent_utils.g_pn_miss_num
1945 THEN
1946 p_rent_index_rec.org_id := l_rent_index_rec_old.org_id;
1947 END IF;
1948
1949 -- Below Code has been commented by ViveK on 27NOV2010
1950 /*
1951 IF p_rent_index_rec.aggregation_flag IS NULL OR p_rent_index_rec.aggregation_flag = pn_index_rent_utils.g_pn_miss_char
1952 THEN
1953 IF
1954 p_rent_index_rec.aggregation_flag := l_rent_index_rec_old.aggregation_flag;
1955 END IF;
1956 */
1957 IF p_rent_index_rec.gross_flag IS NULL OR p_rent_index_rec.gross_flag = pn_index_rent_utils.g_pn_miss_char
1958 THEN
1959 p_rent_index_rec.gross_flag := l_rent_index_rec_old.gross_flag;
1960 END IF;
1961
1962 IF p_rent_index_rec.currency_code IS NULL OR p_rent_index_rec.currency_code = pn_index_rent_utils.g_pn_miss_char
1963 THEN
1964 p_rent_index_rec.currency_code := l_rent_index_rec_old.currency_code;
1965 END IF;
1966
1967 IF p_rent_index_rec.carry_forward_flag IS NULL OR p_rent_index_rec.carry_forward_flag = pn_index_rent_utils.g_pn_miss_char
1968 THEN
1969 p_rent_index_rec.carry_forward_flag := l_rent_index_rec_old.carry_forward_flag;
1970
1971 END IF;
1972
1973 IF p_rent_index_rec.retain_initial_basis_flag IS NULL OR p_rent_index_rec.retain_initial_basis_flag = pn_index_rent_utils.g_pn_miss_char
1974 THEN
1975 p_rent_index_rec.retain_initial_basis_flag :=
1976 l_rent_index_rec_old.retain_initial_basis_flag;
1977
1978 END IF;
1979
1980 IF p_rent_index_rec.index_multiplier IS NULL OR p_rent_index_rec.index_multiplier = pn_index_rent_utils.g_pn_miss_num
1981 THEN
1982 p_rent_index_rec.index_multiplier := l_rent_index_rec_old.index_multiplier;
1983 END IF;
1984
1985 IF p_rent_index_rec.vr_nbp_flag IS NULL OR p_rent_index_rec.vr_nbp_flag = pn_index_rent_utils.g_pn_miss_char
1986 THEN
1987
1988 p_rent_index_rec.vr_nbp_flag := l_rent_index_rec_old.vr_nbp_flag;
1989
1990 END IF;
1991
1992 IF p_rent_index_rec.proration_rule IS NULL OR p_rent_index_rec.proration_rule = pn_index_rent_utils.g_pn_miss_char
1993 THEN
1994
1995 p_rent_index_rec.proration_rule := l_rent_index_rec_old.proration_rule;
1996
1997 END IF;
1998
1999 IF p_rent_index_rec.proration_period_start_date IS NULL OR p_rent_index_rec.proration_period_start_date = pn_index_rent_utils.g_pn_miss_date
2000 THEN
2001
2002 p_rent_index_rec.proration_period_start_date :=
2003 l_rent_index_rec_old.proration_period_start_date;
2004
2005 END IF;
2006
2007 IF c_old_index_rent_values%ISOPEN
2008 THEN
2009 CLOSE c_old_index_rent_values;
2010 END IF;
2011 EXCEPTION
2012 WHEN OTHERS
2013 THEN
2014
2015 IF c_old_index_rent_values%ISOPEN
2016 THEN
2017 CLOSE c_old_index_rent_values;
2018 END IF;
2019
2020 x_return_status := fnd_api.g_ret_sts_unexp_error;
2021 END get_changed_index_rent_rec;
2022
2023 ----------------------------------------------
2024 -- Procedure to validate index record passed
2025 ----------------------------------------------
2026 PROCEDURE validate_index_rent_rec (
2027 p_rent_index_rec IN OUT NOCOPY rent_index_rec
2028 --, p_validate IN VARCHAR2 := fnd_api.g_false
2029 , p_operation IN VARCHAR2 DEFAULT 'CREATE_RENT_INDEX'
2030 , x_return_status OUT NOCOPY VARCHAR2
2031 , x_msg_count OUT NOCOPY NUMBER
2032 , x_msg_data OUT NOCOPY VARCHAR2)
2033 IS
2034 l_lease_param VARCHAR2 (30) := 'LEASE_ID';
2035 l_index_id_param VARCHAR2 (30) := 'INDEX_ID';
2036 l_index_lease_id_param VARCHAR2 (30) := 'INDEX_LEASE_ID';
2037 l_location_param VARCHAR2 (30) := 'LOCATION_ID';
2038 l_abstracted_by_param VARCHAR2 (30) := 'ABSTRACTED_BY';
2039 --l_operation VARCHAR2 (30);
2040 l_currency_code_param VARCHAR2 (30) := 'CURRENCY_CODE';
2041 l_increase_on_param VARCHAR2 (30) := 'INCREASE_ON';
2042 l_reference_period_param VARCHAR2 (30) := 'REFERENCE_PERIOD';
2043 l_basis_type_param VARCHAR2 (30) := 'BASIS_TYPE';
2044 l_index_finder_param VARCHAR2 (30) := 'INDEX_FINDER_METHOD';
2045 l_relationship_default_param VARCHAR2 (30) := 'RELATIONSHIP DEFAULT';
2046 l_negative_rent_type_param VARCHAR2 (30) := 'NEGATIVE_RENT_TYPE';
2047 l_spread_frequency_param VARCHAR2 (30) := 'SPREAD FREQUENCY';
2048 l_constraint_proration_param VARCHAR2 (30) := 'CONSTRAINT PRORATION';
2049 l_param_lease_template VARCHAR2 (30) := 'TERM TEMPLATE';
2050 l_reference_period_type VARCHAR2 (30) := 'PN_INDEX_REF_PERIOD';
2051 l_basis_type_type VARCHAR2 (30) := 'PN_INDEX_BASIS_TYPE';
2052 l_index_finder_method_type VARCHAR2 (30) := 'PN_INDEX_FINDER_METHOD';
2053 l_relationship_default_type VARCHAR2 (30) := 'PN_INDEX_RELATION';
2054 l_negative_rent_type VARCHAR2 (30) := 'PN_INDEX_NEGATIVE_RENT';
2055 l_spread_frequency_type VARCHAR2 (30) := 'PN_PAYMENT_FREQUENCY_TYPE';
2056 l_constraint_proration_type VARCHAR2 (30) := 'PN_CONSTRAINT_PRORATION';
2057 l_index_number_profile VARCHAR2 (30);
2058 l_set_of_books_id NUMBER;
2059 l_func_curr_code gl_sets_of_books.currency_code%TYPE;
2060 l_user_conversion_type VARCHAR2 (30);
2061 l_conversion_type VARCHAR2 (30);
2062 l_lease_class_code VARCHAR2 (30);
2063 l_term_template_type VARCHAR2 (100);
2064 l_lease_commencement_date DATE := TRUNC(SYSDATE);
2065 l_lease_termination_date DATE := TRUNC(SYSDATE);
2066 l_lease_lease_execution_date DATE := TRUNC(SYSDATE);
2067 l_lease_extension_end_date DATE := TRUNC(SYSDATE);
2068 l_mod NUMBER := NULL;
2069 l_tccstatus VARCHAR2 (30);
2070 l_msg VARCHAR2(2000);
2071 l_period_exists NUMBER:= NULL;
2072 l_base_year DATE;
2073 l_base_index NUMBER;
2074 l_base_index_line_id NUMBER;
2075
2076 CURSOR get_func_curr_code (
2077 p_set_of_books_id IN NUMBER)
2078 IS
2079 SELECT currency_code
2080 FROM gl_sets_of_books
2081 WHERE set_of_books_id = p_set_of_books_id;
2082
2083 l_error_count NUMBER := 0;
2084 BEGIN
2085 x_return_status := fnd_api.g_ret_sts_success;
2086 g_program_unit := 'VALIDATE_INDEX_RENT_REC';
2087
2088 pn_index_rent_pvt.DEBUG ( g_pkg_name
2089 || g_program_unit
2090 || ' - Start of validate_index_rent_rec procedure'
2091 , 3);
2092
2093
2094 IF p_rent_index_rec.org_id IS NOT NULL
2095 OR p_rent_index_rec.org_id <> pn_index_rent_utils.g_pn_miss_num
2096 THEN
2097 l_index_number_profile :=
2098 NVL (pn_mo_cache_utils.get_profile_value ('PN_AUTOMATIC_INDEX_RENT_NUMBERING'
2099 , p_rent_index_rec.org_id)
2100 , 'N');
2101 ELSE
2102 l_index_number_profile := 'N';
2103 END IF;
2104
2105
2106 IF l_index_number_profile = 'Y'
2107 AND LTRIM (RTRIM (p_operation)) <> 'UPDATE_INDEX_RENT'
2108 THEN
2109 p_rent_index_rec.index_lease_number := NULL;
2110 END IF;
2111
2112 IF LTRIM (RTRIM (p_operation)) = 'UPDATE_INDEX_RENT'
2113 THEN
2114
2115 pn_index_rent_pvt.DEBUG ( g_pkg_name
2116 || g_program_unit
2117 || ' - Before calling PN_INDEX_RENT_UTILS.GET_INDEX_LEASE_ID index_lease_id - '|| p_rent_index_rec.index_lease_id
2118 , 3);
2119 --IF LTRIM (RTRIM (p_operation)) = 'UPDATE_INDEX_RENT'
2120 --THEN
2121 IF ( p_rent_index_rec.index_lease_number IS NOT NULL
2122 AND p_rent_index_rec.index_lease_number <> pn_index_rent_utils.g_pn_miss_char)
2123 OR ( p_rent_index_rec.index_lease_id IS NOT NULL
2124 AND p_rent_index_rec.index_lease_id <> pn_index_rent_utils.g_pn_miss_num)
2125 THEN
2126 pn_index_rent_utils.get_index_lease_id
2127 (p_parameter_name => l_index_lease_id_param
2128 , p_operation => p_operation
2129 , p_index_lease_number => p_rent_index_rec.index_lease_number
2130 , x_index_lease_id => p_rent_index_rec.index_lease_id
2131 , x_lease_id => p_rent_index_rec.lease_id
2132 , x_org_id => p_rent_index_rec.org_id
2133 , x_index_id => p_rent_index_rec.index_id
2134 , x_return_status => x_return_status);
2135
2136 pn_index_rent_pvt.DEBUG ( g_pkg_name
2137 || g_program_unit
2138 || ' - PN_INDEX_RENT_UTILS.GET_INDEX_LEASE_ID returned index_lease_id - '|| p_rent_index_rec.index_lease_id
2139 , 3);
2140
2141 IF x_return_status<>fnd_api.g_ret_sts_success
2142 THEN
2143 l_error_count:=l_error_count+1;
2144 fnd_message.set_name('PN','PN_INDEX_UPDATE_REQD_DATA');
2145 fnd_msg_pub.ADD;
2146 RAISE fnd_api.g_exc_error;
2147 END IF;
2148 END IF;
2149 --END IF;
2150 END IF;
2151
2152
2153 pn_index_rent_pvt.DEBUG ( g_pkg_name
2154 || g_program_unit
2155 || ' - Before calling PN_INDEX_RENT_UTILS.GET_INDEX_LEASE_ID index_lease_id - '|| p_rent_index_rec.index_lease_id
2156 , 3);
2157
2158 IF LTRIM (RTRIM (p_operation)) <>'UPDATE_INDEX_RENT'
2159 THEN
2160 IF ( p_rent_index_rec.index_lease_number IS NOT NULL
2161 AND p_rent_index_rec.index_lease_number <> pn_index_rent_utils.g_pn_miss_char)
2162 THEN
2163 IF l_index_number_profile = 'N'
2164 THEN
2165 --l_returnstatus := NULL;
2166 pn_index_leases_pkg.check_unq_index_lease_number
2167 (x_return_status => x_return_status
2168 , x_index_lease_id => p_rent_index_rec.index_lease_id
2169 , x_index_lease_number => p_rent_index_rec.index_lease_number);
2170
2171 pn_index_rent_pvt.DEBUG ( g_pkg_name
2172 || g_program_unit
2173 || ' - PN_INDEX_RENT_UTILS.GET_INDEX_LEASE_ID returned index_lease_id - 3'|| p_rent_index_rec.index_lease_id
2174 , 3);
2175
2176
2177 IF x_return_status IS NOT NULL AND x_return_status<>fnd_api.g_ret_sts_success
2178 THEN
2179 l_error_count:=l_error_count+1;
2180 fnd_message.set_name('PN','PN_DUP_INDEX_LEASE_NUMBER');
2181 fnd_msg_pub.ADD;
2182 RAISE fnd_api.g_exc_error;
2183 END IF;
2184 END IF;
2185 END IF;
2186 END IF;
2187
2188 l_set_of_books_id :=
2189 pn_mo_cache_utils.get_profile_value ('PN_SET_OF_BOOKS_ID', p_rent_index_rec.org_id);
2190
2191 FOR rec IN get_func_curr_code (l_set_of_books_id)
2192 LOOP
2193 l_func_curr_code := rec.currency_code;
2194 END LOOP;
2195
2196
2197 pn_index_rent_pvt.DEBUG ( g_pkg_name
2198 || g_program_unit
2199 || ' - Default functional currency of the operating unit '|| l_func_curr_code
2200 , 3);
2201
2202
2203 ------------------------------------------------------------------
2204 -- Get the lease details for the passed Lease Number or Lease Id
2205 ------------------------------------------------------------------
2206 pn_index_rent_pvt.DEBUG ( g_pkg_name
2207 || g_program_unit||
2208 ' - Before calling pn_index_rent_utils.get_lease_id lease_id - '|| p_rent_index_rec.lease_id
2209 , 3);
2210 pn_index_rent_pvt.DEBUG ( g_pkg_name
2211 || g_program_unit ||
2212 ' - Before calling pn_index_rent_utils.get_lease_id lease_number - '|| p_rent_index_rec.lease_num
2213 , 3);
2214 pn_index_rent_pvt.DEBUG ( g_pkg_name
2215 || g_program_unit||
2216 ' - Before calling pn_index_rent_utils.get_lease_id lease_name - '|| p_rent_index_rec.lease_name
2217 , 3);
2218
2219 IF ( ( p_rent_index_rec.lease_id IS NOT NULL
2220 AND p_rent_index_rec.lease_id <> pn_index_rent_utils.g_pn_miss_num)
2221 OR ( p_rent_index_rec.lease_num IS NOT NULL
2222 AND p_rent_index_rec.lease_num <> pn_index_rent_utils.g_pn_miss_char)
2223 OR ( p_rent_index_rec.lease_name IS NOT NULL
2224 AND p_rent_index_rec.lease_name <> pn_index_rent_utils.g_pn_miss_char))
2225 THEN
2226 pn_index_rent_utils.get_lease_id
2227 (p_parameter_name => l_lease_param
2228 , p_operation => p_operation
2229 , p_lease_name => p_rent_index_rec.lease_name
2230 , p_lease_number => p_rent_index_rec.lease_num
2231 , p_org_id => p_rent_index_rec.org_id
2232 , x_lease_id => p_rent_index_rec.lease_id
2233 , x_lease_class_code => l_lease_class_code
2234 , x_lease_commencement_date => l_lease_commencement_date
2235 , x_lease_termination_date => l_lease_termination_date
2236 , x_lease_execution_date => l_lease_lease_execution_date
2237 , x_lease_extension_end_date => l_lease_extension_end_date
2238 , x_return_status => x_return_status);
2239
2240 pn_index_rent_pvt.DEBUG ( g_pkg_name
2241 || g_program_unit ||
2242 ' - After calling pn_index_rent_utils.get_lease_id lease_id - '|| p_rent_index_rec.lease_id
2243 , 3);
2244 pn_index_rent_pvt.DEBUG ( g_pkg_name
2245 || g_program_unit ||
2246 ' - After calling pn_index_rent_utils.get_lease_id lease_number - '|| p_rent_index_rec.lease_num
2247 , 3);
2248 pn_index_rent_pvt.DEBUG ( g_pkg_name
2249 || g_program_unit ||
2250 ' - After calling pn_index_rent_utils.get_lease_id lease_name - '|| p_rent_index_rec.lease_name
2251 , 3);
2252
2253 IF x_return_status<>fnd_api.g_ret_sts_success
2254 THEN
2255 l_error_count:=l_error_count+1;
2256 fnd_message.set_name('PN','PN_LEASE_ID');
2257 fnd_message.set_token (' ID', p_rent_index_rec.lease_id);
2258 fnd_msg_pub.ADD;
2259 RAISE fnd_api.g_exc_error;
2260 END IF;
2261 END IF;
2262
2263 ------------------------------------------------------------------
2264 -- Get the location associated with Lease Number or Lease Id
2265 ------------------------------------------------------------------
2266 pn_index_rent_pvt.DEBUG ( g_pkg_name
2267 || g_program_unit ||
2268 ' - Before calling pn_index_rent_utils.get_location_id location_code - '|| p_rent_index_rec.location_id
2269 , 3);
2270
2271 IF ( ( p_rent_index_rec.location_id IS NOT NULL
2272 AND p_rent_index_rec.location_id <> pn_index_rent_utils.g_pn_miss_num)
2273 OR ( p_rent_index_rec.location_code IS NOT NULL
2274 AND p_rent_index_rec.location_code <> pn_index_rent_utils.g_pn_miss_char))
2275 THEN
2276 pn_index_rent_utils.get_location_id (p_parameter_name => l_location_param
2277 , p_operation => p_operation
2278 , p_lease_id => p_rent_index_rec.lease_id
2279 , p_location_code => p_rent_index_rec.location_code
2280 , p_org_id => p_rent_index_rec.org_id
2281 , x_location_id => p_rent_index_rec.location_id
2282 , x_return_status => x_return_status);
2283 pn_index_rent_pvt.DEBUG ( g_pkg_name
2284 || g_program_unit||
2285 ' - After calling pn_index_rent_utils.get_location_id location_code - '|| p_rent_index_rec.location_id
2286 , 3);
2287
2288 IF x_return_status<>fnd_api.g_ret_sts_success
2289 THEN
2290 l_error_count:=l_error_count+1;
2291 fnd_message.set_name('PN','PN_LOCATION_NOT_EXIST');
2292 fnd_msg_pub.ADD;
2293 RAISE fnd_api.g_exc_error;
2294 END IF;
2295 END IF;
2296
2297 pn_index_rent_pvt.DEBUG ( g_pkg_name
2298 || g_program_unit||
2299 ' - Before calling pn_index_rent_utils.get_index_id index - '|| p_rent_index_rec.index_id
2300 , 3);
2301
2302 -------------------------------------
2303 -- Validate the passed Index Id/Type
2304 -------------------------------------
2305 IF ( ( p_rent_index_rec.index_id IS NOT NULL
2306 AND p_rent_index_rec.index_id <> pn_index_rent_utils.g_pn_miss_num)
2307 OR ( p_rent_index_rec.index_type IS NOT NULL
2308 AND p_rent_index_rec.index_type <> pn_index_rent_utils.g_pn_miss_char))
2309 THEN
2310 pn_index_rent_utils.get_index_id (p_parameter_name => l_index_id_param
2311 , p_operation => p_operation
2312 , p_index_name => p_rent_index_rec.index_type
2313 , x_index_id => p_rent_index_rec.index_id
2314 , x_return_status => x_return_status);
2315 pn_index_rent_pvt.DEBUG ( g_pkg_name
2316 || g_program_unit ||
2317 ' - After calling pn_index_rent_utils.get_index_id index - '|| p_rent_index_rec.index_id
2318 , 3);
2319
2320 IF x_return_status<>fnd_api.g_ret_sts_success
2321 THEN
2322 l_error_count:=l_error_count+1;
2323 fnd_message.set_name('PN','PN_INDEX_TYPE_NOT_EXISTS');
2324 fnd_msg_pub.ADD;
2325 RAISE fnd_api.g_exc_error;
2326 END IF;
2327 END IF;
2328
2329 ----------------------------------------------
2330 -- Validate the passed Index Commencement Date
2331 ----------------------------------------------
2332
2333 pn_index_rent_pvt.DEBUG ( g_pkg_name
2334 || g_program_unit||
2335 ' - Before validating index commencement date - '|| p_rent_index_rec.commencement_date
2336 , 3);
2337
2338 pn_index_rent_pvt.DEBUG ( g_pkg_name
2339 || g_program_unit||
2340 ' - Before validating index termination date - '|| p_rent_index_rec.termination_date
2341 , 3);
2342
2343 IF ( ( p_rent_index_rec.commencement_date IS NULL
2344 OR p_rent_index_rec.commencement_date = pn_index_rent_utils.g_pn_miss_date))
2345 THEN
2346
2347 p_rent_index_rec.commencement_date := ADD_MONTHS (l_lease_commencement_date, 12);
2348
2349 END IF;
2350
2351
2352 IF ( ( p_rent_index_rec.termination_date IS NULL
2353 OR p_rent_index_rec.termination_date = pn_index_rent_utils.g_pn_miss_date))
2354 THEN
2355
2356 p_rent_index_rec.termination_date := GREATEST (l_lease_termination_date, NVL (l_lease_extension_end_date, l_lease_termination_date));
2357 END IF;
2358
2359 IF ( ( p_rent_index_rec.commencement_date IS NOT NULL
2360 AND p_rent_index_rec.commencement_date <> pn_index_rent_utils.g_pn_miss_date)
2361 AND ( p_rent_index_rec.termination_date IS NOT NULL
2362 AND p_rent_index_rec.termination_date <> pn_index_rent_utils.g_pn_miss_date))
2363 THEN
2364 IF ( (p_rent_index_rec.commencement_date < l_lease_commencement_date)
2365 OR (p_rent_index_rec.commencement_date >
2366 GREATEST (l_lease_termination_date
2367 , NVL (l_lease_extension_end_date, l_lease_termination_date))))
2368 THEN
2369 l_error_count:=l_error_count+1;
2370 fnd_message.set_name ('PN', 'PN_INDEX_COMMENCE_TERMINATE_DT');
2371 fnd_msg_pub.ADD;
2372 RAISE fnd_api.g_exc_error;
2373 END IF;
2374
2375 IF (p_rent_index_rec.termination_date < p_rent_index_rec.commencement_date)
2376 THEN
2377 l_error_count:=l_error_count+1;
2378 fnd_message.set_name ('PN', 'PN_INDEX_TERMINATION_DT');
2379 fnd_msg_pub.ADD;
2380 RAISE fnd_api.g_exc_error;
2381 END IF;
2382
2383 IF ( (p_rent_index_rec.termination_date < l_lease_commencement_date)
2384 OR (p_rent_index_rec.termination_date >
2385 GREATEST (l_lease_termination_date
2386 , NVL (l_lease_extension_end_date, l_lease_termination_date))))
2387 THEN
2388 l_error_count:=l_error_count+1;
2389 fnd_message.set_name ('PN', 'PN_INDEX_COMMENCE_TERMINATE_DT');
2390 fnd_msg_pub.ADD;
2391 RAISE fnd_api.g_exc_error;
2392 END IF;
2393
2394 IF (p_rent_index_rec.termination_date < p_rent_index_rec.commencement_date)
2395 THEN
2396 l_error_count:=l_error_count+1;
2397 fnd_message.set_name ('PN', 'PN_INDEX_TERMINATION_DT');
2398 fnd_msg_pub.ADD;
2399 RAISE fnd_api.g_exc_error;
2400 END IF;
2401
2402 --ELSE
2403 -- p_rent_index_rec.commencement_date := ADD_MONTHS (l_lease_commencement_date, 12);
2404 -- p_rent_index_rec.termination_date :=
2405 -- GREATEST (l_lease_termination_date
2406 -- , NVL (l_lease_extension_end_date, l_lease_termination_date));
2407 END IF;
2408
2409 pn_index_rent_pvt.DEBUG ( g_pkg_name
2410 || g_program_unit||
2411 ' - After validating index commencement date - '|| p_rent_index_rec.commencement_date
2412 , 3);
2413
2414 pn_index_rent_pvt.DEBUG ( g_pkg_name
2415 || g_program_unit||
2416 ' - After validating index termination date - '|| p_rent_index_rec.termination_date
2417 , 3);
2418
2419
2420 ---------------------------------------
2421 -- Validate the passed User Responsible
2422 ---------------------------------------
2423 pn_index_rent_pvt.DEBUG ( g_pkg_name
2424 || g_program_unit||
2425 ' - Before calling pn_index_rent_utils.get_user_id - '|| p_rent_index_rec.abstracted_by
2426 , 3);
2427
2428 IF ( ( p_rent_index_rec.abstracted_by IS NOT NULL
2429 AND p_rent_index_rec.abstracted_by <> pn_index_rent_utils.g_pn_miss_num)
2430 OR ( p_rent_index_rec.abstracted_by_username IS NOT NULL
2431 AND p_rent_index_rec.abstracted_by_username <> pn_index_rent_utils.g_pn_miss_char))
2432 THEN
2433 pn_index_rent_utils.get_user_id (p_parameter_name => l_abstracted_by_param
2434 , p_operation => p_operation
2435 , p_user_name => p_rent_index_rec.abstracted_by_username
2436 , x_user_id => p_rent_index_rec.abstracted_by
2437 , x_return_status => x_return_status);
2438
2439 IF x_return_status <> fnd_api.g_ret_sts_success
2440 THEN
2441 l_error_count:=l_error_count+1;
2442 fnd_message.set_name ('PN','PN_INDEX_USER_NOT_EXISTS');
2443 fnd_msg_pub.ADD;
2444 RAISE fnd_api.g_exc_error;
2445 END IF;
2446 END IF;
2447
2448 pn_index_rent_pvt.DEBUG ( g_pkg_name
2449 || g_program_unit||
2450 ' - After calling pn_index_rent_utils.get_user_id - '|| p_rent_index_rec.abstracted_by
2451 , 3);
2452
2453 -------------------------------------
2454 -- Validate the passed Currency Code
2455 -------------------------------------
2456 pn_index_rent_pvt.DEBUG ( g_pkg_name
2457 || g_program_unit||
2458 ' - Before pn_index_rent_utils.get_currency_code currency code - '|| p_rent_index_rec.currency_code
2459 , 3);
2460 /*
2461 IF ( p_rent_index_rec.currency_code IS NOT NULL
2462 AND p_rent_index_rec.currency_code <> pn_index_rent_utils.g_pn_miss_char)
2463 THEN
2464 pn_index_rent_utils.get_currency_code (p_parameter_name => l_currency_code_param
2465 , p_operation => p_operation
2466 , p_functional_currency_code => l_func_curr_code
2467 , x_currency_code => p_rent_index_rec.currency_code
2468 , x_user_conversion_type => l_user_conversion_type
2469 , x_conversion_type => l_conversion_type
2470 , x_return_status => x_return_status);
2471 IF x_return_status<>fnd_api.g_ret_sts_success
2472 THEN
2473 l_error_count:=l_error_count+1;
2474 fnd_message.set_name('PN','PN_CURRENCY_CODE_NOT_EXIST');
2475 fnd_msg_pub.ADD;
2476 RAISE fnd_api.g_exc_error;
2477 END IF;
2478 END IF;*/
2479 p_rent_index_rec.currency_code:= l_func_curr_code;
2480
2481 pn_index_rent_pvt.DEBUG ( g_pkg_name
2482 || g_program_unit||
2483 ' - After pn_index_rent_utils.get_currency_code currency code - '|| p_rent_index_rec.currency_code
2484 , 3);
2485
2486 ------------------------------------------
2487 -- Validate the passed Assessment Interval
2488 ------------------------------------------
2489 pn_index_rent_pvt.DEBUG ( g_pkg_name
2490 || g_program_unit||
2491 ' - Before validation assessment_interval - '|| p_rent_index_rec.assessment_interval
2492 , 3);
2493
2494 IF ( p_rent_index_rec.assessment_interval IS NOT NULL
2495 AND p_rent_index_rec.assessment_interval <> pn_index_rent_utils.g_pn_miss_num)
2496 THEN
2497 l_mod := MOD (p_rent_index_rec.assessment_interval, 1);
2498
2499 IF p_rent_index_rec.assessment_interval <= 0
2500 OR l_mod <> 0
2501 THEN
2502 l_error_count:=l_error_count+1;
2503 fnd_message.set_name ('PN', 'PN_INVALID_ASSESS_YEAR');
2504 fnd_msg_pub.ADD;
2505 RAISE fnd_api.g_exc_error;
2506 END IF;
2507 ELSE
2508 p_rent_index_rec.assessment_interval := 1;
2509 END IF;
2510
2511 pn_index_rent_pvt.DEBUG ( g_pkg_name
2512 || g_program_unit||
2513 ' - After validation assessment_interval - '|| p_rent_index_rec.assessment_interval
2514 , 3);
2515 ------------------------------------------
2516 -- Validate the passed Assessment Date
2517 ------------------------------------------
2518 IF ( p_rent_index_rec.assessment_date IS NOT NULL
2519 AND p_rent_index_rec.assessment_date <> pn_index_rent_utils.g_pn_miss_date)
2520 THEN
2521 -- MESSAGE NAME- PN_INVALID_ASSESS_DATE
2522 p_rent_index_rec.assessment_date := ADD_MONTHS (l_lease_commencement_date, 12);
2523 END IF;
2524
2525 -----------------------------------
2526 -- Validate the passed Increase On
2527 -----------------------------------
2528 pn_index_rent_pvt.DEBUG ( g_pkg_name
2529 || g_program_unit||
2530 ' - Before calling pn_index_rent_utils.get_increase_on increase_on - '|| p_rent_index_rec.increase_on
2531 , 3);
2532 IF ( p_rent_index_rec.increase_on IS NOT NULL
2533 AND p_rent_index_rec.increase_on <> pn_index_rent_utils.g_pn_miss_char)
2534 OR ( p_rent_index_rec.increase_on_meaning IS NOT NULL
2535 AND p_rent_index_rec.increase_on_meaning <> pn_index_rent_utils.g_pn_miss_char)
2536 THEN
2537 pn_index_rent_utils.get_increase_on
2538 (p_parameter_name => l_increase_on_param
2539 , p_operation => p_operation
2540 , p_lookup_meaning => p_rent_index_rec.increase_on_meaning
2541 , p_lease_id => p_rent_index_rec.lease_id
2542 , p_currency_code => l_func_curr_code
2543 --p_rent_index_rec.currency_code
2544 , x_lookup_code => p_rent_index_rec.increase_on
2545 , x_return_status => x_return_status);
2546 IF x_return_status<>fnd_api.g_ret_sts_success
2547 THEN
2548 l_error_count:=l_error_count+1;
2549 fnd_message.set_name('PN','PN_INDEX_INCREASE_ON_NOT_EXIST');
2550 fnd_msg_pub.ADD;
2551 RAISE fnd_api.g_exc_error;
2552 END IF;
2553
2554 END IF;
2555
2556 pn_index_rent_pvt.DEBUG ( g_pkg_name
2557 || g_program_unit||
2558 ' - After calling pn_index_rent_utils.get_increase_on increase_on - '|| p_rent_index_rec.increase_on
2559 , 3);
2560
2561 IF ( p_rent_index_rec.increase_on IS NOT NULL
2562 AND p_rent_index_rec.increase_on <> pn_index_rent_utils.g_pn_miss_char)
2563 THEN
2564 p_rent_index_rec.gross_flag := 'N';
2565 END IF;
2566
2567
2568 ----------------------------------------
2569 -- Validate the passed Reference Period
2570 ----------------------------------------
2571 pn_index_rent_pvt.DEBUG ( g_pkg_name
2572 || g_program_unit||
2573 ' - Before calling pn_index_rent_utils.get_lookup_code reference_period - '|| p_rent_index_rec.reference_period
2574 , 3);
2575
2576
2577 IF ( ( p_rent_index_rec.reference_period IS NOT NULL
2578 AND p_rent_index_rec.reference_period <> pn_index_rent_utils.g_pn_miss_char)
2579 OR ( p_rent_index_rec.reference_period_meaning IS NOT NULL
2580 AND p_rent_index_rec.reference_period_meaning <> pn_index_rent_utils.g_pn_miss_char))
2581 THEN
2582 pn_index_rent_utils.get_lookup_code
2583 (p_parameter_name => l_reference_period_param
2584 , p_operation => p_operation
2585 , p_lookup_meaning => p_rent_index_rec.reference_period_meaning
2586 , p_lookup_type => l_reference_period_type
2587 , x_lookup_type_code => p_rent_index_rec.reference_period
2588 , x_return_status => x_return_status);
2589 IF x_return_status<>fnd_api.g_ret_sts_success
2590 THEN
2591 l_error_count:=l_error_count+1;
2592 fnd_message.set_name('PN','PN_INDEX_REFERENCE_PERIOD');
2593 fnd_msg_pub.ADD;
2594 RAISE fnd_api.g_exc_error;
2595 END IF;
2596 ELSE
2597 IF LTRIM (RTRIM (p_operation)) <> 'UPDATE_INDEX_RENT'
2598 THEN
2599 p_rent_index_rec.reference_period := 'PREV_YEAR_PREV_CURRENT_CPI';
2600 END IF;
2601 END IF;
2602
2603 pn_index_rent_pvt.DEBUG ( g_pkg_name
2604 || g_program_unit||
2605 ' - After calling pn_index_rent_utils.get_lookup_code reference_period - '|| p_rent_index_rec.reference_period
2606 , 3);
2607
2608
2609 ----------------------------------
2610 -- Validate the passed Basis Type
2611 ----------------------------------
2612 pn_index_rent_pvt.DEBUG ( g_pkg_name
2613 || g_program_unit||
2614 ' - Before calling pn_index_rent_utils.get_lookup_code basis_type - '|| p_rent_index_rec.basis_type
2615 , 3);
2616
2617 IF ( ( p_rent_index_rec.basis_type IS NOT NULL
2618 AND p_rent_index_rec.basis_type <> pn_index_rent_utils.g_pn_miss_char)
2619 OR ( p_rent_index_rec.basis_type_meaning IS NOT NULL
2620 AND p_rent_index_rec.basis_type_meaning <> pn_index_rent_utils.g_pn_miss_char))
2621 THEN
2622 pn_index_rent_utils.get_lookup_code
2623 (p_parameter_name => l_basis_type_param
2624 , p_operation => p_operation
2625 , p_lookup_meaning => p_rent_index_rec.basis_type_meaning
2626 , p_lookup_type => l_basis_type_type
2627 , x_lookup_type_code => p_rent_index_rec.basis_type
2628 , x_return_status => x_return_status);
2629 IF x_return_status<>fnd_api.g_ret_sts_success
2630 THEN
2631 l_error_count:=l_error_count+1;
2632 fnd_message.set_name('PN','PN_INDEX_BASIS_TYPE_NOT_EXISTS');
2633 fnd_msg_pub.ADD;
2634 RAISE fnd_api.g_exc_error;
2635 END IF;
2636 END IF;
2637
2638 pn_index_rent_pvt.DEBUG ( g_pkg_name
2639 || g_program_unit||
2640 ' - After calling pn_index_rent_utils.get_lookup_code basis_type - '|| p_rent_index_rec.basis_type
2641 , 3);
2642
2643 ------------------------------------------
2644 -- Validate the passed Index Finder Method
2645 ------------------------------------------
2646 pn_index_rent_pvt.DEBUG ( g_pkg_name
2647 || g_program_unit||
2648 ' - Before calling pn_index_rent_utils.get_lookup_code index_finder_method - '|| p_rent_index_rec.index_finder_method
2649 , 3);
2650
2651 IF ( ( p_rent_index_rec.index_finder_method IS NOT NULL
2652 AND p_rent_index_rec.index_finder_method <> pn_index_rent_utils.g_pn_miss_char)
2653 OR ( p_rent_index_rec.index_finder_method_meaning IS NOT NULL
2654 AND p_rent_index_rec.index_finder_method_meaning <> pn_index_rent_utils.g_pn_miss_char))
2655 THEN
2656 pn_index_rent_utils.get_lookup_code
2657 (p_parameter_name => l_index_finder_param
2658 , p_operation => p_operation
2659 , p_lookup_meaning => p_rent_index_rec.index_finder_method_meaning
2660 , p_lookup_type => l_index_finder_method_type
2661 , x_lookup_type_code => p_rent_index_rec.index_finder_method
2662 , x_return_status => x_return_status);
2663 IF x_return_status<>fnd_api.g_ret_sts_success
2664 THEN
2665 l_error_count:=l_error_count+1;
2666 fnd_message.set_name('PN','PN_INDEX_FINDER_NOT_EXISTS');
2667 fnd_msg_pub.ADD;
2668 RAISE fnd_api.g_exc_error;
2669 END IF;
2670 ELSE
2671 IF LTRIM (RTRIM (p_operation)) <> 'UPDATE_INDEX_RENT'
2672 THEN
2673 p_rent_index_rec.index_finder_method:='FINDER_DATE';
2674 END IF;
2675 END IF;
2676
2677 pn_index_rent_pvt.DEBUG ( g_pkg_name
2678 || g_program_unit||
2679 ' - After calling pn_index_rent_utils.get_lookup_code index_finder_method - '|| p_rent_index_rec.index_finder_method
2680 , 3);
2681
2682 ----------------------------------------
2683 -- Validate the passed Default Relation
2684 -----------------------------------------
2685 pn_index_rent_pvt.DEBUG ( g_pkg_name
2686 || g_program_unit||
2687 ' - Before calling pn_index_rent_utils.get_lookup_code relationship_default - '|| p_rent_index_rec.relationship_default
2688 , 3);
2689
2690 IF ( ( p_rent_index_rec.relationship_default IS NOT NULL
2691 AND p_rent_index_rec.relationship_default <> pn_index_rent_utils.g_pn_miss_char)
2692 OR ( p_rent_index_rec.relationship_default_meaning IS NOT NULL
2693 AND p_rent_index_rec.relationship_default_meaning <>
2694 pn_index_rent_utils.g_pn_miss_char))
2695 THEN
2696 pn_index_rent_utils.get_lookup_code
2697 (p_parameter_name => l_relationship_default_param
2698 , p_operation => p_operation
2699 , p_lookup_meaning => p_rent_index_rec.relationship_default_meaning
2700 , p_lookup_type => l_relationship_default_type
2701 , x_lookup_type_code => p_rent_index_rec.relationship_default
2702 , x_return_status => x_return_status);
2703 IF x_return_status<>fnd_api.g_ret_sts_success
2704 THEN
2705 l_error_count:=l_error_count+1;
2706 fnd_message.set_name('PN','PN_INDEX_RELATION_NOT_EXISTS');
2707 fnd_msg_pub.ADD;
2708 RAISE fnd_api.g_exc_error;
2709 END IF;
2710 END IF;
2711
2712 IF LTRIM (RTRIM (p_operation)) <>'UPDATE_INDEX_RENT'
2713 AND (p_rent_index_rec.relationship_default IS NULL OR p_rent_index_rec.relationship_default =pn_index_rent_utils.g_pn_miss_char)
2714
2715 THEN
2716 p_rent_index_rec.relationship_default := 'INDEX_ONLY';
2717 END IF;
2718 pn_index_rent_pvt.DEBUG ( g_pkg_name
2719 || g_program_unit||
2720 ' - After calling pn_index_rent_utils.get_lookup_code relationship_default - '|| p_rent_index_rec.relationship_default
2721 ,3);
2722
2723 -------------------------------------
2724 -- Validate the passed Term Template
2725 -------------------------------------
2726 pn_index_rent_pvt.DEBUG ( g_pkg_name
2727 || g_program_unit||
2728 ' - Before calling pn_lease_utils.get_term_template_id term_template_id - '|| p_rent_index_rec.term_template_id
2729 ,3);
2730
2731 IF l_lease_class_code = 'DIRECT'
2732 --OR p_lease_rec.lease_class = 'Expense'
2733 THEN
2734 l_term_template_type := 'PAYMENT';
2735 ELSE
2736 l_term_template_type := 'BILLING';
2737 END IF;
2738
2739 IF ( ( p_rent_index_rec.term_template_id IS NOT NULL
2740 AND p_rent_index_rec.term_template_id <> pn_lease_utils.g_pn_miss_num)
2741 OR ( p_rent_index_rec.term_template_name IS NOT NULL
2742 AND p_rent_index_rec.term_template_name <> pn_lease_utils.g_pn_miss_char))
2743 THEN
2744 pn_lease_utils.get_term_template_id
2745 (p_parameter_name => l_param_lease_template
2746 , p_termtemp_name => p_rent_index_rec.term_template_name
2747 , p_operation => p_operation
2748 , p_termtemp_type => l_term_template_type
2749 , p_org_id => p_rent_index_rec.org_id
2750 , x_return_status => x_return_status
2751 , x_termtemp_id => p_rent_index_rec.term_template_id);
2752 IF x_return_status<>fnd_api.g_ret_sts_success
2753 THEN
2754 l_error_count:=l_error_count+1;
2755 fnd_message.set_name('PN','PN_INDEX_TERM_TEMPL_NOT_EXISTS');
2756 fnd_msg_pub.ADD;
2757 RAISE fnd_api.g_exc_error;
2758 END IF;
2759 --END IF;
2760
2761 END IF;
2762
2763 pn_index_rent_pvt.DEBUG ( g_pkg_name
2764 || g_program_unit||
2765 ' - After calling pn_lease_utils.get_term_template_id term_template_id - '|| p_rent_index_rec.term_template_id
2766 ,3);
2767
2768 -- Below If Block code has been added by Vivek on 27NOV2010
2769 --
2770 IF ( ( p_rent_index_rec.term_template_id IS NOT NULL
2771 AND p_rent_index_rec.term_template_id <> pn_lease_utils.g_pn_miss_num)
2772 OR ( p_rent_index_rec.term_template_name IS NOT NULL
2773 AND p_rent_index_rec.term_template_name <> pn_lease_utils.g_pn_miss_char))
2774
2775 AND( p_rent_index_rec.aggregation_flag IS NOT NULL
2776 AND p_rent_index_rec.aggregation_flag<> pn_lease_utils.g_pn_miss_char
2777 AND p_rent_index_rec.aggregation_flag='Y')
2778 THEN
2779 l_error_count:=l_error_count+1;
2780 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
2781 fnd_message.set_token('ERR_MSG', 'Both Term Template and Agreement Flag have been provided. Please provide either Term Template or Agreement Flag');
2782 fnd_msg_pub.ADD;
2783 RAISE fnd_api.g_exc_error;
2784
2785 END IF;
2786 ----
2787
2788
2789 IF ( p_rent_index_rec.commencement_date IS NOT NULL
2790 AND p_rent_index_rec.commencement_date <> pn_lease_utils.g_pn_miss_date
2791 AND p_rent_index_rec.commencement_date= l_lease_commencement_date)
2792 THEN
2793 IF p_rent_index_rec.term_template_id IS NULL
2794 OR p_rent_index_rec.term_template_id =pn_lease_utils.g_pn_miss_num
2795 THEN
2796
2797 l_error_count:=l_error_count+1;
2798 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
2799 fnd_message.set_token('ERR_MSG','The Term Template is required when index commencement date is same as lease commencement date. Please provided a valid term template');
2800 fnd_msg_pub.ADD;
2801 RAISE fnd_api.g_exc_error;
2802 END IF;
2803
2804 ELSIF (( p_rent_index_rec.term_template_id IS NOT NULL
2805 AND p_rent_index_rec.term_template_id <> pn_lease_utils.g_pn_miss_num))
2806 THEN
2807 p_rent_index_rec.aggregation_flag := 'N';
2808
2809 --END IF;
2810 END IF;
2811
2812 -------------------------------------
2813 -- Validate the passed Negative Rent
2814 -------------------------------------
2815
2816 pn_index_rent_pvt.DEBUG ( g_pkg_name
2817 || g_program_unit||
2818 ' - Before calling pn_index_rent_utils.get_lookup_code negative_rent_type - '|| p_rent_index_rec.negative_rent_type
2819 ,3);
2820
2821
2822 IF ( ( p_rent_index_rec.negative_rent_type IS NOT NULL
2823 AND p_rent_index_rec.negative_rent_type <> pn_lease_utils.g_pn_miss_char)
2824 OR ( p_rent_index_rec.negative_rent_type_meaning IS NOT NULL
2825 AND p_rent_index_rec.negative_rent_type_meaning <> pn_lease_utils.g_pn_miss_char))
2826 THEN
2827 pn_index_rent_utils.get_lookup_code
2828 (p_parameter_name => l_negative_rent_type_param
2829 , p_operation => p_operation
2830 , p_lookup_meaning => p_rent_index_rec.negative_rent_type_meaning
2831 , p_lookup_type => l_negative_rent_type
2832 , x_lookup_type_code => p_rent_index_rec.negative_rent_type
2833 , x_return_status => x_return_status);
2834 IF x_return_status<>fnd_api.g_ret_sts_success
2835 THEN
2836 l_error_count:=l_error_count+1;
2837 fnd_message.set_name('PN','PN_INDEX_NEGTV_RENT_NOT_EXISTS');
2838 fnd_msg_pub.ADD;
2839 RAISE fnd_api.g_exc_error;
2840 END IF;
2841 END IF;
2842
2843
2844 IF LTRIM (RTRIM (p_operation)) <>'UPDATE_INDEX_RENT'
2845 AND (p_rent_index_rec.negative_rent_type IS NULL OR p_rent_index_rec.negative_rent_type =pn_index_rent_utils.g_pn_miss_char)
2846
2847 THEN
2848 p_rent_index_rec.negative_rent_type := 'IGNORE';
2849 END IF;
2850
2851 pn_index_rent_pvt.DEBUG ( g_pkg_name
2852 || g_program_unit||
2853 ' - After calling pn_index_rent_utils.get_lookup_code negative_rent_type - '|| p_rent_index_rec.negative_rent_type
2854 ,3);
2855
2856 ----------------------------------------
2857 -- Validate the passed Spread Frequency
2858 ----------------------------------------
2859
2860 pn_index_rent_pvt.DEBUG ( g_pkg_name
2861 || g_program_unit||
2862 ' - Before calling pn_index_rent_utils.get_lookup_code spread_frequency - '|| p_rent_index_rec.spread_frequency
2863 ,3);
2864
2865 IF ( ( p_rent_index_rec.spread_frequency IS NOT NULL
2866 AND p_rent_index_rec.spread_frequency <> pn_lease_utils.g_pn_miss_char)
2867 OR ( p_rent_index_rec.spread_frequency_meaning IS NOT NULL
2868 AND p_rent_index_rec.spread_frequency_meaning <> pn_lease_utils.g_pn_miss_char))
2869 THEN
2870 pn_index_rent_utils.get_lookup_code
2871 (p_parameter_name => l_spread_frequency_param
2872 , p_operation => p_operation
2873 , p_lookup_meaning => p_rent_index_rec.spread_frequency_meaning
2874 , p_lookup_type => l_spread_frequency_type
2875 , x_lookup_type_code => p_rent_index_rec.spread_frequency
2876 , x_return_status => x_return_status);
2877 IF x_return_status<>fnd_api.g_ret_sts_success
2878 THEN
2879 l_error_count:=l_error_count+1;
2880 fnd_message.set_name('PN','PN_INDEX_SPREAD_FRQ_NOT_EXISTS');
2881 fnd_msg_pub.ADD;
2882 --RAISE fnd_api.g_exc_error;
2883 END IF;
2884 END IF;
2885
2886 IF ( ( p_rent_index_rec.spread_frequency IS NULL
2887 OR p_rent_index_rec.spread_frequency = pn_lease_utils.g_pn_miss_char))
2888
2889 THEN
2890 p_rent_index_rec.spread_frequency:='MON';
2891 END IF;
2892 pn_index_rent_pvt.DEBUG ( g_pkg_name
2893 || g_program_unit||
2894 ' - After calling pn_index_rent_utils.get_lookup_code spread_frequency - '|| p_rent_index_rec.spread_frequency
2895 ,3);
2896
2897
2898 ------------------------------------------
2899 -- Validate the passed Index Finder Months
2900 ------------------------------------------
2901
2902 pn_index_rent_pvt.DEBUG ( g_pkg_name
2903 || g_program_unit||
2904 ' - Before validating index_finder_months - '|| p_rent_index_rec.index_finder_months
2905 ,3);
2906
2907 IF ( p_rent_index_rec.index_finder_months IS NOT NULL
2908 AND p_rent_index_rec.index_finder_months <> pn_lease_utils.g_pn_miss_num)
2909 THEN
2910 IF MOD (p_rent_index_rec.index_finder_months, 1) <> 0
2911 THEN
2912 l_error_count:=l_error_count+1;
2913 fnd_message.set_name ('PN', 'PN_INVALID_ASSESS_YEAR');
2914 fnd_msg_pub.ADD;
2915 RAISE fnd_api.g_exc_error;
2916
2917 END IF;
2918 ELSE
2919 p_rent_index_rec.index_finder_months := -2;
2920 END IF;
2921
2922 pn_index_rent_pvt.DEBUG ( g_pkg_name
2923 || g_program_unit||
2924 ' - After validating index_finder_months - '|| p_rent_index_rec.index_finder_months
2925 ,3);
2926
2927
2928 -------------------------------------
2929 -- Validate the passed Initial Basis
2930 -------------------------------------
2931
2932 pn_index_rent_pvt.DEBUG ( g_pkg_name
2933 || g_program_unit||
2934 ' - Before validating initial_basis - '|| p_rent_index_rec.initial_basis
2935 ,3);
2936 IF (p_rent_index_rec.commencement_date= l_lease_commencement_date)
2937 AND ( p_rent_index_rec.initial_basis IS NULL
2938 OR p_rent_index_rec.initial_basis =pn_lease_utils.g_pn_miss_num)
2939 THEN
2940 l_error_count:=l_error_count+1;
2941 fnd_message.set_name ('PN', 'PN_INDEX_INIT_BASIS_REQD');
2942 fnd_msg_pub.ADD;
2943 RAISE fnd_api.g_exc_error;
2944 --ELSE
2945 -- IF ( p_rent_index_rec.initial_basis IS NULL
2946 -- AND pn_r12_util_pkg.is_r12)
2947 -- THEN
2948 -- p_rent_index_rec.initial_basis := NULL;
2949 -- END IF;
2950 END IF;
2951
2952 pn_index_rent_pvt.DEBUG ( g_pkg_name
2953 || g_program_unit||
2954 ' - After validating initial_basis - '|| p_rent_index_rec.initial_basis
2955 ,3);
2956
2957 ------------------------------------------
2958 -- Validate the passed Index Multiplier
2959 ------------------------------------------
2960
2961 pn_index_rent_pvt.DEBUG ( g_pkg_name
2962 || g_program_unit||
2963 ' - Before validating index_multiplier - '|| p_rent_index_rec.index_multiplier
2964 ,3);
2965
2966 IF p_rent_index_rec.index_multiplier IS NOT NULL
2967 AND p_rent_index_rec.index_multiplier <> pn_lease_utils.g_pn_miss_num
2968 THEN
2969 IF p_rent_index_rec.index_multiplier <= 0
2970 THEN
2971 l_error_count:=l_error_count+1;
2972 fnd_message.set_name ('PN', 'PN_ZERO_INDEX_MULTIPLIER');
2973 fnd_msg_pub.ADD;
2974 RAISE fnd_api.g_exc_error;
2975 END IF;
2976 END IF;
2977
2978 pn_index_rent_pvt.DEBUG ( g_pkg_name
2979 || g_program_unit||
2980 ' - After validating index_multiplier - '|| p_rent_index_rec.index_multiplier
2981 ,3);
2982
2983 ------------------------------------------
2984 -- Validate the passed Agreegate Flag
2985 ------------------------------------------
2986
2987 IF NVL (p_rent_index_rec.aggregation_flag, 'Y') = 'Y'
2988 THEN
2989 p_rent_index_rec.term_template_id := NULL;
2990 END IF;
2991
2992 ------------------------------------------
2993 -- Validate the passed Gross Flag
2994 ------------------------------------------
2995 IF p_rent_index_rec.gross_flag IS NOT NULL
2996 AND p_rent_index_rec.gross_flag <> pn_lease_utils.g_pn_miss_char
2997 THEN
2998 IF NVL (p_rent_index_rec.gross_flag, 'N') = 'Y'
2999 THEN
3000 --IF p_rent_index_rec.increase_on IS NOT NULL OR p_rent_index_rec.increase_on <> pn_lease_utils.g_pn_miss_char
3001 --THEN
3002 p_rent_index_rec.increase_on := NULL;
3003 --END IF;
3004 END IF;
3005 END IF;
3006
3007 ------------------------------------------
3008 -- Validate the passed Proration Rule
3009 ------------------------------------------
3010
3011 pn_index_rent_pvt.DEBUG ( g_pkg_name
3012 || g_program_unit||
3013 ' - Before calling pn_index_rent_utils.get_lookup_code proration_rule - '|| p_rent_index_rec.proration_rule
3014 ,3);
3015
3016 IF ( ( p_rent_index_rec.proration_rule IS NOT NULL
3017 AND p_rent_index_rec.proration_rule <> pn_lease_utils.g_pn_miss_char)
3018 OR ( p_rent_index_rec.proration_rule_meaning IS NOT NULL
3019 AND p_rent_index_rec.proration_rule_meaning <> pn_lease_utils.g_pn_miss_char))
3020 THEN
3021 pn_index_rent_utils.get_lookup_code
3022 (p_parameter_name => l_constraint_proration_param
3023 , p_operation => p_operation
3024 , p_lookup_meaning => p_rent_index_rec.proration_rule_meaning
3025 , p_lookup_type => l_constraint_proration_type
3026 , x_lookup_type_code => p_rent_index_rec.proration_rule
3027 , x_return_status => x_return_status);
3028
3029 IF x_return_status<>fnd_api.g_ret_sts_success
3030 THEN
3031 l_error_count:=l_error_count+1;
3032 fnd_message.set_name('PN','PN_INDEX_PRARATION_NOT_EXISTS');
3033 fnd_msg_pub.ADD;
3034 RAISE fnd_api.g_exc_error;
3035 END IF;
3036 END IF;
3037 pn_index_rent_pvt.DEBUG ( g_pkg_name
3038 || g_program_unit||
3039 ' - After calling pn_index_rent_utils.get_lookup_code proration_rule - '|| p_rent_index_rec.proration_rule
3040 ,3);
3041
3042 IF ( ( p_rent_index_rec.index_id IS NOT NULL
3043 AND p_rent_index_rec.index_id <> pn_index_rent_utils.g_pn_miss_num)
3044 AND ( p_rent_index_rec.commencement_date IS NOT NULL
3045 AND p_rent_index_rec.commencement_date <> pn_index_rent_utils.g_pn_miss_date))
3046 THEN
3047 IF p_rent_index_rec.base_year IS NULL OR p_rent_index_rec.base_year = pn_index_rent_utils.g_pn_miss_date
3048 THEN
3049 IF LTRIM (RTRIM (p_operation)) <>'UPDATE_INDEX_RENT' -- Added by vivek on 22NOV2010
3050 THEN
3051 p_rent_index_rec.base_year := p_rent_index_rec.commencement_date;
3052 END IF;
3053 END IF;
3054 --l_base_year := p_rent_index_rec.commencement_date;
3055 END IF;
3056
3057
3058 pn_index_rent_pvt.DEBUG ( g_pkg_name
3059 || g_program_unit||
3060 ' - End of validations base year - '|| p_rent_index_rec.base_year
3061 ,3);
3062
3063
3064 IF (( p_rent_index_rec.base_year IS NOT NULL
3065 AND p_rent_index_rec.base_year <> pn_index_rent_utils.g_pn_miss_date)
3066 --AND ( p_rent_index_rec.base_index_line_id IS NOT NULL
3067 -- AND p_rent_index_rec.base_index_line_id <> pn_index_rent_utils.g_pn_miss_num))
3068 )
3069 THEN
3070 pn_index_lease_common_pkg.lookup_index_history
3071 (p_index_history_id => p_rent_index_rec.index_id
3072 , p_index_finder_date => p_rent_index_rec.base_year
3073 , op_cpi_value => l_base_index --p_rent_index_rec.base_index
3074 , op_cpi_id => l_base_index_line_id --p_rent_index_rec.base_index_line_id
3075 , op_msg => x_return_status);
3076 END IF;
3077
3078 IF p_rent_index_rec.index_id IS NULL
3079 OR p_rent_index_rec.index_id = pn_index_rent_utils.g_pn_miss_num
3080 THEN
3081
3082 p_rent_index_rec.index_id:=l_base_index;
3083 p_rent_index_rec.base_index_line_id:=l_base_index_line_id;
3084 END IF;
3085
3086 -- Below IF statements uncommented by Vivek on 10-Nov-2010
3087 IF p_rent_index_rec.reference_period IS NOT NULL
3088 AND p_rent_index_rec.reference_period <> pn_index_rent_utils.g_pn_miss_char
3089 AND p_rent_index_rec.reference_period = 'BASE_YEAR'
3090 THEN
3091 IF LTRIM (RTRIM (p_operation)) <>'UPDATE_INDEX_RENT' -- Added by vivek on 19NOV2010
3092 THEN
3093 p_rent_index_rec.basis_type := 'FIXED';
3094 END IF;
3095 ELSE
3096 IF LTRIM (RTRIM (p_operation)) <>'UPDATE_INDEX_RENT' -- Added by vivek on 19NOV2010
3097 THEN
3098 IF p_rent_index_rec.basis_type IS NULL
3099 OR p_rent_index_rec.basis_type=pn_index_rent_utils.g_pn_miss_char
3100 THEN
3101 p_rent_index_rec.basis_type := 'COMPOUND';
3102 END IF;
3103 END IF;
3104 END IF;
3105 --END IF;
3106
3107
3108 IF p_rent_index_rec.reference_period IS NOT NULL
3109 AND p_rent_index_rec.reference_period <> pn_index_rent_utils.g_pn_miss_char
3110 AND p_rent_index_rec.reference_period <> 'BASE_YEAR'
3111 AND p_rent_index_rec.basis_type <> 'ROLLING'
3112 AND p_rent_index_rec.basis_type <> 'COMPOUND'
3113 THEN
3114 l_error_count:=l_error_count+1;
3115 --fnd_message.set_name ('PN', 'PN_INVALID_BASIS_TYPE');
3116 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3117 fnd_message.set_token('ERR_MSG', 'Please provide ROLLING\COMPOUND basis type for default reference period(Previous Year - Use Previous Current Index )');
3118 fnd_msg_pub.ADD;
3119 RAISE fnd_api.g_exc_error;
3120 ELSIF p_rent_index_rec.reference_period = 'BASE_YEAR'
3121 AND p_rent_index_rec.basis_type <> 'FIXED'
3122 THEN
3123 l_error_count:=l_error_count+1;
3124 fnd_message.set_name ('PN', 'PN_INVALID_BASIS_TYPE');
3125 fnd_msg_pub.ADD;
3126 RAISE fnd_api.g_exc_error;
3127 END IF;
3128
3129 -- Added by Vivek on 22Nov2010
3130 IF p_rent_index_rec.basis_type IS NOT NULL
3131 AND p_rent_index_rec.basis_type <> pn_index_rent_utils.g_pn_miss_char
3132 THEN
3133 IF NVL(p_rent_index_rec.reference_period,'PREV_YEAR_PREV_CURRENT_CPI') = 'BASE_YEAR'
3134 AND p_rent_index_rec.basis_type <> 'FIXED'
3135 THEN
3136 l_error_count:=l_error_count+1;
3137 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3138 fnd_message.set_token('ERR_MSG', 'Invalid basis type for the provided reference period: '||p_rent_index_rec.reference_period);
3139 fnd_msg_pub.ADD;
3140 ELSIF NVL(p_rent_index_rec.reference_period,'PREV_YEAR_PREV_CURRENT_CPI') <> 'BASE_YEAR'
3141 AND p_rent_index_rec.basis_type NOT IN ( 'ROLLING','COMPOUND')
3142 THEN
3143 l_error_count:=l_error_count+1;
3144 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3145 fnd_message.set_token('ERR_MSG', 'Invalid basis type for the provided reference period: '||p_rent_index_rec.reference_period);
3146 fnd_msg_pub.ADD;
3147 --END IF;
3148 END IF;
3149
3150 END IF;
3151 -- End of code added by Vivek on 22Nov2010
3152
3153 IF p_rent_index_rec.relationship_default IS NOT NULL
3154 AND p_rent_index_rec.relationship_default <> pn_index_rent_utils.g_pn_miss_char
3155 AND p_rent_index_rec.relationship_default = 'INDEX_ONLY'
3156 THEN
3157 IF LTRIM (RTRIM (p_operation)) <>'UPDATE_INDEX_RENT' -- Added by vivek on 19NOV2010
3158 THEN
3159 p_rent_index_rec.basis_percent_default := NULL;
3160 END IF;
3161
3162 IF ( ( p_rent_index_rec.index_id IS NULL
3163 OR p_rent_index_rec.index_id = pn_index_rent_utils.g_pn_miss_num)
3164 OR ( p_rent_index_rec.base_index IS NULL
3165 OR p_rent_index_rec.base_index=pn_index_rent_utils.g_pn_miss_num)
3166 )
3167 THEN
3168
3169 l_error_count:=l_error_count+1;
3170 --fnd_message.set_name ('PN', 'PN_INDEX_REQD_FLDS_INDEX_ONLY');--PN_INDEX_BASE_INDEX_REQUIRED
3171 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3172 fnd_message.set_token('ERR_MSG', 'The Rent Increase Amount cannot be calculated. For an Index Only relation, the Index Id and Base Index are required');
3173 fnd_msg_pub.ADD;
3174 RAISE fnd_api.g_exc_error;
3175 END IF;
3176
3177
3178 IF ( p_rent_index_rec.base_year IS NULL
3179 OR p_rent_index_rec.base_year =pn_index_rent_utils.g_pn_miss_date)
3180 THEN
3181 l_error_count:=l_error_count+1;
3182 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3183 fnd_message.set_token('ERR_MSG', 'Base Year should be provided when relationship default is '||p_rent_index_rec.relationship_default);
3184 fnd_msg_pub.ADD;
3185 RAISE fnd_api.g_exc_error;
3186 END IF;
3187
3188 ELSIF p_rent_index_rec.relationship_default IS NOT NULL
3189 AND p_rent_index_rec.relationship_default <> pn_index_rent_utils.g_pn_miss_char
3190 AND p_rent_index_rec.relationship_default = 'BASIS_ONLY'
3191 THEN
3192 --Below IF block has been commented by Vivek as basis_percent_default should only happen for Create and it is taken care above
3193 --IF p_rent_index_rec.basis_percent_default IS NULL
3194 -- OR p_rent_index_rec.basis_percent_default=pn_index_rent_utils.g_pn_miss_num
3195 --THEN
3196 --l_error_count:=l_error_count+1;
3197 --fnd_message.set_name ('PN', 'PN_INDEX_REQD_FLDS_BASIS_ONLY');
3198 --fnd_msg_pub.ADD;
3199 --RAISE fnd_api.g_exc_error;
3200 -- p_rent_index_rec.basis_percent_default:=0;
3201
3202 --END IF;
3203 IF LTRIM (RTRIM (p_operation)) <>'UPDATE_INDEX_RENT' -- Added by vivek on 19NOV2010
3204 THEN
3205 p_rent_index_rec.base_year := NULL;
3206 p_rent_index_rec.base_index:=NULL;
3207 END IF;
3208 END IF;
3209
3210 -- Below IF block has been added by vivek on 12-NOV-2010
3211 IF p_rent_index_rec.relationship_default IS NOT NULL
3212 AND p_rent_index_rec.relationship_default <> pn_index_rent_utils.g_pn_miss_char
3213 AND p_rent_index_rec.relationship_default IN('LESSER_OF','GREATER_OF')
3214 THEN
3215
3216 IF ( p_rent_index_rec.basis_percent_default IS NULL
3217 OR p_rent_index_rec.basis_percent_default=pn_index_rent_utils.g_pn_miss_num)
3218 THEN
3219 --IF LTRIM (RTRIM (p_operation)) <>'UPDATE_INDEX_RENT' -- Added by vivek on 19NOV2010
3220 --THEN
3221 p_rent_index_rec.basis_percent_default := 0;
3222 --END IF;
3223 END IF;
3224 --OR
3225 IF ( p_rent_index_rec.base_Index IS NULL
3226 OR p_rent_index_rec.base_Index =pn_index_rent_utils.g_pn_miss_num)
3227 THEN
3228 l_error_count:=l_error_count+1;
3229 fnd_message.set_name ('PN', 'PN_INDEX_REQD_FLDS_GT_LT_ONLY'); --PN_INVALID_BASIS_TYPE
3230 fnd_msg_pub.ADD;
3231 RAISE fnd_api.g_exc_error;
3232 END IF;
3233
3234 IF ( p_rent_index_rec.base_year IS NULL
3235 OR p_rent_index_rec.base_year =pn_index_rent_utils.g_pn_miss_date)
3236 THEN
3237 l_error_count:=l_error_count+1;
3238 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3239 fnd_message.set_token('ERR_MSG', 'Base Year should be provided when relationship_default is '||p_rent_index_rec.relationship_default);
3240 fnd_msg_pub.ADD;
3241 RAISE fnd_api.g_exc_error;
3242 END IF;
3243
3244 END IF;
3245 pn_index_rent_pvt.DEBUG ( g_pkg_name
3246 || g_program_unit||
3247 ' - End of validations base year - '|| p_rent_index_rec.base_year
3248 ,3);
3249
3250 IF p_rent_index_rec.term_template_id IS NOT NULL
3251 AND p_rent_index_rec.term_template_id <> pn_lease_utils.g_pn_miss_num
3252 THEN
3253
3254 IF NOT pnp_util_func.validate_term_template
3255 (p_term_temp_id => p_rent_index_rec.term_template_id
3256 , p_lease_cls_code => l_lease_class_code)
3257 THEN
3258 l_error_count:=l_error_count+1;
3259 fnd_message.set_name ('PN', 'PN_MISS_TERM_TEMP_DATA');
3260 fnd_msg_pub.ADD;
3261 RAISE fnd_api.g_exc_error;
3262 END IF;
3263
3264 IF pn_r12_util_pkg.is_r12
3265 THEN
3266 l_tccstatus :=
3267 pn_r12_util_pkg.check_tax_upgrade (p_rent_index_rec.term_template_id);
3268
3269 IF l_tccstatus = 'PN_NO_TCC_FOUND'
3270 THEN
3271 l_error_count:=l_error_count+1;
3272 fnd_message.set_name ('PN', 'PN_NO_TCC_FOUND');
3273 fnd_msg_pub.ADD;
3274 RAISE fnd_api.g_exc_error;
3275 --RAISE;
3276 ELSIF l_tccstatus = 'PN_UPG_TCC'
3277 THEN
3278 l_error_count:=l_error_count+1;
3279 fnd_message.set_name ('PN', 'PN_UPG_TCC_FOUND');
3280 fnd_msg_pub.ADD;
3281 RAISE fnd_api.g_exc_error;
3282 END IF;
3283 END IF;
3284 END IF;
3285
3286 pn_index_rent_pvt.DEBUG ( g_pkg_name
3287 || g_program_unit||
3288 ' - End of validations term_template_id - '|| p_rent_index_rec.term_template_id
3289 ,3);
3290
3291
3292 IF p_rent_index_rec.proration_rule IS NOT NULL
3293 AND p_rent_index_rec.proration_rule <> pn_index_rent_utils.g_pn_miss_char
3294 THEN
3295 IF p_rent_index_rec.proration_rule <> 'NO_PRORATION'
3296 THEN
3297 IF p_rent_index_rec.proration_period_start_date >= p_rent_index_rec.commencement_date
3298 THEN
3299
3300 l_error_count:=l_error_count+1;
3301 fnd_message.set_name ('PN', 'PN_PRORATION_PERIOD_START_DATE');
3302 fnd_msg_pub.ADD;
3303 RAISE fnd_api.g_exc_error;
3304 END IF;
3305 END IF;
3306
3307 IF p_rent_index_rec.proration_rule = 'NO_PRORATION'
3308 THEN
3309
3310
3311 -- Below IF has been commented and added new IF block by Vivek on 27NOV2010
3312 /*
3313 IF p_rent_index_rec.proration_period_start_date IS NULL
3314 OR p_rent_index_rec.proration_period_start_date = pn_index_rent_utils.g_pn_miss_date
3315 THEN
3316 p_rent_index_rec.proration_period_start_date := NULL;
3317 END IF;
3318 */
3319
3320 IF p_rent_index_rec.proration_period_start_date IS NOT NULL
3321 AND p_rent_index_rec.proration_period_start_date <> pn_index_rent_utils.g_pn_miss_date
3322 THEN
3323
3324 l_error_count:=l_error_count+1;
3325 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3326 fnd_message.set_token('ERR_MSG', 'Proration period start data cannot be provided for No Proration Rule');
3327 fnd_msg_pub.ADD;
3328 RAISE fnd_api.g_exc_error;
3329 END IF;
3330 ELSE
3331 p_rent_index_rec.proration_period_start_date := p_rent_index_rec.commencement_date;
3332
3333
3334 END IF;
3335 END IF;
3336
3337 pn_index_rent_pvt.DEBUG ( g_pkg_name
3338 || g_program_unit||
3339 ' - End of validations proration_rule - '|| p_rent_index_rec.proration_rule
3340 ,3);
3341
3342 ----------------------------------------------
3343 -- Validate the passed Index Termination Date
3344 ----------------------------------------------
3345
3346 IF p_rent_index_rec.termination_date IS NOT NULL
3347 AND p_rent_index_rec.termination_date<> pn_index_rent_utils.g_pn_miss_date
3348 THEN
3349
3350
3351 l_period_exists := pn_index_lease_common_pkg.find_if_period_exists( p_rent_index_rec.index_lease_id);
3352
3353 IF l_period_exists IS NOT NULL THEN
3354
3355 pn_index_rent_periods_pkg.process_new_termination_date(
3356 p_index_lease_id => p_rent_index_rec.index_lease_id,
3357 p_new_termination_date => p_rent_index_rec.termination_date,
3358 p_ignore_approved_terms => 'N',
3359 p_msg => l_msg);
3360
3361 END IF;
3362
3363
3364 IF l_msg = 'PN_TERM_DATE_INV_APPR_PRDS' THEN
3365 fnd_message.set_name ('PN', l_msg);
3366 fnd_msg_pub.ADD;
3367 RAISE fnd_api.g_exc_error;
3368
3369 ELSE
3370 fnd_message.set_name ('PN', l_msg);
3371 fnd_msg_pub.ADD;
3372 END IF;
3373
3374 END IF;
3375
3376 IF p_rent_index_rec.rounding_flag IS NULL OR p_rent_index_rec.rounding_flag = pn_index_rent_utils.g_pn_miss_char
3377 THEN
3378
3379 p_rent_index_rec.rounding_flag:='N';
3380 ELSIF p_rent_index_rec.rounding_flag NOT IN ('Y','N')
3381 THEN
3382
3383 l_error_count:=l_error_count+1;
3384 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3385 fnd_message.set_token('ERR_MSG', 'Rounding flag should be Y/N');
3386 fnd_msg_pub.ADD;
3387 RAISE fnd_api.g_exc_error;
3388 END IF;
3389
3390 IF p_rent_index_rec.aggregation_flag IS NULL OR p_rent_index_rec.aggregation_flag = pn_index_rent_utils.g_pn_miss_char
3391 THEN
3392
3393 p_rent_index_rec.aggregation_flag:='Y';
3394 ELSIF p_rent_index_rec.aggregation_flag NOT IN ('Y','N')
3395 THEN
3396
3397 l_error_count:=l_error_count+1;
3398 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3399 fnd_message.set_token('ERR_MSG', 'Aggregation flag should be Y/N');
3400 fnd_msg_pub.ADD;
3401 RAISE fnd_api.g_exc_error;
3402 END IF;
3403
3404
3405 IF p_rent_index_rec.retain_initial_basis_flag IS NULL OR p_rent_index_rec.retain_initial_basis_flag = pn_index_rent_utils.g_pn_miss_char
3406 THEN
3407
3408 p_rent_index_rec.retain_initial_basis_flag:='N';
3409 ELSIF p_rent_index_rec.retain_initial_basis_flag NOT IN ('Y','N')
3410 THEN
3411
3412 l_error_count:=l_error_count+1;
3413 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3414 fnd_message.set_token('ERR_MSG', 'Aggregation flag should be Y/N');
3415 fnd_msg_pub.ADD;
3416 RAISE fnd_api.g_exc_error;
3417 END IF;
3418
3419 IF p_rent_index_rec.vr_nbp_flag IS NOT NULL AND p_rent_index_rec.vr_nbp_flag <> pn_index_rent_utils.g_pn_miss_char
3420 THEN
3421
3422
3423 IF p_rent_index_rec.vr_nbp_flag NOT IN ('N')
3424 THEN
3425
3426 l_error_count:=l_error_count+1;
3427 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
3428 fnd_message.set_token('ERR_MSG', 'Natural Breakpoint basis flag should be N or NULL');
3429 fnd_msg_pub.ADD;
3430 RAISE fnd_api.g_exc_error;
3431 END IF;
3432 END IF;
3433 -- Validate Index Rent Descriptive Fields
3434 validate_index_desc_flex ( p_rent_index_rec => p_rent_index_rec
3435 , x_return_status => x_return_status
3436 , x_msg_count => x_msg_count
3437 , x_msg_data => x_msg_count);
3438
3439 ---------------------End Index Termination Date---------------------
3440
3441 IF LTRIM (RTRIM (p_operation)) = 'UPDATE_INDEX_RENT'
3442 THEN
3443
3444
3445 IF p_rent_index_rec.index_lease_id IS NOT NULL
3446 OR p_rent_index_rec.index_lease_id <> pn_lease_utils.g_pn_miss_num
3447 THEN
3448
3449 pn_index_rent_pvt.DEBUG ( g_pkg_name
3450 || g_program_unit||
3451 ' - Calling get_changed_index_rent_rec after validate_index_rent_rec '
3452 ,3);
3453
3454
3455 get_changed_index_rent_rec (p_rent_index_rec => p_rent_index_rec
3456 -- , p_validate => p_validate
3457 -- ,p_operation => l_operation
3458 , x_return_status => x_return_status
3459 , x_msg_count => x_msg_count
3460 , x_msg_data => x_msg_data);
3461 END IF;
3462 END IF;
3463
3464 IF l_error_count>0 THEN
3465 x_return_status:=fnd_api.g_ret_sts_error;
3466 ELSE
3467 x_return_status:=fnd_api.g_ret_sts_success;
3468 END IF;
3469 EXCEPTION
3470 WHEN fnd_api.g_exc_error
3471 THEN
3472 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
3473 || g_pkg_name
3474 || g_program_unit
3475 || '-'
3476 || SQLERRM
3477 , 5);
3478 x_return_status := fnd_api.g_ret_sts_error;
3479
3480 WHEN OTHERS
3481 THEN
3482 pn_index_rent_pvt.DEBUG ( 'Exception in '
3483 || g_pkg_name
3484 || g_program_unit
3485 || '-'
3486 || SQLERRM
3487 , 5);
3488 x_return_status := fnd_api.g_ret_sts_unexp_error;
3489 END validate_index_rent_rec;
3490
3491 ----------------------------------------------------------------------
3492 -- Prcoedure to update Constraint Record with the provided new values
3493 ----------------------------------------------------------------------
3494 PROCEDURE update_constraint_row (
3495 p_index_constraint_rec IN OUT NOCOPY index_constraint_rec
3496 , p_rent_index_rec IN OUT NOCOPY rent_index_rec
3497 , x_return_status OUT NOCOPY VARCHAR2
3498 , x_msg_count OUT NOCOPY NUMBER
3499 , x_msg_data OUT NOCOPY VARCHAR2)
3500 IS
3501 l_rowid VARCHAR2 (18) := NULL;
3502 BEGIN
3503 g_program_unit := 'UPDATE_CONSTRAINT_ROW';
3504 x_return_status := fnd_api.g_ret_sts_success;
3505 /*pn_index_lease_constraints_pkg.check_unq_constraint_scope (
3506 x_return_status
3507 ,x_index_constraint_id
3508 ,x_index_lease_id
3509 ,x_scope
3510 );*/
3511
3512 pn_index_rent_pvt.DEBUG ( g_pkg_name
3513 || g_program_unit||
3514 ' - Calling pn_index_lease_constraints_pkg.update_row for index_lease_id - '|| p_rent_index_rec.index_lease_id
3515 ,3);
3516
3517 pn_index_lease_constraints_pkg.update_row
3518 (x_rowid => l_rowid
3519 --, x_org_id => p_index_constraint_rec.org_id
3520 , x_index_constraint_id => p_index_constraint_rec.index_constraint_id
3521 , x_index_lease_id => p_rent_index_rec.index_lease_id
3522 , x_scope => p_index_constraint_rec.SCOPE
3523 , x_minimum_amount => p_index_constraint_rec.minimum_amount
3524 , x_maximum_amount => p_index_constraint_rec.maximum_amount
3525 , x_minimum_percent => p_index_constraint_rec.minimum_percent
3526 , x_maximum_percent => p_index_constraint_rec.maximum_percent
3527 , x_attribute_category => p_index_constraint_rec.attribute_category
3528 , x_attribute1 => p_index_constraint_rec.attribute1
3529 , x_attribute2 => p_index_constraint_rec.attribute2
3530 , x_attribute3 => p_index_constraint_rec.attribute3
3531 , x_attribute4 => p_index_constraint_rec.attribute4
3532 , x_attribute5 => p_index_constraint_rec.attribute5
3533 , x_attribute6 => p_index_constraint_rec.attribute6
3534 , x_attribute7 => p_index_constraint_rec.attribute7
3535 , x_attribute8 => p_index_constraint_rec.attribute8
3536 , x_attribute9 => p_index_constraint_rec.attribute9
3537 , x_attribute10 => p_index_constraint_rec.attribute10
3538 , x_attribute11 => p_index_constraint_rec.attribute11
3539 , x_attribute12 => p_index_constraint_rec.attribute12
3540 , x_attribute13 => p_index_constraint_rec.attribute13
3541 , x_attribute14 => p_index_constraint_rec.attribute14
3542 , x_attribute15 => p_index_constraint_rec.attribute15
3543 -- , x_creation_date => NVL(p_index_constraint_rec.last_update_date, TRUNC(SYSDATE))
3544 -- , x_created_by => NVL(p_index_constraint_rec.created_by, fnd_global.user_id)
3545 , x_last_update_date => NVL
3546 (p_index_constraint_rec.last_update_date
3547 , TRUNC(SYSDATE))
3548 , x_last_updated_by => NVL
3549 (p_index_constraint_rec.last_updated_by
3550 , fnd_global.user_id)
3551 , x_last_update_login => NVL
3552 (p_index_constraint_rec.last_update_login
3553 , fnd_global.user_id));
3554
3555
3556 pn_index_rent_pvt.DEBUG ( g_pkg_name
3557 || g_program_unit||
3558 ' - pn_index_lease_constraints_pkg.update_row successful. index_constraint_id - '||p_index_constraint_rec.index_constraint_id
3559 ,3);
3560 EXCEPTION
3561 WHEN fnd_api.g_exc_error
3562 THEN
3563 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
3564 || g_pkg_name
3565 || g_program_unit
3566 || '-'
3567 || SQLERRM
3568 , 5);
3569 x_return_status := fnd_api.g_ret_sts_error;
3570
3571 WHEN OTHERS
3572 THEN
3573 pn_index_rent_pvt.DEBUG ( 'Exception in '
3574 || g_pkg_name
3575 || g_program_unit
3576 || '-'
3577 || SQLERRM
3578 , 5);
3579 x_return_status := fnd_api.g_ret_sts_unexp_error;
3580 END update_constraint_row;
3581
3582 ----------------------------------------------------------------------
3583 -- Prcoedure to insert Constraint Record with the provided values
3584 ----------------------------------------------------------------------
3585 PROCEDURE insert_index_constraint_row (
3586 p_index_constraint_rec IN OUT NOCOPY index_constraint_rec
3587 , p_rent_index_rec IN OUT NOCOPY rent_index_rec
3588 , x_return_status OUT NOCOPY VARCHAR2
3589 , x_msg_count OUT NOCOPY NUMBER
3590 , x_msg_data OUT NOCOPY VARCHAR2)
3591 IS
3592 l_rowid VARCHAR2 (18) := NULL;
3593 BEGIN
3594 g_program_unit := 'INSERT_INDEX_CONSTRAINT_ROW';
3595
3596 x_return_status := fnd_api.g_ret_sts_success;
3597
3598 init_index_constraint_rec (p_index_constraint_rec => p_index_constraint_rec
3599 , x_return_status => x_return_status
3600 , x_msg_count => x_msg_count
3601 , x_msg_data => x_msg_count);
3602
3603 IF p_index_constraint_rec.org_id IS NULL
3604 OR NVL (pn_mo_cache_utils.check_valid_org (p_index_constraint_rec.org_id), 'N') <> 'Y'
3605 THEN
3606 fnd_message.set_name ('MO', 'MO_ORG_INVALID');
3607 fnd_msg_pub.ADD;
3608 --RAISE ERROR;
3609 END IF;
3610
3611
3612 pn_index_rent_pvt.DEBUG ( g_pkg_name
3613 || g_program_unit||
3614 ' - Calling pn_index_lease_constraints_pkg.insert_row for index_constraint_id '
3615 ,3);
3616 pn_index_lease_constraints_pkg.insert_row
3617 (x_rowid => l_rowid
3618 , x_org_id => p_index_constraint_rec.org_id
3619 , x_index_constraint_id => p_index_constraint_rec.index_constraint_id
3620 , x_index_lease_id => p_rent_index_rec.index_lease_id
3621 , x_scope => p_index_constraint_rec.SCOPE
3622 , x_minimum_amount => p_index_constraint_rec.minimum_amount
3623 , x_maximum_amount => p_index_constraint_rec.maximum_amount
3624 , x_minimum_percent => p_index_constraint_rec.minimum_percent
3625 , x_maximum_percent => p_index_constraint_rec.maximum_percent
3626 , x_attribute_category => p_index_constraint_rec.attribute_category
3627 , x_attribute1 => p_index_constraint_rec.attribute1
3628 , x_attribute2 => p_index_constraint_rec.attribute2
3629 , x_attribute3 => p_index_constraint_rec.attribute3
3630 , x_attribute4 => p_index_constraint_rec.attribute4
3631 , x_attribute5 => p_index_constraint_rec.attribute5
3632 , x_attribute6 => p_index_constraint_rec.attribute6
3633 , x_attribute7 => p_index_constraint_rec.attribute7
3634 , x_attribute8 => p_index_constraint_rec.attribute8
3635 , x_attribute9 => p_index_constraint_rec.attribute9
3636 , x_attribute10 => p_index_constraint_rec.attribute10
3637 , x_attribute11 => p_index_constraint_rec.attribute11
3638 , x_attribute12 => p_index_constraint_rec.attribute12
3639 , x_attribute13 => p_index_constraint_rec.attribute13
3640 , x_attribute14 => p_index_constraint_rec.attribute14
3641 , x_attribute15 => p_index_constraint_rec.attribute15
3642 , x_creation_date => NVL
3643 (p_index_constraint_rec.last_update_date
3644 , TRUNC(SYSDATE))
3645 , x_created_by => NVL
3646 (p_index_constraint_rec.created_by
3647 , fnd_global.user_id)
3648 , x_last_update_date => NVL
3649 (p_index_constraint_rec.last_update_date
3650 , TRUNC(SYSDATE))
3651 , x_last_updated_by => NVL
3652 (p_index_constraint_rec.last_updated_by
3653 , fnd_global.user_id)
3654 , x_last_update_login => NVL
3655 (p_index_constraint_rec.last_update_login
3656 , fnd_global.user_id));
3657
3658 pn_index_rent_pvt.DEBUG ( g_pkg_name
3659 || g_program_unit||
3660 ' - pn_index_lease_constraints_pkg.insert_row successful.Index_constraint_id - '||p_index_constraint_rec.index_constraint_id
3661 ,3);
3662 IF p_index_constraint_rec.index_constraint_id >0
3663 THEN
3664 x_return_status := fnd_api.g_ret_sts_success;
3665 ELSE
3666 RAISE fnd_api.g_exc_error;
3667 END IF;
3668 EXCEPTION
3669 WHEN fnd_api.g_exc_error
3670 THEN
3671 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
3672 || g_pkg_name
3673 || g_program_unit
3674 || '-'
3675 || SQLERRM
3676 , 5);
3677
3678
3679 x_return_status := fnd_api.g_ret_sts_error;
3680
3681 WHEN OTHERS
3682 THEN
3683 pn_index_rent_pvt.DEBUG ( 'Exception in '
3684 || g_pkg_name
3685 || g_program_unit
3686 || '-'
3687 || SQLERRM
3688 , 5);
3689
3690 x_return_status := fnd_api.g_ret_sts_unexp_error;
3691 END insert_index_constraint_row;
3692
3693 ------------------------------------------------------------------------------
3694 -- Prcoedure to get the changed Constraint values to update Constraint Record
3695 ------------------------------------------------------------------------------
3696 PROCEDURE get_changed_constraint_rec (
3697 p_index_constraint_rec IN OUT NOCOPY index_constraint_rec
3698 , p_rent_index_rec IN rent_index_rec
3699 , x_return_status OUT NOCOPY VARCHAR2
3700 , x_msg_count OUT NOCOPY VARCHAR2
3701 , x_msg_data OUT NOCOPY VARCHAR2)
3702 IS
3703 CURSOR c_old_constraint_values
3704 IS
3705 SELECT index_constraint_id
3706 , index_lease_id
3707 , SCOPE
3708 , minimum_amount
3709 , maximum_amount
3710 , minimum_percent
3711 , maximum_percent
3712 , last_update_date
3713 , last_updated_by
3714 , creation_date
3715 , created_by
3716 , last_update_login
3717 , attribute_category
3718 , attribute1
3719 , attribute2
3720 , attribute3
3721 , attribute4
3722 , attribute5
3723 , attribute6
3724 , attribute7
3725 , attribute8
3726 , attribute9
3727 , attribute10
3728 , attribute11
3729 , attribute12
3730 , attribute13
3731 , attribute14
3732 , attribute15
3733 , org_id
3734 FROM pn_index_lease_constraints_all
3735 WHERE index_lease_id = p_rent_index_rec.index_lease_id
3736 AND index_constraint_id = p_index_constraint_rec.index_constraint_id
3737 AND org_id = p_rent_index_rec.org_id;
3738
3739 l_constraint_rec_old pn_index_lease_constraints_all%ROWTYPE;
3740
3741 --l_error_count NUMBER := 0;
3742 BEGIN
3743 g_program_unit := 'GET_CHANGED_CONSTRAINT_REC';
3744 x_return_status := fnd_api.g_ret_sts_success;
3745
3746 pn_index_rent_pvt.DEBUG ( g_pkg_name
3747 || g_program_unit
3748 || ' Inside get_changed_constraint_rec procedure'
3749 , 3);
3750
3751 OPEN c_old_constraint_values;
3752
3753 FETCH c_old_constraint_values
3754 INTO l_constraint_rec_old;
3755
3756 IF (c_old_constraint_values%NOTFOUND)
3757 THEN
3758 pn_index_rent_pvt.DEBUG ( g_pkg_name
3759 || g_program_unit
3760 || ' CURSOR c_old_constraint_values failed to return the existing record'
3761 , 3);
3762 x_return_status := fnd_api.g_ret_sts_error;
3763 ELSE
3764 x_return_status := fnd_api.g_ret_sts_success;
3765 END IF;
3766
3767
3768 IF p_index_constraint_rec.SCOPE IS NULL OR p_index_constraint_rec.SCOPE =pn_index_rent_utils.g_pn_miss_char
3769 THEN
3770
3771 p_index_constraint_rec.SCOPE := l_constraint_rec_old.SCOPE;
3772
3773 END IF;
3774
3775 /*
3776 IF p_index_constraint_rec.minimum_amount IS NULL OR p_index_constraint_rec.minimum_amount=pn_index_rent_utils.g_pn_miss_num
3777 THEN
3778
3779 IF ( p_index_constraint_rec.minimum_percent IS NULL
3780 OR p_index_constraint_rec.minimum_percent = pn_index_rent_utils.g_pn_miss_num
3781 )
3782 OR
3783 ( p_index_constraint_rec.maximum_percent IS NULL
3784 OR p_index_constraint_rec.maximum_percent = pn_index_rent_utils.g_pn_miss_num
3785 )
3786 THEN
3787 p_index_constraint_rec.minimum_amount := l_constraint_rec_old.minimum_amount;
3788 p_index_constraint_rec.maximum_amount := l_constraint_rec_old.maximum_amount;
3789 END IF;
3790
3791
3792 END IF;
3793
3794
3795
3796 IF NVL(p_index_constraint_rec.maximum_amount,p_index_constraint_rec.minimum_amount) IS NULL
3797 OR NVL(p_index_constraint_rec.maximum_amount,p_index_constraint_rec.minimum_amount)=pn_index_rent_utils.g_pn_miss_num
3798 THEN
3799
3800
3801 IF ( p_index_constraint_rec.minimum_percent IS NULL
3802 OR p_index_constraint_rec.minimum_percent = pn_index_rent_utils.g_pn_miss_num
3803 )
3804 OR
3805 ( p_index_constraint_rec.maximum_percent IS NULL
3806 OR p_index_constraint_rec.maximum_percent = pn_index_rent_utils.g_pn_miss_num
3807 )
3808 THEN
3809 p_index_constraint_rec.minimum_amount := l_constraint_rec_old.minimum_amount;
3810 p_index_constraint_rec.maximum_amount := l_constraint_rec_old.maximum_amount;
3811 END IF;
3812
3813
3814 END IF;
3815
3816 IF p_index_constraint_rec.minimum_percent IS NULL OR p_index_constraint_rec.minimum_percent=pn_index_rent_utils.g_pn_miss_num
3817 THEN
3818
3819
3820 IF ( p_index_constraint_rec.minimum_amount IS NULL
3821 OR p_index_constraint_rec.minimum_amount = pn_index_rent_utils.g_pn_miss_num
3822 )
3823 OR( p_index_constraint_rec.maximum_percent IS NULL
3824 OR p_index_constraint_rec.maximum_percent = pn_index_rent_utils.g_pn_miss_num
3825 )
3826 THEN
3827 p_index_constraint_rec.minimum_percent := l_constraint_rec_old.minimum_percent;
3828 p_index_constraint_rec.maximum_percent := l_constraint_rec_old.maximum_percent;
3829 END IF;
3830
3831 END IF;
3832
3833 IF NVL(p_index_constraint_rec.maximum_percent,p_index_constraint_rec.minimum_percent) IS NULL
3834 OR NVL(p_index_constraint_rec.maximum_percent,p_index_constraint_rec.minimum_percent)= pn_index_rent_utils.g_pn_miss_num
3835 THEN
3836
3837 IF ( p_index_constraint_rec.minimum_amount IS NULL
3838 OR p_index_constraint_rec.minimum_amount = pn_index_rent_utils.g_pn_miss_num
3839 )
3840 OR( p_index_constraint_rec.maximum_percent IS NULL
3841 OR p_index_constraint_rec.maximum_percent = pn_index_rent_utils.g_pn_miss_num
3842 )
3843 THEN
3844 p_index_constraint_rec.minimum_percent := l_constraint_rec_old.minimum_percent;
3845 p_index_constraint_rec.maximum_percent := l_constraint_rec_old.maximum_percent;
3846 END IF;
3847
3848 END IF;
3849 */
3850 --- The above code has been commented and below code added by Vivek on 27NOV2010
3851
3852 IF (p_index_constraint_rec.minimum_amount IS NULL OR p_index_constraint_rec.minimum_amount=pn_index_rent_utils.g_pn_miss_num)
3853 AND (p_index_constraint_rec.maximum_amount IS NULL OR p_index_constraint_rec.maximum_amount=pn_index_rent_utils.g_pn_miss_num)
3854 AND (p_index_constraint_rec.minimum_percent IS NULL OR p_index_constraint_rec.minimum_percent=pn_index_rent_utils.g_pn_miss_num)
3855 AND (p_index_constraint_rec.maximum_percent IS NULL OR p_index_constraint_rec.maximum_percent=pn_index_rent_utils.g_pn_miss_num)
3856 THEN
3857
3858 p_index_constraint_rec.minimum_amount := l_constraint_rec_old.minimum_amount;
3859 p_index_constraint_rec.maximum_amount := l_constraint_rec_old.maximum_amount;
3860 p_index_constraint_rec.minimum_percent := l_constraint_rec_old.minimum_percent;
3861 p_index_constraint_rec.maximum_percent := l_constraint_rec_old.maximum_percent;
3862 END IF;
3863 ---
3864
3865 IF p_index_constraint_rec.attribute_category IS NULL OR p_index_constraint_rec.attribute_category=pn_index_rent_utils.g_pn_miss_char
3866 THEN
3867
3868 p_index_constraint_rec.attribute_category := l_constraint_rec_old.attribute_category;
3869
3870 END IF;
3871
3872 IF p_index_constraint_rec.attribute1 IS NULL OR p_index_constraint_rec.attribute1=pn_index_rent_utils.g_pn_miss_char
3873 THEN
3874
3875 p_index_constraint_rec.attribute1 := l_constraint_rec_old.attribute1;
3876
3877 END IF;
3878
3879 IF p_index_constraint_rec.attribute2 IS NULL OR p_index_constraint_rec.attribute2=pn_index_rent_utils.g_pn_miss_char
3880 THEN
3881
3882 p_index_constraint_rec.attribute2 := l_constraint_rec_old.attribute2;
3883
3884 END IF;
3885
3886
3887 IF p_index_constraint_rec.attribute3 IS NULL OR p_index_constraint_rec.attribute3=pn_index_rent_utils.g_pn_miss_char
3888 THEN
3889
3890 p_index_constraint_rec.attribute3 := l_constraint_rec_old.attribute3;
3891
3892 END IF;
3893
3894 IF p_index_constraint_rec.attribute4 IS NULL OR p_index_constraint_rec.attribute4=pn_index_rent_utils.g_pn_miss_char
3895 THEN
3896
3897 p_index_constraint_rec.attribute4 := l_constraint_rec_old.attribute4;
3898
3899 END IF;
3900
3901 IF p_index_constraint_rec.attribute5 IS NULL OR p_index_constraint_rec.attribute5=pn_index_rent_utils.g_pn_miss_char
3902 THEN
3903
3904 p_index_constraint_rec.attribute5 := l_constraint_rec_old.attribute5;
3905
3906 END IF;
3907
3908 IF p_index_constraint_rec.attribute6 IS NULL OR p_index_constraint_rec.attribute6=pn_index_rent_utils.g_pn_miss_char
3909 THEN
3910
3911 p_index_constraint_rec.attribute6 := l_constraint_rec_old.attribute6;
3912
3913 END IF;
3914
3915 IF p_index_constraint_rec.attribute7 IS NULL OR p_index_constraint_rec.attribute7=pn_index_rent_utils.g_pn_miss_char
3916 THEN
3917
3918 p_index_constraint_rec.attribute7 := l_constraint_rec_old.attribute7;
3919
3920 END IF;
3921
3922 IF p_index_constraint_rec.attribute8 IS NULL OR p_index_constraint_rec.attribute8=pn_index_rent_utils.g_pn_miss_char
3923 THEN
3924
3925 p_index_constraint_rec.attribute8 := l_constraint_rec_old.attribute8;
3926
3927 END IF;
3928
3929 IF p_index_constraint_rec.attribute9 IS NULL OR p_index_constraint_rec.attribute9=pn_index_rent_utils.g_pn_miss_char
3930 THEN
3931
3932 p_index_constraint_rec.attribute9 := l_constraint_rec_old.attribute9;
3933
3934 END IF;
3935
3936 IF p_index_constraint_rec.attribute10 IS NULL OR p_index_constraint_rec.attribute10=pn_index_rent_utils.g_pn_miss_char
3937 THEN
3938
3939 p_index_constraint_rec.attribute10 := l_constraint_rec_old.attribute10;
3940
3941 END IF;
3942
3943 IF p_index_constraint_rec.attribute11 IS NULL OR p_index_constraint_rec.attribute11=pn_index_rent_utils.g_pn_miss_char
3944 THEN
3945
3946 p_index_constraint_rec.attribute11 := l_constraint_rec_old.attribute11;
3947
3948 END IF;
3949
3950 IF p_index_constraint_rec.attribute12 IS NULL OR p_index_constraint_rec.attribute12=pn_index_rent_utils.g_pn_miss_char
3951 THEN
3952
3953 p_index_constraint_rec.attribute12 := l_constraint_rec_old.attribute12;
3954
3955 END IF;
3956
3957
3958 IF p_index_constraint_rec.attribute13 IS NULL OR p_index_constraint_rec.attribute13=pn_index_rent_utils.g_pn_miss_char
3959 THEN
3960
3961 p_index_constraint_rec.attribute13 := l_constraint_rec_old.attribute13;
3962
3963 END IF;
3964
3965 IF p_index_constraint_rec.attribute14 IS NULL OR p_index_constraint_rec.attribute14=pn_index_rent_utils.g_pn_miss_char
3966 THEN
3967
3968 p_index_constraint_rec.attribute14 := l_constraint_rec_old.attribute14;
3969
3970 END IF;
3971
3972 IF p_index_constraint_rec.attribute15 IS NULL OR p_index_constraint_rec.attribute15=pn_index_rent_utils.g_pn_miss_char
3973 THEN
3974
3975 p_index_constraint_rec.attribute15 := l_constraint_rec_old.attribute15;
3976
3977 END IF;
3978 IF p_index_constraint_rec.org_id IS NULL OR p_index_constraint_rec.org_id=pn_index_rent_utils.g_pn_miss_num
3979 THEN
3980
3981 p_index_constraint_rec.org_id := l_constraint_rec_old.org_id;
3982
3983 END IF;
3984
3985 IF c_old_constraint_values%ISOPEN
3986 THEN
3987 CLOSE c_old_constraint_values;
3988 END IF;
3989 pn_index_rent_pvt.DEBUG ( g_pkg_name
3990 || g_program_unit
3991 || ' End of get_changed_constraint_rec procedure'
3992 , 3);
3993 EXCEPTION
3994 WHEN OTHERS
3995 THEN
3996
3997 IF c_old_constraint_values%ISOPEN
3998 THEN
3999 CLOSE c_old_constraint_values;
4000 END IF;
4001
4002 x_return_status := fnd_api.g_ret_sts_unexp_error;
4003 END get_changed_constraint_rec;
4004
4005 ----------------------------------------------------------------------
4006 -- Prcoedure to validate Constraint Record for the provided values
4007 ----------------------------------------------------------------------
4008 PROCEDURE validate_index_constraint_tbl (
4009 p_index_constraint_tbl IN OUT NOCOPY index_constraint_tbl
4010 , p_rent_index_rec IN OUT NOCOPY rent_index_rec
4011 , p_validate IN VARCHAR2 := fnd_api.g_false
4012 , p_operation IN VARCHAR2 DEFAULT 'CREATE_CONSTRAINTS'
4013 , x_return_status OUT NOCOPY VARCHAR2
4014 , x_msg_count OUT NOCOPY NUMBER
4015 , x_msg_data OUT NOCOPY VARCHAR2)
4016 IS
4017 l_constraint_proration_param VARCHAR2 (30) := 'CONSTRAINT SCOPE';
4018 l_constraint_proration_type VARCHAR2 (30) := 'PN_INDEX_CONSTRAINT';
4019 l_error_count NUMBER := 0;
4020 --l_operation VARCHAR2 (30);
4021 BEGIN
4022 g_program_unit := 'VALIDATE_INDEX_CONSTRAINT_TBL';
4023 x_return_status := fnd_api.g_ret_sts_success;
4024 pn_index_rent_pvt.DEBUG ( g_pkg_name
4025 || g_program_unit
4026 || ' Inside validate_index_constraint_tbl procedure'
4027 , 3);
4028
4029
4030
4031 FOR i IN 1 .. p_index_constraint_tbl.COUNT
4032 LOOP
4033
4034 IF p_index_constraint_tbl (i).org_id IS NULL OR p_index_constraint_tbl (i).org_id=pn_index_rent_utils.g_pn_miss_num
4035 THEN
4036 p_index_constraint_tbl (i).org_id:=FND_PROFILE.VALUE('ORG_ID');
4037 END IF;
4038
4039 IF ( p_index_constraint_tbl (i).SCOPE IS NOT NULL
4040 AND p_index_constraint_tbl (i).SCOPE <> pn_index_rent_utils.g_pn_miss_char)
4041 OR ( p_index_constraint_tbl (i).scope_meaning IS NOT NULL
4042 AND p_index_constraint_tbl (i).scope_meaning <> pn_index_rent_utils.g_pn_miss_char)
4043 THEN
4044 pn_index_rent_utils.get_lookup_code
4045 (p_parameter_name => l_constraint_proration_param
4046 , p_operation => p_operation
4047 , p_lookup_meaning => p_index_constraint_tbl (i).scope_meaning
4048 , p_lookup_type => l_constraint_proration_type
4049 , x_lookup_type_code => p_index_constraint_tbl (i).SCOPE
4050 , x_return_status => x_return_status);
4051 IF x_return_status<>fnd_api.g_ret_sts_success
4052 THEN
4053 fnd_message.set_name('PN','PN_CONSTRAINT_SCOPE_NOT_EXISTS');
4054 fnd_msg_pub.ADD;
4055 RAISE fnd_api.g_exc_error;
4056 END IF;
4057 END IF;
4058
4059
4060 IF (p_index_constraint_tbl (i).minimum_amount IS NOT NULL AND p_index_constraint_tbl (i).minimum_amount<>pn_index_rent_utils.g_pn_miss_num)
4061 AND (p_index_constraint_tbl (i).maximum_amount IS NOT NULL AND p_index_constraint_tbl (i).maximum_amount<>pn_index_rent_utils.g_pn_miss_num)
4062 AND (p_index_constraint_tbl (i).minimum_percent IS NOT NULL AND p_index_constraint_tbl (i).minimum_percent<>pn_index_rent_utils.g_pn_miss_num)
4063 AND (p_index_constraint_tbl (i).maximum_percent IS NOT NULL AND p_index_constraint_tbl (i).maximum_percent<>pn_index_rent_utils.g_pn_miss_num)
4064 THEN
4065
4066 l_error_count:=l_error_count+1;
4067 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
4068 fnd_message.set_token('ERR_MSG', 'Both Constraint amounts and percentages cannot be provided. Please provide either amounts or percentages ');
4069 fnd_msg_pub.ADD;
4070 RAISE fnd_api.g_exc_error;
4071 END IF;
4072
4073 IF ( p_index_constraint_tbl (i).minimum_amount IS NOT NULL
4074 AND p_index_constraint_tbl (i).minimum_amount <> pn_index_rent_utils.g_pn_miss_num)
4075 THEN
4076 p_index_constraint_tbl (i).minimum_percent := NULL;
4077 p_index_constraint_tbl (i).maximum_percent := NULL;
4078
4079 --IF ( p_index_constraint_tbl (i).maximum_amount IS NOT NULL
4080 -- AND p_index_constraint_tbl (i).maximum_amount <> pn_index_rent_utils.g_pn_miss_num
4081 -- )
4082 --THEN
4083 IF (p_index_constraint_tbl (i).maximum_amount < NVL(p_index_constraint_tbl (i).minimum_amount,pn_index_rent_utils.g_pn_miss_num))
4084 THEN
4085 -- NULL;
4086 -- ELSE
4087 fnd_message.set_name ('PN', 'PN_INDEX_CONSTRAINT_AMOUNT');
4088 fnd_msg_pub.ADD;
4089 RAISE fnd_api.g_exc_error;
4090 END IF;
4091 --END IF;
4092 ELSE
4093 p_index_constraint_tbl (i).minimum_amount:=NULL;
4094 END IF;
4095
4096 --
4097 IF ( p_index_constraint_tbl (i).maximum_amount IS NOT NULL
4098 AND p_index_constraint_tbl (i).maximum_amount <> pn_index_rent_utils.g_pn_miss_num)
4099 THEN
4100 p_index_constraint_tbl (i).minimum_percent := NULL;
4101 p_index_constraint_tbl (i).maximum_percent := NULL;
4102
4103
4104
4105 --IF ( p_index_constraint_tbl (i).minimum_amount IS NOT NULL
4106 -- AND p_index_constraint_tbl (i).minimum_amount <> pn_index_rent_utils.g_pn_miss_num
4107 -- )
4108 --THEN
4109 IF (p_index_constraint_tbl (i).maximum_amount <NVL(p_index_constraint_tbl (i).minimum_amount,pn_index_rent_utils.g_pn_miss_num))
4110 THEN
4111 -- NULL;
4112 --ELSE
4113
4114 fnd_message.set_name ('PN', 'PN_INDEX_CONSTRAINT_AMOUNT');
4115 fnd_msg_pub.ADD;
4116 RAISE fnd_api.g_exc_error;
4117 END IF;
4118 --END IF;
4119 ELSE
4120 p_index_constraint_tbl (i).maximum_amount:=NULL;
4121 END IF;
4122
4123 ---
4124 IF ( p_index_constraint_tbl (i).minimum_percent IS NOT NULL
4125 AND p_index_constraint_tbl (i).minimum_percent <> pn_index_rent_utils.g_pn_miss_num)
4126 THEN
4127 p_index_constraint_tbl (i).minimum_amount := NULL;
4128 p_index_constraint_tbl (i).maximum_amount := NULL;
4129
4130 --IF ( p_index_constraint_tbl (i).maximum_percent IS NOT NULL
4131 -- AND p_index_constraint_tbl (i).maximum_percent <> pn_index_rent_utils.g_pn_miss_num
4132 -- )
4133 --THEN
4134 IF (p_index_constraint_tbl (i).maximum_percent <NVL(p_index_constraint_tbl (i).minimum_percent,pn_index_rent_utils.g_pn_miss_num))
4135 THEN
4136 -- NULL;
4137 --ELSE
4138 fnd_message.set_name ('PN', 'PN_INDEX_CONSTRAINT_PERCENT');
4139 fnd_msg_pub.ADD;
4140 RAISE fnd_api.g_exc_error;
4141 END IF;
4142 --END IF;
4143 ELSE
4144 p_index_constraint_tbl (i).minimum_percent:=NULL;
4145 END IF;
4146
4147 IF ( p_index_constraint_tbl (i).maximum_percent IS NOT NULL
4148 AND p_index_constraint_tbl (i).maximum_percent <> pn_index_rent_utils.g_pn_miss_num)
4149 THEN
4150 p_index_constraint_tbl (i).minimum_amount := NULL;
4151 p_index_constraint_tbl (i).maximum_amount := NULL;
4152
4153 --IF ( p_index_constraint_tbl (i).minimum_percent IS NOT NULL
4154 -- AND p_index_constraint_tbl (i).minimum_percent <> pn_index_rent_utils.g_pn_miss_num
4155 -- )
4156 --THEN
4157 IF (p_index_constraint_tbl (i).maximum_percent <NVL(p_index_constraint_tbl (i).minimum_percent,pn_index_rent_utils.g_pn_miss_num))
4158 THEN
4159 -- NULL;
4160 --ELSE
4161 fnd_message.set_name ('PN', 'PN_INDEX_CONSTRAINT_PERCENT');
4162 fnd_msg_pub.ADD;
4163 RAISE fnd_api.g_exc_error;
4164 END IF;
4165 --END IF;
4166 ELSE
4167 p_index_constraint_tbl (i).maximum_percent:=NULL;
4168 END IF;
4169
4170 IF LTRIM (RTRIM (p_operation)) <> 'UPDATE_INDEX_RENT_CONSTRAINTS'
4171 THEN
4172 IF (x_return_status = fnd_api.g_ret_sts_success) AND p_validate=fnd_api.g_false
4173 THEN
4174
4175 pn_index_rent_pvt.DEBUG(
4176 g_pkg_name
4177 || g_program_unit
4178 || ' Calling insert_index_constraint_row from validate_index_constraint_tbl procedure'
4179 , 3);
4180
4181 insert_index_constraint_row( p_index_constraint_rec => p_index_constraint_tbl(i)
4182 , p_rent_index_rec => p_rent_index_rec
4183 , x_return_status => x_return_status
4184 , x_msg_count => x_msg_count
4185 , x_msg_data => x_msg_data);
4186 END IF;
4187
4188 IF x_return_status in (fnd_api.g_ret_sts_error,fnd_api.g_ret_sts_unexp_error)
4189 THEN
4190 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
4191 fnd_message.set_token('ERR_MSG', 'Cannot create multiple Constraint records with the scope');
4192 fnd_msg_pub.ADD;
4193 --ROLLBACK;
4194 --RAISE fnd_api.g_exc_error;
4195 END IF;
4196
4197 END IF;
4198
4199 IF LTRIM(RTRIM (p_operation)) = 'UPDATE_INDEX_RENT_CONSTRAINTS'
4200 THEN
4201 IF ( p_index_constraint_tbl (i).index_constraint_id IS NOT NULL AND p_index_constraint_tbl (i).index_constraint_id <>pn_index_rent_utils.g_pn_miss_num)
4202 THEN
4203
4204 pn_index_rent_pvt.DEBUG ( g_pkg_name
4205 || g_program_unit
4206 || ' Inside validate_index_constraint_tbl procedure calling get_changed_constraint_rec'
4207 , 3);
4208
4209
4210 IF ( p_rent_index_rec.index_lease_id IS NOT NULL
4211 OR p_rent_index_rec.index_lease_id <> pn_lease_utils.g_pn_miss_num)
4212 AND ( p_index_constraint_tbl (i).index_constraint_id IS NOT NULL
4213 OR p_index_constraint_tbl (i).index_constraint_id <> pn_lease_utils.g_pn_miss_num)
4214 THEN
4215
4216 get_changed_constraint_rec (p_index_constraint_rec => p_index_constraint_tbl(i)
4217 , p_rent_index_rec => p_rent_index_rec
4218 , x_return_status => x_return_status
4219 , x_msg_count => x_msg_count
4220 , x_msg_data => x_msg_data);
4221
4222
4223 IF x_return_status =fnd_api.g_ret_sts_error
4224 THEN
4225 RAISE fnd_api.g_exc_error;
4226 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
4227 THEN
4228
4229 RAISE fnd_api.g_exc_unexpected_error;
4230 END IF;
4231
4232 END IF;
4233
4234 END IF;
4235
4236
4237
4238 IF (x_return_status = fnd_api.g_ret_sts_success) AND p_validate=fnd_api.g_false
4239 THEN
4240
4241
4242 pn_index_rent_pvt.DEBUG ( g_pkg_name
4243 || g_program_unit
4244 || ' Calling update_constraint_row from validate_index_constraint_tbl procedure'
4245 , 3);
4246
4247 IF ( p_index_constraint_tbl (i).index_constraint_id IS NOT NULL AND p_index_constraint_tbl (i).index_constraint_id <>pn_index_rent_utils.g_pn_miss_num)
4248 THEN
4249 update_constraint_row (p_index_constraint_rec => p_index_constraint_tbl (i)
4250 , p_rent_index_rec => p_rent_index_rec
4251 , x_return_status => x_return_status
4252 , x_msg_count => x_msg_count
4253 , x_msg_data => x_msg_data);
4254 ELSE
4255
4256 pn_index_rent_pvt.DEBUG(
4257 g_pkg_name
4258 || g_program_unit
4259 || ' Calling insert_index_constraint_row from validate_index_constraint_tbl procedure'
4260 , 3);
4261 p_index_constraint_tbl (i).index_constraint_id:=NULL;
4262 insert_index_constraint_row( p_index_constraint_rec => p_index_constraint_tbl(i)
4263 , p_rent_index_rec => p_rent_index_rec
4264 , x_return_status => x_return_status
4265 , x_msg_count => x_msg_count
4266 , x_msg_data => x_msg_data);
4267
4268 END IF;
4269
4270 END IF;
4271
4272 IF x_return_status in (fnd_api.g_ret_sts_error,fnd_api.g_ret_sts_unexp_error)
4273 THEN
4274 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
4275 fnd_message.set_token('ERR_MSG', 'Cannot update multiple Constraint records with the scope');
4276 fnd_msg_pub.ADD;
4277 --ROLLBACK;
4278 --RAISE fnd_api.g_exc_error;
4279 END IF;
4280
4281
4282
4283 END IF;
4284 END LOOP;
4285
4286 validate_constraints_desc_flex ( p_index_constraint_tbl => p_index_constraint_tbl
4287 , x_return_status => x_return_status
4288 , x_msg_count => x_msg_count
4289 , x_msg_data => x_msg_count);
4290 EXCEPTION
4291 WHEN fnd_api.g_exc_error
4292 THEN
4293 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
4294 || g_pkg_name
4295 || g_program_unit
4296 || '-'
4297 || SQLERRM
4298 , 5);
4299 x_return_status := fnd_api.g_ret_sts_error;
4300
4301 WHEN OTHERS
4302 THEN
4303 pn_index_rent_pvt.DEBUG ( 'Exception in '
4304 || g_pkg_name
4305 || g_program_unit
4306 || '-'
4307 || SQLERRM
4308 , 5);
4309 x_return_status := fnd_api.g_ret_sts_unexp_error;
4310 END validate_index_constraint_tbl;
4311
4312 ---------------------------------------------------------------------------------------------
4313 -- Prcoedure to validate create Index Rent and Constraint Records with the passed values
4314 ---------------------------------------------------------------------------------------------
4315 PROCEDURE create_index_rent (
4316 p_api_version IN NUMBER
4317 , p_init_msg_list IN VARCHAR2
4318 , p_commit IN VARCHAR2
4319 , p_validate IN VARCHAR2
4320 , p_rent_index_rec IN OUT NOCOPY rent_index_rec
4321 , p_index_constraint_tbl IN OUT NOCOPY index_constraint_tbl
4322 , x_return_status OUT NOCOPY VARCHAR2
4323 , x_msg_count OUT NOCOPY NUMBER
4324 , x_msg_data OUT NOCOPY VARCHAR2)
4325 IS
4326 l_operation VARCHAR2 (30);
4327 l_error_count NUMBER := 0;
4328 l_period_exists NUMBER;
4329 l_msg VARCHAR2 (100);
4330
4331 BEGIN
4332 l_operation := 'CREATE_RENT_INDEX';
4333 g_pkg_name := 'PN_INDEX_RENT_PVT.';
4334 g_program_unit := 'CREATE_INDEX_RENT';
4335
4336 x_return_status := fnd_api.g_ret_sts_success;
4337
4338 IF p_rent_index_rec.org_id IS NOT NULL AND p_rent_index_rec.org_id<>pn_index_rent_utils.g_pn_miss_num
4339 THEN
4340 IF p_rent_index_rec.org_id<>fnd_global.org_id
4341 THEN
4342 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
4343 fnd_message.set_token('ERR_MSG', 'Operating unit provided do not exists in the list of Operating Units that are allowed access to, for a responsibility');
4344 fnd_msg_pub.ADD;
4345 RAISE fnd_api.g_exc_error;
4346 END IF;
4347 ELSE
4348 p_rent_index_rec.org_id:=FND_PROFILE.VALUE('ORG_ID');
4349 END IF;
4350
4351 pn_index_rent_pvt.DEBUG ( g_pkg_name
4352 || g_program_unit
4353 || ' Org Id set to:'||p_rent_index_rec.org_id
4354 , 3);
4355 pn_index_rent_pvt.DEBUG ( g_pkg_name
4356 || g_program_unit
4357 || ' Calling validate_index_rent_rec procedure from main'
4358 , 3);
4359
4360
4361
4362 validate_index_rent_rec (p_rent_index_rec => p_rent_index_rec
4363 -- , p_validate => p_validate
4364 , p_operation => l_operation
4365 , x_return_status => x_return_status
4366 , x_msg_count => x_msg_count
4367 , x_msg_data => x_msg_data);
4368
4369 IF (x_return_status = fnd_api.g_ret_sts_error)
4370 THEN
4371
4372 pn_index_rent_pvt.DEBUG ( g_pkg_name
4373 || g_program_unit
4374 || ' validate_index_rent_rec procedure returned error'
4375 , 3);
4376
4377 RAISE fnd_api.g_exc_error;
4378
4379 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
4380 THEN
4381
4382 pn_index_rent_pvt.DEBUG ( g_pkg_name
4383 || g_program_unit
4384 || ' validate_index_rent_rec procedure returned unexpected error'
4385 , 3);
4386
4387 RAISE fnd_api.g_exc_unexpected_error;
4388 END IF;
4389
4390
4391 pn_index_rent_pvt.DEBUG (' Calling INSERT_INDEX_RENT_ROW procedure from main', 3);
4392
4393 IF (x_return_status = fnd_api.g_ret_sts_success)
4394 THEN
4395 pn_index_rent_pvt.DEBUG ( g_pkg_name
4396 || g_program_unit
4397 || ' Calling insert_index_rent_row procedure from main'
4398 , 3);
4399
4400 IF p_validate=fnd_api.g_false
4401 THEN
4402
4403 pn_index_rent_pvt.DEBUG ( g_pkg_name
4404 || g_program_unit
4405 || ' Calling insert_index_rent_row procedure from main'
4406 , 3);
4407 insert_index_rent_row (p_rent_index_rec => p_rent_index_rec
4408 , x_return_status => x_return_status
4409 , x_msg_count => x_msg_count
4410 , x_msg_data => x_msg_data);
4411 END IF;
4412 END IF;
4413
4414 IF (x_return_status = fnd_api.g_ret_sts_error)
4415 THEN
4416 RAISE fnd_api.g_exc_error;
4417 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
4418 THEN
4419 RAISE fnd_api.g_exc_unexpected_error;
4420 END IF;
4421
4422 IF (x_return_status = fnd_api.g_ret_sts_success) and (p_index_constraint_tbl.count>0)
4423 THEN
4424
4425 pn_index_rent_pvt.DEBUG ( g_pkg_name
4426 || g_program_unit
4427 || ' Calling validate_index_constraint_tbl procedure from main'
4428 , 3);
4429
4430
4431 l_operation := 'CREATE_CONSTRAINTS';
4432
4433 pn_index_rent_pvt.DEBUG (' Calling Validate_index_constraint_tbl procedure from main', 3);
4434
4435 validate_index_constraint_tbl (p_index_constraint_tbl => p_index_constraint_tbl
4436 , p_rent_index_rec => p_rent_index_rec
4437 , p_validate => p_validate
4438 , p_operation => l_operation
4439 , x_return_status => x_return_status
4440 , x_msg_count => x_msg_count
4441 , x_msg_data => x_msg_data);
4442 END IF;
4443
4444 IF (x_return_status = fnd_api.g_ret_sts_error)
4445 THEN
4446
4447 RAISE fnd_api.g_exc_error;
4448 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
4449 THEN
4450
4451 RAISE fnd_api.g_exc_unexpected_error;
4452 END IF;
4453
4454 l_operation := 'Generating Periods ';
4455
4456
4457
4458
4459 IF (x_return_status = fnd_api.g_ret_sts_success)
4460 THEN
4461
4462 pn_index_rent_pvt.DEBUG ( g_pkg_name
4463 || g_program_unit
4464 || ' Generating Periods '
4465 , 3);
4466 l_period_exists :=
4467 pn_index_lease_common_pkg.find_if_period_exists (p_rent_index_rec.index_lease_id);
4468
4469 IF l_period_exists IS NULL
4470 THEN
4471 pn_index_rent_pvt.DEBUG ( g_pkg_name
4472 || g_program_unit
4473 || ' Generating Periods after period_exists check'
4474 , 3);
4475 pn_index_rent_periods_pkg.generate_periods
4476 (ip_index_lease_id => p_rent_index_rec.index_lease_id
4477 , op_msg => l_msg);
4478
4479 IF l_msg IS NOT NULL
4480 THEN
4481 fnd_message.set_name ('PN', l_msg);
4482 fnd_msg_pub.ADD;
4483 END IF;
4484
4485 END IF;
4486 END IF;
4487
4488
4489 pn_index_rent_pvt.DEBUG ( g_pkg_name
4490 || g_program_unit
4491 || ' End of create_index_rent'
4492 , 3);
4493 EXCEPTION
4494 WHEN fnd_api.g_exc_error
4495 THEN
4496 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
4497 || g_pkg_name
4498 || g_program_unit
4499 || '-'
4500 || SQLERRM
4501 , 5);
4502 x_return_status := fnd_api.g_ret_sts_error;
4503
4504 WHEN OTHERS
4505 THEN
4506 pn_index_rent_pvt.DEBUG ( 'Exception in '
4507 || g_pkg_name
4508 || g_program_unit
4509 || '-'
4510 || SQLERRM
4511 , 5);
4512 x_return_status := fnd_api.g_ret_sts_unexp_error;
4513 END create_index_rent;
4514
4515 ---------------------------------------------------------------------------------------------
4516 -- Prcoedure to validate update Index Rent and Constraint Records with the passed values
4517 ---------------------------------------------------------------------------------------------
4518 PROCEDURE update_index_rent (
4519 p_api_version IN NUMBER
4520 , p_init_msg_list IN VARCHAR2
4521 , p_commit IN VARCHAR2
4522 , p_validate IN VARCHAR2
4523 , p_rent_index_rec IN OUT NOCOPY rent_index_rec
4524 , p_index_constraint_tbl IN OUT NOCOPY index_constraint_tbl
4525 , x_return_status OUT NOCOPY VARCHAR2
4526 , x_msg_count OUT NOCOPY NUMBER
4527 , x_msg_data OUT NOCOPY VARCHAR2)
4528 IS
4529 l_operation VARCHAR2 (30);
4530 l_error_count NUMBER := 0;
4531 l_period_exists NUMBER;
4532 l_msg VARCHAR2 (100);
4533 BEGIN
4534 l_operation := 'UPDATE_INDEX_RENT';
4535 g_pkg_name := 'PN_INDEX_RENT_PVT.';
4536 g_program_unit := NULL;
4537 x_return_status := fnd_api.g_ret_sts_success;
4538
4539 IF p_rent_index_rec.org_id IS NOT NULL AND p_rent_index_rec.org_id<>pn_index_rent_utils.g_pn_miss_num
4540 THEN
4541 IF p_rent_index_rec.org_id<>fnd_global.org_id
4542 THEN
4543 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
4544 fnd_message.set_token('ERR_MSG', 'Operating unit provided do not exists in the list of Operating Units that are allowed access to, for a responsibility');
4545 fnd_msg_pub.ADD;
4546 RAISE fnd_api.g_exc_error;
4547 END IF;
4548 ELSE
4549 p_rent_index_rec.org_id:=FND_PROFILE.VALUE('ORG_ID');
4550 END IF;
4551
4552 pn_index_rent_pvt.DEBUG ( g_pkg_name
4553 || g_program_unit
4554 || ' Calling VALIDATE_INDEX_RENT_REC procedure from update main'
4555 , 3);
4556
4557 validate_index_rent_rec (p_rent_index_rec => p_rent_index_rec
4558 -- , p_validate => p_validate
4559 , p_operation => l_operation
4560 , x_return_status => x_return_status
4561 , x_msg_count => x_msg_count
4562 , x_msg_data => x_msg_data);
4563 IF (x_return_status = fnd_api.g_ret_sts_error)
4564 THEN
4565 RAISE fnd_api.g_exc_error;
4566 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
4567 THEN
4568 RAISE fnd_api.g_exc_unexpected_error;
4569 END IF;
4570
4571
4572
4573 IF (x_return_status = fnd_api.g_ret_sts_success)
4574 THEN
4575 IF p_validate=fnd_api.g_false
4576 THEN
4577 pn_index_rent_pvt.DEBUG ( g_pkg_name
4578 || g_program_unit
4579 || ' Calling update_index_rent_row procedure from update main'
4580 , 3);
4581
4582
4583 update_index_rent_row (p_rent_index_rec => p_rent_index_rec
4584 , x_return_status => x_return_status
4585 , x_msg_count => x_msg_count
4586 , x_msg_data => x_msg_data);
4587
4588 END IF;
4589 END IF;
4590
4591 IF (x_return_status = fnd_api.g_ret_sts_error)
4592 THEN
4593 RAISE fnd_api.g_exc_error;
4594 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
4595 THEN
4596 RAISE fnd_api.g_exc_unexpected_error;
4597 END IF;
4598
4599
4600 IF (x_return_status = fnd_api.g_ret_sts_success) and (p_index_constraint_tbl.count>0)
4601 THEN
4602
4603 pn_index_rent_pvt.DEBUG ( g_pkg_name
4604 || g_program_unit
4605 || ' Calling validate_index_constraint_tbl procedure from update main'
4606 , 3);
4607 l_operation := 'UPDATE_INDEX_RENT_CONSTRAINTS';
4608
4609 --pn_index_rent_pvt.DEBUG (' Calling VALIDATE_INDEX_CONSTRAINT_TBL procedure', 3);
4610 validate_index_constraint_tbl (p_index_constraint_tbl => p_index_constraint_tbl
4611 , p_rent_index_rec => p_rent_index_rec
4612 , p_validate => p_validate
4613 , p_operation => l_operation
4614 , x_return_status => x_return_status
4615 , x_msg_count => x_msg_count
4616 , x_msg_data => x_msg_data);
4617 END IF;
4618
4619 IF (x_return_status = fnd_api.g_ret_sts_error)
4620 THEN
4621 RAISE fnd_api.g_exc_error;
4622 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
4623 THEN
4624 RAISE fnd_api.g_exc_unexpected_error;
4625 ELSE
4626
4627 pn_index_lease_common_pkg.chk_for_approved_index_periods( p_index_lease_id => p_rent_index_rec.index_lease_id,
4628 p_index_lease_period_id => NULL,
4629 p_chk_index_ind => 'N',
4630 p_msg => l_msg
4631 );
4632 END IF;
4633
4634 IF l_msg = 'PN_APPROVED_PERIODS_FOUND' THEN
4635 fnd_message.set_name ('PN', l_msg);
4636 RAISE fnd_api.g_exc_error;
4637 ELSE
4638 pn_index_rent_pvt.DEBUG (g_pkg_name
4639 || g_program_unit
4640 || ' Undo Periods if approved periods are not found'
4641 , 3);
4642 pn_index_rent_periods_pkg.undo_periods(p_index_lease_id => p_rent_index_rec.index_lease_id,
4643 p_msg => l_msg
4644 );
4645 END IF;
4646
4647 IF (x_return_status = fnd_api.g_ret_sts_success AND l_msg<>'PN_UNDO_PRDS_FAIL_APPROVE_PRDS')
4648 THEN
4649
4650 pn_index_rent_pvt.DEBUG ( g_pkg_name
4651 || g_program_unit
4652 || ' Generating Periods '
4653 , 3);
4654 l_period_exists := pn_index_lease_common_pkg.find_if_period_exists (p_rent_index_rec.index_lease_id);
4655
4656 IF l_period_exists IS NULL
4657 THEN
4658 pn_index_rent_pvt.DEBUG ( g_pkg_name
4659 || g_program_unit
4660 || ' Generating Periods after period_exists check'
4661 , 3);
4662 pn_index_rent_periods_pkg.generate_periods(ip_index_lease_id => p_rent_index_rec.index_lease_id
4663 , op_msg => l_msg);
4664
4665 IF l_msg IS NOT NULL
4666 THEN
4667 fnd_message.set_name ('PN', l_msg);
4668 fnd_msg_pub.ADD;
4669 END IF;
4670
4671 END IF;
4672 END IF;
4673
4674 EXCEPTION
4675 WHEN fnd_api.g_exc_error
4676 THEN
4677 pn_index_rent_pvt.DEBUG ( 'Error occurred in '
4678 || g_pkg_name
4679 || g_program_unit
4680 || '-'
4681 || SQLERRM
4682 , 5);
4683 x_return_status := fnd_api.g_ret_sts_error;
4684
4685 WHEN OTHERS
4686 THEN
4687 pn_index_rent_pvt.DEBUG ( 'Exception in '
4688 || g_pkg_name
4689 || g_program_unit
4690 || '-'
4691 || SQLERRM
4692 , 5);
4693 x_return_status := fnd_api.g_ret_sts_unexp_error;
4694 END update_index_rent;
4695
4696 END pn_index_rent_pvt;