DBA Data[Home] [Help]

APPS.AR_CALC_AGING dependencies on AR_CALC_AGING

Line 1: PACKAGE BODY ar_calc_aging AS

1: PACKAGE BODY ar_calc_aging AS
2: /* $Header: ARRECONB.pls 120.22.12010000.2 2008/11/05 05:37:45 npanchak ship $ */
3: /*-------------------------------------------------------------
4: PRIVATE variables
5: ---------------------------------------------------------------*/

Line 36: ar_calc_aging.g_reporting_entity_id := p_reporting_entity_id;

32: p_coa_id IN NUMBER)
33: IS
34: BEGIN
35:
36: ar_calc_aging.g_reporting_entity_id := p_reporting_entity_id;
37:
38: IF NVL(ar_calc_aging.ca_sob_type,'P') = 'P' THEN
39: l_ps_table := 'ar_payment_schedules_all ';
40: l_ra_table := 'ar_receivable_applications_all ';

Line 38: IF NVL(ar_calc_aging.ca_sob_type,'P') = 'P' THEN

34: BEGIN
35:
36: ar_calc_aging.g_reporting_entity_id := p_reporting_entity_id;
37:
38: IF NVL(ar_calc_aging.ca_sob_type,'P') = 'P' THEN
39: l_ps_table := 'ar_payment_schedules_all ';
40: l_ra_table := 'ar_receivable_applications_all ';
41: l_adj_table := 'ar_adjustments_all ';
42: l_ard_table := 'ar_distributions_all ';

Line 73: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

