932:
933:
934:
935:
936:
937:
938:
939:
940:
934:
935:
936:
937:
938:
939:
940:
941:
942:
937:
938:
939:
940:
941:
942:
943:
944:
945:
939:
940:
941:
942:
943:
944:
945:
946:
947:
1223: END IF;
1224:
1225: populate_setup_information;
1226:
1227: pg_short_unid_phrase := RTRIM(RPAD(ARPT_SQL_FUNC_UTIL.get_lookup_meaning
1228: ('MISC_PHRASES','UNIDENTIFIED_PAYMENT'),20));
1229:
1230: pg_payment_meaning := INITCAP(RTRIM(RPAD(ARPT_SQL_FUNC_UTIL.get_lookup_meaning
1231: ('INV/CM/ADJ','PMT'),20)));
1226:
1227: pg_short_unid_phrase := RTRIM(RPAD(ARPT_SQL_FUNC_UTIL.get_lookup_meaning
1228: ('MISC_PHRASES','UNIDENTIFIED_PAYMENT'),20));
1229:
1230: pg_payment_meaning := INITCAP(RTRIM(RPAD(ARPT_SQL_FUNC_UTIL.get_lookup_meaning
1231: ('INV/CM/ADJ','PMT'),20)));
1232:
1233: pg_risk_meaning := rtrim(rpad(ARPT_SQL_FUNC_UTIL.get_lookup_meaning
1234: ('MISC_PHRASES','RISK'),20));
1229:
1230: pg_payment_meaning := INITCAP(RTRIM(RPAD(ARPT_SQL_FUNC_UTIL.get_lookup_meaning
1231: ('INV/CM/ADJ','PMT'),20)));
1232:
1233: pg_risk_meaning := rtrim(rpad(ARPT_SQL_FUNC_UTIL.get_lookup_meaning
1234: ('MISC_PHRASES','RISK'),20));
1235:
1236: IF PG_DEBUG in ('Y', 'C') THEN
1237: arp_standard.debug( ' pg_short_unid_phrase :'||pg_short_unid_phrase);
1412: AND ps.class <> ''PMT'''||pg_org_where_ps||l_where_clause;
1413:
1414: IF pg_in_invoice_type_low IS NOT NULL THEN
1415: l_inv_sub_query := l_inv_sub_query || '
1416: and arpt_sql_func_util.get_org_trx_type_details(ps.cust_trx_type_id,ps.org_id)
1417: >= :pg_in_invoice_type_low ';
1418: END IF;
1419:
1420: IF pg_in_invoice_type_high IS NOT NULL THEN
1418: END IF;
1419:
1420: IF pg_in_invoice_type_high IS NOT NULL THEN
1421: l_inv_sub_query := l_inv_sub_query || '
1422: and arpt_sql_func_util.get_org_trx_type_details(ps.cust_trx_type_id,ps.org_id)
1423: <= :pg_in_invoice_type_high ';
1424: END IF;
1425:
1426: l_crh_sub_query := '
1642:
1643: -- IF p_qry_category IN (AR_AGING_CTGRY_INVOICE,AR_AGING_CTGRY_BR ) THEN
1644: -- p_rep_specific_cols := ' ,decode(upper(:p_in_sortoption),
1645: -- ''CUSTOMER'',NULL,
1646: -- arpt_sql_func_util.get_org_trx_type_details(ps.cust_trx_type_id,ps.org_id)) sort_field1
1647: -- ,decode(upper(:p_in_sortoption),''CUSTOMER'',-999,ps.cust_trx_type_id) inv_tid_inv';
1648: --
1649: -- ELSIF p_qry_category = AR_AGING_CTGRY_RECEIPT THEN
1650: -- p_rep_specific_cols := ',decode(upper(:p_in_sortoption),
2299: select /*+ LEADING(ps) */
2300: nvl(cust_acct.cust_account_id,-999) customer_id,
2301: cust_acct.account_number customer_number,
2302: substrb(party.party_name,1,50) short_customer_name,
2303: arpt_sql_func_util.get_org_trx_type_details(ps.cust_trx_type_id,ps.org_id) sort_field2,
2304: site.site_use_id contact_site_id,
2305: loc.state customer_state,
2306: loc.city customer_city,
2307: decode(:format_detailed,NULL,-1,acct_site.cust_acct_site_id) cust_acct_site_id,
2317: ps.gl_date gl_date,
2318: decode(ps.invoice_currency_code, :functional_currency, NULL,
2319: decode(ps.exchange_rate, NULL, ''*'', NULL)) data_converted_flag,
2320: nvl(ps.exchange_rate, 1) exchange_rate,
2321: arpt_sql_func_util.bucket_function(:bucket_line_type_0,
2322: dh.amount_in_dispute,ps.amount_adjusted_pending,
2323: :bucket_days_from_0,:bucket_days_to_0,
2324: ps.due_date,:bucket_category_0,:as_of_date) bucket_0,
2325: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2321: arpt_sql_func_util.bucket_function(:bucket_line_type_0,
2322: dh.amount_in_dispute,ps.amount_adjusted_pending,
2323: :bucket_days_from_0,:bucket_days_to_0,
2324: ps.due_date,:bucket_category_0,:as_of_date) bucket_0,
2325: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2326: dh.amount_in_dispute,ps.amount_adjusted_pending,
2327: :bucket_days_from_1,:bucket_days_to_1,
2328: ps.due_date,:bucket_category_1,:as_of_date) bucket_1,
2329: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2325: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2326: dh.amount_in_dispute,ps.amount_adjusted_pending,
2327: :bucket_days_from_1,:bucket_days_to_1,
2328: ps.due_date,:bucket_category_1,:as_of_date) bucket_1,
2329: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2330: dh.amount_in_dispute,ps.amount_adjusted_pending,
2331: :bucket_days_from_2,:bucket_days_to_2,
2332: ps.due_date,:bucket_category_2,:as_of_date) bucket_2,
2333: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2329: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2330: dh.amount_in_dispute,ps.amount_adjusted_pending,
2331: :bucket_days_from_2,:bucket_days_to_2,
2332: ps.due_date,:bucket_category_2,:as_of_date) bucket_2,
2333: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2334: dh.amount_in_dispute,ps.amount_adjusted_pending,
2335: :bucket_days_from_3,:bucket_days_to_3,
2336: ps.due_date,:bucket_category_3,:as_of_date) bucket_3,
2337: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2333: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2334: dh.amount_in_dispute,ps.amount_adjusted_pending,
2335: :bucket_days_from_3,:bucket_days_to_3,
2336: ps.due_date,:bucket_category_3,:as_of_date) bucket_3,
2337: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2338: dh.amount_in_dispute,ps.amount_adjusted_pending,
2339: :bucket_days_from_4,:bucket_days_to_4,
2340: ps.due_date,:bucket_category_4,:as_of_date) bucket_4,
2341: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2337: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2338: dh.amount_in_dispute,ps.amount_adjusted_pending,
2339: :bucket_days_from_4,:bucket_days_to_4,
2340: ps.due_date,:bucket_category_4,:as_of_date) bucket_4,
2341: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2342: dh.amount_in_dispute,ps.amount_adjusted_pending,
2343: :bucket_days_from_5,:bucket_days_to_5,
2344: ps.due_date,:bucket_category_5,:as_of_date) bucket_5,
2345: arpt_sql_func_util.bucket_function(:bucket_line_type_6,
2341: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2342: dh.amount_in_dispute,ps.amount_adjusted_pending,
2343: :bucket_days_from_5,:bucket_days_to_5,
2344: ps.due_date,:bucket_category_5,:as_of_date) bucket_5,
2345: arpt_sql_func_util.bucket_function(:bucket_line_type_6,
2346: dh.amount_in_dispute,ps.amount_adjusted_pending,
2347: :bucket_days_from_6,:bucket_days_to_6,
2348: ps.due_date,:bucket_category_6,:as_of_date) bucket_6, '||pg_acct_flex_bal_seg||'
2349: bal_segment_value,
2346: dh.amount_in_dispute,ps.amount_adjusted_pending,
2347: :bucket_days_from_6,:bucket_days_to_6,
2348: ps.due_date,:bucket_category_6,:as_of_date) bucket_6, '||pg_acct_flex_bal_seg||'
2349: bal_segment_value,
2350: arpt_sql_func_util.get_org_trx_type_details(ps.cust_trx_type_id,ps.org_id)
2351: invoice_type '|| l_rep_specific_cols || '
2352: from '||l_inv_act_sub_query|| '
2353: hz_cust_accounts cust_acct,
2354: hz_parties party,
2403: ps.gl_date gl_date,
2404: decode(ps.invoice_currency_code, :functional_currency, NULL,
2405: decode(ps.exchange_rate, NULL, ''*'', NULL) ) data_converted_flag,
2406: nvl(ps.exchange_rate, 1) exchange_rate,
2407: arpt_sql_func_util.bucket_function(:bucket_line_type_0,
2408: ps.amount_in_dispute,ps.amount_adjusted_pending,
2409: :bucket_days_from_0,:bucket_days_to_0,
2410: ps.due_date,:bucket_category_0,:as_of_date) bucket_0,
2411: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2407: arpt_sql_func_util.bucket_function(:bucket_line_type_0,
2408: ps.amount_in_dispute,ps.amount_adjusted_pending,
2409: :bucket_days_from_0,:bucket_days_to_0,
2410: ps.due_date,:bucket_category_0,:as_of_date) bucket_0,
2411: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2412: ps.amount_in_dispute,ps.amount_adjusted_pending,
2413: :bucket_days_from_1,:bucket_days_to_1,
2414: ps.due_date,:bucket_category_1,:as_of_date) bucket_1,
2415: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2411: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2412: ps.amount_in_dispute,ps.amount_adjusted_pending,
2413: :bucket_days_from_1,:bucket_days_to_1,
2414: ps.due_date,:bucket_category_1,:as_of_date) bucket_1,
2415: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2416: ps.amount_in_dispute,ps.amount_adjusted_pending,
2417: :bucket_days_from_2,:bucket_days_to_2,
2418: ps.due_date,:bucket_category_2,:as_of_date) bucket_2,
2419: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2415: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2416: ps.amount_in_dispute,ps.amount_adjusted_pending,
2417: :bucket_days_from_2,:bucket_days_to_2,
2418: ps.due_date,:bucket_category_2,:as_of_date) bucket_2,
2419: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2420: ps.amount_in_dispute,ps.amount_adjusted_pending,
2421: :bucket_days_from_3,:bucket_days_to_3,
2422: ps.due_date,:bucket_category_3,:as_of_date) bucket_3,
2423: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2419: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2420: ps.amount_in_dispute,ps.amount_adjusted_pending,
2421: :bucket_days_from_3,:bucket_days_to_3,
2422: ps.due_date,:bucket_category_3,:as_of_date) bucket_3,
2423: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2424: ps.amount_in_dispute,ps.amount_adjusted_pending,
2425: :bucket_days_from_4,:bucket_days_to_4,
2426: ps.due_date,:bucket_category_4,:as_of_date) bucket_4,
2427: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2423: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2424: ps.amount_in_dispute,ps.amount_adjusted_pending,
2425: :bucket_days_from_4,:bucket_days_to_4,
2426: ps.due_date,:bucket_category_4,:as_of_date) bucket_4,
2427: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2428: ps.amount_in_dispute,ps.amount_adjusted_pending,
2429: :bucket_days_from_5,:bucket_days_to_5,
2430: ps.due_date,:bucket_category_5,:as_of_date) bucket_5,
2431: arpt_sql_func_util.bucket_function(:bucket_line_type_6,
2427: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2428: ps.amount_in_dispute,ps.amount_adjusted_pending,
2429: :bucket_days_from_5,:bucket_days_to_5,
2430: ps.due_date,:bucket_category_5,:as_of_date) bucket_5,
2431: arpt_sql_func_util.bucket_function(:bucket_line_type_6,
2432: ps.amount_in_dispute,ps.amount_adjusted_pending,
2433: :bucket_days_from_6,:bucket_days_to_6,
2434: ps.due_date,:bucket_category_6,:as_of_date) bucket_6,
2435: '||pg_acct_flex_bal_seg||'
2521: crh.gl_date gl_date,
2522: decode(ps.invoice_currency_code, :functional_currency, NULL,
2523: decode(crh.exchange_rate, NULL, ''*'', NULL)) data_converted_flag,
2524: nvl(crh.exchange_rate, 1) exchange_rate,
2525: arpt_sql_func_util.bucket_function(:bucket_line_type_0,
2526: 0,0,:bucket_days_from_0,:bucket_days_to_0,
2527: ps.due_date,:bucket_category_0,:as_of_date) bucket_0,
2528: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2529: 0,0,:bucket_days_from_1,:bucket_days_to_1,
2524: nvl(crh.exchange_rate, 1) exchange_rate,
2525: arpt_sql_func_util.bucket_function(:bucket_line_type_0,
2526: 0,0,:bucket_days_from_0,:bucket_days_to_0,
2527: ps.due_date,:bucket_category_0,:as_of_date) bucket_0,
2528: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2529: 0,0,:bucket_days_from_1,:bucket_days_to_1,
2530: ps.due_date,:bucket_category_1,:as_of_date) bucket_1,
2531: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2532: 0,0,:bucket_days_from_2,:bucket_days_to_2,
2527: ps.due_date,:bucket_category_0,:as_of_date) bucket_0,
2528: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2529: 0,0,:bucket_days_from_1,:bucket_days_to_1,
2530: ps.due_date,:bucket_category_1,:as_of_date) bucket_1,
2531: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2532: 0,0,:bucket_days_from_2,:bucket_days_to_2,
2533: ps.due_date,:bucket_category_2,:as_of_date) bucket_2,
2534: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2535: 0,0,:bucket_days_from_3,:bucket_days_to_3,
2530: ps.due_date,:bucket_category_1,:as_of_date) bucket_1,
2531: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2532: 0,0,:bucket_days_from_2,:bucket_days_to_2,
2533: ps.due_date,:bucket_category_2,:as_of_date) bucket_2,
2534: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2535: 0,0,:bucket_days_from_3,:bucket_days_to_3,
2536: ps.due_date,:bucket_category_3,:as_of_date) bucket_3,
2537: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2538: 0,0,:bucket_days_from_4,:bucket_days_to_4,
2533: ps.due_date,:bucket_category_2,:as_of_date) bucket_2,
2534: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2535: 0,0,:bucket_days_from_3,:bucket_days_to_3,
2536: ps.due_date,:bucket_category_3,:as_of_date) bucket_3,
2537: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2538: 0,0,:bucket_days_from_4,:bucket_days_to_4,
2539: ps.due_date,:bucket_category_4,:as_of_date) bucket_4,
2540: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2541: 0,0,:bucket_days_from_5,:bucket_days_to_5,
2536: ps.due_date,:bucket_category_3,:as_of_date) bucket_3,
2537: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2538: 0,0,:bucket_days_from_4,:bucket_days_to_4,
2539: ps.due_date,:bucket_category_4,:as_of_date) bucket_4,
2540: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2541: 0,0,:bucket_days_from_5,:bucket_days_to_5,
2542: ps.due_date,:bucket_category_5,:as_of_date) bucket_5,
2543: arpt_sql_func_util.bucket_function(:bucket_line_type_6,
2544: 0,0,:bucket_days_from_6,:bucket_days_to_6,
2539: ps.due_date,:bucket_category_4,:as_of_date) bucket_4,
2540: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2541: 0,0,:bucket_days_from_5,:bucket_days_to_5,
2542: ps.due_date,:bucket_category_5,:as_of_date) bucket_5,
2543: arpt_sql_func_util.bucket_function(:bucket_line_type_6,
2544: 0,0,:bucket_days_from_6,:bucket_days_to_6,
2545: ps.due_date,:bucket_category_6,:as_of_date) bucket_6,
2546: '||pg_acct_flex_bal_seg||'
2547: bal_segment_value,
2603: p_out_br_query := '
2604: select /*+ LEADING(aging) */
2605: substrb(party.party_name,1,50) short_customer_name,
2606: cust_acct.account_number customer_number,
2607: arpt_sql_func_util.get_org_trx_type_details(ps.cust_trx_type_id,ps.org_id) sort_field2,
2608: site.site_use_id contact_site_id,
2609: loc.state customer_state,
2610: loc.city customer_city,
2611: decode(:format_detailed,NULL,-1,acct_site.cust_acct_site_id) cust_acct_site_id,
2624: ps.gl_date gl_date,
2625: decode(ps.invoice_currency_code, :functional_currency, NULL,
2626: decode(ps.exchange_rate, NULL, ''*'', NULL)) data_converted_flag,
2627: nvl(ps.exchange_rate, 1) exchange_rate,
2628: arpt_sql_func_util.bucket_function(:bucket_line_type_0,
2629: ps.amount_in_dispute,ps.amount_adjusted_pending,
2630: :bucket_days_from_0,:bucket_days_to_0,
2631: ps.due_date,:bucket_category_0,:as_of_date) bucket_0,
2632: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2628: arpt_sql_func_util.bucket_function(:bucket_line_type_0,
2629: ps.amount_in_dispute,ps.amount_adjusted_pending,
2630: :bucket_days_from_0,:bucket_days_to_0,
2631: ps.due_date,:bucket_category_0,:as_of_date) bucket_0,
2632: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2633: ps.amount_in_dispute,ps.amount_adjusted_pending,
2634: :bucket_days_from_1,:bucket_days_to_1,
2635: ps.due_date,:bucket_category_1,:as_of_date) bucket_1,
2636: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2632: arpt_sql_func_util.bucket_function(:bucket_line_type_1,
2633: ps.amount_in_dispute,ps.amount_adjusted_pending,
2634: :bucket_days_from_1,:bucket_days_to_1,
2635: ps.due_date,:bucket_category_1,:as_of_date) bucket_1,
2636: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2637: ps.amount_in_dispute,ps.amount_adjusted_pending,
2638: :bucket_days_from_2,:bucket_days_to_2,
2639: ps.due_date,:bucket_category_2,:as_of_date) bucket_2,
2640: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2636: arpt_sql_func_util.bucket_function(:bucket_line_type_2,
2637: ps.amount_in_dispute,ps.amount_adjusted_pending,
2638: :bucket_days_from_2,:bucket_days_to_2,
2639: ps.due_date,:bucket_category_2,:as_of_date) bucket_2,
2640: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2641: ps.amount_in_dispute,ps.amount_adjusted_pending,
2642: :bucket_days_from_3,:bucket_days_to_3,
2643: ps.due_date,:bucket_category_3,:as_of_date) bucket_3,
2644: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2640: arpt_sql_func_util.bucket_function(:bucket_line_type_3,
2641: ps.amount_in_dispute,ps.amount_adjusted_pending,
2642: :bucket_days_from_3,:bucket_days_to_3,
2643: ps.due_date,:bucket_category_3,:as_of_date) bucket_3,
2644: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2645: ps.amount_in_dispute,ps.amount_adjusted_pending,
2646: :bucket_days_from_4,:bucket_days_to_4,
2647: ps.due_date,:bucket_category_4,:as_of_date) bucket_4,
2648: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2644: arpt_sql_func_util.bucket_function(:bucket_line_type_4,
2645: ps.amount_in_dispute,ps.amount_adjusted_pending,
2646: :bucket_days_from_4,:bucket_days_to_4,
2647: ps.due_date,:bucket_category_4,:as_of_date) bucket_4,
2648: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2649: ps.amount_in_dispute,ps.amount_adjusted_pending,
2650: :bucket_days_from_5,:bucket_days_to_5,
2651: ps.due_date,:bucket_category_5,:as_of_date) bucket_5,
2652: arpt_sql_func_util.bucket_function(:bucket_line_type_6,
2648: arpt_sql_func_util.bucket_function(:bucket_line_type_5,
2649: ps.amount_in_dispute,ps.amount_adjusted_pending,
2650: :bucket_days_from_5,:bucket_days_to_5,
2651: ps.due_date,:bucket_category_5,:as_of_date) bucket_5,
2652: arpt_sql_func_util.bucket_function(:bucket_line_type_6,
2653: ps.amount_in_dispute,ps.amount_adjusted_pending,
2654: :bucket_days_from_6,:bucket_days_to_6,
2655: ps.due_date,:bucket_category_6,:as_of_date) bucket_6,
2656: '||pg_acct_flex_bal_seg||'
2654: :bucket_days_from_6,:bucket_days_to_6,
2655: ps.due_date,:bucket_category_6,:as_of_date) bucket_6,
2656: '||pg_acct_flex_bal_seg||'
2657: bal_segment_value,
2658: arpt_sql_func_util.get_org_trx_type_details(ps.cust_trx_type_id,ps.org_id) invoice_type
2659: '|| l_rep_specific_cols ||'
2660: from hz_cust_accounts cust_acct,
2661: hz_parties party,
2662: ar_aging_payment_schedules aging,