[Home] [Help]
PACKAGE BODY: APPS.IGIPMSLR
Source
1 Package Body IGIPMSLR AS
2 -- $Header: igipmslb.pls 115.6 2003/12/01 15:00:09 sdixit ship $
3 -- ---------
4 -- SUBTYPES
5 -- --------
6 SUBTYPE SUBLGR IS IGI_MPP_SUBLEDGER%ROWTYPE;
7 -- ---------
8 -- CONSTANTS
9 -- ---------
10
11 AP_APPLICATION_ID CONSTANT NUMBER(15) := 200;
12 G_USER_ID CONSTANT NUMBER(15) := fnd_global.user_id;
13 G_DATE CONSTANT DATE := sysdate;
14 G_LOGIN_ID CONSTANT NUMBER(15) := fnd_global.login_id;
15 --bug 3199481: following variables added for fnd logging changes:sdixit :start
16 l_debug_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
17 l_state_level number := FND_LOG.LEVEL_STATEMENT;
18 l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
19 l_event_level number := FND_LOG.LEVEL_EVENT;
20 l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
21 l_error_level number := FND_LOG.LEVEL_ERROR;
22 l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
23
24 -- ----------
25 -- CURSORS
26 -- ----------
27
28 CURSOR c_dist ( cp_invoice_id in number
29 , cp_distribution_line_number in number
30 )
31 IS
32 SELECT dist.invoice_id, dist.set_of_books_id, dist.period_name, dist.amount
33 , dist.distribution_line_number, dist.dist_code_combination_id
34 , dist.description, dist.accounting_date, gsob.chart_of_accounts_id
35 , dist.base_amount, dist.exchange_rate, dist.exchange_date,
36 dist.exchange_rate_type, gsob.currency_code functional_currency_code
37 FROM ap_invoice_distributions dist
38 , gl_sets_of_books gsob
39 WHERE dist.distribution_line_number = cp_distribution_line_number
40 AND dist.set_of_books_id = gsob.set_of_books_id
41 AND dist.invoice_id = cp_invoice_id
42 ;
43
44
45 CURSOR c_ext_dist ( cp_invoice_id in number
46 , cp_distribution_line_number in number
47 )
48 IS
49 SELECT ext_dist.*
50 FROM igi_mpp_ap_invoice_dists_det ext_dist
51 WHERE ext_dist.distribution_line_number = cp_distribution_line_number
52 AND ext_dist.invoice_id = cp_invoice_id
53 ORDER BY ext_dist.mpp_dist_line_number
54 ;
55
56 -- ----------------
57 -- COMMON PROCEDURES
58 -- -----------------
59
60 PROCEDURE WriteToLog ( pp_mesg in varchar2 ) IS
61 BEGIN
62 -- FND_FILE.put_line( FND_FILE.log, pp_mesg );
63 null;
64 END;
65
66 -- -----------------
67 -- FUNCTIONS
68 -- -----------------
69 FUNCTION GetInvoiceCurrency ( fp_invoice_id in number)
70 RETURN VARCHAR2
71 IS
72 CURSOR C_curr IS
73 SELECT invoice_currency_code
74 from ap_invoices
75 where invoice_id = fp_invoice_id
76 ;
77 BEGIN
78 FOR l_curr in C_curr LOOP
79 return l_curr.invoice_currency_code;
80 END LOOP;
81 return '-1';
82 END GetInvoiceCurrency;
83
84 FUNCTION ExistsOffsetEntries ( p_invoice_id in number
85 , p_distribution_line_number in number
86 )
87 RETURN BOOLEAN IS
88 CURSOR c_exists IS
89 SELECT count('x') ct
90 FROM igi_mpp_subledger
91 WHERE invoice_id = p_invoice_id
92 AND distribution_line_number = p_distribution_line_number
93 AND reference1 = '0'
94 ;
95 BEGIN
96 FOR l_exists in c_exists LOOP
97 IF l_exists.ct = 2 THEN
98 return TRUE;
99 END IF;
100 END LOOP;
101 return FALSE;
102 END ExistsOffsetEntries;
103
104 FUNCTION ExistsRecognizedEntries ( p_invoice_id in number
105 , p_distribution_line_number in number
106 )
107 RETURN BOOLEAN IS
108 CURSOR c_exists IS
109 SELECT 'x'
110 FROM igi_mpp_subledger
111 WHERE invoice_id = p_invoice_id
112 AND distribution_line_number = p_distribution_line_number
113 AND ( nvl(expense_recognized_flag,'N') = 'Y'
114 OR nvl(gl_posted_flag,'N') = 'Y' )
115 ;
116 BEGIN
117 FOR l_exists in c_exists LOOP
118 return TRUE;
119 END LOOP;
120 return FALSE;
121 END ExistsRecognizedEntries;
122
123
124 FUNCTION ConvertToFuncCurr ( fp_set_of_books_id in number
125 , fp_txn_date in date
126 , fp_curr_conv_type in varchar2
127 , fp_txn_amount in number
128 , fp_txn_curr in varchar2
129 , fp_func_curr in varchar2 )
130 RETURN Number
131 IS
132 BEGIN
133 IF fp_txn_curr = nvl(fp_func_curr, fp_txn_curr) then
134 return fp_txn_amount;
135 END IF;
136
137 return GL_CURRENCY_API.Convert_amount ( fp_txn_curr, fp_func_curr,
138 fp_txn_date, fp_curr_conv_type, fp_txn_amount );
139
140 END ConvertToFuncCurr;
141 -- ------------
142 -- PROCEDURES
143 -- ------------
144
145 PROCEDURE InsertIntoSublgr ( p_sublgr in SUBLGR ) IS
146 l_date DATE;
147 l_factor NUMBER := 0;
148
149 FUNCTION DateFactor ( fp_invoice_id in number, fp_dist_line_num in number
150 , fp_sob_id in number
151 )
152 RETURN Number
153 IS
154 l_date DATE := null;
155
156 CURSOR c_acc_date is
157 SELECT accounting_date
158 FROM ap_invoice_distributions
159 WHERE invoice_id = fp_invoice_id
160 AND set_of_books_id = fp_sob_id
161 AND distribution_line_number =
162 fp_dist_line_num
163 ;
164 CURSOR c_date IS
165 SELECT start_date, end_date
166 FROM gl_period_statuses
167 WHERE application_id = AP_APPLICATION_ID
168 AND set_of_books_id = fp_sob_id
169 AND period_name = ( select period_name
170 from ap_invoice_distributions
171 where invoice_id = fp_invoice_id AND
172 distribution_line_number =
173 fp_dist_line_num ) ;
174 BEGIN
175 FOR l_acc_date in c_acc_date LOOP
176 FOR l_date in c_date LOOP
177 return (
178 ( l_acc_date.accounting_date - l_date.start_date) /
179 ( l_date.end_date - l_date.start_date )
180 )
181 ;
182 END LOOP;
183 END LOOP;
184 return null;
185 EXCEPTION WHEN OTHERS THEN
186 --bug 3199481 fnd logging changes:sdixit :start
187 --standard way to handle when-others as per FND logging guidelines
188
189 IF ( l_unexp_level >= l_debug_level ) THEN
190
191 FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
192 FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
193 FND_MESSAGE.SET_TOKEN('MSG', SQLERRM);
194 FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.igipmslb.IGIPMSLR.DateFactor',TRUE);
195 END IF;
196 --bug 3199481 fnd logging changes: sdixit: end block
197 return null;
198 END DateFactor;
199
200 FUNCTION GetDay ( fp_period_name in varchar2, fp_sob_id in number,
201 fp_factor in number
202 )
203 return Date
204 IS
205 CURSOR c_last_date IS
206 SELECT start_date, end_date
207 FROM gl_period_statuses
208 WHERE application_id = AP_APPLICATION_ID
209 AND set_of_books_id = fp_sob_id
210 AND period_name = fp_period_name;
211
212 BEGIN
213
214 FOR l_date in c_last_date LOOP
215 return ( fp_factor * ( l_date.end_date - l_date.start_date) )
216 + l_date.start_date;
217 END LOOP;
218
219 return NULL;
220 EXCEPTION
221 when others then
222 --bug 3199481 fnd logging changes:sdixit :start
223 --standard way to handle when-others as per FND logging guidelines
224
225 IF ( l_unexp_level >= l_debug_level ) THEN
226
227 FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
228 FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
229 FND_MESSAGE.SET_TOKEN('MSG', SQLERRM);
230 FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.igipmslb.IGIPMSLR.GetDay',TRUE);
231 END IF;
232 --bug 3199481 fnd logging changes: sdixit: end block
233 null;
234 END GetDay;
235
236 BEGIN
237
238 l_factor := DateFactor( p_sublgr.invoice_id, p_sublgr.distribution_line_number
239 , p_sublgr.set_of_books_id
240 );
241
242 l_date := GetDay ( p_sublgr.period_name, p_sublgr.set_of_books_id,
243 l_factor );
244
245 l_date := nvl( l_date, p_sublgr.gl_date );
246
247 INSERT INTO IGI_MPP_SUBLEDGER
248 (
249 invoice_id
250 ,distribution_line_number
251 ,last_update_date
252 ,last_updated_by
253 ,creation_date
254 ,created_by
255 ,last_update_login
256 ,subledger_entry_id
257 ,currency_code
258 ,actual_flag
259 ,je_source_name
260 ,je_category_name
261 ,set_of_books_id
262 ,gl_date
263 ,expense_recognized_flag
264 ,gl_posted_flag
265 ,code_combination_id
266 ,accounted_dr
267 ,accounted_cr
268 ,entered_dr
269 ,entered_cr
270 ,currency_conversion_date
271 ,user_currency_conversion_type
272 ,currency_conversion_rate
273 ,period_name
274 ,chart_of_accounts_id
275 ,functional_currency_code
276 ,date_created_in_gl
277 ,je_batch_name
278 ,je_batch_description
279 ,je_header_name
280 ,je_line_description
281 ,reverse_journal_flag
282 ,reversal_period_name
283 ,ussgl_transaction_code
284 ,reference1
285 ,reference2
286 ,reference3
287 ) VALUES (
288 p_sublgr.invoice_id
289 ,p_sublgr.distribution_line_number
290 ,p_sublgr.last_update_date
291 ,p_sublgr.last_updated_by
292 ,p_sublgr.creation_date
293 ,p_sublgr.created_by
294 ,p_sublgr.last_update_login
295 ,p_sublgr.subledger_entry_id
296 ,p_sublgr.currency_code
297 ,p_sublgr.actual_flag
298 ,p_sublgr.je_source_name
299 ,p_sublgr.je_category_name
300 ,p_sublgr.set_of_books_id
301 ,l_date
302 ,p_sublgr.expense_recognized_flag
303 ,p_sublgr.gl_posted_flag
304 ,p_sublgr.code_combination_id
305 ,p_sublgr.accounted_dr
306 ,p_sublgr.accounted_cr
307 ,p_sublgr.entered_dr
308 ,p_sublgr.entered_cr
309 ,p_sublgr.currency_conversion_date
310 ,p_sublgr.user_currency_conversion_type
311 ,p_sublgr.currency_conversion_rate
312 ,p_sublgr.period_name
313 ,p_sublgr.chart_of_accounts_id
314 ,p_sublgr.functional_currency_code
315 ,p_sublgr.date_created_in_gl
316 ,p_sublgr.je_batch_name
317 ,p_sublgr.je_batch_description
318 ,p_sublgr.je_header_name
319 ,p_sublgr.je_line_description
320 ,p_sublgr.reverse_journal_flag
321 ,p_sublgr.reversal_period_name
322 ,p_sublgr.ussgl_transaction_code
323 ,p_sublgr.reference1
324 ,p_sublgr.reference2
325 ,p_sublgr.reference3
326 );
327
328 END;
329
330
331 PROCEDURE CreateOffsetEntries ( p_sublgr IN SUBLGR
332 , p_ccid in number
333 , p_dr_or_cr IN VARCHAR2
334 , p_amount IN NUMBER
335 , p_base_amount in NUMBER
336 ) IS
337 l_sublgr SUBLGR := p_sublgr;
338
339 BEGIN
340 l_sublgr.reference1 := '0';
341 l_sublgr.code_combination_id := p_ccid;
342
343 SELECT DECODE(p_dr_or_cr,'DR',p_amount,null)
344 , DECODE(p_dr_or_cr,'DR',null,p_amount)
345 INTO l_sublgr.entered_dr ,
346 l_sublgr.entered_cr
347 FROM SYS.DUAL;
348
349 IF l_sublgr.entered_dr is not null then
350 l_sublgr.accounted_dr := ConvertToFuncCurr
351 ( l_sublgr.set_of_books_id
352 , l_sublgr.currency_conversion_date
353 , l_sublgr.user_currency_conversion_type
354 , l_sublgr.entered_dr
355 , l_sublgr.currency_code
356 , l_sublgr.functional_currency_code
357 );
358 END IF;
359 IF l_sublgr.entered_cr is not null then
360 l_sublgr.accounted_cr := ConvertToFuncCurr
361 ( l_sublgr.set_of_books_id
362 , l_sublgr.currency_conversion_date
363 , l_sublgr.user_currency_conversion_type
364 , l_sublgr.entered_cr
365 , l_sublgr.currency_code
366 , l_sublgr.functional_currency_code
367 );
368 END IF;
369
370 SELECT igi_mpp_subledger_s.nextval
371 INTO l_sublgr.subledger_entry_id
372 FROM sys.dual;
373
374 InsertIntoSublgr ( l_sublgr );
375
376 END ;
377 PROCEDURE CreateNormalEntries ( p_sublgr IN SUBLGR
378 , p_ext_dist IN c_ext_dist%ROWTYPE
379 , p_future_posting_ccid in number
380 , p_dr_or_cr IN VARCHAR2
381 ) IS
382 l_sublgr SUBLGR := p_sublgr;
383 BEGIN
384
385 l_sublgr.reference1 := p_ext_dist.mpp_dist_line_number;
386 l_sublgr.period_name := p_ext_dist.period_name;
387
388 IF p_dr_or_cr = 'DR' THEN
389 --bug 3199481: fnd logging changes:sdixit :start
390 IF (l_state_level >= l_debug_level ) THEN
391 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateNormalEntries',
392 '>> >> >> >> Debit entry..(EXPENSE).');
393 END IF;
394 l_sublgr.code_combination_id := p_ext_dist.code_combination_id;
395 ELSE
396 --bug 3199481: fnd logging changes:sdixit :start
397 IF (l_state_level >= l_debug_level ) THEN
398 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateNormalEntries',
399 '>> >> >> >> Credit entry..(FUTURE POSTING).');
400 END IF;
401 --bug 3199481 fnd logging changes: sdixit: end block
402 l_sublgr.code_combination_id := p_future_posting_ccid;
403 END IF;
404
405 SELECT DECODE(p_dr_or_cr,'DR',p_ext_dist.amount,null)
406 , DECODE(p_dr_or_cr,'DR',null,p_ext_dist.amount)
407 INTO l_sublgr.entered_dr ,
408 l_sublgr.entered_cr
409 FROM SYS.DUAL;
410
411 IF l_sublgr.entered_dr is not null then
412 l_sublgr.accounted_dr := ConvertToFuncCurr
413 ( l_sublgr.set_of_books_id
414 , l_sublgr.currency_conversion_date
415 , l_sublgr.user_currency_conversion_type
416 , l_sublgr.entered_dr
417 , l_sublgr.currency_code
418 , l_sublgr.functional_currency_code
419 );
420 END IF;
421 IF l_sublgr.entered_cr is not null then
422 l_sublgr.accounted_cr := ConvertToFuncCurr
423 ( l_sublgr.set_of_books_id
424 , l_sublgr.currency_conversion_date
425 , l_sublgr.user_currency_conversion_type
426 , l_sublgr.entered_cr
427 , l_sublgr.currency_code
428 , l_sublgr.functional_currency_code
429 );
430 END IF;
431 SELECT igi_mpp_subledger_s.nextval
432 INTO l_sublgr.subledger_entry_id
433 FROM sys.dual;
434
435 InsertIntoSublgr ( l_sublgr );
436
437 END;
438
439 PROCEDURE CreateEntries ( p_dist in c_dist%ROWTYPE ) IS
440
441 CURSOR c_future_post IS
442 SELECT setup.*
443 FROM igi_mpp_setup setup
444 ;
445
446 l_future_post c_future_post%ROWTYPE;
447 l_sublgr SUBLGR ;
448 l_continue BOOLEAN := FALSE;
449 BEGIN
450 /*
451 -- Get the future posting account details and the
452 -- mpp distribution details
453 */
454 --bug 3199481: fnd logging changes:sdixit :start
455 IF (l_state_level >= l_debug_level ) THEN
456 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateEntries',
457 '>> >> Inside Create new Subledger entry...');
458 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateEntries',
459 '>> >> Validating Set up...');
460 END IF;
461 --bug 3199481 fnd logging changes: sdixit: end block
462 OPEN c_future_post;
463 LOOP
464 FETCH c_future_post into l_future_post;
465 EXIT WHEN c_future_post%NOTFOUND;
466
467 l_continue := TRUE;
468 IF l_future_post.future_posting_ccid is not null then
469 NULL;
470 ELSE
471 CLOSE c_future_post;
472 raise_application_error ( -20000, 'Future Posting Account is not set.');
473 END IF;
474 --bug 3199481: fnd logging changes:sdixit :start
475 IF (l_state_level >= l_debug_level ) THEN
476 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateEntries',
477 '>> >> MPP Setup Validation successful...');
478 END IF;
479 --bug 3199481 fnd logging changes: sdixit: end block
480 END LOOP;
481 CLOSE c_future_post;
482
483
484 IF NOT l_continue THEN
485 raise_application_error (-20000, 'MPP Setup is not done properly.');
486 END IF;
487 /*
488 -- Set the Subldger Template record
489 */
490 --bug 3199481: fnd logging changes:sdixit :start
491 IF (l_state_level >= l_debug_level ) THEN
492 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateEntries',
493 '>> >> Building Sub ledger Template...');
494 END IF;
495 --bug 3199481 fnd logging changes: sdixit: end block
496
497 l_sublgr.invoice_id := p_dist.invoice_id;
498 l_sublgr.distribution_line_number := p_dist.distribution_line_number;
499 l_sublgr.last_update_date := g_date;
500 l_sublgr.last_updated_by := g_user_id;
501 l_sublgr.creation_date := g_date;
502 l_sublgr.created_by := g_user_id;
503 l_sublgr.last_update_login := g_login_id;
504 l_sublgr.currency_code := GetInvoiceCurrency ( p_dist.invoice_id) ;
505 l_sublgr.actual_flag := 'A';
506 l_sublgr.je_source_name := l_future_post.je_source_name;
507 l_sublgr.je_category_name := l_future_post.je_category_name;
508 l_sublgr.set_of_books_id := p_dist.set_of_books_id;
509 l_sublgr.gl_date := p_dist.accounting_date;
510 l_sublgr.expense_recognized_flag := 'N';
511 l_sublgr.gl_posted_flag := 'N';
512 l_sublgr.code_combination_id := NULL;
513 l_sublgr.accounted_dr := NULL;
514 l_sublgr.accounted_cr := NULL;
515 l_sublgr.entered_dr := NULL;
516 l_sublgr.entered_cr := NULL;
517 l_sublgr.currency_conversion_Date := p_dist.exchange_date;
518 l_sublgr.currency_conversion_rate := p_dist.exchange_rate;
519 l_sublgr.user_currency_conversion_type := p_dist.exchange_rate_type;
520 l_sublgr.period_name := p_dist.period_name;
521 l_sublgr.chart_of_accounts_id := p_dist.chart_of_accounts_id;
522 l_sublgr.functional_currency_code := p_dist.functional_currency_code ;
523 l_sublgr.date_created_in_gl := NULL;
524 l_sublgr.je_batch_name := NULL;
525 l_sublgr.je_batch_description := NULL;
526 l_sublgr.je_header_name := NULL;
527 l_sublgr.je_line_description := NULL;
528 -- l_sublgr.reversal_journal_flag := NULL;
529 l_sublgr.reversal_period_name := NULL;
530 l_sublgr.ussgl_transaction_code := NULL;
531 l_sublgr.reference1 := p_dist.distribution_line_number;
532 l_sublgr.reference2 := p_dist.description;
533 l_sublgr.reference3 := NULL;
534
535
536
537
538 /*
539 --
540 -- Create Offset Account entries at the invoice distribution
541 -- line level
542 */
543 --bug 3199481: fnd logging changes:sdixit :start
544 IF (l_state_level >= l_debug_level ) THEN
545 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateEntries',
546 '>> >> Creating Offset entries...');
547 END IF;
548 --bug 3199481 fnd logging changes: sdixit: end block
549
550
551 IF NOT ExistsOffsetEntries ( p_dist.invoice_id
552 , p_dist.distribution_line_number
553 ) THEN
554 --bug 3199481: fnd logging changes:sdixit :start
555 IF (l_state_level >= l_debug_level ) THEN
556 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateEntries',
557 '>> >> >> Creating Offset entries (CR) OF EXPENSE ...');
558 END IF;
559 --bug 3199481 fnd logging changes: sdixit: end block
560 CreateOffsetEntries ( l_sublgr
561 , p_dist.dist_code_combination_id
562 , 'CR'
563 , p_dist.amount
564 , p_dist.base_amount
565 );
566 --bug 3199481: fnd logging changes:sdixit :start
567 IF (l_state_level >= l_debug_level ) THEN
568 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateEntries',
569 '>> >> >> Creating Offset entries (DR) OF FUTURE POSTING ...');
570 END IF;
571 --bug 3199481 fnd logging changes: sdixit: end block
572 CreateOffsetEntries ( l_sublgr
573 , l_future_post.future_posting_ccid
574 , 'DR'
575 , p_dist.amount
576 , p_dist.base_amount
577 );
578
579 FOR l_mpp IN c_ext_dist ( p_dist.invoice_id
580 , p_dist.distribution_line_number )
581 LOOP
582 --bug 3199481: fnd logging changes:sdixit :start
583 IF (l_state_level >= l_debug_level ) THEN
584 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateEntries',
585 '>> >> >> Creating Normal entries (DR) OF EXPENSE ...');
586 END IF;
587 --bug 3199481 fnd logging changes: sdixit: end block
588
589 CreateNormalEntries ( l_sublgr
590 , l_mpp
591 , l_future_post.future_posting_ccid
592 , 'DR' )
593 ;
594 --bug 3199481: fnd logging changes:sdixit :start
595 IF (l_state_level >= l_debug_level ) THEN
596 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.CreateEntries',
597 '>> >> >> Creating Normal entries (CR) OF FUTURE POSTING ...');
598 END IF;
599 --bug 3199481 fnd logging changes: sdixit: end block
600
601 CreateNormalEntries ( l_sublgr
602 , l_mpp
603 , l_future_post.future_posting_ccid
604 , 'CR' )
605 ;
606
607 END LOOP;
608 END IF;
609
610 END;
611
612 PROCEDURE Create_MPPSLR_Details
613 ( p_invoice_id in number
614 , p_distribution_line_number in number
615 ) IS
616 l_currency_code ap_invoices_all.invoice_currency_code%TYPE := NULL;
617
618 BEGIN
619
620 --bug 3199481: fnd logging changes:sdixit :start
621 IF (l_state_level >= l_debug_level ) THEN
622 FND_LOG.STRING (l_state_level ,'igi.pls.igipmslb.IGIPMSLR.Create_MPPSLR_Details',
623 'Begin Creation of MPP Subledger Entry...');
624 END IF;
625
626 l_currency_code := GetInvoiceCurrency ( p_invoice_id );
627 IF (l_state_level >= l_debug_level ) THEN
628 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.Create_MPPSLR_Details',
629 '>> Invoice Currency '||l_currency_code );
630 END IF;
631 --bug 3199481 fnd logging changes: sdixit: end block
632
633 FOR l_dist in c_dist ( p_invoice_id, p_distribution_line_number ) LOOP
634 --bug 3199481: fnd logging changes:sdixit :start
635 IF (l_state_level >= l_debug_level ) THEN
636 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.Create_MPPSLR_Details',
637 '>> Processing Invoice Distributions ...');
638 END IF;
639 IF (l_state_level >= l_debug_level ) THEN
640 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.Create_MPPSLR_Details',
641 '>> Processing MPP distributions ...');
642 END IF;
643 --bug 3199481 fnd logging changes: sdixit: end block
644
645 IF ExistsRecognizedEntries ( l_dist.invoice_id
646 , l_dist.distribution_line_number
647 ) THEN
648 --bug 3199481: fnd logging changes:sdixit :start
649 IF (l_state_level >= l_debug_level ) THEN
650 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.Create_MPPSLR_Details',
651 '>> >> Subledger entries have been recognized or posted...');
652 END IF;
653 IF (l_state_level >= l_debug_level ) THEN
654 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.Create_MPPSLR_Details',
655 '>> >> Stop further processing on this MPP distribution...');
656 END IF;
657 --bug 3199481 fnd logging changes: sdixit: end block
658
659 NULL;
660 ELSE
661 --bug 3199481: fnd logging changes:sdixit :start
662 IF (l_state_level >= l_debug_level ) THEN
663 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.Create_MPPSLR_Details',
664 '>> >> Delete from Subledger Entries...');
665 END IF;
666 --bug 3199481 fnd logging changes: sdixit: end block
667
668 delete from igi_mpp_subledger
669 where invoice_id = l_dist.invoice_id
670 and distribution_line_number = l_dist.distribution_line_number
671 ;
672 --bug 3199481: fnd logging changes:sdixit :start
673 --WriteToLog ('>> >> Create New Subledger Entries...');
674 IF (l_state_level >= l_debug_level ) THEN
675 FND_LOG.STRING (l_state_level , 'igi.pls.igipmslb.IGIPMSLR.Create_MPPSLR_Details',
676 '>> >> Create New Subledger Entries...');
677 END IF;
678 --bug 3199481 fnd logging changes: sdixit: end block
679 CreateEntries ( l_dist );
680
681 END IF;
682
683 END LOOP;
684
685 END;
686
687 PROCEDURE Update_MPPSLR_Details
688 ( p_invoice_id in number
689 , p_distribution_line_number in number
690 ) IS
691 BEGIN
692 NULL;
693 END;
694
695
696
697 PROCEDURE Delete_MPPSLR_details
698 ( p_invoice_id in number
699 , p_distribution_line_number in number
700 )
701 IS
702 BEGIN
703 NULL;
704 END;
705
706
707 END;