7: AP_APPLICATION_ID CONSTANT NUMBER(15) := 200;
8: G_USER_ID CONSTANT NUMBER(15) := fnd_global.user_id;
9: G_DATE CONSTANT DATE := sysdate;
10: G_LOGIN_ID CONSTANT NUMBER(15) := fnd_global.login_id;
11: --bug 3199481: following variables added for fnd logging changes: sdixit
12: l_debug_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
13: l_state_level number := FND_LOG.LEVEL_STATEMENT;
14: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
15: l_event_level number := FND_LOG.LEVEL_EVENT;
8: G_USER_ID CONSTANT NUMBER(15) := fnd_global.user_id;
9: G_DATE CONSTANT DATE := sysdate;
10: G_LOGIN_ID CONSTANT NUMBER(15) := fnd_global.login_id;
11: --bug 3199481: following variables added for fnd logging changes: sdixit
12: l_debug_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
13: l_state_level number := FND_LOG.LEVEL_STATEMENT;
14: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
15: l_event_level number := FND_LOG.LEVEL_EVENT;
16: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
9: G_DATE CONSTANT DATE := sysdate;
10: G_LOGIN_ID CONSTANT NUMBER(15) := fnd_global.login_id;
11: --bug 3199481: following variables added for fnd logging changes: sdixit
12: l_debug_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
13: l_state_level number := FND_LOG.LEVEL_STATEMENT;
14: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
15: l_event_level number := FND_LOG.LEVEL_EVENT;
16: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
17: l_error_level number := FND_LOG.LEVEL_ERROR;
10: G_LOGIN_ID CONSTANT NUMBER(15) := fnd_global.login_id;
11: --bug 3199481: following variables added for fnd logging changes: sdixit
12: l_debug_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
13: l_state_level number := FND_LOG.LEVEL_STATEMENT;
14: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
15: l_event_level number := FND_LOG.LEVEL_EVENT;
16: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
17: l_error_level number := FND_LOG.LEVEL_ERROR;
18: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
11: --bug 3199481: following variables added for fnd logging changes: sdixit
12: l_debug_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
13: l_state_level number := FND_LOG.LEVEL_STATEMENT;
14: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
15: l_event_level number := FND_LOG.LEVEL_EVENT;
16: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
17: l_error_level number := FND_LOG.LEVEL_ERROR;
18: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
19:
12: l_debug_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
13: l_state_level number := FND_LOG.LEVEL_STATEMENT;
14: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
15: l_event_level number := FND_LOG.LEVEL_EVENT;
16: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
17: l_error_level number := FND_LOG.LEVEL_ERROR;
18: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
19:
20: -- ----------
13: l_state_level number := FND_LOG.LEVEL_STATEMENT;
14: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
15: l_event_level number := FND_LOG.LEVEL_EVENT;
16: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
17: l_error_level number := FND_LOG.LEVEL_ERROR;
18: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
19:
20: -- ----------
21: -- CURSORS
14: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
15: l_event_level number := FND_LOG.LEVEL_EVENT;
16: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
17: l_error_level number := FND_LOG.LEVEL_ERROR;
18: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
19:
20: -- ----------
21: -- CURSORS
22: -- ----------
105: ;
106: l_eff_period_num NUMBER := 0;
107: l_count NUMBER := 0;
108: BEGIN
109: --bug 3199481 fnd logging changes: sdixit: start block
110: IF (l_state_level >= l_debug_level ) THEN
111: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.GetRelPeriodName',
112: '>> >> Current Period '||fp_period_name );
113: END IF;
107: l_count NUMBER := 0;
108: BEGIN
109: --bug 3199481 fnd logging changes: sdixit: start block
110: IF (l_state_level >= l_debug_level ) THEN
111: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.GetRelPeriodName',
112: '>> >> Current Period '||fp_period_name );
113: END IF;
114: l_eff_period_num := GetEffPeriodNum( fp_period_name, fp_sob_id );
115: IF (l_state_level >= l_debug_level ) THEN
112: '>> >> Current Period '||fp_period_name );
113: END IF;
114: l_eff_period_num := GetEffPeriodNum( fp_period_name, fp_sob_id );
115: IF (l_state_level >= l_debug_level ) THEN
116: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.GetRelPeriodName',
117: '>> >> Current Eff Period Num '||l_eff_period_num );
118: END IF;
119:
120: l_count := 0;
120: l_count := 0;
121: FOR l_per IN c_ap_periods ( l_eff_period_num ) LOOP
122: IF l_count = fp_relative THEN
123: IF (l_state_level >= l_debug_level ) THEN
124: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.GetRelPeriodName',
125: '>> >> New Period Name '||l_per.period_name );
126: END IF;
127: --bug 3199481 fnd logging changes: sdixit: end block
128: return l_per.period_name;
123: IF (l_state_level >= l_debug_level ) THEN
124: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.GetRelPeriodName',
125: '>> >> New Period Name '||l_per.period_name );
126: END IF;
127: --bug 3199481 fnd logging changes: sdixit: end block
128: return l_per.period_name;
129: ELSE
130: l_count := l_count + 1;
131: END IF;
178: return TRUE;
179: END LOOP;
180: return FALSE;
181: EXCEPTION WHEN OTHERS THEN
182: --bug 3199481 fnd logging changes: sdixit: start block
183: --standard way to handle when-others as per FND logging guidelines
184: IF ( l_unexp_level >= l_debug_level ) THEN
185:
186: FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
179: END LOOP;
180: return FALSE;
181: EXCEPTION WHEN OTHERS THEN
182: --bug 3199481 fnd logging changes: sdixit: start block
183: --standard way to handle when-others as per FND logging guidelines
184: IF ( l_unexp_level >= l_debug_level ) THEN
185:
186: FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
187: FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
185:
186: FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
187: FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
188: FND_MESSAGE.SET_TOKEN('MSG', SQLERRM);
189: FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.isipmsdb.igipmsmd.isVariableduration',TRUE);
190: END IF;
191: --bug 3199481 fnd logging changes: sdixit: end block
192: return FALSE;
193: END ;
187: FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
188: FND_MESSAGE.SET_TOKEN('MSG', SQLERRM);
189: FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.isipmsdb.igipmsmd.isVariableduration',TRUE);
190: END IF;
191: --bug 3199481 fnd logging changes: sdixit: end block
192: return FALSE;
193: END ;
194:
195: PROCEDURE InsertRecord ( p_mpp_dist_line_num in number
201:
202: IS
203:
204: BEGIN
205: --bug 3199481 fnd logging changes: sdixit: start block
206: IF (l_state_level >= l_debug_level ) THEN
207: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.InsertRecord',
208: '>> >> ** Mpp dist line number '|| p_mpp_dist_line_num );
209: END IF;
203:
204: BEGIN
205: --bug 3199481 fnd logging changes: sdixit: start block
206: IF (l_state_level >= l_debug_level ) THEN
207: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.InsertRecord',
208: '>> >> ** Mpp dist line number '|| p_mpp_dist_line_num );
209: END IF;
210: IF (l_state_level >= l_debug_level ) THEN
211: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.InsertRecord',
207: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.InsertRecord',
208: '>> >> ** Mpp dist line number '|| p_mpp_dist_line_num );
209: END IF;
210: IF (l_state_level >= l_debug_level ) THEN
211: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.InsertRecord',
212: '>> >> ** Mpp dist amount '|| p_amount );
213: END IF;
214: --bug 3199481 fnd logging changes: sdixit: end block
215:
210: IF (l_state_level >= l_debug_level ) THEN
211: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.InsertRecord',
212: '>> >> ** Mpp dist amount '|| p_amount );
213: END IF;
214: --bug 3199481 fnd logging changes: sdixit: end block
215:
216: INSERT INTO igi_mpp_ap_invoice_dists_det
217: ( mpp_dist_line_number
218: , distribution_line_number
261: END LOOP;
262:
263: return null;
264: EXCEPTION WHEN OTHERS THEN
265: --bug 3199481 fnd logging changes: sdixit: start block
266: --standard way to handle when-others as per FND logging guidelines
267:
268: IF ( l_unexp_level >= l_debug_level ) THEN
269:
262:
263: return null;
264: EXCEPTION WHEN OTHERS THEN
265: --bug 3199481 fnd logging changes: sdixit: start block
266: --standard way to handle when-others as per FND logging guidelines
267:
268: IF ( l_unexp_level >= l_debug_level ) THEN
269:
270: FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
269:
270: FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
271: FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
272: FND_MESSAGE.SET_TOKEN('MSG', SQLERRM);
273: FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.igipmmdb.igipmsmd.GetPeriod',TRUE);
274: END IF;
275: --bug 3199481 fnd logging changes: sdixit: end block
276: return null;
277: END GetPeriod;
271: FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
272: FND_MESSAGE.SET_TOKEN('MSG', SQLERRM);
273: FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.igipmmdb.igipmsmd.GetPeriod',TRUE);
274: END IF;
275: --bug 3199481 fnd logging changes: sdixit: end block
276: return null;
277: END GetPeriod;
278:
279: PROCEDURE CreateFixedDists ( p_dist in c_dist%ROWTYPE
295: p_dist.set_of_books_id
296: ), p_dist.period_name) ;
297:
298: FOR l_rs IN c_rule_schedules ( p_accounting_rule_id) LOOP
299: --bug 3199481 fnd logging changes: sdixit: start block
300: IF (l_state_level >= l_debug_level ) THEN
301: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
302: '>> Processing Accounting Rules ...');
303: END IF;
297:
298: FOR l_rs IN c_rule_schedules ( p_accounting_rule_id) LOOP
299: --bug 3199481 fnd logging changes: sdixit: start block
300: IF (l_state_level >= l_debug_level ) THEN
301: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
302: '>> Processing Accounting Rules ...');
303: END IF;
304: --bug 3199481 fnd logging changes: sdixit: end block
305:
300: IF (l_state_level >= l_debug_level ) THEN
301: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
302: '>> Processing Accounting Rules ...');
303: END IF;
304: --bug 3199481 fnd logging changes: sdixit: end block
305:
306: p_mpp_dist_line_num := p_mpp_dist_line_num + 1;
307: --bug 3199481 fnd logging changes: sdixit: start block
308: IF (l_state_level >= l_debug_level ) THEN
303: END IF;
304: --bug 3199481 fnd logging changes: sdixit: end block
305:
306: p_mpp_dist_line_num := p_mpp_dist_line_num + 1;
307: --bug 3199481 fnd logging changes: sdixit: start block
308: IF (l_state_level >= l_debug_level ) THEN
309: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
310: '>> MPP Distribution Line number '||p_mpp_dist_line_num );
311: END IF;
305:
306: p_mpp_dist_line_num := p_mpp_dist_line_num + 1;
307: --bug 3199481 fnd logging changes: sdixit: start block
308: IF (l_state_level >= l_debug_level ) THEN
309: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
310: '>> MPP Distribution Line number '||p_mpp_dist_line_num );
311: END IF;
312: --bug 3199481 fnd logging changes: sdixit: end block
313:
308: IF (l_state_level >= l_debug_level ) THEN
309: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
310: '>> MPP Distribution Line number '||p_mpp_dist_line_num );
311: END IF;
312: --bug 3199481 fnd logging changes: sdixit: end block
313:
314: l_amount := (l_rs.percent/100) * p_dist.amount;
315: --bug 3199481 fnd logging changes: sdixit: start block
316: IF (l_state_level >= l_debug_level ) THEN
311: END IF;
312: --bug 3199481 fnd logging changes: sdixit: end block
313:
314: l_amount := (l_rs.percent/100) * p_dist.amount;
315: --bug 3199481 fnd logging changes: sdixit: start block
316: IF (l_state_level >= l_debug_level ) THEN
317: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
318: '>> MPP Distribution Amount (Before Rounding) '||l_amount );
319: END IF;
313:
314: l_amount := (l_rs.percent/100) * p_dist.amount;
315: --bug 3199481 fnd logging changes: sdixit: start block
316: IF (l_state_level >= l_debug_level ) THEN
317: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
318: '>> MPP Distribution Amount (Before Rounding) '||l_amount );
319: END IF;
320: --bug 3199481 fnd logging changes: sdixit: end block
321:
316: IF (l_state_level >= l_debug_level ) THEN
317: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
318: '>> MPP Distribution Amount (Before Rounding) '||l_amount );
319: END IF;
320: --bug 3199481 fnd logging changes: sdixit: end block
321:
322: l_amount := arp_util.CurrRound( l_amount, p_currency_code );
323: p_running_amount := p_running_amount - l_amount;
324: --bug 3199481 fnd logging changes: sdixit: start block
320: --bug 3199481 fnd logging changes: sdixit: end block
321:
322: l_amount := arp_util.CurrRound( l_amount, p_currency_code );
323: p_running_amount := p_running_amount - l_amount;
324: --bug 3199481 fnd logging changes: sdixit: start block
325: IF (l_state_level >= l_debug_level ) THEN
326: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
327: '>> MPP Distribution Amount (After Rounding) '||l_amount );
328: END IF;
322: l_amount := arp_util.CurrRound( l_amount, p_currency_code );
323: p_running_amount := p_running_amount - l_amount;
324: --bug 3199481 fnd logging changes: sdixit: start block
325: IF (l_state_level >= l_debug_level ) THEN
326: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
327: '>> MPP Distribution Amount (After Rounding) '||l_amount );
328: END IF;
329: IF (l_state_level >= l_debug_level ) THEN
330: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
326: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
327: '>> MPP Distribution Amount (After Rounding) '||l_amount );
328: END IF;
329: IF (l_state_level >= l_debug_level ) THEN
330: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
331: '>> Balance '||p_running_amount );
332: END IF;
333: --bug 3199481 fnd logging changes: sdixit: end block
334:
329: IF (l_state_level >= l_debug_level ) THEN
330: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
331: '>> Balance '||p_running_amount );
332: END IF;
333: --bug 3199481 fnd logging changes: sdixit: end block
334:
335:
336:
337: l_Period_name := GetRelPeriodName
338: ( l_first_period_name
339: , p_dist.set_of_books_id
340: , p_mpp_dist_line_num -1
341: ) ;
342: --bug 3199481 fnd logging changes: sdixit: start block
343: IF (l_state_level >= l_debug_level ) THEN
344: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
345: '>> MPP Distribution Period '||l_period_name );
346: END IF;
340: , p_mpp_dist_line_num -1
341: ) ;
342: --bug 3199481 fnd logging changes: sdixit: start block
343: IF (l_state_level >= l_debug_level ) THEN
344: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
345: '>> MPP Distribution Period '||l_period_name );
346: END IF;
347: IF (l_state_level >= l_debug_level ) THEN
348: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
344: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
345: '>> MPP Distribution Period '||l_period_name );
346: END IF;
347: IF (l_state_level >= l_debug_level ) THEN
348: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
349: '>> Inserting the record into MPP details...' );
350: END IF;
351: --bug 3199481 fnd logging changes: sdixit: end block
352:
347: IF (l_state_level >= l_debug_level ) THEN
348: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
349: '>> Inserting the record into MPP details...' );
350: END IF;
351: --bug 3199481 fnd logging changes: sdixit: end block
352:
353: InsertRecord ( p_mpp_dist_line_num
354: , p_dist
355: , l_period_name
393: return l_percent.percent_value;
394: END LOOP;
395: return 0;
396: EXCEPTION WHEN OTHERS THEN
397: --bug 3199481 fnd logging changes: sdixit: start block
398: --standard way to handle when-others as per FND logging guidelines
399:
400: IF ( l_unexp_level >= l_debug_level ) THEN
401:
394: END LOOP;
395: return 0;
396: EXCEPTION WHEN OTHERS THEN
397: --bug 3199481 fnd logging changes: sdixit: start block
398: --standard way to handle when-others as per FND logging guidelines
399:
400: IF ( l_unexp_level >= l_debug_level ) THEN
401:
402: FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
401:
402: FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
403: FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
404: FND_MESSAGE.SET_TOKEN('MSG', SQLERRM);
405: FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.igipmmdb.igipmsmd.GetPercent',TRUE);
406: END IF;
407: --bug 3199481 fnd logging changes: sdixit: end block
408: return 0;
409: END GetPercent;
403: FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
404: FND_MESSAGE.SET_TOKEN('MSG', SQLERRM);
405: FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.igipmmdb.igipmsmd.GetPercent',TRUE);
406: END IF;
407: --bug 3199481 fnd logging changes: sdixit: end block
408: return 0;
409: END GetPercent;
410:
411: BEGIN
414: --
415: p_mpp_dist_line_num := 1;
416: l_amount := p_dist.amount * GetPercent( p_accounting_rule_id ,
417: p_duration = 1 );
418: --bug 3199481 fnd logging changes: sdixit: start block
419: IF (l_state_level >= l_debug_level ) THEN
420: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
421: '>> >> First instalment '|| l_amount );
422: END IF;
416: l_amount := p_dist.amount * GetPercent( p_accounting_rule_id ,
417: p_duration = 1 );
418: --bug 3199481 fnd logging changes: sdixit: start block
419: IF (l_state_level >= l_debug_level ) THEN
420: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
421: '>> >> First instalment '|| l_amount );
422: END IF;
423:
424: l_amount := arp_util.CurrRound( l_amount, p_currency_code );
425: p_running_amount := p_running_amount - l_amount;
426: l_first_period_name := GetPeriod ( p_start_date, p_dist.set_of_books_id );
427:
428: IF (l_state_level >= l_debug_level ) THEN
429: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
430: '>> >> Period Name '|| l_period_name );
431: END IF;
432: --bug 3199481 fnd logging changes: sdixit: end block
433:
428: IF (l_state_level >= l_debug_level ) THEN
429: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
430: '>> >> Period Name '|| l_period_name );
431: END IF;
432: --bug 3199481 fnd logging changes: sdixit: end block
433:
434: InsertRecord ( p_mpp_dist_line_num
435: , p_dist
436: , l_first_period_name
443: end if;
444:
445: l_amount_remaining := p_dist.amount - l_amount;
446: l_amount := l_amount_remaining / (p_duration - 1);
447: --bug 3199481 fnd logging changes: sdixit: start block
448: IF (l_state_level >= l_debug_level ) THEN
449: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
450: '>> MPP Distribution Amount (Before Rounding) '||l_amount );
451: END IF;
445: l_amount_remaining := p_dist.amount - l_amount;
446: l_amount := l_amount_remaining / (p_duration - 1);
447: --bug 3199481 fnd logging changes: sdixit: start block
448: IF (l_state_level >= l_debug_level ) THEN
449: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
450: '>> MPP Distribution Amount (Before Rounding) '||l_amount );
451: END IF;
452: l_amount := arp_util.CurrRound( l_amount, p_currency_code );
453: IF (l_state_level >= l_debug_level ) THEN
450: '>> MPP Distribution Amount (Before Rounding) '||l_amount );
451: END IF;
452: l_amount := arp_util.CurrRound( l_amount, p_currency_code );
453: IF (l_state_level >= l_debug_level ) THEN
454: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
455: '>> MPP Distribution Amount (After Rounding) '||l_amount );
456: END IF;
457: --bug 3199481 fnd logging changes: sdixit: end block
458:
453: IF (l_state_level >= l_debug_level ) THEN
454: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
455: '>> MPP Distribution Amount (After Rounding) '||l_amount );
456: END IF;
457: --bug 3199481 fnd logging changes: sdixit: end block
458:
459: FOR t_mpp_dist_line_num IN 2 .. p_duration LOOP
460: p_mpp_dist_line_num := t_mpp_dist_line_num;
461:
458:
459: FOR t_mpp_dist_line_num IN 2 .. p_duration LOOP
460: p_mpp_dist_line_num := t_mpp_dist_line_num;
461:
462: --bug 3199481 fnd logging changes: sdixit: start block
463: IF (l_state_level >= l_debug_level ) THEN
464: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
465: '>> MPP Distribution Line number '||p_mpp_dist_line_num );
466: END IF;
460: p_mpp_dist_line_num := t_mpp_dist_line_num;
461:
462: --bug 3199481 fnd logging changes: sdixit: start block
463: IF (l_state_level >= l_debug_level ) THEN
464: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
465: '>> MPP Distribution Line number '||p_mpp_dist_line_num );
466: END IF;
467:
468: p_running_amount := p_running_amount - l_amount;
466: END IF;
467:
468: p_running_amount := p_running_amount - l_amount;
469: IF (l_state_level >= l_debug_level ) THEN
470: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
471: '>> Balance '||p_running_amount );
472: END IF;
473: --bug 3199481 fnd logging changes: sdixit: end block
474:
469: IF (l_state_level >= l_debug_level ) THEN
470: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
471: '>> Balance '||p_running_amount );
472: END IF;
473: --bug 3199481 fnd logging changes: sdixit: end block
474:
475: l_Period_name := GetRelPeriodName
476: ( l_first_period_name
477: , p_dist.set_of_books_id
476: ( l_first_period_name
477: , p_dist.set_of_books_id
478: , p_mpp_dist_line_num -1
479: ) ;
480: --bug 3199481 fnd logging changes: sdixit: start block
481: IF (l_state_level >= l_debug_level ) THEN
482: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
483: '>> MPP Distribution Period '||l_period_name );
484: END IF;
478: , p_mpp_dist_line_num -1
479: ) ;
480: --bug 3199481 fnd logging changes: sdixit: start block
481: IF (l_state_level >= l_debug_level ) THEN
482: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
483: '>> MPP Distribution Period '||l_period_name );
484: END IF;
485: IF (l_state_level >= l_debug_level ) THEN
486: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
482: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
483: '>> MPP Distribution Period '||l_period_name );
484: END IF;
485: IF (l_state_level >= l_debug_level ) THEN
486: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
487: '>> Inserting the record into MPP details...' );
488: END IF;
489: --bug 3199481 fnd logging changes: sdixit: end block
490: InsertRecord ( p_mpp_dist_line_num
485: IF (l_state_level >= l_debug_level ) THEN
486: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
487: '>> Inserting the record into MPP details...' );
488: END IF;
489: --bug 3199481 fnd logging changes: sdixit: end block
490: InsertRecord ( p_mpp_dist_line_num
491: , p_dist
492: , l_period_name
493: , p_accounting_rule_id
499:
500: BEGIN /** create mpp distributions **/
501:
502:
503: --bug 3199481: fnd logging changes: sdixit : start
504: IF (l_state_level >= l_debug_level ) THEN
505: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
506: 'Begin Creation of MPP Dist Details...');
507: END IF;
501:
502:
503: --bug 3199481: fnd logging changes: sdixit : start
504: IF (l_state_level >= l_debug_level ) THEN
505: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
506: 'Begin Creation of MPP Dist Details...');
507: END IF;
508:
509: l_currency_code := GetInvoiceCurrency ( p_invoice_id );
507: END IF;
508:
509: l_currency_code := GetInvoiceCurrency ( p_invoice_id );
510: IF (l_state_level >= l_debug_level ) THEN
511: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
512: '>> Invoice Currency '||l_currency_code );
513: END IF;
514: --bug 3199481 fnd logging changes: sdixit: end block
515:
510: IF (l_state_level >= l_debug_level ) THEN
511: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
512: '>> Invoice Currency '||l_currency_code );
513: END IF;
514: --bug 3199481 fnd logging changes: sdixit: end block
515:
516: FOR l_dist in c_dist ( p_invoice_id, p_distribution_line_number ) LOOP
517:
518: l_mpp_dist_line_num := 0;
517:
518: l_mpp_dist_line_num := 0;
519: l_total_amount := l_dist.amount;
520: l_running_amount := l_dist.amount;
521: --bug 3199481 fnd logging changes: sdixit: start block
522: IF (l_state_level >= l_debug_level ) THEN
523: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
524: '>> Processing Invoice Distributions ...');
525: END IF;
519: l_total_amount := l_dist.amount;
520: l_running_amount := l_dist.amount;
521: --bug 3199481 fnd logging changes: sdixit: start block
522: IF (l_state_level >= l_debug_level ) THEN
523: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
524: '>> Processing Invoice Distributions ...');
525: END IF;
526: IF (l_state_level >= l_debug_level ) THEN
527: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
523: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
524: '>> Processing Invoice Distributions ...');
525: END IF;
526: IF (l_state_level >= l_debug_level ) THEN
527: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
528: '>> Distribution Amount '||l_total_amount );
529: END IF;
530: --bug 3199481 fnd logging changes: sdixit: end block
531:
526: IF (l_state_level >= l_debug_level ) THEN
527: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
528: '>> Distribution Amount '||l_total_amount );
529: END IF;
530: --bug 3199481 fnd logging changes: sdixit: end block
531:
532: IF IsVariableDuration ( p_accounting_rule_id ) THEN
533: CreateVariableDists ( l_dist
534: , p_accounting_rule_id
547: , p_start_date
548: );
549: END IF;
550:
551: --bug 3199481 fnd logging changes: sdixit: start block
552: IF (l_state_level >= l_debug_level ) THEN
553: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
554: '>> Rounding Checks... ');
555: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
549: END IF;
550:
551: --bug 3199481 fnd logging changes: sdixit: start block
552: IF (l_state_level >= l_debug_level ) THEN
553: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
554: '>> Rounding Checks... ');
555: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
556: '>> >> Running Amount '|| l_running_amount );
557: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
551: --bug 3199481 fnd logging changes: sdixit: start block
552: IF (l_state_level >= l_debug_level ) THEN
553: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
554: '>> Rounding Checks... ');
555: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
556: '>> >> Running Amount '|| l_running_amount );
557: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
558: '>> >> Dist Line Num '|| l_mpp_dist_line_num );
559: END IF;
553: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
554: '>> Rounding Checks... ');
555: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
556: '>> >> Running Amount '|| l_running_amount );
557: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
558: '>> >> Dist Line Num '|| l_mpp_dist_line_num );
559: END IF;
560: --bug 3199481 fnd logging changes: sdixit: end block
561: IF l_running_amount <> 0 AND l_mpp_dist_line_num <> 0 THEN
556: '>> >> Running Amount '|| l_running_amount );
557: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
558: '>> >> Dist Line Num '|| l_mpp_dist_line_num );
559: END IF;
560: --bug 3199481 fnd logging changes: sdixit: end block
561: IF l_running_amount <> 0 AND l_mpp_dist_line_num <> 0 THEN
562:
563: UPDATE igi_mpp_ap_invoice_dists_det
564: SET amount = amount + l_running_amount
565: WHERE invoice_id = l_dist.invoice_id
566: AND distribution_line_number = l_dist.distribution_line_number
567: AND mpp_dist_line_number = l_mpp_dist_line_num
568: ;
569: --bug 3199481 fnd logging changes: sdixit: start block
570: IF (l_state_level >= l_debug_level ) THEN
571: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
572: '>> Rounding Performed on the last mpp distribution '|| l_mpp_dist_line_num );
573: END IF;
567: AND mpp_dist_line_number = l_mpp_dist_line_num
568: ;
569: --bug 3199481 fnd logging changes: sdixit: start block
570: IF (l_state_level >= l_debug_level ) THEN
571: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
572: '>> Rounding Performed on the last mpp distribution '|| l_mpp_dist_line_num );
573: END IF;
574: --bug 3199481 fnd logging changes: sdixit: end block
575:
570: IF (l_state_level >= l_debug_level ) THEN
571: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
572: '>> Rounding Performed on the last mpp distribution '|| l_mpp_dist_line_num );
573: END IF;
574: --bug 3199481 fnd logging changes: sdixit: end block
575:
576: ELSE
577: --bug 3199481 fnd logging changes: sdixit: start block
578: IF (l_state_level >= l_debug_level ) THEN
573: END IF;
574: --bug 3199481 fnd logging changes: sdixit: end block
575:
576: ELSE
577: --bug 3199481 fnd logging changes: sdixit: start block
578: IF (l_state_level >= l_debug_level ) THEN
579: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
580: '>> Rounding Check okay!... ');
581: END IF;
575:
576: ELSE
577: --bug 3199481 fnd logging changes: sdixit: start block
578: IF (l_state_level >= l_debug_level ) THEN
579: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
580: '>> Rounding Check okay!... ');
581: END IF;
582: --bug 3199481 fnd logging changes: sdixit: end block
583: END IF;
578: IF (l_state_level >= l_debug_level ) THEN
579: FND_LOG.STRING (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
580: '>> Rounding Check okay!... ');
581: END IF;
582: --bug 3199481 fnd logging changes: sdixit: end block
583: END IF;
584:
585: END LOOP;
586: