DBA Data[Home] [Help]

APPS.AP_TRIAL_BALANCE_PKG dependencies on AP_TRIAL_BAL

Line 1: PACKAGE BODY AP_TRIAL_BALANCE_PKG AS

1: PACKAGE BODY AP_TRIAL_BALANCE_PKG AS
2: /* $Header: aptrbalb.pls 120.2 2004/06/04 23:09:22 yicao noship $ */
3:
4: /*=============================================================================
5: This is the main entry routine for the Trial Balance Report. This function will

Line 29: 1. Delete all records from AP_TRIAL_BAL table

25:
26: Logic:
27: ======
28:
29: 1. Delete all records from AP_TRIAL_BAL table
30: 2. If Exclude invoices from date is not provided,
31: 2.1 Calls the Insert AP_TRIAL_BAL function without from date.
32: 2.2 validates for this given ORG condition if there exists atleast
33: one record that has future_dated_pmt_liab_relief = MATURITY.

Line 31: 2.1 Calls the Insert AP_TRIAL_BAL function without from date.

27: ======
28:
29: 1. Delete all records from AP_TRIAL_BAL table
30: 2. If Exclude invoices from date is not provided,
31: 2.1 Calls the Insert AP_TRIAL_BAL function without from date.
32: 2.2 validates for this given ORG condition if there exists atleast
33: one record that has future_dated_pmt_liab_relief = MATURITY.
34: If so calls the future dated payments insert for AP_TRIAL_BAL
35: 2.3 If the report is submitted only for Negative Balances calls the

Line 34: If so calls the future dated payments insert for AP_TRIAL_BAL

30: 2. If Exclude invoices from date is not provided,
31: 2.1 Calls the Insert AP_TRIAL_BAL function without from date.
32: 2.2 validates for this given ORG condition if there exists atleast
33: one record that has future_dated_pmt_liab_relief = MATURITY.
34: If so calls the future dated payments insert for AP_TRIAL_BAL
35: 2.3 If the report is submitted only for Negative Balances calls the
36: process negative balances routine to remove all the possitive
37: balances records.
38: 3. Else Processes the same logic mentioned above for p_from_date case.

Line 39: 3.1 Calls the Insert AP_TRIAL_BAL function with from date.

35: 2.3 If the report is submitted only for Negative Balances calls the
36: process negative balances routine to remove all the possitive
37: balances records.
38: 3. Else Processes the same logic mentioned above for p_from_date case.
39: 3.1 Calls the Insert AP_TRIAL_BAL function with from date.
40: 3.2 validates for this given ORG condition if there exists atleast
41: one record that has future_dated_pmt_liab_relief = MATURITY.
42: If so calls the future dated payments insert for AP_TRIAL_BAL
43: 3.3 If the report is submitted only for Negative Balances calls the

Line 42: If so calls the future dated payments insert for AP_TRIAL_BAL

38: 3. Else Processes the same logic mentioned above for p_from_date case.
39: 3.1 Calls the Insert AP_TRIAL_BAL function with from date.
40: 3.2 validates for this given ORG condition if there exists atleast
41: one record that has future_dated_pmt_liab_relief = MATURITY.
42: If so calls the future dated payments insert for AP_TRIAL_BAL
43: 3.3 If the report is submitted only for Negative Balances calls the
44: process negative balances routine to remove all the possitive
45: balances records.
46: =============================================================================*/

Line 66: fnd_file.put_line (fnd_file.log, 'Stage :002 - Delete Existing ap_trial_bal'

62:
63: BEGIN
64:
65: fnd_file.put_line (fnd_file.log, 'Stage :001 - Into Process_Trial_Balance');
66: fnd_file.put_line (fnd_file.log, 'Stage :002 - Delete Existing ap_trial_bal'
67: ||' records.');
68:
69: DELETE FROM ap_trial_bal;
70:

Line 69: DELETE FROM ap_trial_bal;

65: fnd_file.put_line (fnd_file.log, 'Stage :001 - Into Process_Trial_Balance');
66: fnd_file.put_line (fnd_file.log, 'Stage :002 - Delete Existing ap_trial_bal'
67: ||' records.');
68:
69: DELETE FROM ap_trial_bal;
70:
71: fnd_file.put_line (fnd_file.log, 'Stage :003 - Insert AP_Trial_Bal Info.');
72:
73: IF (p_from_date IS NULL) THEN

Line 71: fnd_file.put_line (fnd_file.log, 'Stage :003 - Insert AP_Trial_Bal Info.');

67: ||' records.');
68:
69: DELETE FROM ap_trial_bal;
70:
71: fnd_file.put_line (fnd_file.log, 'Stage :003 - Insert AP_Trial_Bal Info.');
72:
73: IF (p_from_date IS NULL) THEN
74:
75: fnd_file.put_line (fnd_file.log, 'Stage :004 - Into From Date Null Case');