69: l_cr_org_where := XLA_MO_REPORTING_API.Get_Predicate('cr' ,null);
70:
71: /* Replace the variables to bind with the function calls so that we don't have to bind those */
72: l_ps_org_where := replace(l_ps_org_where,
73: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
74: l_gl_dist_org_where:= replace(l_gl_dist_org_where,
75: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
76: l_trx_org_where := replace(l_trx_org_where,
77: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

Line 75: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

71: /* Replace the variables to bind with the function calls so that we don't have to bind those */
72: l_ps_org_where := replace(l_ps_org_where,
73: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
74: l_gl_dist_org_where:= replace(l_gl_dist_org_where,
75: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
76: l_trx_org_where := replace(l_trx_org_where,
77: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
78: l_line_org_where := replace(l_line_org_where,
79: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

Line 77: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

73: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
74: l_gl_dist_org_where:= replace(l_gl_dist_org_where,
75: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
76: l_trx_org_where := replace(l_trx_org_where,
77: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
78: l_line_org_where := replace(l_line_org_where,
79: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
80: l_ra_org_where := replace(l_ra_org_where,
81: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

Line 79: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

75: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
76: l_trx_org_where := replace(l_trx_org_where,
77: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
78: l_line_org_where := replace(l_line_org_where,
79: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
80: l_ra_org_where := replace(l_ra_org_where,
81: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
82: l_ard_org_where := replace(l_ard_org_where,
83: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

Line 81: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

77: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
78: l_line_org_where := replace(l_line_org_where,
79: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
80: l_ra_org_where := replace(l_ra_org_where,
81: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
82: l_ard_org_where := replace(l_ard_org_where,
83: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
84: l_ard1_org_where := replace(l_ard1_org_where,
85: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

Line 83: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

79: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
80: l_ra_org_where := replace(l_ra_org_where,
81: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
82: l_ard_org_where := replace(l_ard_org_where,
83: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
84: l_ard1_org_where := replace(l_ard1_org_where,
85: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
86: l_ath_org_where := replace(l_ath_org_where,
87: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

Line 85: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

81: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
82: l_ard_org_where := replace(l_ard_org_where,
83: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
84: l_ard1_org_where := replace(l_ard1_org_where,
85: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
86: l_ath_org_where := replace(l_ath_org_where,
87: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
88: l_adj_org_where := replace(l_adj_org_where,
89: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

Line 87: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

83: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
84: l_ard1_org_where := replace(l_ard1_org_where,
85: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
86: l_ath_org_where := replace(l_ath_org_where,
87: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
88: l_adj_org_where := replace(l_adj_org_where,
89: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
90: l_cr_org_where := replace(l_cr_org_where,
91: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

Line 89: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

85: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
86: l_ath_org_where := replace(l_ath_org_where,
87: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
88: l_adj_org_where := replace(l_adj_org_where,
89: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
90: l_cr_org_where := replace(l_cr_org_where,
91: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
92:
93: IF company_segment_where IS NULL THEN

Line 91: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

87: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
88: l_adj_org_where := replace(l_adj_org_where,
89: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
90: l_cr_org_where := replace(l_cr_org_where,
91: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
92:
93: IF company_segment_where IS NULL THEN
94: IF p_co_seg_low IS NULL AND p_co_seg_high IS NULL THEN
95: company_segment_where := NULL;

Line 98: ar_calc_aging.FLEX_SQL(p_application_id => 101,

94: IF p_co_seg_low IS NULL AND p_co_seg_high IS NULL THEN
95: company_segment_where := NULL;
96: ELSIF p_co_seg_low IS NULL THEN
97: company_segment_where := ' AND ' ||
98: ar_calc_aging.FLEX_SQL(p_application_id => 101,
99: p_id_flex_code => 'GL#',
100: p_id_flex_num =>p_coa_id,
101: p_table_alias => 'GC',
102: p_mode => 'WHERE',

Line 108: ar_calc_aging.FLEX_SQL(p_application_id => 101,

104: p_function => '<=',
105: p_operand1 => p_co_seg_high);
106: ELSIF p_co_seg_high IS NULL THEN
107: company_segment_where := ' AND ' ||
108: ar_calc_aging.FLEX_SQL(p_application_id => 101,
109: p_id_flex_code => 'GL#',
110: p_id_flex_num => p_coa_id,
111: p_table_alias => 'GC',
112: p_mode => 'WHERE',

Line 118: ar_calc_aging.FLEX_SQL(p_application_id => 101,

114: p_function => '>=',
115: p_operand1 => p_co_seg_low);
116: ELSE
117: company_segment_where := ' AND ' ||
118: ar_calc_aging.FLEX_SQL(p_application_id => 101,
119: p_id_flex_code => 'GL#',
120: p_id_flex_num =>p_coa_id,
121: p_table_alias => 'GC',
122: p_mode => 'WHERE',

Line 139: return ar_calc_aging.g_reporting_entity_id;

135: ========================================================================*/
136:
137: FUNCTION get_reporting_entity_id return NUMBER is
138: BEGIN
139: return ar_calc_aging.g_reporting_entity_id;
140: END get_reporting_entity_id;
141:
142:
143: /*========================================================================+

Line 247: ar_calc_aging.ca_sob_type := 'P';

243: l_profile_rsob_id NUMBER := NULL;
244: l_client_info_rsob_id NUMBER := NULL;
245: BEGIN
246: --Bug 4928220
247: ar_calc_aging.ca_sob_type := 'P';
248:
249: END;
250:
251: /*-------------------------------------------------------------

Line 294: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

290: p_co_seg_high,
291: p_coa_id);
292:
293: l_ps_select := 'SELECT ps.customer_trx_id ,
294: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
295: NULL,:p_as_of_date_from)
296: * ps.amount_due_remaining) start_bal,
297: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
298: NULL,:p_as_of_date_to)

Line 297: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

293: l_ps_select := 'SELECT ps.customer_trx_id ,
294: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
295: NULL,:p_as_of_date_from)
296: * ps.amount_due_remaining) start_bal,
297: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
298: NULL,:p_as_of_date_to)
299: * ps.amount_due_remaining) end_bal,
300: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
301: NULL,:p_as_of_date_from)

Line 300: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

296: * ps.amount_due_remaining) start_bal,
297: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
298: NULL,:p_as_of_date_to)
299: * ps.amount_due_remaining) end_bal,
300: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
301: NULL,:p_as_of_date_from)
302: * ps.acctd_amount_due_remaining) acctd_start_bal,
303: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
304: NULL,:p_as_of_date_to)

Line 303: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

299: * ps.amount_due_remaining) end_bal,
300: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
301: NULL,:p_as_of_date_from)
302: * ps.acctd_amount_due_remaining) acctd_start_bal,
303: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
304: NULL,:p_as_of_date_to)
305: * ps.acctd_amount_due_remaining) acctd_end_bal
306: FROM '||l_ps_table||' ps
307: WHERE ps.payment_schedule_id+0 > 0

Line 316: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

312: GROUP BY ps.customer_trx_id ' ;
313:
314: l_ra_select := 'SELECT
315: ps.customer_trx_id ,
316: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
317: ra.gl_date,:p_as_of_date_from)
318: * ( ra.amount_applied + NVL(ra.earned_discount_taken,0)
319: + NVL(ra.unearned_discount_taken,0))) start_bal,
320: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 320: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

316: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
317: ra.gl_date,:p_as_of_date_from)
318: * ( ra.amount_applied + NVL(ra.earned_discount_taken,0)
319: + NVL(ra.unearned_discount_taken,0))) start_bal,
320: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
321: ra.gl_date,:p_as_of_date_to)
322: * ( ra.amount_applied + NVL(ra.earned_discount_taken,0)
323: + NVL(ra.unearned_discount_taken,0))) end_bal,
324: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 324: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

320: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
321: ra.gl_date,:p_as_of_date_to)
322: * ( ra.amount_applied + NVL(ra.earned_discount_taken,0)
323: + NVL(ra.unearned_discount_taken,0))) end_bal,
324: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
325: ra.gl_date,:p_as_of_date_from)
326: * (ra.acctd_amount_applied_to +
327: NVL(ra.acctd_earned_discount_taken,0)
328: + NVL(ra.acctd_unearned_discount_taken,0))) acctd_start_bal,

Line 329: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

325: ra.gl_date,:p_as_of_date_from)
326: * (ra.acctd_amount_applied_to +
327: NVL(ra.acctd_earned_discount_taken,0)
328: + NVL(ra.acctd_unearned_discount_taken,0))) acctd_start_bal,
329: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
330: ra.gl_date,:p_as_of_date_to)
331: * (ra.acctd_amount_applied_to +
332: NVL(ra.acctd_earned_discount_taken,0)
333: + NVL(ra.acctd_unearned_discount_taken,0))) acctd_end_bal

Line 350: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

346: GROUP BY ps.customer_trx_id ';
347:
348: l_cm_ra_select := 'SELECT
349: ps.customer_trx_id ,
350: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
351: ra.gl_date,:p_as_of_date_from)
352: * -1
353: * ( ra.amount_applied + NVL(ra.earned_discount_taken,0)
354: + NVL(ra.unearned_discount_taken,0))) start_bal,

Line 355: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

351: ra.gl_date,:p_as_of_date_from)
352: * -1
353: * ( ra.amount_applied + NVL(ra.earned_discount_taken,0)
354: + NVL(ra.unearned_discount_taken,0))) start_bal,
355: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
356: ra.gl_date,:p_as_of_date_to)
357: * -1
358: * ( ra.amount_applied + NVL(ra.earned_discount_taken,0)
359: + NVL(ra.unearned_discount_taken,0))) end_bal,

Line 360: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

356: ra.gl_date,:p_as_of_date_to)
357: * -1
358: * ( ra.amount_applied + NVL(ra.earned_discount_taken,0)
359: + NVL(ra.unearned_discount_taken,0))) end_bal,
360: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
361: ra.gl_date,:p_as_of_date_from)
362: * -1
363: * ra.acctd_amount_applied_from ) acctd_start_bal,
364: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 364: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

360: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
361: ra.gl_date,:p_as_of_date_from)
362: * -1
363: * ra.acctd_amount_applied_from ) acctd_start_bal,
364: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
365: ra.gl_date,:p_as_of_date_to)
366: * -1
367: * ra.acctd_amount_applied_from ) acctd_end_bal
368: FROM '|| l_ps_table ||' ps,

Line 384: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

380: '|| l_ra_org_where||'
381: GROUP BY ps.customer_trx_id ';
382:
383: l_adj_select := 'SELECT ps.customer_trx_id,
384: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
385: adj.gl_date,:p_as_of_date_from)
386: * adj.amount) start_bal,
387: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
388: adj.gl_date,:p_as_of_date_to)

Line 387: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

383: l_adj_select := 'SELECT ps.customer_trx_id,
384: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
385: adj.gl_date,:p_as_of_date_from)
386: * adj.amount) start_bal,
387: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
388: adj.gl_date,:p_as_of_date_to)
389: * adj.amount) end_bal ,
390: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
391: adj.gl_date,:p_as_of_date_from)

Line 390: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

386: * adj.amount) start_bal,
387: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
388: adj.gl_date,:p_as_of_date_to)
389: * adj.amount) end_bal ,
390: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
391: adj.gl_date,:p_as_of_date_from)
392: * adj.acctd_amount) acctd_start_bal,
393: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
394: adj.gl_date,:p_as_of_date_to)

Line 393: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

389: * adj.amount) end_bal ,
390: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
391: adj.gl_date,:p_as_of_date_from)
392: * adj.acctd_amount) acctd_start_bal,
393: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
394: adj.gl_date,:p_as_of_date_to)
395: * adj.acctd_amount) acctd_end_bal
396: FROM '||l_adj_table||' adj ,'
397: ||l_ps_table ||' ps

Line 411: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

407: GROUP BY ps.customer_trx_id ';
408:
409: IF p_co_seg_low IS NOT NULL OR p_co_seg_high IS NOT NULL THEN
410: l_cancel_br_select := 'SELECT
411: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
412: ath.gl_date,:p_as_of_date_from)
413: * decode(nvl(ard.amount_cr,0), 0, nvl(ard.amount_dr,0),
414: (ard.amount_cr * -1))) start_bal,
415: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 415: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

411: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
412: ath.gl_date,:p_as_of_date_from)
413: * decode(nvl(ard.amount_cr,0), 0, nvl(ard.amount_dr,0),
414: (ard.amount_cr * -1))) start_bal,
415: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
416: ath.gl_date,:p_as_of_date_to)
417: * decode(nvl(ard.amount_cr,0), 0, nvl(ard.amount_dr,0),
418: (ard.amount_cr * -1))) end_bal,
419: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 419: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

415: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
416: ath.gl_date,:p_as_of_date_to)
417: * decode(nvl(ard.amount_cr,0), 0, nvl(ard.amount_dr,0),
418: (ard.amount_cr * -1))) end_bal,
419: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
420: ath.gl_date,:p_as_of_date_from)
421: * decode(nvl(ard.acctd_amount_cr,0), 0, nvl(ard.acctd_amount_dr,0),
422: (ard.acctd_amount_cr * -1))) acctd_start_bal,
423: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 423: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

419: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
420: ath.gl_date,:p_as_of_date_from)
421: * decode(nvl(ard.acctd_amount_cr,0), 0, nvl(ard.acctd_amount_dr,0),
422: (ard.acctd_amount_cr * -1))) acctd_start_bal,
423: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
424: ath.gl_date,:p_as_of_date_to)
425: * decode(nvl(ard.acctd_amount_cr,0), 0, nvl(ard.acctd_amount_dr,0),
426: (ard.acctd_amount_cr * -1))) acctd_end_bal
427: FROM '||l_ps_table||' ps,

Line 451: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

447: ' || l_line_org_where ||'
448: ' || company_segment_where;
449: ELSE
450: l_cancel_br_select := 'SELECT
451: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
452: ath.gl_date,:p_as_of_date_from)
453: * decode(nvl(ard.amount_cr,0), 0, nvl(ard.amount_dr,0),
454: (ard.amount_cr * -1))) start_bal,
455: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 455: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

451: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
452: ath.gl_date,:p_as_of_date_from)
453: * decode(nvl(ard.amount_cr,0), 0, nvl(ard.amount_dr,0),
454: (ard.amount_cr * -1))) start_bal,
455: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
456: ath.gl_date,:p_as_of_date_to)
457: * decode(nvl(ard.amount_cr,0), 0, nvl(ard.amount_dr,0),
458: (ard.amount_cr * -1))) end_bal,
459: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 459: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

455: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
456: ath.gl_date,:p_as_of_date_to)
457: * decode(nvl(ard.amount_cr,0), 0, nvl(ard.amount_dr,0),
458: (ard.amount_cr * -1))) end_bal,
459: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
460: ath.gl_date,:p_as_of_date_from)
461: * decode(nvl(ard.acctd_amount_cr,0), 0, nvl(ard.acctd_amount_dr,0),
462: (ard.acctd_amount_cr * -1))) acctd_start_bal,
463: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 463: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

459: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
460: ath.gl_date,:p_as_of_date_from)
461: * decode(nvl(ard.acctd_amount_cr,0), 0, nvl(ard.acctd_amount_dr,0),
462: (ard.acctd_amount_cr * -1))) acctd_start_bal,
463: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
464: ath.gl_date,:p_as_of_date_to)
465: * decode(nvl(ard.acctd_amount_cr,0), 0, nvl(ard.acctd_amount_dr,0),
466: (ard.acctd_amount_cr * -1))) acctd_end_bal
467: FROM '||l_ps_table||' ps,

Line 489: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,

485: ' || l_line_org_where;
486: END IF;
487:
488: l_br_select := ' SELECT ps.customer_trx_id ,
489: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
490: NULL,:p_as_of_date_from)
491: * ps.amount_due_remaining) start_bal,
492: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
493: NULL,:p_as_of_date_to)

Line 492: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,

488: l_br_select := ' SELECT ps.customer_trx_id ,
489: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
490: NULL,:p_as_of_date_from)
491: * ps.amount_due_remaining) start_bal,
492: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
493: NULL,:p_as_of_date_to)
494: * ps.amount_due_remaining) end_bal,
495: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
496: NULL,:p_as_of_date_from)

Line 495: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,

491: * ps.amount_due_remaining) start_bal,
492: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
493: NULL,:p_as_of_date_to)
494: * ps.amount_due_remaining) end_bal,
495: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
496: NULL,:p_as_of_date_from)
497: * ps.acctd_amount_due_remaining) acctd_start_bal,
498: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
499: NULL,:p_as_of_date_to)

Line 498: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,

494: * ps.amount_due_remaining) end_bal,
495: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
496: NULL,:p_as_of_date_from)
497: * ps.acctd_amount_due_remaining) acctd_start_bal,
498: sum(ar_calc_aging.begin_or_end_bal(gl_date,gl_date_closed,
499: NULL,:p_as_of_date_to)
500: * ps.acctd_amount_due_remaining) acctd_end_bal
501: FROM '||l_ps_table||' ps
502: WHERE ps.payment_schedule_id+0 > 0

Line 511: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

507: GROUP BY ps.customer_trx_id ';
508:
509: l_br_app_select := ' SELECT
510: ps.customer_trx_id ,
511: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
512: ra.gl_date,:p_as_of_date_from)
513: *(ra.amount_applied + NVL(ra.earned_discount_taken,0)
514: + NVL(ra.unearned_discount_taken,0))) start_bal,
515: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 515: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

511: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
512: ra.gl_date,:p_as_of_date_from)
513: *(ra.amount_applied + NVL(ra.earned_discount_taken,0)
514: + NVL(ra.unearned_discount_taken,0))) start_bal,
515: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
516: ra.gl_date,:p_as_of_date_to)
517: *(ra.amount_applied + NVL(ra.earned_discount_taken,0)
518: + NVL(ra.unearned_discount_taken,0))) end_bal,
519: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 519: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

515: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
516: ra.gl_date,:p_as_of_date_to)
517: *(ra.amount_applied + NVL(ra.earned_discount_taken,0)
518: + NVL(ra.unearned_discount_taken,0))) end_bal,
519: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
520: ra.gl_date,:p_as_of_date_from)
521: *(ra.acctd_amount_applied_to + NVL(ra.acctd_earned_discount_taken,0)
522: + NVL(ra.acctd_unearned_discount_taken,0))) acctd_start_bal,
523: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

Line 523: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

519: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
520: ra.gl_date,:p_as_of_date_from)
521: *(ra.acctd_amount_applied_to + NVL(ra.acctd_earned_discount_taken,0)
522: + NVL(ra.acctd_unearned_discount_taken,0))) acctd_start_bal,
523: sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
524: ra.gl_date,:p_as_of_date_to)
525: *(ra.acctd_amount_applied_to + NVL(ra.acctd_earned_discount_taken,0)
526: + NVL(ra.acctd_unearned_discount_taken,0))) acctd_end_bal
527: FROM '|| l_ps_table||' ps,

Line 542: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

538: '|| l_ra_org_where ||'
539: GROUP by ps.customer_trx_id ';
540:
541: l_br_adj_select:= ' SELECT ps.customer_trx_id,
542: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
543: adj.gl_date,:p_as_of_date_from)
544: * adj.amount) start_bal,
545: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
546: adj.gl_date,:p_as_of_date_to)

Line 545: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

541: l_br_adj_select:= ' SELECT ps.customer_trx_id,
542: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
543: adj.gl_date,:p_as_of_date_from)
544: * adj.amount) start_bal,
545: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
546: adj.gl_date,:p_as_of_date_to)
547: * adj.amount) end_bal,
548: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
549: adj.gl_date,:p_as_of_date_from)

Line 548: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

544: * adj.amount) start_bal,
545: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
546: adj.gl_date,:p_as_of_date_to)
547: * adj.amount) end_bal,
548: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
549: adj.gl_date,:p_as_of_date_from)
550: * adj.acctd_amount) acctd_start_bal,
551: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
552: adj.gl_date,:p_as_of_date_to)

Line 551: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,

547: * adj.amount) end_bal,
548: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
549: adj.gl_date,:p_as_of_date_from)
550: * adj.acctd_amount) acctd_start_bal,
551: -sum(ar_calc_aging.begin_or_end_bal(ps.gl_date,ps.gl_date_closed,
552: adj.gl_date,:p_as_of_date_to)
553: * adj.acctd_amount) acctd_end_bal
554: FROM '|| l_adj_table ||' adj,
555: '|| l_ps_table ||' ps

Line 569: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,

565: GROUP BY ps.customer_trx_id ';
566:
567: IF p_co_seg_low IS NOT NULL OR p_co_seg_high IS NOT NULL THEN
568: l_unapp_select := 'SELECT
569: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
570: NULL,:p_as_of_date_from)
571: * ra.amount_applied) ,0 ) start_bal,
572: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
573: NULL,:p_as_of_date_to)

Line 572: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,

568: l_unapp_select := 'SELECT
569: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
570: NULL,:p_as_of_date_from)
571: * ra.amount_applied) ,0 ) start_bal,
572: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
573: NULL,:p_as_of_date_to)
574: * ra.amount_applied) ,0) end_bal,
575: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
576: NULL,:p_as_of_date_from)

Line 575: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,

571: * ra.amount_applied) ,0 ) start_bal,
572: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
573: NULL,:p_as_of_date_to)
574: * ra.amount_applied) ,0) end_bal,
575: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
576: NULL,:p_as_of_date_from)
577: * ra.acctd_amount_applied_from) ,0 ) acctd_start_bal,
578: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
579: NULL,:p_as_of_date_to)

Line 578: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,

574: * ra.amount_applied) ,0) end_bal,
575: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
576: NULL,:p_as_of_date_from)
577: * ra.acctd_amount_applied_from) ,0 ) acctd_start_bal,
578: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
579: NULL,:p_as_of_date_to)
580: * ra.acctd_amount_applied_from) ,0) acctd_end_bal
581: FROM '|| l_ps_table ||' ps,
582: '|| l_ra_table ||' ra,

Line 597: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,

593: ' || l_ra_org_where || '
594: ' || company_segment_where;
595: ELSE
596: l_unapp_select := 'SELECT
597: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
598: NULL,:p_as_of_date_from)
599: * ra.amount_applied) ,0 ) start_bal,
600: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
601: NULL,:p_as_of_date_to)

Line 600: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,

596: l_unapp_select := 'SELECT
597: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
598: NULL,:p_as_of_date_from)
599: * ra.amount_applied) ,0 ) start_bal,
600: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
601: NULL,:p_as_of_date_to)
602: * ra.amount_applied) ,0) end_bal,
603: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
604: NULL,:p_as_of_date_from)

Line 603: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,

599: * ra.amount_applied) ,0 ) start_bal,
600: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
601: NULL,:p_as_of_date_to)
602: * ra.amount_applied) ,0) end_bal,
603: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
604: NULL,:p_as_of_date_from)
605: * ra.acctd_amount_applied_from) ,0 ) acctd_start_bal,
606: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
607: NULL,:p_as_of_date_to)

Line 606: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,

602: * ra.amount_applied) ,0) end_bal,
603: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
604: NULL,:p_as_of_date_from)
605: * ra.acctd_amount_applied_from) ,0 ) acctd_start_bal,
606: NVL(-sum(ar_calc_aging.begin_or_end_bal(ra.gl_date,gl_date_closed,
607: NULL,:p_as_of_date_to)
608: * ra.acctd_amount_applied_from) ,0) acctd_end_bal
609: FROM '|| l_ps_table ||' ps,
610: '|| l_ra_table ||' ra

Line 1090: IF NVL(ar_calc_aging.ca_sob_type,'P') = 'P'

1086:
1087: -- For Zero Amount Transactions , sometimes the acctd_amount is
1088: -- derived as 0.01 or 0.02.
1089:
1090: IF NVL(ar_calc_aging.ca_sob_type,'P') = 'P'
1091: THEN
1092: SELECT NVL(SUM(NVL(acctd_amount,0)),0)
1093: INTO l_rounding_diff
1094: FROM ra_cust_trx_line_gl_dist

Line 1851: ar_calc_aging.g_reporting_entity_id := p_reporting_entity_id;

1847: l_org_name VARCHAR2(10000);
1848: l_br_flag VARCHAR2(1);
1849: BEGIN
1850:
1851: ar_calc_aging.g_reporting_entity_id := p_reporting_entity_id;
1852:
1853: IF NVL(ar_calc_aging.ca_sob_type,'P') = 'P' THEN
1854: l_sysparam_table := 'ar_system_parameters_all ';
1855: ELSE

Line 1853: IF NVL(ar_calc_aging.ca_sob_type,'P') = 'P' THEN

1849: BEGIN
1850:
1851: ar_calc_aging.g_reporting_entity_id := p_reporting_entity_id;
1852:
1853: IF NVL(ar_calc_aging.ca_sob_type,'P') = 'P' THEN
1854: l_sysparam_table := 'ar_system_parameters_all ';
1855: ELSE
1856: l_sysparam_table := 'ar_system_parameters_all_mrc_v ';
1857: END IF;

Line 1864: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');

1860:
1861: l_sysparam_where := XLA_MO_REPORTING_API.Get_Predicate('param',null);
1862:
1863: l_sysparam_where := replace(l_sysparam_where,
1864: ':p_reporting_entity_id','ar_calc_aging.get_reporting_entity_id()');
1865:
1866: l_select_stmt := 'SELECT sob.name sob_name,
1867: sob.currency_code functional_currency,
1868: sob.chart_of_accounts_id ,

Line 1925: END ar_calc_aging ;

1921: p_bills_receivable_flag := br_enabled_flag;
1922:
1923: END get_report_heading;
1924:
1925: END ar_calc_aging ;