[Home] [Help]
PACKAGE BODY: APPS.FTP_BR_PREPAYMENT_PVT
Source
1 PACKAGE BODY ftp_br_prepayment_pvt AS
2 /* $Header: ftpbppab.pls 120.1 2005/10/24 03:24:12 appldev noship $ */
3
4 G_PKG_NAME constant varchar2(30) := 'FTP_BR_PREPAYMENT_PVT';
5
6 --------------------------------------------------------------------------------
7 -- PRIVATE SPECS
8 --------------------------------------------------------------------------------
9
10 PROCEDURE DeletePrepaymentAssumptionRecs(
11 p_obj_def_id in number
12 );
13
14 PROCEDURE DeleteRateDefinitionRecs(
15 p_obj_def_id in number
16 );
17
18 PROCEDURE DeleteConditionRecs(
19 p_obj_def_id in number
20 );
21
22 PROCEDURE CopyPrepaymentAssumptionRecs(
23 p_source_obj_def_id in number
24 ,p_target_obj_def_id in number
25 ,p_created_by in number
26 ,p_creation_date in date
27 );
28
29 PROCEDURE CopyRateDefinitionRecs(
30 p_source_obj_def_id in number
31 ,p_target_obj_def_id in number
32 ,p_created_by in number
33 ,p_creation_date in date
34 );
35
36
37 PROCEDURE CopyConditionRecs(
38 p_source_obj_def_id in number
39 ,p_target_obj_def_id in number
40 ,p_created_by in number
41 ,p_creation_date in date
42 );
43 ----------------------------------------
44 -- PUBLIC BODIES ------
45 ----------------------------------------
46
47 ---------------------------------------------------------------------
48 -- Deletes all the details records of a Prepayment Table Definition.
49 ---------------------------------------------------------------------
50
51 PROCEDURE DeleteObjectDefinition(
52 p_obj_def_id in number
53 )
54 IS
55
56 g_api_name constant varchar2(30) := 'DeleteObjectDefinition';
57
58 BEGIN
59 DeletePrepaymentAssumptionRecs(
60 p_obj_def_id => p_obj_def_id
61 );
62
63 DeleteRateDefinitionRecs(
64 p_obj_def_id => p_obj_def_id
65 );
66
67 DeleteConditionRecs(
68 p_obj_def_id => p_obj_def_id
69 );
70
71 EXCEPTION
72
73 when others then
74 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, g_api_name);
75 raise FND_API.G_EXC_UNEXPECTED_ERROR;
76
77 END DeleteObjectDefinition;
78
79
80
81 ----------------------------------------------------------------------------
82 -- Creates all the detail records of a new Prepayment Table Rule Definition (target)
83 -- by copying the detail records of another Prepayment Table Rule Definition (source).
84 --
85 -- IN Parameters
86 -- p_source_obj_def_id - Source Object Definition ID.
87 -- p_target_obj_def_id - Target Object Definition ID.
88 -- p_created_by - FND User ID (optional).
89 -- p_creation_date - System Date (optional).
90 ----------------------------------------------------------------------------
91 PROCEDURE CopyObjectDefinition(
92 p_source_obj_def_id in number
93 ,p_target_obj_def_id in number
94 ,p_created_by in number
95 ,p_creation_date in date
96 )
97 IS
98
99 g_api_name constant varchar2(30) := 'CopyObjectDefinition';
100
101 BEGIN
102
103 CopyPrepaymentAssumptionRecs(
104 p_source_obj_def_id => p_source_obj_def_id
105 ,p_target_obj_def_id => p_target_obj_def_id
106 ,p_created_by => p_created_by
107 ,p_creation_date => p_creation_date
108 --,x_target_ppr_assumption_id
109 );
110
111 CopyRateDefinitionRecs(
112 p_source_obj_def_id => p_source_obj_def_id
113 ,p_target_obj_def_id => p_target_obj_def_id
114 ,p_created_by => p_created_by
115 ,p_creation_date => p_creation_date
116 --,p_target_ppr_assumption_id => p_target_ppr_assumption_id
117 );
118
119
120 CopyConditionRecs(
121 p_source_obj_def_id => p_source_obj_def_id
122 ,p_target_obj_def_id => p_target_obj_def_id
123 ,p_created_by => p_created_by
124 ,p_creation_date => p_creation_date
125 );
126
127 EXCEPTION
128
129 when others then
130 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, g_api_name);
131 raise FND_API.G_EXC_UNEXPECTED_ERROR;
132
133 END CopyObjectDefinition;
134
135
136
137 ----------------------------------------
138 -- PRIVATE BODIES ----------------------
139 ----------------------------------------
140
141 --
142 -- PROCEDURE
143 -- DeletePrepaymentAssumptionRecs
144 --
145 -- DESCRIPTION
146 -- Deletes a Prepayment Rule Definition by performing deletes on records
147 -- in the FTP_PREPAYMENT_RULE table.
148 --
149 -- IN
150 -- p_obj_def_id - Object Definition ID.
151 --
152 --------------------------------------------------------------------------------
153 PROCEDURE DeletePrepaymentAssumptionRecs(
154 p_obj_def_id in number
155 )
156 --------------------------------------------------------------------------------
157 IS
158 BEGIN
159
160 delete from ftp_prepayment_rule
161 where object_definition_id = p_obj_def_id;
162
163 END DeletePrepaymentAssumptionRecs;
164
165
166 --
167 -- PROCEDURE
168 -- DeleteUnpricedAccountRecs
169 --
170 -- DESCRIPTION
171 -- Deletes Prepayment Rule Definition records by performing deletes on records
172 -- in the FTP_PP_ORGDATE_ASSUMP table.
173 --
174 -- IN
175 -- p_obj_def_id - Object Definition ID.
176 --
177 --------------------------------------------------------------------------------
178 PROCEDURE DeleteRateDefinitionRecs(
179 p_obj_def_id in number
180 )
181 --------------------------------------------------------------------------------
182 IS
183 BEGIN
184
185 delete from ftp_pp_orgdate_assump
186 where object_definition_id = p_obj_def_id;
187
188 END DeleteRateDefinitionRecs;
189
190
191 --
192 -- PROCEDURE
193 -- DeleteConditionRecs
194 --
195 -- DESCRIPTION
196 -- Deletes Prepayment Rule Definition records by performing deletes on records
197
198 -- in the FTP_TP_PP_CONDITIONS table.
199 --
200 -- IN
201 -- p_obj_def_id - Object Definition ID.
202 --
203 --------------------------------------------------------------------------------
204 PROCEDURE DeleteConditionRecs(
205 p_obj_def_id in number
206 )
207 --------------------------------------------------------------------------------
208 IS
209 BEGIN
210
211 delete from ftp_tp_pp_conditions
212 where object_definition_id = p_obj_def_id;
213
214 END DeleteConditionRecs;
215
216
217 --
218 -- PROCEDURE
219 -- CopTransferPriceRuleRec
220 --
221 -- DESCRIPTION
222 -- Creates a new Prepayment Rule Definition by copying records in the
223 -- FTP_PREPAYMENT_RULE table.
224 --
225 -- IN
226 -- p_source_obj_def_id - Source Object Definition ID.
227 -- p_target_obj_def_id - Target Object Definition ID.
228 -- p_created_by - FND User ID (optional).
229 -- p_creation_date - System Date (optional).
230 --
231 --------------------------------------------------------------------------------
232 PROCEDURE CopyPrepaymentAssumptionRecs(
233 p_source_obj_def_id in number
234 ,p_target_obj_def_id in number
235 ,p_created_by in number
236 ,p_creation_date in date
237 )
238 --------------------------------------------------------------------------------
239 IS
240
241 BEGIN
242
243 insert into ftp_prepayment_rule (
244 object_definition_id
245 ,line_item_id
246 ,currency
247 ,cond_sequence
248 ,calc_method_code
249 ,portfolio_flg
250 ,quote_code
251 ,rate_term_code
252 ,interest_rate_code
253 ,seasonality_flg
254 ,rate_spread
255 ,jan_coeff
256 ,feb_coeff
257 ,mar_coeff
258 ,apr_coeff
259 ,may_coeff
260 ,jun_coeff
261 ,jul_coeff
262 ,aug_coeff
263 ,sep_coeff
264 ,oct_coeff
265 ,nov_coeff
266 ,dec_coeff
267 ,created_by
268 ,creation_date
269 ,last_updated_by
270 ,last_update_date
271 ,last_update_login
272 ,ppr_assumption_id
273 ) select
274 p_target_obj_def_id
275 ,line_item_id
276 ,currency
277 ,cond_sequence
278 ,calc_method_code
279 ,portfolio_flg
280 ,quote_code
281 ,rate_term_code
282 ,interest_rate_code
283 ,seasonality_flg
284 ,rate_spread
285 ,jan_coeff
286 ,feb_coeff
287 ,mar_coeff
288 ,apr_coeff
289 ,may_coeff
290 ,jun_coeff
291 ,jul_coeff
292 ,aug_coeff
293 ,sep_coeff
294 ,oct_coeff
295 ,nov_coeff
296 ,dec_coeff
297 ,nvl(p_created_by,created_by)
298 ,nvl(p_creation_date,creation_date)
299 ,FND_GLOBAL.user_id
300 ,sysdate
301 ,FND_GLOBAL.login_id
302 ,FTP.FTP_PPR_ASSUMPTION_ID_SEQ.NEXTVAL
303 from ftp_prepayment_rule
304 where object_definition_id = p_source_obj_def_id;
305
306 END CopyPrepaymentAssumptionRecs;
307
308
309 --
310 -- PROCEDURE
311 -- CopyRateDefinitionRecs
312 --
313 -- DESCRIPTION
314 -- Creates a new Prepayment Rule Definition records by copying records in the
315 -- ftp_pp_orgdate_assump
316 --
317 -- IN
318 -- p_source_obj_def_id - Source Object Definition ID.
319 -- p_target_obj_def_id - Target Object Definition ID.
320 -- p_created_by - FND User ID (optional).
321 -- p_creation_date - System Date (optional).
322 --
323 --------------------------------------------------------------------------------
324 PROCEDURE CopyRateDefinitionRecs(
325 p_source_obj_def_id in number
326 ,p_target_obj_def_id in number
327 ,p_created_by in number
328 ,p_creation_date in date
329 )
330 --------------------------------------------------------------------------------
331 IS
332 -- Declare program variables as shown above
333
334 v_ppr_id FTP_PREPAYMENT_RULE.PPR_ASSUMPTION_ID%TYPE;
335 v_obj_id FTP_PREPAYMENT_RULE.OBJECT_DEFINITION_ID%TYPE;
336 v_ln_id FTP_PREPAYMENT_RULE.LINE_ITEM_ID%TYPE;
337 v_currency FTP_PREPAYMENT_RULE.CURRENCY%TYPE;
338 v_seq FTP_PREPAYMENT_RULE.COND_SEQUENCE%TYPE;
339
340 CURSOR cur_ppr IS
341 SELECT PPR_ASSUMPTION_ID, OBJECT_DEFINITION_ID,
342 LINE_ITEM_ID,CURRENCY, COND_SEQUENCE
343 FROM FTP_PREPAYMENT_RULE
344 WHERE OBJECT_DEFINITION_ID = p_target_obj_def_id;
345
346 BEGIN
347 OPEN cur_ppr ; -- open cursor
348
349 LOOP
350 FETCH cur_ppr INTO v_ppr_id, v_obj_id,v_ln_id, v_currency, v_seq;
351 EXIT WHEN cur_ppr%NOTFOUND;
352
353 insert into ftp_pp_orgdate_assump (
354 object_definition_id
355 ,line_item_id
356 ,currency
357 ,cond_sequence
358 ,origination_date
359 ,const_prepay_rate
360 ,prepay_tbl_object_id
361 ,burnout_factor
362 ,arc_coeff_1
363 ,arc_coeff_2
364 ,arc_coeff_3
365 ,arc_coeff_4
366 ,created_by
367 ,creation_date
368 ,last_updated_by
369 ,last_update_date
370 ,last_update_login
371 ,ppr_assumption_id
372 ) select
373 p_target_obj_def_id
374 ,line_item_id
375 ,currency
376 ,cond_sequence
377 ,origination_date
378 ,const_prepay_rate
379 ,prepay_tbl_object_id
380 ,burnout_factor
381 ,arc_coeff_1
382 ,arc_coeff_2
383 ,arc_coeff_3
384 ,arc_coeff_4
385 ,nvl(p_created_by,created_by)
386 ,nvl(p_creation_date,creation_date)
387 ,FND_GLOBAL.user_id
388 ,sysdate
389 ,FND_GLOBAL.login_id
390 ,v_ppr_id
391 from ftp_pp_orgdate_assump
392 where object_definition_id = p_source_obj_def_id
393 and line_item_id = v_ln_id
394 and currency = v_currency
395 and cond_sequence = v_seq;
396
397 END LOOP;
398 CLOSE cur_ppr ;
399
400 END CopyRateDefinitionRecs;
401
402 --
403 -- PROCEDURE
404 -- CopyConditionRecs
405 --
406 -- DESCRIPTION
407 -- Creates a new Prepayment Rule Definition records by copying records in the
408 -- FTP_TP_PP_CONDITIONS table.
409 --
410 -- IN
411 -- p_source_obj_def_id - Source Object Definition ID.
412 -- p_target_obj_def_id - Target Object Definition ID.
413 -- p_created_by - FND User ID (optional).
414 -- p_creation_date - System Date (optional).
415 --
416 --------------------------------------------------------------------------------
417 PROCEDURE CopyConditionRecs(
418 p_source_obj_def_id in number
419 ,p_target_obj_def_id in number
420 ,p_created_by in number
421 ,p_creation_date in date
422 )
423 --------------------------------------------------------------------------------
424 IS
425 BEGIN
426
427 insert into ftp_tp_pp_conditions (
428 object_definition_id
429 ,line_item_id
430 ,currency
431 ,cond_sequence
432 ,cond_order
433 ,level_num
434 ,table_name
435 ,column_name
436 ,column_data_type
437 ,compare_type
438 ,comparator
439 ,logical
440 ,r_from
441 ,r_to
442 ,left_paren
443 ,right_paren
444 ,created_by
445 ,creation_date
446 ,last_updated_by
447 ,last_update_date
448 ,last_update_login
449 ) select
450 p_target_obj_def_id
451 ,line_item_id
452 ,currency
453 ,cond_sequence
454 ,cond_order
455 ,level_num
456 ,table_name
457 ,column_name
458 ,column_data_type
459 ,compare_type
460 ,comparator
461 ,logical
462 ,r_from
463 ,r_to
464 ,left_paren
465 ,right_paren
466 ,nvl(p_created_by,created_by)
467 ,nvl(p_creation_date,creation_date)
468 ,FND_GLOBAL.user_id
469 ,sysdate
470 ,FND_GLOBAL.login_id
471 from ftp_tp_pp_conditions
472 where object_definition_id = p_source_obj_def_id;
473
474 END CopyConditionRecs;
475
476
477 END FTP_BR_PREPAYMENT_PVT;