Line 77: IF (Insert_AP_Trial_Bal (p_accounting_date,

73: IF (p_from_date IS NULL) THEN
74:
75: fnd_file.put_line (fnd_file.log, 'Stage :004 - Into From Date Null Case');
76:
77: IF (Insert_AP_Trial_Bal (p_accounting_date,
78: p_request_id,
79: p_reporting_entity_id,
80: p_org_where_alb,
81: p_org_where_ael,

Line 132: IF (Insert_AP_Trial_Bal (p_accounting_date,

128: ELSE
129:
130: fnd_file.put_line (fnd_file.log, 'Stage :010 - Into From Date Case');
131:
132: IF (Insert_AP_Trial_Bal (p_accounting_date,
133: p_from_date,
134: p_request_id,
135: p_reporting_entity_id,
136: p_org_where_alb,

Line 203: Insert_AP_Trial_Bal Function is an overloaded function. Based on the

199:
200: END Process_Trial_Balance;
201:
202: /*=============================================================================
203: Insert_AP_Trial_Bal Function is an overloaded function. Based on the
204: p_from_date option either of the function will be called. This function returns
205: TRUE on success and FALSE on any errors.
206:
207: This procedure inserts records into AP_TRIAL_BAL table for a given org_id or

Line 207: This procedure inserts records into AP_TRIAL_BAL table for a given org_id or

203: Insert_AP_Trial_Bal Function is an overloaded function. Based on the
204: p_from_date option either of the function will be called. This function returns
205: TRUE on success and FALSE on any errors.
206:
207: This procedure inserts records into AP_TRIAL_BAL table for a given org_id or
208: for set of orgs as per the parameter for AP and AX set of books. This inserts
209: invoices that have not been fully paid on or before for a given as of date.
210:
211: For AP the insert gets the information from the AP_LIABILITY_BALANCE. As of

Line 227: FUNCTION Insert_AP_Trial_Bal (

223:
224: The UNION SELECT is written to handle the same requirement.
225:
226: =============================================================================*/
227: FUNCTION Insert_AP_Trial_Bal (
228: p_accounting_date IN DATE,
229: p_request_id IN NUMBER,
230: p_reporting_entity_id IN NUMBER,
231: p_org_where_alb IN VARCHAR2,

Line 240: fnd_file.put_line (fnd_file.log, 'Stage :016 - Into Insert_AP_Trial_Bal');

236: l_sql_stmt VARCHAR2(32000);
237:
238: BEGIN
239:
240: fnd_file.put_line (fnd_file.log, 'Stage :016 - Into Insert_AP_Trial_Bal');
241:
242: l_sql_stmt:= 'INSERT INTO ap_trial_bal '
243: || ' SELECT alb.invoice_id invoice_id, '
244: || ' alb.code_combination_id code_combination_id, '

Line 242: l_sql_stmt:= 'INSERT INTO ap_trial_bal '

238: BEGIN
239:
240: fnd_file.put_line (fnd_file.log, 'Stage :016 - Into Insert_AP_Trial_Bal');
241:
242: l_sql_stmt:= 'INSERT INTO ap_trial_bal '
243: || ' SELECT alb.invoice_id invoice_id, '
244: || ' alb.code_combination_id code_combination_id, '
245: || ' SUM (alb.accounted_cr) - '
246: || ' SUM (alb.accounted_dr) remaining_amount, '

Line 277: fnd_file.put_line(fnd_file.log,'Error Occured in Insert_AP_Trial_Bal'

273: EXCEPTION
274:
275: WHEN OTHERS THEN
276:
277: fnd_file.put_line(fnd_file.log,'Error Occured in Insert_AP_Trial_Bal'
278: ||' Function.');
279: IF (p_debug_switch IN ('y','Y')) THEN
280: fnd_file.put_line(fnd_file.log,l_sql_stmt);
281: END IF;

Line 287: END Insert_AP_Trial_Bal;

283: fnd_file.put_line(fnd_file.log,'Error Message: '||SQLERRM);
284:
285: RETURN FALSE;
286:
287: END Insert_AP_Trial_Bal;
288:
289: /*=============================================================================
290: Insert_AP_Trial_Bal Function is an overloaded function. Same as the previous
291: function. But this will be called only if the p_from_date is provided.

Line 290: Insert_AP_Trial_Bal Function is an overloaded function. Same as the previous

286:
287: END Insert_AP_Trial_Bal;
288:
289: /*=============================================================================
290: Insert_AP_Trial_Bal Function is an overloaded function. Same as the previous
291: function. But this will be called only if the p_from_date is provided.
292:
293: =============================================================================*/
294: FUNCTION Insert_AP_Trial_Bal (

Line 294: FUNCTION Insert_AP_Trial_Bal (

290: Insert_AP_Trial_Bal Function is an overloaded function. Same as the previous
291: function. But this will be called only if the p_from_date is provided.
292:
293: =============================================================================*/
294: FUNCTION Insert_AP_Trial_Bal (
295: p_accounting_date IN DATE,
296: p_from_date IN DATE,
297: p_request_id IN NUMBER,
298: p_reporting_entity_id IN NUMBER,

Line 308: fnd_file.put_line (fnd_file.log, 'Stage :017 - Into Insert_AP_Trial_Bal');

304: l_sql_stmt VARCHAR2(32000);
305:
306: BEGIN
307:
308: fnd_file.put_line (fnd_file.log, 'Stage :017 - Into Insert_AP_Trial_Bal');
309:
310: l_sql_stmt := 'INSERT INTO ap_trial_bal '
311: || ' SELECT alb.invoice_id invoice_id, '
312: || ' alb.code_combination_id code_combination_id, '

Line 310: l_sql_stmt := 'INSERT INTO ap_trial_bal '

306: BEGIN
307:
308: fnd_file.put_line (fnd_file.log, 'Stage :017 - Into Insert_AP_Trial_Bal');
309:
310: l_sql_stmt := 'INSERT INTO ap_trial_bal '
311: || ' SELECT alb.invoice_id invoice_id, '
312: || ' alb.code_combination_id code_combination_id, '
313: || ' SUM (alb.accounted_cr) - '
314: || ' SUM (alb.accounted_dr) remaining_amount, '

Line 349: fnd_file.put_line(fnd_file.log,'Error Occured in Insert_AP_Trial_Bal'

345: EXCEPTION
346:
347: WHEN OTHERS THEN
348:
349: fnd_file.put_line(fnd_file.log,'Error Occured in Insert_AP_Trial_Bal'
350: ||' Function.');
351: IF (p_debug_switch IN ('y','Y')) THEN
352: fnd_file.put_line(fnd_file.log,l_sql_stmt);
353: END IF;

Line 358: END Insert_AP_Trial_Bal;

354: fnd_file.put_line(fnd_file.log,'Error Code: '||to_char(SQLCODE));
355: fnd_file.put_line(fnd_file.log,'Error Message: '||SQLERRM);
356: RETURN FALSE;
357:
358: END Insert_AP_Trial_Bal;
359:
360: /*=============================================================================
361: Insert_Future_Dated Function is an overloaded function. Based on the
362: p_from_date option either of the function will be called. This function returns

Line 365: This procedure inserts records into AP_TRIAL_BAL table for a given org_id or

361: Insert_Future_Dated Function is an overloaded function. Based on the
362: p_from_date option either of the function will be called. This function returns
363: TRUE on success and FALSE on any errors.
364:
365: This procedure inserts records into AP_TRIAL_BAL table for a given org_id or
366: for set of orgs as per the parameter for AP and AX set of books. This inserts
367: invoices that have not been fully paid on or before for a given as of date
368: associated to the future dated payments.
369:

Line 399: l_sql_stmt_1 := 'INSERT INTO ap_trial_bal '

395: fnd_file.put_line (fnd_file.log, 'Stage :018 - Into Insert_Future_Dated');
396: fnd_file.put_line (fnd_file.log, 'Stage :019 - Gain Loss At Payment '
397: ||'Line Level');
398:
399: l_sql_stmt_1 := 'INSERT INTO ap_trial_bal '
400: || '(( '
401: || ' SELECT /*+ full(aeh) '
402: || ' parallel(aeh,DEFAULT) '
403: || ' parallel(ael,DEFAULT) '

Line 413: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '

409: || ' ael.third_party_id vendor_id, '
410: || ' aeh.set_of_books_id set_of_books_id, '
411: || ' ael.org_id org_id, '
412: || ' '||p_request_id||' request_id, '
413: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '
414: || ' aeh.set_of_books_id, '
415: || ' ai.invoice_id, '
416: || ' ai.invoice_amount, '
417: || ' NVL(ai.exchange_rate,1)) invoice_amount '

Line 441: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '

437: || ' ael.third_party_id, '
438: || ' aeh.set_of_books_id, '
439: || ' ael.org_id, '
440: || ' '||p_request_id||', '
441: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '
442: || ' aeh.set_of_books_id, '
443: || ' ai.invoice_id, '
444: || ' ai.invoice_amount, '
445: || ' NVL(ai.exchange_rate,1)) '

Line 458: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '

454: || ' ai.vendor_id vendor_id, '
455: || ' aeh.set_of_books_id set_of_books_id, '
456: || ' ael.org_id org_id, '
457: || ' '||p_request_id||' request_id, '
458: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '
459: || ' aeh.set_of_books_id, '
460: || ' ai.invoice_id, '
461: || ' ai.invoice_amount, '
462: || ' NVL(ai.exchange_rate,1)) invoice_amount '

Line 488: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '

484: || ' ai.vendor_id, '
485: || ' aeh.set_of_books_id, '
486: || ' ael.org_id, '
487: || ' '||p_request_id||', '
488: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '
489: || ' aeh.set_of_books_id, '
490: || ' ai.invoice_id, '
491: || ' ai.invoice_amount, '
492: || ' NVL(ai.exchange_rate,1)) '

Line 546: l_sql_stmt_1 := 'INSERT INTO ap_trial_bal '

542:
543: fnd_file.put_line (fnd_file.log, 'Stage :020 - Into Insert_Future_Dated');
544: fnd_file.put_line (fnd_file.log, 'Stage :021 - Gain Loss At Payment '
545: ||'Line Level');
546: l_sql_stmt_1 := 'INSERT INTO ap_trial_bal '
547: || '(( '
548: || ' SELECT /*+ full(aeh) '
549: || ' parallel(aeh,DEFAULT) '
550: || ' parallel(ael,DEFAULT) '

Line 560: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '

556: || ' ael.third_party_id vendor_id, '
557: || ' aeh.set_of_books_id set_of_books_id, '
558: || ' ael.org_id org_id, '
559: || ' '||p_request_id||' request_id, '
560: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '
561: || ' aeh.set_of_books_id, '
562: || ' ai.invoice_id, '
563: || ' ai.invoice_amount, '
564: || ' NVL(ai.exchange_rate,1)) invoice_amount '

Line 589: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '

585: || ' ael.third_party_id, '
586: || ' aeh.set_of_books_id, '
587: || ' ael.org_id, '
588: || ' '||p_request_id||', '
589: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '
590: || ' aeh.set_of_books_id, '
591: || ' ai.invoice_id, '
592: || ' ai.invoice_amount, '
593: || ' NVL(ai.exchange_rate,1)) '

Line 606: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '

602: || ' ai.vendor_id vendor_id, '
603: || ' aeh.set_of_books_id set_of_books_id, '
604: || ' ael.org_id org_id, '
605: || ' '||p_request_id||' request_id, '
606: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '
607: || ' aeh.set_of_books_id, '
608: || ' ai.invoice_id, '
609: || ' ai.invoice_amount, '
610: || ' NVL(ai.exchange_rate,1)) invoice_amount '

Line 637: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '

633: || ' ai.vendor_id, '
634: || ' aeh.set_of_books_id, '
635: || ' ael.org_id, '
636: || ' '||p_request_id||', '
637: || ' Ap_Trial_Balance_Pkg.Get_Invoice_Amount ( '
638: || ' aeh.set_of_books_id, '
639: || ' ai.invoice_id, '
640: || ' ai.invoice_amount, '
641: || ' NVL(ai.exchange_rate,1)) '

Line 672: that add to a possitive balance in the AP_TRIAL_BAL table. So that when the

668: END Insert_Future_Dated;
669:
670: /*=============================================================================
671: Process_Neg_Bal function - This function is used to get rid of the records
672: that add to a possitive balance in the AP_TRIAL_BAL table. So that when the
673: trial balance select statement gets executed will report only on the negative
674: balances only. This was an added feature to the trial balance report to replace
675: the supplier open balance report.
676: =============================================================================*/

Line 686: DELETE FROM ap_trial_bal

682: BEGIN
683:
684: fnd_file.put_line (fnd_file.log, 'Stage :024 - Into Process_Neg_Bal');
685:
686: DELETE FROM ap_trial_bal
687: WHERE (code_combination_id,
688: vendor_id,
689: set_of_books_id,
690: nvl(org_id,-99)) --Bug2679383 Added nvl to org_id passing -99 for

Line 698: FROM ap_trial_bal

694: vendor_id,
695: set_of_books_id,
696: nvl(org_id,-99) --Bug2679383 Added nvl to org_id passing -99
697: --for non-multi org.
698: FROM ap_trial_bal
699: WHERE request_id = p_request_id
700: GROUP BY
701: code_combination_id,
702: vendor_id,

Line 1153: END AP_TRIAL_BALANCE_PKG;

1149:
1150:
1151:
1152:
1153: END AP_TRIAL_BALANCE_PKG;