128: FROM ar_line_conts alc
129: WHERE alc.customer_trx_line_id = ctl.customer_trx_line_id
130: AND alc.contingency_id = 5)
131: GROUP BY ctl.customer_trx_line_id, tl.term_id
132: HAVING max(due_days) > arp_standard.sysparm.payment_threshold;
133:
134: ELSE /* Autoinvoice */
135: INSERT INTO ar_line_conts
136: (
189: FROM ar_line_conts alc
190: WHERE alc.customer_trx_line_id = ctl.customer_trx_line_id
191: AND alc.contingency_id = 5)
192: GROUP BY ctl.customer_trx_line_id, tl.term_id
193: HAVING max(due_days) > arp_standard.sysparm.payment_threshold;
194: END IF;
195: ELSE /* Manual transaction */
196: INSERT INTO ar_line_conts
197: (
246: FROM ar_line_conts alc
247: WHERE alc.customer_trx_line_id = ctl.customer_trx_line_id
248: AND alc.contingency_id = 5)
249: GROUP BY ctl.customer_trx_line_id, ctl.org_id,tl.term_id
250: HAVING max(tl.due_days) > arp_standard.sysparm.payment_threshold;
251: END IF;
252:
253: l_rows := SQL%ROWCOUNT;
254:
952: END IF;
953:
954: IF l_customer_trx_line_id_tbl.COUNT = 0 AND l_last_fetch THEN
955: IF pg_debug IN ('Y', 'C') THEN
956: arp_standard.debug('No more rows');
957: END IF;
958: EXIT;
959: END IF;
960:
1090: (SELECT customer_trx_line_id
1091: FROM ra_customer_trx_lines ctl
1092: WHERE ctl.request_id = p_request_id)
1093: AND trunc(expiration_date) - trunc(sysdate) <
1094: NVL(arp_standard.sysparm.standard_refund,0)
1095: AND EXISTS
1096: (SELECT 'its a refund contingency'
1097: FROM ar_deferral_reasons dr
1098: WHERE dr.contingency_id = lrc.contingency_id
1142: AND ct.term_id = tl.term_id
1143: AND ctl.request_id = p_request_id
1144: GROUP BY ctl.customer_trx_line_id, tl.term_id
1145: HAVING NVL(max(due_days),0) <=
1146: NVL(arp_standard.sysparm.payment_threshold,0))
1147: AND EXISTS
1148: (SELECT 'its a PAYMENT_TERM'
1149: FROM ar_deferral_reasons dr
1150: WHERE dr.policy_attached = 'PAYMENT_TERM'
1182: /* manual process, based on customer_trx_line_id */
1183: DELETE
1184: FROM ar_line_conts lrc
1185: WHERE trunc(expiration_date) - trunc(sysdate) <
1186: NVL(arp_standard.sysparm.standard_refund,0)
1187: AND lrc.customer_trx_line_id = p_customer_trx_line_id
1188: AND EXISTS
1189: (SELECT 'a refund contingency'
1190: FROM ar_deferral_reasons dr
1242: AND ct.term_id = tl.term_id
1243: AND ctl.customer_trx_line_id = lc.customer_trx_line_id
1244: GROUP BY ctl.customer_trx_line_id, tl.term_id
1245: HAVING NVL(max(due_days),0) <=
1246: NVL(arp_standard.sysparm.payment_threshold,0));
1247:
1248: IF PG_DEBUG IN ('Y','C')
1249: THEN
1250: debug('payment term contingencies deleted: ' || SQL%ROWCOUNT);
2406: SELECT
2407: lgt.trx_header_id,
2408: lgt.trx_line_id,
2409: cgt.trx_contingency_id,
2410: arp_standard.fnd_message('AR_RVMG_INVALID_CONTINGENCY'),
2411: cgt.contingency_id
2412: FROM ar_trx_lines_gt lgt,
2413: ar_trx_header_gt hgt,
2414: ar_trx_contingencies_gt cgt
2447: SELECT
2448: lgt.trx_header_id,
2449: lgt.trx_line_id,
2450: cgt.trx_contingency_id,
2451: arp_standard.fnd_message('AR_RVMG_NO_EXP_DATE'),
2452: cgt.contingency_id
2453: FROM ar_trx_lines_gt lgt,
2454: ar_trx_header_gt hgt,
2455: ar_trx_contingencies_gt cgt,
2510: )
2511: SELECT
2512: l.interface_line_id,
2513: c.interface_contingency_id,
2514: arp_standard.fnd_message('AR_RVMG_INVALID_CONTINGENCY'),
2515: c.contingency_id,
2516: l.org_id
2517: FROM ra_interface_lines l,
2518: ar_interface_conts c
2550: )
2551: SELECT
2552: l.interface_line_id,
2553: c.interface_contingency_id,
2554: arp_standard.fnd_message('AR_RVMG_NO_EXP_DATE'),
2555: c.contingency_id,
2556: l.org_id
2557: FROM ra_interface_lines l,
2558: ar_interface_conts c,
2621:
2622: BEGIN
2623:
2624: IF pg_debug IN ('Y', 'C') THEN
2625: arp_standard.debug('get_base_currency_info()+');
2626: END IF;
2627:
2628: OPEN currency;
2629: FETCH currency INTO g_currency_code_f,
2631: g_minimum_accountable_unit_f;
2632: CLOSE currency;
2633:
2634: IF pg_debug IN ('Y', 'C') THEN
2635: arp_standard.debug('Functional Currency Code : ' || g_currency_code_f);
2636: arp_standard.debug(' Precision : ' || g_precision_f);
2637: arp_standard.debug(' accountable unit : ' ||
2638: g_minimum_accountable_unit_f);
2639: END IF;
2632: CLOSE currency;
2633:
2634: IF pg_debug IN ('Y', 'C') THEN
2635: arp_standard.debug('Functional Currency Code : ' || g_currency_code_f);
2636: arp_standard.debug(' Precision : ' || g_precision_f);
2637: arp_standard.debug(' accountable unit : ' ||
2638: g_minimum_accountable_unit_f);
2639: END IF;
2640:
2633:
2634: IF pg_debug IN ('Y', 'C') THEN
2635: arp_standard.debug('Functional Currency Code : ' || g_currency_code_f);
2636: arp_standard.debug(' Precision : ' || g_precision_f);
2637: arp_standard.debug(' accountable unit : ' ||
2638: g_minimum_accountable_unit_f);
2639: END IF;
2640:
2641: IF pg_debug IN ('Y', 'C') THEN
2638: g_minimum_accountable_unit_f);
2639: END IF;
2640:
2641: IF pg_debug IN ('Y', 'C') THEN
2642: arp_standard.debug('get_base_currency_info()-');
2643: END IF;
2644:
2645: EXCEPTION
2646:
2644:
2645: EXCEPTION
2646:
2647: WHEN NO_DATA_FOUND THEN
2648: arp_standard.debug('NO_DATA_FOUND: get_base_currency_info');
2649: arp_standard.debug(sqlerrm);
2650: RAISE;
2651:
2652: WHEN OTHERS THEN
2645: EXCEPTION
2646:
2647: WHEN NO_DATA_FOUND THEN
2648: arp_standard.debug('NO_DATA_FOUND: get_base_currency_info');
2649: arp_standard.debug(sqlerrm);
2650: RAISE;
2651:
2652: WHEN OTHERS THEN
2653: arp_standard.debug('OTHERS: get_base_currency_info');
2649: arp_standard.debug(sqlerrm);
2650: RAISE;
2651:
2652: WHEN OTHERS THEN
2653: arp_standard.debug('OTHERS: get_base_currency_info');
2654: arp_standard.debug(sqlerrm);
2655: RAISE;
2656:
2657: END get_base_currency_info;
2650: RAISE;
2651:
2652: WHEN OTHERS THEN
2653: arp_standard.debug('OTHERS: get_base_currency_info');
2654: arp_standard.debug(sqlerrm);
2655: RAISE;
2656:
2657: END get_base_currency_info;
2658:
2679: -- for which data is provided, the rest will retain their
2680: -- original values.
2681:
2682: IF pg_debug IN ('Y', 'C') THEN
2683: arp_standard.debug('update_deferred_lines()+');
2684: arp_standard.debug('** update_deferred_lines parameters **');
2685: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2686: arp_standard.debug(' p_customer_trx_line_id : ' ||
2687: p_customer_trx_line_id);
2680: -- original values.
2681:
2682: IF pg_debug IN ('Y', 'C') THEN
2683: arp_standard.debug('update_deferred_lines()+');
2684: arp_standard.debug('** update_deferred_lines parameters **');
2685: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2686: arp_standard.debug(' p_customer_trx_line_id : ' ||
2687: p_customer_trx_line_id);
2688: END IF;
2681:
2682: IF pg_debug IN ('Y', 'C') THEN
2683: arp_standard.debug('update_deferred_lines()+');
2684: arp_standard.debug('** update_deferred_lines parameters **');
2685: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2686: arp_standard.debug(' p_customer_trx_line_id : ' ||
2687: p_customer_trx_line_id);
2688: END IF;
2689:
2682: IF pg_debug IN ('Y', 'C') THEN
2683: arp_standard.debug('update_deferred_lines()+');
2684: arp_standard.debug('** update_deferred_lines parameters **');
2685: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2686: arp_standard.debug(' p_customer_trx_line_id : ' ||
2687: p_customer_trx_line_id);
2688: END IF;
2689:
2690: l_sysdate := trunc(sysdate);
2697:
2698: IF (p_customer_trx_line_id IS NULL) THEN
2699:
2700: IF pg_debug IN ('Y', 'C') THEN
2701: arp_standard.debug('p_customer_trx_line_id IS NULL');
2702: END IF;
2703:
2704: UPDATE ar_deferred_lines
2705: SET line_collectible_flag = nvl(l_line_collectible,
2713:
2714: ELSE
2715:
2716: IF pg_debug IN ('Y', 'C') THEN
2717: arp_standard.debug('p_customer_trx_line_id IS NOT NULL');
2718: END IF;
2719:
2720: UPDATE ar_deferred_lines
2721: SET line_collectible_flag = nvl(l_line_collectible,
2736:
2737: END IF;
2738:
2739: IF pg_debug IN ('Y', 'C') THEN
2740: arp_standard.debug('update_deferred_lines()-');
2741: END IF;
2742:
2743: EXCEPTION
2744:
2743: EXCEPTION
2744:
2745: WHEN NO_DATA_FOUND THEN
2746: IF pg_debug IN ('Y', 'C') THEN
2747: arp_standard.debug('NO_DATA_FOUND: update_deferred_lines');
2748: arp_standard.debug(sqlerrm);
2749: END IF;
2750: RAISE;
2751:
2744:
2745: WHEN NO_DATA_FOUND THEN
2746: IF pg_debug IN ('Y', 'C') THEN
2747: arp_standard.debug('NO_DATA_FOUND: update_deferred_lines');
2748: arp_standard.debug(sqlerrm);
2749: END IF;
2750: RAISE;
2751:
2752: WHEN OTHERS THEN
2750: RAISE;
2751:
2752: WHEN OTHERS THEN
2753: IF pg_debug IN ('Y', 'C') THEN
2754: arp_standard.debug('OTHERS: update_deferred_lines');
2755: arp_standard.debug(sqlerrm);
2756: END IF;
2757: RAISE;
2758:
2751:
2752: WHEN OTHERS THEN
2753: IF pg_debug IN ('Y', 'C') THEN
2754: arp_standard.debug('OTHERS: update_deferred_lines');
2755: arp_standard.debug(sqlerrm);
2756: END IF;
2757: RAISE;
2758:
2759: END update_deferred_lines;
2779: -- This function determined if the invoice in question has
2780: -- invoicing rules assocaited with it.
2781:
2782: IF pg_debug IN ('Y', 'C') THEN
2783: arp_standard.debug('rule_based()+');
2784: arp_standard.debug('** rule_based parameter **');
2785: arp_standard.debug('rule_based: ' || ' p_customer_trx_id : ' ||
2786: p_customer_trx_id);
2787: END IF;
2780: -- invoicing rules assocaited with it.
2781:
2782: IF pg_debug IN ('Y', 'C') THEN
2783: arp_standard.debug('rule_based()+');
2784: arp_standard.debug('** rule_based parameter **');
2785: arp_standard.debug('rule_based: ' || ' p_customer_trx_id : ' ||
2786: p_customer_trx_id);
2787: END IF;
2788:
2781:
2782: IF pg_debug IN ('Y', 'C') THEN
2783: arp_standard.debug('rule_based()+');
2784: arp_standard.debug('** rule_based parameter **');
2785: arp_standard.debug('rule_based: ' || ' p_customer_trx_id : ' ||
2786: p_customer_trx_id);
2787: END IF;
2788:
2789: OPEN c;
2791: l_return_value := c%FOUND;
2792: CLOSE c;
2793:
2794: IF pg_debug IN ('Y', 'C') THEN
2795: arp_standard.debug('rule_based()-');
2796: END IF;
2797: RETURN l_return_value;
2798:
2799: EXCEPTION
2799: EXCEPTION
2800:
2801: WHEN NO_DATA_FOUND THEN
2802: IF pg_debug IN ('Y', 'C') THEN
2803: arp_standard.debug('NO_DATA_FOUND: rule_based');
2804: arp_standard.debug(sqlerrm);
2805: END IF;
2806: RAISE;
2807:
2800:
2801: WHEN NO_DATA_FOUND THEN
2802: IF pg_debug IN ('Y', 'C') THEN
2803: arp_standard.debug('NO_DATA_FOUND: rule_based');
2804: arp_standard.debug(sqlerrm);
2805: END IF;
2806: RAISE;
2807:
2808: WHEN OTHERS THEN
2806: RAISE;
2807:
2808: WHEN OTHERS THEN
2809: IF pg_debug IN ('Y', 'C') THEN
2810: arp_standard.debug('OTHERS: rule_based');
2811: arp_standard.debug(sqlerrm);
2812: END IF;
2813: RAISE;
2814:
2807:
2808: WHEN OTHERS THEN
2809: IF pg_debug IN ('Y', 'C') THEN
2810: arp_standard.debug('OTHERS: rule_based');
2811: arp_standard.debug(sqlerrm);
2812: END IF;
2813: RAISE;
2814:
2815: END rule_based;
2836: -- This function determines if the revenue recognition has run
2837: -- called for this invoices with rules to create the distributions.
2838:
2839: IF pg_debug IN ('Y', 'C') THEN
2840: arp_standard.debug('distributions_created()+');
2841: arp_standard.debug('** distributions_created parameter **');
2842: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2843: END IF;
2844:
2837: -- called for this invoices with rules to create the distributions.
2838:
2839: IF pg_debug IN ('Y', 'C') THEN
2840: arp_standard.debug('distributions_created()+');
2841: arp_standard.debug('** distributions_created parameter **');
2842: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2843: END IF;
2844:
2845: OPEN c;
2838:
2839: IF pg_debug IN ('Y', 'C') THEN
2840: arp_standard.debug('distributions_created()+');
2841: arp_standard.debug('** distributions_created parameter **');
2842: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2843: END IF;
2844:
2845: OPEN c;
2846: FETCH c INTO l_dummy_flag;
2847: l_return_value := c%FOUND;
2848: CLOSE c;
2849:
2850: IF pg_debug IN ('Y', 'C') THEN
2851: arp_standard.debug('distributions_created()-');
2852: END IF;
2853:
2854: RETURN l_return_value;
2855:
2856: EXCEPTION
2857:
2858: WHEN NO_DATA_FOUND THEN
2859: IF pg_debug IN ('Y', 'C') THEN
2860: arp_standard.debug('NO_DATA_FOUND: distributions_created');
2861: arp_standard.debug(sqlerrm);
2862: END IF;
2863: RAISE;
2864:
2857:
2858: WHEN NO_DATA_FOUND THEN
2859: IF pg_debug IN ('Y', 'C') THEN
2860: arp_standard.debug('NO_DATA_FOUND: distributions_created');
2861: arp_standard.debug(sqlerrm);
2862: END IF;
2863: RAISE;
2864:
2865: WHEN OTHERS THEN
2863: RAISE;
2864:
2865: WHEN OTHERS THEN
2866: IF pg_debug IN ('Y', 'C') THEN
2867: arp_standard.debug('OTHERS: distributions_created');
2868: arp_standard.debug(sqlerrm);
2869: END IF;
2870: RAISE;
2871:
2864:
2865: WHEN OTHERS THEN
2866: IF pg_debug IN ('Y', 'C') THEN
2867: arp_standard.debug('OTHERS: distributions_created');
2868: arp_standard.debug(sqlerrm);
2869: END IF;
2870: RAISE;
2871:
2872: END distributions_created;
2890:
2891: BEGIN
2892:
2893: IF pg_debug IN ('Y', 'C') THEN
2894: arp_standard.debug('monitored_transaction()+');
2895: arp_standard.debug('** monitored_transaction parameter **');
2896: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2897: END IF;
2898:
2891: BEGIN
2892:
2893: IF pg_debug IN ('Y', 'C') THEN
2894: arp_standard.debug('monitored_transaction()+');
2895: arp_standard.debug('** monitored_transaction parameter **');
2896: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2897: END IF;
2898:
2899: OPEN monitored_txn;
2892:
2893: IF pg_debug IN ('Y', 'C') THEN
2894: arp_standard.debug('monitored_transaction()+');
2895: arp_standard.debug('** monitored_transaction parameter **');
2896: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2897: END IF;
2898:
2899: OPEN monitored_txn;
2900: FETCH monitored_txn INTO l_dummy_flag;
2900: FETCH monitored_txn INTO l_dummy_flag;
2901:
2902: IF monitored_txn%FOUND THEN
2903: IF pg_debug IN ('Y', 'C') THEN
2904: arp_standard.debug ('RAM-C Transaction');
2905: END IF;
2906: CLOSE monitored_txn;
2907: IF pg_debug IN ('Y', 'C') THEN
2908: arp_standard.debug('monitored_transaction()-');
2904: arp_standard.debug ('RAM-C Transaction');
2905: END IF;
2906: CLOSE monitored_txn;
2907: IF pg_debug IN ('Y', 'C') THEN
2908: arp_standard.debug('monitored_transaction()-');
2909: END IF;
2910: RETURN TRUE;
2911: END IF;
2912: CLOSE monitored_txn;
2911: END IF;
2912: CLOSE monitored_txn;
2913:
2914: IF pg_debug IN ('Y', 'C') THEN
2915: arp_standard.debug ('Not a monitored transaction');
2916: arp_standard.debug('monitored_transaction()-');
2917: END IF;
2918:
2919: RETURN FALSE;
2912: CLOSE monitored_txn;
2913:
2914: IF pg_debug IN ('Y', 'C') THEN
2915: arp_standard.debug ('Not a monitored transaction');
2916: arp_standard.debug('monitored_transaction()-');
2917: END IF;
2918:
2919: RETURN FALSE;
2920:
2921: EXCEPTION
2922:
2923: WHEN NO_DATA_FOUND THEN
2924: IF pg_debug IN ('Y', 'C') THEN
2925: arp_standard.debug('NO_DATA_FOUND: monitored_transaction');
2926: arp_standard.debug(sqlerrm);
2927: END IF;
2928: RAISE;
2929:
2922:
2923: WHEN NO_DATA_FOUND THEN
2924: IF pg_debug IN ('Y', 'C') THEN
2925: arp_standard.debug('NO_DATA_FOUND: monitored_transaction');
2926: arp_standard.debug(sqlerrm);
2927: END IF;
2928: RAISE;
2929:
2930: WHEN OTHERS THEN
2928: RAISE;
2929:
2930: WHEN OTHERS THEN
2931: IF pg_debug IN ('Y', 'C') THEN
2932: arp_standard.debug('OTHERS: ramc_transcation');
2933: arp_standard.debug(sqlerrm);
2934: END IF;
2935: RAISE;
2936:
2929:
2930: WHEN OTHERS THEN
2931: IF pg_debug IN ('Y', 'C') THEN
2932: arp_standard.debug('OTHERS: ramc_transcation');
2933: arp_standard.debug(sqlerrm);
2934: END IF;
2935: RAISE;
2936:
2937: END monitored_transaction;
2954: -- this line anymore.
2955: ---------------------------------------------------------------------------
2956:
2957: IF pg_debug IN ('Y', 'C') THEN
2958: arp_standard.debug('manual_override()+');
2959: arp_standard.debug('** manual_override parameters **');
2960: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2961: arp_standard.debug(' p_customer_trx_line_id : ' ||
2962: p_customer_trx_line_id);
2955: ---------------------------------------------------------------------------
2956:
2957: IF pg_debug IN ('Y', 'C') THEN
2958: arp_standard.debug('manual_override()+');
2959: arp_standard.debug('** manual_override parameters **');
2960: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2961: arp_standard.debug(' p_customer_trx_line_id : ' ||
2962: p_customer_trx_line_id);
2963: END IF;
2956:
2957: IF pg_debug IN ('Y', 'C') THEN
2958: arp_standard.debug('manual_override()+');
2959: arp_standard.debug('** manual_override parameters **');
2960: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2961: arp_standard.debug(' p_customer_trx_line_id : ' ||
2962: p_customer_trx_line_id);
2963: END IF;
2964:
2957: IF pg_debug IN ('Y', 'C') THEN
2958: arp_standard.debug('manual_override()+');
2959: arp_standard.debug('** manual_override parameters **');
2960: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
2961: arp_standard.debug(' p_customer_trx_line_id : ' ||
2962: p_customer_trx_line_id);
2963: END IF;
2964:
2965: l_sysdate := trunc(sysdate);
2967:
2968: IF (p_customer_trx_line_id IS NULL) THEN
2969:
2970: IF pg_debug IN ('Y', 'C') THEN
2971: arp_standard.debug('Manual RAM adjustments done to the entire txn');
2972: END IF;
2973:
2974: update_deferred_lines (
2975: p_customer_trx_id => p_customer_trx_id,
2977:
2978: ELSE
2979:
2980: IF pg_debug IN ('Y', 'C') THEN
2981: arp_standard.debug('Manual RAM adjustments done to a specific line');
2982: END IF;
2983:
2984: update_deferred_lines (
2985: p_customer_trx_line_id => p_customer_trx_line_id,
2987:
2988: END IF;
2989:
2990: IF pg_debug IN ('Y', 'C') THEN
2991: arp_standard.debug('manual_override()-');
2992: END IF;
2993:
2994: EXCEPTION
2995:
2994: EXCEPTION
2995:
2996: WHEN NO_DATA_FOUND THEN
2997: IF pg_debug IN ('Y', 'C') THEN
2998: arp_standard.debug('NO_DATA_FOUND: manual_override');
2999: arp_standard.debug(sqlerrm);
3000: END IF;
3001: RAISE;
3002:
2995:
2996: WHEN NO_DATA_FOUND THEN
2997: IF pg_debug IN ('Y', 'C') THEN
2998: arp_standard.debug('NO_DATA_FOUND: manual_override');
2999: arp_standard.debug(sqlerrm);
3000: END IF;
3001: RAISE;
3002:
3003: WHEN OTHERS THEN
3001: RAISE;
3002:
3003: WHEN OTHERS THEN
3004: IF pg_debug IN ('Y', 'C') THEN
3005: arp_standard.debug('OTHERS: manual_override');
3006: arp_standard.debug(sqlerrm);
3007: END IF;
3008: RAISE;
3009:
3002:
3003: WHEN OTHERS THEN
3004: IF pg_debug IN ('Y', 'C') THEN
3005: arp_standard.debug('OTHERS: manual_override');
3006: arp_standard.debug(sqlerrm);
3007: END IF;
3008: RAISE;
3009:
3010: END manual_override;
3033:
3034: BEGIN
3035:
3036: IF pg_debug IN ('Y', 'C') THEN
3037: arp_standard.debug('update_for_event()+');
3038: arp_standard.debug('** update_for_event parameters **');
3039: arp_standard.debug(' p_cust_trx_line_id : ' ||
3040: p_cust_trx_line_id);
3041: arp_standard.debug(' p_event_code: ' || p_event_code);
3034: BEGIN
3035:
3036: IF pg_debug IN ('Y', 'C') THEN
3037: arp_standard.debug('update_for_event()+');
3038: arp_standard.debug('** update_for_event parameters **');
3039: arp_standard.debug(' p_cust_trx_line_id : ' ||
3040: p_cust_trx_line_id);
3041: arp_standard.debug(' p_event_code: ' || p_event_code);
3042: END IF;
3035:
3036: IF pg_debug IN ('Y', 'C') THEN
3037: arp_standard.debug('update_for_event()+');
3038: arp_standard.debug('** update_for_event parameters **');
3039: arp_standard.debug(' p_cust_trx_line_id : ' ||
3040: p_cust_trx_line_id);
3041: arp_standard.debug(' p_event_code: ' || p_event_code);
3042: END IF;
3043:
3037: arp_standard.debug('update_for_event()+');
3038: arp_standard.debug('** update_for_event parameters **');
3039: arp_standard.debug(' p_cust_trx_line_id : ' ||
3040: p_cust_trx_line_id);
3041: arp_standard.debug(' p_event_code: ' || p_event_code);
3042: END IF;
3043:
3044: -- if we reach here that means, we do care about this event.
3045:
3100:
3101: END LOOP;
3102:
3103: IF pg_debug IN ('Y', 'C') THEN
3104: arp_standard.debug('update_for_event()-');
3105: END IF;
3106:
3107: EXCEPTION
3108:
3107: EXCEPTION
3108:
3109: WHEN NO_DATA_FOUND THEN
3110: IF pg_debug IN ('Y', 'C') THEN
3111: arp_standard.debug('NO_DATA_FOUND: update_for_event');
3112: arp_standard.debug(sqlerrm);
3113: END IF;
3114: RAISE;
3115:
3108:
3109: WHEN NO_DATA_FOUND THEN
3110: IF pg_debug IN ('Y', 'C') THEN
3111: arp_standard.debug('NO_DATA_FOUND: update_for_event');
3112: arp_standard.debug(sqlerrm);
3113: END IF;
3114: RAISE;
3115:
3116: WHEN OTHERS THEN
3114: RAISE;
3115:
3116: WHEN OTHERS THEN
3117: IF pg_debug IN ('Y', 'C') THEN
3118: arp_standard.debug('OTHERS: update_for_event');
3119: arp_standard.debug(sqlerrm);
3120: END IF;
3121: RAISE;
3122:
3115:
3116: WHEN OTHERS THEN
3117: IF pg_debug IN ('Y', 'C') THEN
3118: arp_standard.debug('OTHERS: update_for_event');
3119: arp_standard.debug(sqlerrm);
3120: END IF;
3121: RAISE;
3122:
3123: END update_for_event;
3165: | passed explicitly.
3166: +------------------------------------------------------------------------*/
3167:
3168: IF pg_debug IN ('Y', 'C') THEN
3169: arp_standard.debug('adjust_revenue()+');
3170: arp_standard.debug('** adjust_revenue parameters **');
3171: arp_standard.debug(' p_mode : ' || p_mode);
3172: arp_standard.debug(' p_gl_date : ' || p_gl_date);
3173: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3166: +------------------------------------------------------------------------*/
3167:
3168: IF pg_debug IN ('Y', 'C') THEN
3169: arp_standard.debug('adjust_revenue()+');
3170: arp_standard.debug('** adjust_revenue parameters **');
3171: arp_standard.debug(' p_mode : ' || p_mode);
3172: arp_standard.debug(' p_gl_date : ' || p_gl_date);
3173: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3174: arp_standard.debug(' p_customer_trx_line_id : ' ||
3167:
3168: IF pg_debug IN ('Y', 'C') THEN
3169: arp_standard.debug('adjust_revenue()+');
3170: arp_standard.debug('** adjust_revenue parameters **');
3171: arp_standard.debug(' p_mode : ' || p_mode);
3172: arp_standard.debug(' p_gl_date : ' || p_gl_date);
3173: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3174: arp_standard.debug(' p_customer_trx_line_id : ' ||
3175: p_customer_trx_line_id);
3168: IF pg_debug IN ('Y', 'C') THEN
3169: arp_standard.debug('adjust_revenue()+');
3170: arp_standard.debug('** adjust_revenue parameters **');
3171: arp_standard.debug(' p_mode : ' || p_mode);
3172: arp_standard.debug(' p_gl_date : ' || p_gl_date);
3173: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3174: arp_standard.debug(' p_customer_trx_line_id : ' ||
3175: p_customer_trx_line_id);
3176: arp_standard.debug(' p_amount : ' || p_rev_adj_rec.amount);
3169: arp_standard.debug('adjust_revenue()+');
3170: arp_standard.debug('** adjust_revenue parameters **');
3171: arp_standard.debug(' p_mode : ' || p_mode);
3172: arp_standard.debug(' p_gl_date : ' || p_gl_date);
3173: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3174: arp_standard.debug(' p_customer_trx_line_id : ' ||
3175: p_customer_trx_line_id);
3176: arp_standard.debug(' p_amount : ' || p_rev_adj_rec.amount);
3177: arp_standard.debug(' p_acctd_amount : ' || p_acctd_amount);
3170: arp_standard.debug('** adjust_revenue parameters **');
3171: arp_standard.debug(' p_mode : ' || p_mode);
3172: arp_standard.debug(' p_gl_date : ' || p_gl_date);
3173: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3174: arp_standard.debug(' p_customer_trx_line_id : ' ||
3175: p_customer_trx_line_id);
3176: arp_standard.debug(' p_amount : ' || p_rev_adj_rec.amount);
3177: arp_standard.debug(' p_acctd_amount : ' || p_acctd_amount);
3178: END IF;
3172: arp_standard.debug(' p_gl_date : ' || p_gl_date);
3173: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3174: arp_standard.debug(' p_customer_trx_line_id : ' ||
3175: p_customer_trx_line_id);
3176: arp_standard.debug(' p_amount : ' || p_rev_adj_rec.amount);
3177: arp_standard.debug(' p_acctd_amount : ' || p_acctd_amount);
3178: END IF;
3179:
3180:
3173: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3174: arp_standard.debug(' p_customer_trx_line_id : ' ||
3175: p_customer_trx_line_id);
3176: arp_standard.debug(' p_amount : ' || p_rev_adj_rec.amount);
3177: arp_standard.debug(' p_acctd_amount : ' || p_acctd_amount);
3178: END IF;
3179:
3180:
3181: /*+---------------------------------------------------------------------
3231: -- *** Being called in earned mode ***
3232: IF (p_mode = c_earn_revenue) THEN
3233:
3234: IF pg_debug IN ('Y', 'C') THEN
3235: arp_standard.debug('RAM being called in EARN mode');
3236: END IF;
3237:
3238: IF (rule_based(p_customer_trx_id) AND
3239: NOT distributions_created(p_customer_trx_id)) THEN
3238: IF (rule_based(p_customer_trx_id) AND
3239: NOT distributions_created(p_customer_trx_id)) THEN
3240:
3241: IF pg_debug IN ('Y', 'C') THEN
3242: arp_standard.debug ('revenue recognition has not run for this txn');
3243: END IF;
3244:
3245: -- call to the concurrent program
3246: l_status := arp_auto_rule.create_distributions(
3248: p_debug => 'N',
3249: p_trx_id => p_customer_trx_id);
3250:
3251: IF pg_debug IN ('Y', 'C') THEN
3252: arp_standard.debug ('revenue recognition done');
3253: END IF;
3254:
3255: END IF;
3256:
3272: l_acctd_adjustable_amount := 0;
3273: END IF;
3274:
3275: IF pg_debug IN ('Y', 'C') THEN
3276: arp_standard.debug('adjust_revenue - amount adjustable: ' ||
3277: l_adjustable_amount);
3278: arp_standard.debug('adjust_revenue - aacctd amount adjustable: ' ||
3279: l_acctd_adjustable_amount);
3280: END IF;
3274:
3275: IF pg_debug IN ('Y', 'C') THEN
3276: arp_standard.debug('adjust_revenue - amount adjustable: ' ||
3277: l_adjustable_amount);
3278: arp_standard.debug('adjust_revenue - aacctd amount adjustable: ' ||
3279: l_acctd_adjustable_amount);
3280: END IF;
3281:
3282: IF (l_adjustable_amount < l_rev_adj_rec.amount) THEN
3289: -- initial amount and then adding the adjustable amount.
3290: -----------------------------------------------------------------------
3291:
3292: IF pg_debug IN ('Y', 'C') THEN
3293: arp_standard.debug('Adjustable amount is less the computed amount');
3294: END IF;
3295:
3296: -- The reason we are subtracting the l_rev_adj_rec.amount from the
3297: -- recognized amount is because that is what has been added to
3316:
3317: END IF;
3318:
3319: IF pg_debug IN ('Y', 'C') THEN
3320: arp_standard.debug(l_rev_adj_rec.amount ||
3321: ' Being Earned For Customer Trx ID ' || p_customer_trx_id ||
3322: ' Line ID ' || p_customer_trx_line_id);
3323: END IF;
3324:
3338: x_adjustment_id => l_adjustment_id,
3339: x_adjustment_number => x_adjustment_number);
3340: ELSE
3341: IF pg_debug IN ('Y', 'C') THEN
3342: arp_standard.debug('RAM API skipped for Customer Trx ID ' ||
3343: p_customer_trx_id || ' because amount is zero.');
3344: END IF;
3345:
3346: x_return_status := fnd_api.g_ret_sts_success;
3349: -- *** Being called in un-earn mode ***
3350: ELSE
3351:
3352: IF pg_debug IN ('Y', 'C') THEN
3353: arp_standard.debug('RAM being called in UN-EARN mode');
3354: arp_standard.debug(l_rev_adj_rec.amount ||
3355: ' UnEarned For Customer Trx ID ' || p_customer_trx_id ||
3356: ' Line ID ' || p_customer_trx_line_id);
3357: END IF;
3350: ELSE
3351:
3352: IF pg_debug IN ('Y', 'C') THEN
3353: arp_standard.debug('RAM being called in UN-EARN mode');
3354: arp_standard.debug(l_rev_adj_rec.amount ||
3355: ' UnEarned For Customer Trx ID ' || p_customer_trx_id ||
3356: ' Line ID ' || p_customer_trx_line_id);
3357: END IF;
3358:
3371:
3372: IF x_return_status = fnd_api.g_ret_sts_success THEN
3373:
3374: IF pg_debug IN ('Y', 'C') THEN
3375: arp_standard.debug('Call To RAM API successful');
3376: END IF;
3377:
3378: ELSE
3379:
3377:
3378: ELSE
3379:
3380: IF pg_debug IN ('Y', 'C') THEN
3381: arp_standard.debug('RME encountered an ERROR with RAM!');
3382: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3383: arp_standard.debug(' p_customer_trx_line_id : ' ||
3384: p_customer_trx_line_id);
3385: END IF;
3378: ELSE
3379:
3380: IF pg_debug IN ('Y', 'C') THEN
3381: arp_standard.debug('RME encountered an ERROR with RAM!');
3382: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3383: arp_standard.debug(' p_customer_trx_line_id : ' ||
3384: p_customer_trx_line_id);
3385: END IF;
3386:
3379:
3380: IF pg_debug IN ('Y', 'C') THEN
3381: arp_standard.debug('RME encountered an ERROR with RAM!');
3382: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3383: arp_standard.debug(' p_customer_trx_line_id : ' ||
3384: p_customer_trx_line_id);
3385: END IF;
3386:
3387: fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false,
3387: fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false,
3388: x_msg_data, x_msg_count);
3389:
3390: IF pg_debug IN ('Y', 'C') THEN
3391: arp_standard.debug('Error Reported By RAM API: ' || x_msg_data);
3392: END IF;
3393:
3394: fnd_message.set_name ('AR','GENERIC_MESSAGE');
3395: fnd_message.set_token('GENERIC_TEXT', x_msg_data);
3397:
3398: END IF;
3399:
3400: IF pg_debug IN ('Y', 'C') THEN
3401: arp_standard.debug('adjustment number: ' || l_adjustment_number);
3402: arp_standard.debug('adjustment id: ' || l_adjustment_id);
3403: arp_standard.debug('adjust_revenue()-');
3404: END IF;
3405:
3398: END IF;
3399:
3400: IF pg_debug IN ('Y', 'C') THEN
3401: arp_standard.debug('adjustment number: ' || l_adjustment_number);
3402: arp_standard.debug('adjustment id: ' || l_adjustment_id);
3403: arp_standard.debug('adjust_revenue()-');
3404: END IF;
3405:
3406: EXCEPTION
3399:
3400: IF pg_debug IN ('Y', 'C') THEN
3401: arp_standard.debug('adjustment number: ' || l_adjustment_number);
3402: arp_standard.debug('adjustment id: ' || l_adjustment_id);
3403: arp_standard.debug('adjust_revenue()-');
3404: END IF;
3405:
3406: EXCEPTION
3407:
3406: EXCEPTION
3407:
3408: WHEN NO_DATA_FOUND THEN
3409: IF pg_debug IN ('Y', 'C') THEN
3410: arp_standard.debug('NO_DATA_FOUND: adjust_revenue');
3411: arp_standard.debug(sqlerrm);
3412: END IF;
3413: RAISE;
3414:
3407:
3408: WHEN NO_DATA_FOUND THEN
3409: IF pg_debug IN ('Y', 'C') THEN
3410: arp_standard.debug('NO_DATA_FOUND: adjust_revenue');
3411: arp_standard.debug(sqlerrm);
3412: END IF;
3413: RAISE;
3414:
3415: WHEN OTHERS THEN
3413: RAISE;
3414:
3415: WHEN OTHERS THEN
3416: IF pg_debug IN ('Y', 'C') THEN
3417: arp_standard.debug('OTHERS: adjust_revenue');
3418: arp_standard.debug(sqlerrm);
3419: END IF;
3420: RAISE;
3421:
3414:
3415: WHEN OTHERS THEN
3416: IF pg_debug IN ('Y', 'C') THEN
3417: arp_standard.debug('OTHERS: adjust_revenue');
3418: arp_standard.debug(sqlerrm);
3419: END IF;
3420: RAISE;
3421:
3422: END adjust_revenue;
3488:
3489: -- This subroutine computes the credit classification.
3490:
3491: IF pg_debug IN ('Y', 'C') THEN
3492: arp_standard.debug('creditworthy()+');
3493: arp_standard.debug('** creditworthy parameters **');
3494: arp_standard.debug(' p_customer_account_id : ' ||
3495: p_customer_account_id);
3496: arp_standard.debug(' p_customer_site_use_id : ' ||
3489: -- This subroutine computes the credit classification.
3490:
3491: IF pg_debug IN ('Y', 'C') THEN
3492: arp_standard.debug('creditworthy()+');
3493: arp_standard.debug('** creditworthy parameters **');
3494: arp_standard.debug(' p_customer_account_id : ' ||
3495: p_customer_account_id);
3496: arp_standard.debug(' p_customer_site_use_id : ' ||
3497: p_customer_site_use_id);
3490:
3491: IF pg_debug IN ('Y', 'C') THEN
3492: arp_standard.debug('creditworthy()+');
3493: arp_standard.debug('** creditworthy parameters **');
3494: arp_standard.debug(' p_customer_account_id : ' ||
3495: p_customer_account_id);
3496: arp_standard.debug(' p_customer_site_use_id : ' ||
3497: p_customer_site_use_id);
3498: END IF;
3492: arp_standard.debug('creditworthy()+');
3493: arp_standard.debug('** creditworthy parameters **');
3494: arp_standard.debug(' p_customer_account_id : ' ||
3495: p_customer_account_id);
3496: arp_standard.debug(' p_customer_site_use_id : ' ||
3497: p_customer_site_use_id);
3498: END IF;
3499:
3500: IF NOT g_credit_class_tbl.EXISTS (p_customer_site_use_id) THEN
3507: -- find out if a credit classificaion exist for bill to site, account
3508: -- or party level.
3509:
3510: IF pg_debug IN ('Y', 'C') THEN
3511: arp_standard.debug('Party ID: ' || l_party_id);
3512: END IF;
3513:
3514: --------------------------------------------------------------------------
3515: -- This following logic retrives the classifcation for a customer. First
3519: -- classifcation there.
3520: -------------------------------------------------------------------------
3521:
3522: IF pg_debug IN ('Y', 'C') THEN
3523: arp_standard.debug('Looking at site, account, party for classification');
3524: END IF;
3525:
3526: OPEN site(l_party_id, p_customer_account_id, p_customer_site_use_id);
3527: FETCH site INTO l_credit_classification;
3529:
3530: IF l_credit_classification IS NULL THEN
3531:
3532: IF pg_debug IN ('Y', 'C') THEN
3533: arp_standard.debug('(site) no credit classification');
3534: END IF;
3535:
3536: OPEN account(l_party_id, p_customer_account_id);
3537: FETCH account INTO l_credit_classification;
3541:
3542: IF l_credit_classification IS NULL THEN
3543:
3544: IF pg_debug IN ('Y', 'C') THEN
3545: arp_standard.debug('(account) no credit classification');
3546: END IF;
3547:
3548: OPEN party(l_party_id);
3549: FETCH party INTO l_credit_classification;
3553:
3554: IF l_credit_classification IS NULL THEN
3555:
3556: IF pg_debug IN ('Y', 'C') THEN
3557: arp_standard.debug('(party) no credit classification');
3558: END IF;
3559:
3560: -------------------------------------------------------------------------
3561: -- no credit classification was found for bill to site, account
3577: FETCH parent INTO l_credit_classification;
3578: CLOSE parent;
3579:
3580: IF pg_debug IN ('Y', 'C') THEN
3581: arp_standard.debug('Parent Party ID: ' || l_party_id);
3582: END IF;
3583:
3584: IF l_credit_classification IS NOT NULL THEN
3585: IF pg_debug IN ('Y', 'C') THEN
3582: END IF;
3583:
3584: IF l_credit_classification IS NOT NULL THEN
3585: IF pg_debug IN ('Y', 'C') THEN
3586: arp_standard.debug('(parent) - classification : ' ||
3587: l_credit_classification);
3588: END IF;
3589: EXIT;
3590: END IF;
3599: END IF; -- NOT EXISTS
3600:
3601:
3602: IF pg_debug IN ('Y', 'C') THEN
3603: arp_standard.debug('credit Classification: ' || l_credit_classification);
3604: arp_standard.debug('creditworthy()-');
3605: END IF;
3606:
3607: IF g_credit_class_tbl(p_customer_site_use_id) IN (
3600:
3601:
3602: IF pg_debug IN ('Y', 'C') THEN
3603: arp_standard.debug('credit Classification: ' || l_credit_classification);
3604: arp_standard.debug('creditworthy()-');
3605: END IF;
3606:
3607: IF g_credit_class_tbl(p_customer_site_use_id) IN (
3608: arp_standard.sysparm.credit_classification1,
3604: arp_standard.debug('creditworthy()-');
3605: END IF;
3606:
3607: IF g_credit_class_tbl(p_customer_site_use_id) IN (
3608: arp_standard.sysparm.credit_classification1,
3609: arp_standard.sysparm.credit_classification2,
3610: arp_standard.sysparm.credit_classification3) THEN
3611:
3612: l_verdict := defer;
3605: END IF;
3606:
3607: IF g_credit_class_tbl(p_customer_site_use_id) IN (
3608: arp_standard.sysparm.credit_classification1,
3609: arp_standard.sysparm.credit_classification2,
3610: arp_standard.sysparm.credit_classification3) THEN
3611:
3612: l_verdict := defer;
3613:
3606:
3607: IF g_credit_class_tbl(p_customer_site_use_id) IN (
3608: arp_standard.sysparm.credit_classification1,
3609: arp_standard.sysparm.credit_classification2,
3610: arp_standard.sysparm.credit_classification3) THEN
3611:
3612: l_verdict := defer;
3613:
3614: ELSE
3623: EXCEPTION
3624:
3625: WHEN NO_DATA_FOUND THEN
3626: IF pg_debug IN ('Y', 'C') THEN
3627: arp_standard.debug('NO_DATA_FOUND: creditworthy');
3628: arp_standard.debug(sqlerrm);
3629: END IF;
3630: RETURN NULL;
3631:
3624:
3625: WHEN NO_DATA_FOUND THEN
3626: IF pg_debug IN ('Y', 'C') THEN
3627: arp_standard.debug('NO_DATA_FOUND: creditworthy');
3628: arp_standard.debug(sqlerrm);
3629: END IF;
3630: RETURN NULL;
3631:
3632: WHEN OTHERS THEN
3630: RETURN NULL;
3631:
3632: WHEN OTHERS THEN
3633: IF pg_debug IN ('Y', 'C') THEN
3634: arp_standard.debug(' creditworthy');
3635: arp_standard.debug(sqlerrm);
3636: END IF;
3637: RETURN NULL;
3638:
3631:
3632: WHEN OTHERS THEN
3633: IF pg_debug IN ('Y', 'C') THEN
3634: arp_standard.debug(' creditworthy');
3635: arp_standard.debug(sqlerrm);
3636: END IF;
3637: RETURN NULL;
3638:
3639: END creditworthy;
3658: -- This functions gets total receipt amount applied against
3659: -- the invoice.
3660:
3661: IF pg_debug IN ('Y', 'C') THEN
3662: arp_standard.debug('get_total_application()+');
3663: arp_standard.debug('** get_total_application parameters **');
3664: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3665: END IF;
3666:
3659: -- the invoice.
3660:
3661: IF pg_debug IN ('Y', 'C') THEN
3662: arp_standard.debug('get_total_application()+');
3663: arp_standard.debug('** get_total_application parameters **');
3664: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3665: END IF;
3666:
3667: OPEN total_app;
3660:
3661: IF pg_debug IN ('Y', 'C') THEN
3662: arp_standard.debug('get_total_application()+');
3663: arp_standard.debug('** get_total_application parameters **');
3664: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3665: END IF;
3666:
3667: OPEN total_app;
3668: FETCH total_app INTO l_total_application;
3668: FETCH total_app INTO l_total_application;
3669: CLOSE total_app;
3670:
3671: IF pg_debug IN ('Y', 'C') THEN
3672: arp_standard.debug('get_total_application()-');
3673: END IF;
3674:
3675: RETURN l_total_application;
3676:
3677: EXCEPTION
3678:
3679: WHEN NO_DATA_FOUND THEN
3680: IF pg_debug IN ('Y', 'C') THEN
3681: arp_standard.debug('NO_DATA_FOUND: get_total_application');
3682: arp_standard.debug(sqlerrm);
3683: END IF;
3684: RAISE;
3685:
3678:
3679: WHEN NO_DATA_FOUND THEN
3680: IF pg_debug IN ('Y', 'C') THEN
3681: arp_standard.debug('NO_DATA_FOUND: get_total_application');
3682: arp_standard.debug(sqlerrm);
3683: END IF;
3684: RAISE;
3685:
3686: WHEN OTHERS THEN
3684: RAISE;
3685:
3686: WHEN OTHERS THEN
3687: IF pg_debug IN ('Y', 'C') THEN
3688: arp_standard.debug('OTHERS: get_total_application');
3689: arp_standard.debug(sqlerrm);
3690: END IF;
3691: RAISE;
3692:
3685:
3686: WHEN OTHERS THEN
3687: IF pg_debug IN ('Y', 'C') THEN
3688: arp_standard.debug('OTHERS: get_total_application');
3689: arp_standard.debug(sqlerrm);
3690: END IF;
3691: RAISE;
3692:
3693: END get_total_application;
3712: -- This functions gets total accounted amount receipt amount applied against
3713: -- the invoice.
3714:
3715: IF pg_debug IN ('Y', 'C') THEN
3716: arp_standard.debug('get_acctd_total_application()+');
3717: arp_standard.debug('** get_acctd_total_application parameters **');
3718: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3719: END IF;
3720:
3713: -- the invoice.
3714:
3715: IF pg_debug IN ('Y', 'C') THEN
3716: arp_standard.debug('get_acctd_total_application()+');
3717: arp_standard.debug('** get_acctd_total_application parameters **');
3718: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3719: END IF;
3720:
3721: OPEN acctd_total_app;
3714:
3715: IF pg_debug IN ('Y', 'C') THEN
3716: arp_standard.debug('get_acctd_total_application()+');
3717: arp_standard.debug('** get_acctd_total_application parameters **');
3718: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
3719: END IF;
3720:
3721: OPEN acctd_total_app;
3722: FETCH acctd_total_app INTO l_acctd_total_application;
3722: FETCH acctd_total_app INTO l_acctd_total_application;
3723: CLOSE acctd_total_app;
3724:
3725: IF pg_debug IN ('Y', 'C') THEN
3726: arp_standard.debug('get_acctd_total_application()-');
3727: END IF;
3728:
3729: RETURN l_acctd_total_application;
3730:
3731: EXCEPTION
3732:
3733: WHEN NO_DATA_FOUND THEN
3734: IF pg_debug IN ('Y', 'C') THEN
3735: arp_standard.debug('NO_DATA_FOUND: get_acctd_total_application');
3736: arp_standard.debug(sqlerrm);
3737: END IF;
3738: RAISE;
3739:
3732:
3733: WHEN NO_DATA_FOUND THEN
3734: IF pg_debug IN ('Y', 'C') THEN
3735: arp_standard.debug('NO_DATA_FOUND: get_acctd_total_application');
3736: arp_standard.debug(sqlerrm);
3737: END IF;
3738: RAISE;
3739:
3740: WHEN OTHERS THEN
3738: RAISE;
3739:
3740: WHEN OTHERS THEN
3741: IF pg_debug IN ('Y', 'C') THEN
3742: arp_standard.debug('OTHERS: get_acctd_total_application');
3743: arp_standard.debug(sqlerrm);
3744: END IF;
3745: RAISE;
3746:
3739:
3740: WHEN OTHERS THEN
3741: IF pg_debug IN ('Y', 'C') THEN
3742: arp_standard.debug('OTHERS: get_acctd_total_application');
3743: arp_standard.debug(sqlerrm);
3744: END IF;
3745: RAISE;
3746:
3747: END get_acctd_total_application;
3765: BEGIN
3766:
3767: /*------------------------------------------------------------------------
3768: | This function is a generic function to compute the line balance
3769: | using a standard rounding logic. This function is being called
3770: | both for invoice currency and functional currency. It is important
3771: | to understand the meanign of each parameter, so I give a detailed
3772: | explanations explantion for each parameter.
3773: |
3839: |
3840: +--------------------------------------------------------------------------*/
3841:
3842: IF pg_debug IN ('Y', 'C') THEN
3843: arp_standard.debug('compute_line_amount()+');
3844: arp_standard.debug('** compute_line_amount parameters **');
3845: arp_standard.debug(' p_mode : ' || p_mode);
3846: arp_standard.debug(' p_amount_previously applied : ' ||
3847: p_amount_previously_applied);
3840: +--------------------------------------------------------------------------*/
3841:
3842: IF pg_debug IN ('Y', 'C') THEN
3843: arp_standard.debug('compute_line_amount()+');
3844: arp_standard.debug('** compute_line_amount parameters **');
3845: arp_standard.debug(' p_mode : ' || p_mode);
3846: arp_standard.debug(' p_amount_previously applied : ' ||
3847: p_amount_previously_applied);
3848: arp_standard.debug(' p_current_amount_applied : ' ||
3841:
3842: IF pg_debug IN ('Y', 'C') THEN
3843: arp_standard.debug('compute_line_amount()+');
3844: arp_standard.debug('** compute_line_amount parameters **');
3845: arp_standard.debug(' p_mode : ' || p_mode);
3846: arp_standard.debug(' p_amount_previously applied : ' ||
3847: p_amount_previously_applied);
3848: arp_standard.debug(' p_current_amount_applied : ' ||
3849: p_current_amount_applied);
3842: IF pg_debug IN ('Y', 'C') THEN
3843: arp_standard.debug('compute_line_amount()+');
3844: arp_standard.debug('** compute_line_amount parameters **');
3845: arp_standard.debug(' p_mode : ' || p_mode);
3846: arp_standard.debug(' p_amount_previously applied : ' ||
3847: p_amount_previously_applied);
3848: arp_standard.debug(' p_current_amount_applied : ' ||
3849: p_current_amount_applied);
3850: arp_standard.debug(' p_line_balance_orig : ' ||
3844: arp_standard.debug('** compute_line_amount parameters **');
3845: arp_standard.debug(' p_mode : ' || p_mode);
3846: arp_standard.debug(' p_amount_previously applied : ' ||
3847: p_amount_previously_applied);
3848: arp_standard.debug(' p_current_amount_applied : ' ||
3849: p_current_amount_applied);
3850: arp_standard.debug(' p_line_balance_orig : ' ||
3851: p_line_balance_orig);
3852: arp_standard.debug(' p_currency_code : ' ||
3846: arp_standard.debug(' p_amount_previously applied : ' ||
3847: p_amount_previously_applied);
3848: arp_standard.debug(' p_current_amount_applied : ' ||
3849: p_current_amount_applied);
3850: arp_standard.debug(' p_line_balance_orig : ' ||
3851: p_line_balance_orig);
3852: arp_standard.debug(' p_currency_code : ' ||
3853: p_currency_code);
3854: arp_standard.debug(' p_sum_of_all_lines : ' ||
3848: arp_standard.debug(' p_current_amount_applied : ' ||
3849: p_current_amount_applied);
3850: arp_standard.debug(' p_line_balance_orig : ' ||
3851: p_line_balance_orig);
3852: arp_standard.debug(' p_currency_code : ' ||
3853: p_currency_code);
3854: arp_standard.debug(' p_sum_of_all_lines : ' ||
3855: p_sum_of_all_lines);
3856: arp_standard.debug(' p_current_line_balance : ' ||
3850: arp_standard.debug(' p_line_balance_orig : ' ||
3851: p_line_balance_orig);
3852: arp_standard.debug(' p_currency_code : ' ||
3853: p_currency_code);
3854: arp_standard.debug(' p_sum_of_all_lines : ' ||
3855: p_sum_of_all_lines);
3856: arp_standard.debug(' p_current_line_balance : ' ||
3857: p_current_line_balance);
3858: arp_standard.debug(' p_running_lines_balance : ' ||
3852: arp_standard.debug(' p_currency_code : ' ||
3853: p_currency_code);
3854: arp_standard.debug(' p_sum_of_all_lines : ' ||
3855: p_sum_of_all_lines);
3856: arp_standard.debug(' p_current_line_balance : ' ||
3857: p_current_line_balance);
3858: arp_standard.debug(' p_running_lines_balance : ' ||
3859: p_running_lines_balance);
3860: arp_standard.debug(' p_running_allocated_balance : ' ||
3854: arp_standard.debug(' p_sum_of_all_lines : ' ||
3855: p_sum_of_all_lines);
3856: arp_standard.debug(' p_current_line_balance : ' ||
3857: p_current_line_balance);
3858: arp_standard.debug(' p_running_lines_balance : ' ||
3859: p_running_lines_balance);
3860: arp_standard.debug(' p_running_allocated_balance : ' ||
3861: p_running_allocated_balance);
3862: END IF;
3856: arp_standard.debug(' p_current_line_balance : ' ||
3857: p_current_line_balance);
3858: arp_standard.debug(' p_running_lines_balance : ' ||
3859: p_running_lines_balance);
3860: arp_standard.debug(' p_running_allocated_balance : ' ||
3861: p_running_allocated_balance);
3862: END IF;
3863:
3864: IF (p_sum_of_all_lines = 0) THEN
3901: p_running_allocated_balance := p_running_allocated_balance +
3902: l_computed_line_amount;
3903:
3904: IF pg_debug IN ('Y', 'C') THEN
3905: arp_standard.debug('Calculation : ');
3906: arp_standard.debug('l_computed_line_amount := ');
3907: arp_standard.debug(' arpcurr.currround(');
3908: arp_standard.debug(' p_running_lines_balance / ');
3909: arp_standard.debug(' p_sum_of_all_lines * l_total_amount,');
3902: l_computed_line_amount;
3903:
3904: IF pg_debug IN ('Y', 'C') THEN
3905: arp_standard.debug('Calculation : ');
3906: arp_standard.debug('l_computed_line_amount := ');
3907: arp_standard.debug(' arpcurr.currround(');
3908: arp_standard.debug(' p_running_lines_balance / ');
3909: arp_standard.debug(' p_sum_of_all_lines * l_total_amount,');
3910: arp_standard.debug(' p_currency_code)');
3903:
3904: IF pg_debug IN ('Y', 'C') THEN
3905: arp_standard.debug('Calculation : ');
3906: arp_standard.debug('l_computed_line_amount := ');
3907: arp_standard.debug(' arpcurr.currround(');
3908: arp_standard.debug(' p_running_lines_balance / ');
3909: arp_standard.debug(' p_sum_of_all_lines * l_total_amount,');
3910: arp_standard.debug(' p_currency_code)');
3911: arp_standard.debug(' - p_running_allocated_balance');
3904: IF pg_debug IN ('Y', 'C') THEN
3905: arp_standard.debug('Calculation : ');
3906: arp_standard.debug('l_computed_line_amount := ');
3907: arp_standard.debug(' arpcurr.currround(');
3908: arp_standard.debug(' p_running_lines_balance / ');
3909: arp_standard.debug(' p_sum_of_all_lines * l_total_amount,');
3910: arp_standard.debug(' p_currency_code)');
3911: arp_standard.debug(' - p_running_allocated_balance');
3912: arp_standard.debug('-----------------------------------------');
3905: arp_standard.debug('Calculation : ');
3906: arp_standard.debug('l_computed_line_amount := ');
3907: arp_standard.debug(' arpcurr.currround(');
3908: arp_standard.debug(' p_running_lines_balance / ');
3909: arp_standard.debug(' p_sum_of_all_lines * l_total_amount,');
3910: arp_standard.debug(' p_currency_code)');
3911: arp_standard.debug(' - p_running_allocated_balance');
3912: arp_standard.debug('-----------------------------------------');
3913: arp_standard.debug(' p_running_lines_balance : ' ||
3906: arp_standard.debug('l_computed_line_amount := ');
3907: arp_standard.debug(' arpcurr.currround(');
3908: arp_standard.debug(' p_running_lines_balance / ');
3909: arp_standard.debug(' p_sum_of_all_lines * l_total_amount,');
3910: arp_standard.debug(' p_currency_code)');
3911: arp_standard.debug(' - p_running_allocated_balance');
3912: arp_standard.debug('-----------------------------------------');
3913: arp_standard.debug(' p_running_lines_balance : ' ||
3914: p_running_lines_balance);
3907: arp_standard.debug(' arpcurr.currround(');
3908: arp_standard.debug(' p_running_lines_balance / ');
3909: arp_standard.debug(' p_sum_of_all_lines * l_total_amount,');
3910: arp_standard.debug(' p_currency_code)');
3911: arp_standard.debug(' - p_running_allocated_balance');
3912: arp_standard.debug('-----------------------------------------');
3913: arp_standard.debug(' p_running_lines_balance : ' ||
3914: p_running_lines_balance);
3915: arp_standard.debug(' p_sum_of_all_lines : ' ||
3908: arp_standard.debug(' p_running_lines_balance / ');
3909: arp_standard.debug(' p_sum_of_all_lines * l_total_amount,');
3910: arp_standard.debug(' p_currency_code)');
3911: arp_standard.debug(' - p_running_allocated_balance');
3912: arp_standard.debug('-----------------------------------------');
3913: arp_standard.debug(' p_running_lines_balance : ' ||
3914: p_running_lines_balance);
3915: arp_standard.debug(' p_sum_of_all_lines : ' ||
3916: p_sum_of_all_lines);
3909: arp_standard.debug(' p_sum_of_all_lines * l_total_amount,');
3910: arp_standard.debug(' p_currency_code)');
3911: arp_standard.debug(' - p_running_allocated_balance');
3912: arp_standard.debug('-----------------------------------------');
3913: arp_standard.debug(' p_running_lines_balance : ' ||
3914: p_running_lines_balance);
3915: arp_standard.debug(' p_sum_of_all_lines : ' ||
3916: p_sum_of_all_lines);
3917: arp_standard.debug(' l_total_amount : ' || l_total_amount);
3911: arp_standard.debug(' - p_running_allocated_balance');
3912: arp_standard.debug('-----------------------------------------');
3913: arp_standard.debug(' p_running_lines_balance : ' ||
3914: p_running_lines_balance);
3915: arp_standard.debug(' p_sum_of_all_lines : ' ||
3916: p_sum_of_all_lines);
3917: arp_standard.debug(' l_total_amount : ' || l_total_amount);
3918: arp_standard.debug(' p_currency_code : ' ||
3919: p_currency_code);
3913: arp_standard.debug(' p_running_lines_balance : ' ||
3914: p_running_lines_balance);
3915: arp_standard.debug(' p_sum_of_all_lines : ' ||
3916: p_sum_of_all_lines);
3917: arp_standard.debug(' l_total_amount : ' || l_total_amount);
3918: arp_standard.debug(' p_currency_code : ' ||
3919: p_currency_code);
3920: arp_standard.debug(' p_running_allocated_balance : ' ||
3921: p_running_allocated_balance);
3914: p_running_lines_balance);
3915: arp_standard.debug(' p_sum_of_all_lines : ' ||
3916: p_sum_of_all_lines);
3917: arp_standard.debug(' l_total_amount : ' || l_total_amount);
3918: arp_standard.debug(' p_currency_code : ' ||
3919: p_currency_code);
3920: arp_standard.debug(' p_running_allocated_balance : ' ||
3921: p_running_allocated_balance);
3922: arp_standard.debug(' p_computed_line_amount : ' ||
3916: p_sum_of_all_lines);
3917: arp_standard.debug(' l_total_amount : ' || l_total_amount);
3918: arp_standard.debug(' p_currency_code : ' ||
3919: p_currency_code);
3920: arp_standard.debug(' p_running_allocated_balance : ' ||
3921: p_running_allocated_balance);
3922: arp_standard.debug(' p_computed_line_amount : ' ||
3923: l_computed_line_amount);
3924: END IF;
3918: arp_standard.debug(' p_currency_code : ' ||
3919: p_currency_code);
3920: arp_standard.debug(' p_running_allocated_balance : ' ||
3921: p_running_allocated_balance);
3922: arp_standard.debug(' p_computed_line_amount : ' ||
3923: l_computed_line_amount);
3924: END IF;
3925:
3926:
3928: l_computed_line_amount := l_computed_line_amount - p_current_line_balance;
3929: END IF;
3930:
3931: IF pg_debug IN ('Y', 'C') THEN
3932: arp_standard.debug('compute_line_amount()-');
3933: END IF;
3934:
3935: RETURN l_computed_line_amount;
3936:
3937: EXCEPTION
3938:
3939: WHEN NO_DATA_FOUND THEN
3940: IF pg_debug IN ('Y', 'C') THEN
3941: arp_standard.debug('NO_DATA_FOUND: compute_line_amount');
3942: arp_standard.debug(sqlerrm);
3943: END IF;
3944: RAISE;
3945:
3938:
3939: WHEN NO_DATA_FOUND THEN
3940: IF pg_debug IN ('Y', 'C') THEN
3941: arp_standard.debug('NO_DATA_FOUND: compute_line_amount');
3942: arp_standard.debug(sqlerrm);
3943: END IF;
3944: RAISE;
3945:
3946: WHEN OTHERS THEN
3944: RAISE;
3945:
3946: WHEN OTHERS THEN
3947: IF pg_debug IN ('Y', 'C') THEN
3948: arp_standard.debug('OTHERS: compute_line_amount');
3949: arp_standard.debug(sqlerrm);
3950: END IF;
3951: RAISE;
3952:
3945:
3946: WHEN OTHERS THEN
3947: IF pg_debug IN ('Y', 'C') THEN
3948: arp_standard.debug('OTHERS: compute_line_amount');
3949: arp_standard.debug(sqlerrm);
3950: END IF;
3951: RAISE;
3952:
3953: END compute_line_amount;
4009: | passed variable into the local variables.
4010: +------------------------------------------------------------------------*/
4011:
4012: IF pg_debug IN ('Y', 'C') THEN
4013: arp_standard.debug('get_receipt_parameters()+');
4014: END IF;
4015:
4016: IF (p_mode = c_receipt_application_mode) THEN
4017:
4015:
4016: IF (p_mode = c_receipt_application_mode) THEN
4017:
4018: IF pg_debug IN ('Y', 'C') THEN
4019: arp_standard.debug('receipt application mode');
4020: END IF;
4021:
4022: -- simply copy over.
4023:
4032: x_gl_date := p_gl_date;
4033:
4034: ELSE
4035: IF pg_debug IN ('Y', 'C') THEN
4036: arp_standard.debug('receipt reversal mode');
4037: END IF;
4038:
4039: OPEN application;
4040: FETCH application INTO
4054:
4055: END IF;
4056:
4057: IF pg_debug IN ('Y', 'C') THEN
4058: arp_standard.debug('** get_receipt_parameters **');
4059: arp_standard.debug(' p_mode : ' || p_mode);
4060: arp_standard.debug(' x_customer_trx_id : ' || x_customer_trx_id);
4061: arp_standard.debug(' x_acctd_amount_applied : ' ||
4062: x_acctd_amount_applied);
4055: END IF;
4056:
4057: IF pg_debug IN ('Y', 'C') THEN
4058: arp_standard.debug('** get_receipt_parameters **');
4059: arp_standard.debug(' p_mode : ' || p_mode);
4060: arp_standard.debug(' x_customer_trx_id : ' || x_customer_trx_id);
4061: arp_standard.debug(' x_acctd_amount_applied : ' ||
4062: x_acctd_amount_applied);
4063: arp_standard.debug(' x_exchange_rate : ' || x_exchange_rate);
4056:
4057: IF pg_debug IN ('Y', 'C') THEN
4058: arp_standard.debug('** get_receipt_parameters **');
4059: arp_standard.debug(' p_mode : ' || p_mode);
4060: arp_standard.debug(' x_customer_trx_id : ' || x_customer_trx_id);
4061: arp_standard.debug(' x_acctd_amount_applied : ' ||
4062: x_acctd_amount_applied);
4063: arp_standard.debug(' x_exchange_rate : ' || x_exchange_rate);
4064: arp_standard.debug(' x_invoice_currency_code : ' ||
4057: IF pg_debug IN ('Y', 'C') THEN
4058: arp_standard.debug('** get_receipt_parameters **');
4059: arp_standard.debug(' p_mode : ' || p_mode);
4060: arp_standard.debug(' x_customer_trx_id : ' || x_customer_trx_id);
4061: arp_standard.debug(' x_acctd_amount_applied : ' ||
4062: x_acctd_amount_applied);
4063: arp_standard.debug(' x_exchange_rate : ' || x_exchange_rate);
4064: arp_standard.debug(' x_invoice_currency_code : ' ||
4065: x_invoice_currency_code);
4059: arp_standard.debug(' p_mode : ' || p_mode);
4060: arp_standard.debug(' x_customer_trx_id : ' || x_customer_trx_id);
4061: arp_standard.debug(' x_acctd_amount_applied : ' ||
4062: x_acctd_amount_applied);
4063: arp_standard.debug(' x_exchange_rate : ' || x_exchange_rate);
4064: arp_standard.debug(' x_invoice_currency_code : ' ||
4065: x_invoice_currency_code);
4066: arp_standard.debug(' x_tax_applied : ' || x_tax_applied);
4067: arp_standard.debug(' x_charges_applied : ' || x_charges_applied);
4060: arp_standard.debug(' x_customer_trx_id : ' || x_customer_trx_id);
4061: arp_standard.debug(' x_acctd_amount_applied : ' ||
4062: x_acctd_amount_applied);
4063: arp_standard.debug(' x_exchange_rate : ' || x_exchange_rate);
4064: arp_standard.debug(' x_invoice_currency_code : ' ||
4065: x_invoice_currency_code);
4066: arp_standard.debug(' x_tax_applied : ' || x_tax_applied);
4067: arp_standard.debug(' x_charges_applied : ' || x_charges_applied);
4068: arp_standard.debug(' x_line_applied : ' || x_line_applied);
4062: x_acctd_amount_applied);
4063: arp_standard.debug(' x_exchange_rate : ' || x_exchange_rate);
4064: arp_standard.debug(' x_invoice_currency_code : ' ||
4065: x_invoice_currency_code);
4066: arp_standard.debug(' x_tax_applied : ' || x_tax_applied);
4067: arp_standard.debug(' x_charges_applied : ' || x_charges_applied);
4068: arp_standard.debug(' x_line_applied : ' || x_line_applied);
4069: arp_standard.debug(' x_freight_applied : ' || x_freight_applied);
4070: arp_standard.debug(' x_gl_date : ' || x_gl_date);
4063: arp_standard.debug(' x_exchange_rate : ' || x_exchange_rate);
4064: arp_standard.debug(' x_invoice_currency_code : ' ||
4065: x_invoice_currency_code);
4066: arp_standard.debug(' x_tax_applied : ' || x_tax_applied);
4067: arp_standard.debug(' x_charges_applied : ' || x_charges_applied);
4068: arp_standard.debug(' x_line_applied : ' || x_line_applied);
4069: arp_standard.debug(' x_freight_applied : ' || x_freight_applied);
4070: arp_standard.debug(' x_gl_date : ' || x_gl_date);
4071: arp_standard.debug(' p_recv..._appl..id : ' ||
4064: arp_standard.debug(' x_invoice_currency_code : ' ||
4065: x_invoice_currency_code);
4066: arp_standard.debug(' x_tax_applied : ' || x_tax_applied);
4067: arp_standard.debug(' x_charges_applied : ' || x_charges_applied);
4068: arp_standard.debug(' x_line_applied : ' || x_line_applied);
4069: arp_standard.debug(' x_freight_applied : ' || x_freight_applied);
4070: arp_standard.debug(' x_gl_date : ' || x_gl_date);
4071: arp_standard.debug(' p_recv..._appl..id : ' ||
4072: p_receivable_application_id);
4065: x_invoice_currency_code);
4066: arp_standard.debug(' x_tax_applied : ' || x_tax_applied);
4067: arp_standard.debug(' x_charges_applied : ' || x_charges_applied);
4068: arp_standard.debug(' x_line_applied : ' || x_line_applied);
4069: arp_standard.debug(' x_freight_applied : ' || x_freight_applied);
4070: arp_standard.debug(' x_gl_date : ' || x_gl_date);
4071: arp_standard.debug(' p_recv..._appl..id : ' ||
4072: p_receivable_application_id);
4073: arp_standard.debug('get_receipt_parameters()-');
4066: arp_standard.debug(' x_tax_applied : ' || x_tax_applied);
4067: arp_standard.debug(' x_charges_applied : ' || x_charges_applied);
4068: arp_standard.debug(' x_line_applied : ' || x_line_applied);
4069: arp_standard.debug(' x_freight_applied : ' || x_freight_applied);
4070: arp_standard.debug(' x_gl_date : ' || x_gl_date);
4071: arp_standard.debug(' p_recv..._appl..id : ' ||
4072: p_receivable_application_id);
4073: arp_standard.debug('get_receipt_parameters()-');
4074: END IF;
4067: arp_standard.debug(' x_charges_applied : ' || x_charges_applied);
4068: arp_standard.debug(' x_line_applied : ' || x_line_applied);
4069: arp_standard.debug(' x_freight_applied : ' || x_freight_applied);
4070: arp_standard.debug(' x_gl_date : ' || x_gl_date);
4071: arp_standard.debug(' p_recv..._appl..id : ' ||
4072: p_receivable_application_id);
4073: arp_standard.debug('get_receipt_parameters()-');
4074: END IF;
4075:
4069: arp_standard.debug(' x_freight_applied : ' || x_freight_applied);
4070: arp_standard.debug(' x_gl_date : ' || x_gl_date);
4071: arp_standard.debug(' p_recv..._appl..id : ' ||
4072: p_receivable_application_id);
4073: arp_standard.debug('get_receipt_parameters()-');
4074: END IF;
4075:
4076: EXCEPTION
4077:
4076: EXCEPTION
4077:
4078: WHEN NO_DATA_FOUND THEN
4079: IF pg_debug IN ('Y', 'C') THEN
4080: arp_standard.debug('NO_DATA_FOUND: get_receipt_parameters');
4081: arp_standard.debug(sqlerrm);
4082: END IF;
4083: RAISE;
4084:
4077:
4078: WHEN NO_DATA_FOUND THEN
4079: IF pg_debug IN ('Y', 'C') THEN
4080: arp_standard.debug('NO_DATA_FOUND: get_receipt_parameters');
4081: arp_standard.debug(sqlerrm);
4082: END IF;
4083: RAISE;
4084:
4085: WHEN OTHERS THEN
4083: RAISE;
4084:
4085: WHEN OTHERS THEN
4086: IF pg_debug IN ('Y', 'C') THEN
4087: arp_standard.debug('OTHERS: get_receipt_parameters');
4088: arp_standard.debug(sqlerrm);
4089: END IF;
4090: RAISE;
4091:
4084:
4085: WHEN OTHERS THEN
4086: IF pg_debug IN ('Y', 'C') THEN
4087: arp_standard.debug('OTHERS: get_receipt_parameters');
4088: arp_standard.debug(sqlerrm);
4089: END IF;
4090: RAISE;
4091:
4092: END get_receipt_parameters;
4183: | scenarios we are facing.
4184: +------------------------------------------------------------------------*/
4185:
4186: IF pg_debug IN ('Y', 'C') THEN
4187: arp_standard.debug('get_line_status()+');
4188: arp_standard.debug('** get_line_status parameters **');
4189: arp_standard.debug(' line : ' || p_cust_trx_line_id);
4190: END IF;
4191:
4184: +------------------------------------------------------------------------*/
4185:
4186: IF pg_debug IN ('Y', 'C') THEN
4187: arp_standard.debug('get_line_status()+');
4188: arp_standard.debug('** get_line_status parameters **');
4189: arp_standard.debug(' line : ' || p_cust_trx_line_id);
4190: END IF;
4191:
4192: /* 7276627 - review contingencies by customer_trx_line_id */
4185:
4186: IF pg_debug IN ('Y', 'C') THEN
4187: arp_standard.debug('get_line_status()+');
4188: arp_standard.debug('** get_line_status parameters **');
4189: arp_standard.debug(' line : ' || p_cust_trx_line_id);
4190: END IF;
4191:
4192: /* 7276627 - review contingencies by customer_trx_line_id */
4193: review_contingencies(p_cust_trx_line_id);
4212: l_line_status := c_recognizable;
4213: END IF;
4214:
4215: IF pg_debug IN ('Y', 'C') THEN
4216: arp_standard.debug('get_receipt_analyzer_scenario()-');
4217: END IF;
4218:
4219: RETURN l_line_status;
4220:
4220:
4221: EXCEPTION
4222: WHEN OTHERS THEN
4223: IF pg_debug IN ('Y', 'C') THEN
4224: arp_standard.debug('OTHERS: get_line_status');
4225: arp_standard.debug(sqlerrm);
4226: END IF;
4227: RAISE;
4228:
4221: EXCEPTION
4222: WHEN OTHERS THEN
4223: IF pg_debug IN ('Y', 'C') THEN
4224: arp_standard.debug('OTHERS: get_line_status');
4225: arp_standard.debug(sqlerrm);
4226: END IF;
4227: RAISE;
4228:
4229: END get_line_status;
4280: -- for which data is provided, the rest will retain their
4281: -- original values.
4282:
4283: IF pg_debug IN ('Y', 'C') THEN
4284: arp_standard.debug('update_line_conts()+');
4285: arp_standard.debug('** parameters **');
4286: arp_standard.debug(' p_customer_trx_line_id : ' ||
4287: p_customer_trx_line_id);
4288: arp_standard.debug(' p_contingency_id : ' ||
4281: -- original values.
4282:
4283: IF pg_debug IN ('Y', 'C') THEN
4284: arp_standard.debug('update_line_conts()+');
4285: arp_standard.debug('** parameters **');
4286: arp_standard.debug(' p_customer_trx_line_id : ' ||
4287: p_customer_trx_line_id);
4288: arp_standard.debug(' p_contingency_id : ' ||
4289: p_contingency_id);
4282:
4283: IF pg_debug IN ('Y', 'C') THEN
4284: arp_standard.debug('update_line_conts()+');
4285: arp_standard.debug('** parameters **');
4286: arp_standard.debug(' p_customer_trx_line_id : ' ||
4287: p_customer_trx_line_id);
4288: arp_standard.debug(' p_contingency_id : ' ||
4289: p_contingency_id);
4290: END IF;
4284: arp_standard.debug('update_line_conts()+');
4285: arp_standard.debug('** parameters **');
4286: arp_standard.debug(' p_customer_trx_line_id : ' ||
4287: p_customer_trx_line_id);
4288: arp_standard.debug(' p_contingency_id : ' ||
4289: p_contingency_id);
4290: END IF;
4291:
4292: l_sysdate := trunc(sysdate);
4305: WHERE customer_trx_line_id = p_customer_trx_line_id
4306: AND contingency_id = p_contingency_id;
4307:
4308: IF pg_debug IN ('Y', 'C') THEN
4309: arp_standard.debug('update_line_conts()-');
4310: END IF;
4311:
4312: EXCEPTION
4313:
4312: EXCEPTION
4313:
4314: WHEN NO_DATA_FOUND THEN
4315: IF pg_debug IN ('Y', 'C') THEN
4316: arp_standard.debug('NO_DATA_FOUND: update_line_conts');
4317: arp_standard.debug(sqlerrm);
4318: END IF;
4319: RAISE;
4320:
4313:
4314: WHEN NO_DATA_FOUND THEN
4315: IF pg_debug IN ('Y', 'C') THEN
4316: arp_standard.debug('NO_DATA_FOUND: update_line_conts');
4317: arp_standard.debug(sqlerrm);
4318: END IF;
4319: RAISE;
4320:
4321: WHEN OTHERS THEN
4319: RAISE;
4320:
4321: WHEN OTHERS THEN
4322: IF pg_debug IN ('Y', 'C') THEN
4323: arp_standard.debug('OTHERS: update_line_conts');
4324: arp_standard.debug(sqlerrm);
4325: END IF;
4326: RAISE;
4327:
4320:
4321: WHEN OTHERS THEN
4322: IF pg_debug IN ('Y', 'C') THEN
4323: arp_standard.debug('OTHERS: update_line_conts');
4324: arp_standard.debug(sqlerrm);
4325: END IF;
4326: RAISE;
4327:
4328: END update_line_conts;
4363: -- for which data is provided, the rest will retain their
4364: -- original values.
4365:
4366: IF pg_debug IN ('Y', 'C') THEN
4367: arp_standard.debug('delete_line_conts()+');
4368: arp_standard.debug('** delete_line_conts parameters **');
4369: arp_standard.debug(' p_customer_trx_line_id : ' ||
4370: p_customer_trx_line_id);
4371: arp_standard.debug(' p_contingency_id : ' ||
4364: -- original values.
4365:
4366: IF pg_debug IN ('Y', 'C') THEN
4367: arp_standard.debug('delete_line_conts()+');
4368: arp_standard.debug('** delete_line_conts parameters **');
4369: arp_standard.debug(' p_customer_trx_line_id : ' ||
4370: p_customer_trx_line_id);
4371: arp_standard.debug(' p_contingency_id : ' ||
4372: p_contingency_id);
4365:
4366: IF pg_debug IN ('Y', 'C') THEN
4367: arp_standard.debug('delete_line_conts()+');
4368: arp_standard.debug('** delete_line_conts parameters **');
4369: arp_standard.debug(' p_customer_trx_line_id : ' ||
4370: p_customer_trx_line_id);
4371: arp_standard.debug(' p_contingency_id : ' ||
4372: p_contingency_id);
4373: END IF;
4367: arp_standard.debug('delete_line_conts()+');
4368: arp_standard.debug('** delete_line_conts parameters **');
4369: arp_standard.debug(' p_customer_trx_line_id : ' ||
4370: p_customer_trx_line_id);
4371: arp_standard.debug(' p_contingency_id : ' ||
4372: p_contingency_id);
4373: END IF;
4374:
4375: DELETE
4377: WHERE customer_trx_line_id = p_customer_trx_line_id
4378: AND contingency_id = p_contingency_id;
4379:
4380: IF pg_debug IN ('Y', 'C') THEN
4381: arp_standard.debug('delete_line_conts()-');
4382: END IF;
4383:
4384: EXCEPTION
4385:
4384: EXCEPTION
4385:
4386: WHEN NO_DATA_FOUND THEN
4387: IF pg_debug IN ('Y', 'C') THEN
4388: arp_standard.debug('NO_DATA_FOUND: delete_line_conts');
4389: arp_standard.debug(sqlerrm);
4390: END IF;
4391: RAISE;
4392:
4385:
4386: WHEN NO_DATA_FOUND THEN
4387: IF pg_debug IN ('Y', 'C') THEN
4388: arp_standard.debug('NO_DATA_FOUND: delete_line_conts');
4389: arp_standard.debug(sqlerrm);
4390: END IF;
4391: RAISE;
4392:
4393: WHEN OTHERS THEN
4391: RAISE;
4392:
4393: WHEN OTHERS THEN
4394: IF pg_debug IN ('Y', 'C') THEN
4395: arp_standard.debug('OTHERS: delete_line_conts');
4396: arp_standard.debug(sqlerrm);
4397: END IF;
4398: RAISE;
4399:
4392:
4393: WHEN OTHERS THEN
4394: IF pg_debug IN ('Y', 'C') THEN
4395: arp_standard.debug('OTHERS: delete_line_conts');
4396: arp_standard.debug(sqlerrm);
4397: END IF;
4398: RAISE;
4399:
4400: END delete_line_conts;
4440: -- it automatically means Revenue Management would not manage that
4441: -- transaction. So, this subroutine returns TRUE in hard coded
4442: -- fashion.
4443:
4444: arp_standard.debug('ar_revenue_management_pvt.revenue_management_enabled()+');
4445: l_return_value := TRUE;
4446:
4447: arp_standard.debug('ar_revenue_management_pvt.revenue_management_enabled()-');
4448: RETURN l_return_value;
4443:
4444: arp_standard.debug('ar_revenue_management_pvt.revenue_management_enabled()+');
4445: l_return_value := TRUE;
4446:
4447: arp_standard.debug('ar_revenue_management_pvt.revenue_management_enabled()-');
4448: RETURN l_return_value;
4449:
4450: EXCEPTION
4451:
4449:
4450: EXCEPTION
4451:
4452: WHEN NO_DATA_FOUND THEN
4453: arp_standard.debug('NO_DATA_FOUND: revenue_management_enabled');
4454: arp_standard.debug(sqlerrm);
4455: RAISE;
4456:
4457: WHEN OTHERS THEN
4450: EXCEPTION
4451:
4452: WHEN NO_DATA_FOUND THEN
4453: arp_standard.debug('NO_DATA_FOUND: revenue_management_enabled');
4454: arp_standard.debug(sqlerrm);
4455: RAISE;
4456:
4457: WHEN OTHERS THEN
4458: arp_standard.debug('OTHERS: revenue_management_enabled');
4454: arp_standard.debug(sqlerrm);
4455: RAISE;
4456:
4457: WHEN OTHERS THEN
4458: arp_standard.debug('OTHERS: revenue_management_enabled');
4459: arp_standard.debug(sqlerrm);
4460: RAISE;
4461:
4462: END revenue_management_enabled;
4455: RAISE;
4456:
4457: WHEN OTHERS THEN
4458: arp_standard.debug('OTHERS: revenue_management_enabled');
4459: arp_standard.debug(sqlerrm);
4460: RAISE;
4461:
4462: END revenue_management_enabled;
4463:
4514:
4515: BEGIN
4516:
4517: IF pg_debug IN ('Y', 'C') THEN
4518: arp_standard.debug('ar_revenue_management_pvt.line_collectible()+');
4519: arp_standard.debug('** line_collectible parameters **');
4520: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4521: arp_standard.debug(' p_customer_trx_line_id : ' ||
4522: p_customer_trx_line_id);
4515: BEGIN
4516:
4517: IF pg_debug IN ('Y', 'C') THEN
4518: arp_standard.debug('ar_revenue_management_pvt.line_collectible()+');
4519: arp_standard.debug('** line_collectible parameters **');
4520: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4521: arp_standard.debug(' p_customer_trx_line_id : ' ||
4522: p_customer_trx_line_id);
4523: END IF;
4516:
4517: IF pg_debug IN ('Y', 'C') THEN
4518: arp_standard.debug('ar_revenue_management_pvt.line_collectible()+');
4519: arp_standard.debug('** line_collectible parameters **');
4520: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4521: arp_standard.debug(' p_customer_trx_line_id : ' ||
4522: p_customer_trx_line_id);
4523: END IF;
4524:
4517: IF pg_debug IN ('Y', 'C') THEN
4518: arp_standard.debug('ar_revenue_management_pvt.line_collectible()+');
4519: arp_standard.debug('** line_collectible parameters **');
4520: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4521: arp_standard.debug(' p_customer_trx_line_id : ' ||
4522: p_customer_trx_line_id);
4523: END IF;
4524:
4525: OPEN c;
4535:
4536: CLOSE c;
4537:
4538: IF pg_debug IN ('Y', 'C') THEN
4539: arp_standard.debug('ar_revenue_management_pvt.line_collectible()-');
4540: END IF;
4541:
4542: RETURN l_return_value;
4543:
4544: EXCEPTION
4545:
4546: WHEN NO_DATA_FOUND THEN
4547: IF pg_debug IN ('Y', 'C') THEN
4548: arp_standard.debug('NO_DATA_FOUND: line_collectible');
4549: arp_standard.debug(sqlerrm);
4550: END IF;
4551: RAISE;
4552:
4545:
4546: WHEN NO_DATA_FOUND THEN
4547: IF pg_debug IN ('Y', 'C') THEN
4548: arp_standard.debug('NO_DATA_FOUND: line_collectible');
4549: arp_standard.debug(sqlerrm);
4550: END IF;
4551: RAISE;
4552:
4553: WHEN OTHERS THEN
4551: RAISE;
4552:
4553: WHEN OTHERS THEN
4554: IF pg_debug IN ('Y', 'C') THEN
4555: arp_standard.debug('OTHERS: line_collectible');
4556: arp_standard.debug(sqlerrm);
4557: END IF;
4558: RAISE;
4559:
4552:
4553: WHEN OTHERS THEN
4554: IF pg_debug IN ('Y', 'C') THEN
4555: arp_standard.debug('OTHERS: line_collectible');
4556: arp_standard.debug(sqlerrm);
4557: END IF;
4558: RAISE;
4559:
4560: END line_collectible;
4606:
4607: BEGIN
4608:
4609: IF pg_debug IN ('Y', 'C') THEN
4610: arp_standard.debug('ar_revenue_management_pvt.txn_collectible()+');
4611: arp_standard.debug('** txn_collectible parameters **');
4612: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4613: END IF;
4614:
4607: BEGIN
4608:
4609: IF pg_debug IN ('Y', 'C') THEN
4610: arp_standard.debug('ar_revenue_management_pvt.txn_collectible()+');
4611: arp_standard.debug('** txn_collectible parameters **');
4612: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4613: END IF;
4614:
4615: OPEN c;
4608:
4609: IF pg_debug IN ('Y', 'C') THEN
4610: arp_standard.debug('ar_revenue_management_pvt.txn_collectible()+');
4611: arp_standard.debug('** txn_collectible parameters **');
4612: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4613: END IF;
4614:
4615: OPEN c;
4616: FETCH c INTO l_flag;
4617: l_return_value := c%NOTFOUND;
4618: CLOSE c;
4619:
4620: IF pg_debug IN ('Y', 'C') THEN
4621: arp_standard.debug('ar_revenue_management_pvt.txn_collectible()-');
4622: END IF;
4623:
4624: RETURN l_return_value;
4625:
4626: EXCEPTION
4627:
4628: WHEN NO_DATA_FOUND THEN
4629: IF pg_debug IN ('Y', 'C') THEN
4630: arp_standard.debug('NO_DATA_FOUND: txn_collectible');
4631: arp_standard.debug(sqlerrm);
4632: END IF;
4633: RAISE;
4634:
4627:
4628: WHEN NO_DATA_FOUND THEN
4629: IF pg_debug IN ('Y', 'C') THEN
4630: arp_standard.debug('NO_DATA_FOUND: txn_collectible');
4631: arp_standard.debug(sqlerrm);
4632: END IF;
4633: RAISE;
4634:
4635: WHEN OTHERS THEN
4633: RAISE;
4634:
4635: WHEN OTHERS THEN
4636: IF pg_debug IN ('Y', 'C') THEN
4637: arp_standard.debug('OTHERS: txn_collectible');
4638: arp_standard.debug(sqlerrm);
4639: END IF;
4640: RAISE;
4641:
4634:
4635: WHEN OTHERS THEN
4636: IF pg_debug IN ('Y', 'C') THEN
4637: arp_standard.debug('OTHERS: txn_collectible');
4638: arp_standard.debug(sqlerrm);
4639: END IF;
4640: RAISE;
4641:
4642: END txn_collectible;
4672:
4673: BEGIN
4674:
4675: IF pg_debug IN ('Y', 'C') THEN
4676: arp_standard.debug('ar_revenue_management_pvt.delete_failed_rows()+');
4677: arp_standard.debug('** delete_failed_rows parameters **');
4678: arp_standard.debug(' p_request_id : ' || p_request_id);
4679: END IF;
4680:
4673: BEGIN
4674:
4675: IF pg_debug IN ('Y', 'C') THEN
4676: arp_standard.debug('ar_revenue_management_pvt.delete_failed_rows()+');
4677: arp_standard.debug('** delete_failed_rows parameters **');
4678: arp_standard.debug(' p_request_id : ' || p_request_id);
4679: END IF;
4680:
4681: DELETE FROM ar_deferred_lines
4674:
4675: IF pg_debug IN ('Y', 'C') THEN
4676: arp_standard.debug('ar_revenue_management_pvt.delete_failed_rows()+');
4677: arp_standard.debug('** delete_failed_rows parameters **');
4678: arp_standard.debug(' p_request_id : ' || p_request_id);
4679: END IF;
4680:
4681: DELETE FROM ar_deferred_lines
4682: WHERE request_id = p_request_id;
4684: DELETE FROM ar_line_conts
4685: WHERE request_id = p_request_id;
4686:
4687: IF pg_debug IN ('Y', 'C') THEN
4688: arp_standard.debug('ar_revenue_management_pvt.delete_failed_rows()-');
4689: END IF;
4690:
4691: EXCEPTION
4692:
4691: EXCEPTION
4692:
4693: WHEN NO_DATA_FOUND THEN
4694: IF pg_debug IN ('Y', 'C') THEN
4695: arp_standard.debug('NO_DATA_FOUND: delete_failed_rows');
4696: arp_standard.debug(sqlerrm);
4697: END IF;
4698: RAISE;
4699:
4692:
4693: WHEN NO_DATA_FOUND THEN
4694: IF pg_debug IN ('Y', 'C') THEN
4695: arp_standard.debug('NO_DATA_FOUND: delete_failed_rows');
4696: arp_standard.debug(sqlerrm);
4697: END IF;
4698: RAISE;
4699:
4700: WHEN OTHERS THEN
4698: RAISE;
4699:
4700: WHEN OTHERS THEN
4701: IF pg_debug IN ('Y', 'C') THEN
4702: arp_standard.debug('OTHERS: delete_failed_rows');
4703: arp_standard.debug(sqlerrm);
4704: END IF;
4705: RAISE;
4706:
4699:
4700: WHEN OTHERS THEN
4701: IF pg_debug IN ('Y', 'C') THEN
4702: arp_standard.debug('OTHERS: delete_failed_rows');
4703: arp_standard.debug(sqlerrm);
4704: END IF;
4705: RAISE;
4706:
4707: END delete_failed_rows;
4866: | do not have an acceptance problem.
4867: +------------------------------------------------------------------------*/
4868:
4869: IF pg_debug IN ('Y', 'C') THEN
4870: arp_standard.debug('ar_revenue_management_pvt.acceptance_allowed()+');
4871: arp_standard.debug('** acceptance_allowed parameters **');
4872: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4873: arp_standard.debug(' p_customer_trx_line_id : ' ||
4874: p_customer_trx_line_id);
4867: +------------------------------------------------------------------------*/
4868:
4869: IF pg_debug IN ('Y', 'C') THEN
4870: arp_standard.debug('ar_revenue_management_pvt.acceptance_allowed()+');
4871: arp_standard.debug('** acceptance_allowed parameters **');
4872: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4873: arp_standard.debug(' p_customer_trx_line_id : ' ||
4874: p_customer_trx_line_id);
4875: END IF;
4868:
4869: IF pg_debug IN ('Y', 'C') THEN
4870: arp_standard.debug('ar_revenue_management_pvt.acceptance_allowed()+');
4871: arp_standard.debug('** acceptance_allowed parameters **');
4872: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4873: arp_standard.debug(' p_customer_trx_line_id : ' ||
4874: p_customer_trx_line_id);
4875: END IF;
4876:
4869: IF pg_debug IN ('Y', 'C') THEN
4870: arp_standard.debug('ar_revenue_management_pvt.acceptance_allowed()+');
4871: arp_standard.debug('** acceptance_allowed parameters **');
4872: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4873: arp_standard.debug(' p_customer_trx_line_id : ' ||
4874: p_customer_trx_line_id);
4875: END IF;
4876:
4877:
4877:
4878: IF NOT monitored_transaction(p_customer_trx_id) THEN
4879:
4880: IF pg_debug IN ('Y', 'C') THEN
4881: arp_standard.debug('Not A RAMC Transaction');
4882: END IF;
4883: l_return_value := c_transaction_not_monitored;
4884:
4885: ELSE
4884:
4885: ELSE
4886:
4887: IF pg_debug IN ('Y', 'C') THEN
4888: arp_standard.debug('It is a RAMC Transaction');
4889: END IF;
4890: OPEN contingencies;
4891: FETCH contingencies INTO l_dummy;
4892: IF contingencies%NOTFOUND THEN
4890: OPEN contingencies;
4891: FETCH contingencies INTO l_dummy;
4892: IF contingencies%NOTFOUND THEN
4893: IF pg_debug IN ('Y', 'C') THEN
4894: arp_standard.debug('acceptance not required');
4895: END IF;
4896: l_return_value := c_acceptance_not_required;
4897: END IF;
4898: CLOSE contingencies;
4899:
4900: END IF;
4901:
4902: IF pg_debug IN ('Y', 'C') THEN
4903: arp_standard.debug('Acceptance Allowed? : ' || l_return_value);
4904: arp_standard.debug('ar_revenue_management_pvt.acceptance_allowed()-');
4905: END IF;
4906:
4907: RETURN l_return_value;
4900: END IF;
4901:
4902: IF pg_debug IN ('Y', 'C') THEN
4903: arp_standard.debug('Acceptance Allowed? : ' || l_return_value);
4904: arp_standard.debug('ar_revenue_management_pvt.acceptance_allowed()-');
4905: END IF;
4906:
4907: RETURN l_return_value;
4908:
4909: EXCEPTION
4910:
4911: WHEN NO_DATA_FOUND THEN
4912: IF pg_debug IN ('Y', 'C') THEN
4913: arp_standard.debug('NO_DATA_FOUND: acceptance_allowed');
4914: arp_standard.debug(sqlerrm);
4915: END IF;
4916: RAISE;
4917:
4910:
4911: WHEN NO_DATA_FOUND THEN
4912: IF pg_debug IN ('Y', 'C') THEN
4913: arp_standard.debug('NO_DATA_FOUND: acceptance_allowed');
4914: arp_standard.debug(sqlerrm);
4915: END IF;
4916: RAISE;
4917:
4918: WHEN OTHERS THEN
4916: RAISE;
4917:
4918: WHEN OTHERS THEN
4919: IF pg_debug IN ('Y', 'C') THEN
4920: arp_standard.debug('OTHERS: acceptance_allowed');
4921: arp_standard.debug(sqlerrm);
4922: END IF;
4923: RAISE;
4924:
4917:
4918: WHEN OTHERS THEN
4919: IF pg_debug IN ('Y', 'C') THEN
4920: arp_standard.debug('OTHERS: acceptance_allowed');
4921: arp_standard.debug(sqlerrm);
4922: END IF;
4923: RAISE;
4924:
4925: END acceptance_allowed;
4969:
4970: BEGIN
4971:
4972: IF pg_debug IN ('Y', 'C') THEN
4973: arp_standard.debug('ar_revenue_management_pvt.cash_based()+');
4974: arp_standard.debug('** cash_based parameters **');
4975: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4976: END IF;
4977:
4970: BEGIN
4971:
4972: IF pg_debug IN ('Y', 'C') THEN
4973: arp_standard.debug('ar_revenue_management_pvt.cash_based()+');
4974: arp_standard.debug('** cash_based parameters **');
4975: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4976: END IF;
4977:
4978: IF NOT monitored_transaction (p_customer_trx_id) THEN
4971:
4972: IF pg_debug IN ('Y', 'C') THEN
4973: arp_standard.debug('ar_revenue_management_pvt.cash_based()+');
4974: arp_standard.debug('** cash_based parameters **');
4975: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
4976: END IF;
4977:
4978: IF NOT monitored_transaction (p_customer_trx_id) THEN
4979: IF pg_debug IN ('Y', 'C') THEN
4976: END IF;
4977:
4978: IF NOT monitored_transaction (p_customer_trx_id) THEN
4979: IF pg_debug IN ('Y', 'C') THEN
4980: arp_standard.debug ('*** This Transaction Is Not Being Monitored ***');
4981: END IF;
4982: RETURN c_no;
4983: END IF;
4984:
4993:
4994: CLOSE contingencies;
4995:
4996: IF pg_debug IN ('Y', 'C') THEN
4997: arp_standard.debug('ar_revenue_management_pvt.cash_based()-');
4998: END IF;
4999:
5000: EXCEPTION
5001:
5000: EXCEPTION
5001:
5002: WHEN NO_DATA_FOUND THEN
5003: IF pg_debug IN ('Y', 'C') THEN
5004: arp_standard.debug('NO_DATA_FOUND: cash_based');
5005: arp_standard.debug(sqlerrm);
5006: END IF;
5007: RAISE;
5008:
5001:
5002: WHEN NO_DATA_FOUND THEN
5003: IF pg_debug IN ('Y', 'C') THEN
5004: arp_standard.debug('NO_DATA_FOUND: cash_based');
5005: arp_standard.debug(sqlerrm);
5006: END IF;
5007: RAISE;
5008:
5009: WHEN OTHERS THEN
5007: RAISE;
5008:
5009: WHEN OTHERS THEN
5010: IF pg_debug IN ('Y', 'C') THEN
5011: arp_standard.debug('OTHERS: cash_based');
5012: arp_standard.debug(sqlerrm);
5013: END IF;
5014: RAISE;
5015:
5008:
5009: WHEN OTHERS THEN
5010: IF pg_debug IN ('Y', 'C') THEN
5011: arp_standard.debug('OTHERS: cash_based');
5012: arp_standard.debug(sqlerrm);
5013: END IF;
5014: RAISE;
5015:
5016: END cash_based;
5103:
5104: IF (l_line_status = c_recognizable) THEN
5105:
5106: IF pg_debug IN ('Y', 'C') THEN
5107: arp_standard.debug('no issues remain');
5108: END IF;
5109:
5110: l_rev_adj_rec.line_selection_mode := 'S';
5111: l_rev_adj_rec.from_cust_trx_line_id := p_cust_trx_line_id;
5127: x_msg_count => l_msg_count,
5128: x_msg_data => l_msg_data);
5129:
5130: IF pg_debug IN ('Y', 'C') THEN
5131: arp_standard.debug('Revenue adjusted and now updating rvmg tables');
5132: END IF;
5133:
5134: update_deferred_lines (
5135: p_customer_trx_line_id => p_cust_trx_line_id,
5150: -- pending column we should recognize that much. |
5151: --------------------------------------------------------------------
5152:
5153: IF pg_debug IN ('Y', 'C') THEN
5154: arp_standard.debug('only header issues remain');
5155: END IF;
5156:
5157: IF (l_amount_pending > 0) THEN
5158:
5156:
5157: IF (l_amount_pending > 0) THEN
5158:
5159: IF pg_debug IN ('Y', 'C') THEN
5160: arp_standard.debug('amount pending is greater than zero');
5161: END IF;
5162:
5163: l_rev_adj_rec.line_selection_mode := 'S';
5164: l_rev_adj_rec.from_cust_trx_line_id := p_cust_trx_line_id;
5306:
5307: BEGIN
5308:
5309: IF pg_debug IN ('Y', 'C') THEN
5310: arp_standard.debug('ar_revenue_management_pvt.revenue_synchronizer +');
5311: arp_standard.debug('** revenue_synchronizer parameters **');
5312: arp_standard.debug(' p_mode : ' || p_mode);
5313: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
5314: arp_standard.debug(' p_customer_trx_line_id : ' ||
5307: BEGIN
5308:
5309: IF pg_debug IN ('Y', 'C') THEN
5310: arp_standard.debug('ar_revenue_management_pvt.revenue_synchronizer +');
5311: arp_standard.debug('** revenue_synchronizer parameters **');
5312: arp_standard.debug(' p_mode : ' || p_mode);
5313: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
5314: arp_standard.debug(' p_customer_trx_line_id : ' ||
5315: p_customer_trx_line_id);
5308:
5309: IF pg_debug IN ('Y', 'C') THEN
5310: arp_standard.debug('ar_revenue_management_pvt.revenue_synchronizer +');
5311: arp_standard.debug('** revenue_synchronizer parameters **');
5312: arp_standard.debug(' p_mode : ' || p_mode);
5313: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
5314: arp_standard.debug(' p_customer_trx_line_id : ' ||
5315: p_customer_trx_line_id);
5316: arp_standard.debug(' p_gl_date : ' || p_gl_date);
5309: IF pg_debug IN ('Y', 'C') THEN
5310: arp_standard.debug('ar_revenue_management_pvt.revenue_synchronizer +');
5311: arp_standard.debug('** revenue_synchronizer parameters **');
5312: arp_standard.debug(' p_mode : ' || p_mode);
5313: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
5314: arp_standard.debug(' p_customer_trx_line_id : ' ||
5315: p_customer_trx_line_id);
5316: arp_standard.debug(' p_gl_date : ' || p_gl_date);
5317: arp_standard.debug(' p_comments : ' || p_comments);
5310: arp_standard.debug('ar_revenue_management_pvt.revenue_synchronizer +');
5311: arp_standard.debug('** revenue_synchronizer parameters **');
5312: arp_standard.debug(' p_mode : ' || p_mode);
5313: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
5314: arp_standard.debug(' p_customer_trx_line_id : ' ||
5315: p_customer_trx_line_id);
5316: arp_standard.debug(' p_gl_date : ' || p_gl_date);
5317: arp_standard.debug(' p_comments : ' || p_comments);
5318: END IF;
5312: arp_standard.debug(' p_mode : ' || p_mode);
5313: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
5314: arp_standard.debug(' p_customer_trx_line_id : ' ||
5315: p_customer_trx_line_id);
5316: arp_standard.debug(' p_gl_date : ' || p_gl_date);
5317: arp_standard.debug(' p_comments : ' || p_comments);
5318: END IF;
5319:
5320: x_return_status := fnd_api.g_ret_sts_success;
5313: arp_standard.debug(' p_customer_trx_id : ' || p_customer_trx_id);
5314: arp_standard.debug(' p_customer_trx_line_id : ' ||
5315: p_customer_trx_line_id);
5316: arp_standard.debug(' p_gl_date : ' || p_gl_date);
5317: arp_standard.debug(' p_comments : ' || p_comments);
5318: END IF;
5319:
5320: x_return_status := fnd_api.g_ret_sts_success;
5321:
5321:
5322: IF (p_mode = c_manual_override_mode) THEN
5323:
5324: IF pg_debug IN ('Y', 'C') THEN
5325: arp_standard.debug('called in manual override mode');
5326: END IF;
5327:
5328: manual_override(
5329: p_customer_trx_id => p_customer_trx_id,
5333:
5334: IF (p_mode = c_acceptance_obtained_mode) THEN
5335:
5336: IF pg_debug IN ('Y', 'C') THEN
5337: arp_standard.debug('called in acceptance obtained mode');
5338: END IF;
5339:
5340: populate_acceptance_rows(
5341: p_customer_trx_id => p_customer_trx_id,
5409: LIMIT c_max_bulk_fetch_size;
5410:
5411: IF rev_lines%NOTFOUND THEN
5412: IF pg_debug IN ('Y', 'C') THEN
5413: arp_standard.debug('rev_lines%NOTFOUND');
5414: END IF;
5415: l_last_fetch := TRUE;
5416: END IF;
5417:
5417:
5418: debug('inside loop: ' || lr_customer_trx_line_id_tbl.COUNT);
5419: IF lr_customer_trx_line_id_tbl.COUNT = 0 AND l_last_fetch THEN
5420: IF pg_debug IN ('Y', 'C') THEN
5421: arp_standard.debug('No more rows');
5422: END IF;
5423: EXIT;
5424: END IF;
5425:
5426: FOR i IN lr_customer_trx_line_id_tbl.FIRST ..
5427: lr_customer_trx_line_id_tbl.LAST LOOP
5428:
5429: IF pg_debug IN ('Y', 'C') THEN
5430: arp_standard.debug('Revenue Synchronizer Loop - Line ID: ' ||
5431: lr_customer_trx_line_id_tbl(i));
5432: END IF;
5433:
5434: IF (p_mode = c_acceptance_obtained_mode) THEN
5457: -- been re-evaluated, so we can now recognize reveneue for this
5458: -- line.
5459:
5460: IF pg_debug IN ('Y', 'C') THEN
5461: arp_standard.debug('no issues remain');
5462: END IF;
5463:
5464: l_rev_adj_rec.line_selection_mode := 'S';
5465: l_rev_adj_rec.from_cust_trx_line_id :=
5483: x_msg_count => x_msg_count,
5484: x_msg_data => x_msg_data);
5485:
5486: IF pg_debug IN ('Y', 'C') THEN
5487: arp_standard.debug('Revenue adjusted and now updating rvmg tables');
5488: END IF;
5489:
5490: update_deferred_lines (
5491: p_customer_trx_line_id => lr_customer_trx_line_id_tbl(i),
5510: -- pending column we should recognize that much. |
5511: --------------------------------------------------------------------
5512:
5513: IF pg_debug IN ('Y', 'C') THEN
5514: arp_standard.debug('only header issues remain');
5515: END IF;
5516:
5517: IF (lr_amount_pending_tbl(i) > 0) THEN
5518:
5516:
5517: IF (lr_amount_pending_tbl(i) > 0) THEN
5518:
5519: IF pg_debug IN ('Y', 'C') THEN
5520: arp_standard.debug('amount pending is greater than zero');
5521: END IF;
5522:
5523: l_rev_adj_rec.line_selection_mode := 'S';
5524: l_rev_adj_rec.from_cust_trx_line_id :=
5564: -- recognized, the flag that says all recognized should be
5565: -- turned off.
5566:
5567: IF pg_debug IN ('Y', 'C') THEN
5568: arp_standard.debug('amount pending is NOT greater than zero');
5569: END IF;
5570: l_fully_recognized := FALSE;
5571:
5572: END IF;
5585: -- we can not recognize revenue because there exists at least
5586: -- one reason for deferral.
5587:
5588: IF pg_debug IN ('Y', 'C') THEN
5589: arp_standard.debug('other line level issues remain');
5590: END IF;
5591:
5592: l_fully_recognized := FALSE;
5593:
5609: -- value same as the first one, so that if this is the last
5610: -- adjustment in this run, the between clause will still work.
5611:
5612: IF pg_debug IN ('Y', 'C') THEN
5613: arp_standard.debug('first adjustment' || l_adjustment_number);
5614: END IF;
5615: x_first_adjustment_number := l_adjustment_number;
5616: x_last_adjustment_number := l_adjustment_number;
5617: l_first_adjustment := FALSE;
5620:
5621: -- from now on simply move the upper limit along.
5622:
5623: IF pg_debug IN ('Y', 'C') THEN
5624: arp_standard.debug('last adjustment' || l_adjustment_number);
5625: END IF;
5626: x_last_adjustment_number := l_adjustment_number;
5627:
5628: END IF;
5647: END IF;
5648:
5649: IF (l_partially_recognized) THEN
5650: IF pg_debug IN ('Y', 'C') THEN
5651: arp_standard.debug('partially recognized');
5652: END IF;
5653: x_scenario := c_partially_recognized;
5654: ELSIF (l_fully_recognized) THEN
5655: IF pg_debug IN ('Y', 'C') THEN
5652: END IF;
5653: x_scenario := c_partially_recognized;
5654: ELSIF (l_fully_recognized) THEN
5655: IF pg_debug IN ('Y', 'C') THEN
5656: arp_standard.debug('fully recognized');
5657: END IF;
5658: x_scenario := c_fully_recognized;
5659: ELSE
5660: IF pg_debug IN ('Y', 'C') THEN
5657: END IF;
5658: x_scenario := c_fully_recognized;
5659: ELSE
5660: IF pg_debug IN ('Y', 'C') THEN
5661: arp_standard.debug('not recognized');
5662: END IF;
5663: x_scenario := c_not_recognized;
5664: END IF;
5665:
5665:
5666: END IF;
5667:
5668: IF pg_debug IN ('Y', 'C') THEN
5669: arp_standard.debug('ar_revenue_management_pvt.revenue_synchronizer()-');
5670: END IF;
5671:
5672: EXCEPTION
5673:
5672: EXCEPTION
5673:
5674: WHEN NO_DATA_FOUND THEN
5675: IF pg_debug IN ('Y', 'C') THEN
5676: arp_standard.debug('NO_DATA_FOUND: revenue_synchronizer');
5677: arp_standard.debug(sqlerrm);
5678: END IF;
5679: RAISE;
5680:
5673:
5674: WHEN NO_DATA_FOUND THEN
5675: IF pg_debug IN ('Y', 'C') THEN
5676: arp_standard.debug('NO_DATA_FOUND: revenue_synchronizer');
5677: arp_standard.debug(sqlerrm);
5678: END IF;
5679: RAISE;
5680:
5681: WHEN OTHERS THEN
5679: RAISE;
5680:
5681: WHEN OTHERS THEN
5682: IF pg_debug IN ('Y', 'C') THEN
5683: arp_standard.debug('OTHERS: revenue_synchronizer');
5684: arp_standard.debug(sqlerrm);
5685: END IF;
5686: RAISE;
5687:
5680:
5681: WHEN OTHERS THEN
5682: IF pg_debug IN ('Y', 'C') THEN
5683: arp_standard.debug('OTHERS: revenue_synchronizer');
5684: arp_standard.debug(sqlerrm);
5685: END IF;
5686: RAISE;
5687:
5688: END revenue_synchronizer;
6073: | doubtfult that we may not collect money for it. So, when money
6074: | arrives, we can immediately recognize it.
6075: |
6076: | In the second scneario, it is the very similar to the first one
6077: | however, there may be a non-standard refund clause so we can not
6078: | recognize any revenue until that has expired. At the same time,
6079: | we do not lose track of this receipt. So, we put in pending, and
6080: | as soon as the expiration happens this pending amount will be
6081: | recognized.
6083: | Third scenario is the simplest, we do not do anything. Simply because
6084: | when all expire the periodic sweeper is smart enough to recognize the
6085: | entire amount.
6086: |
6087: | The fourth scenario happens when intially there was a non-standard
6088: | refund policy for this line. And just before this receipt arrived,
6089: | this expired, so now we should do the periodc sweeper's job and
6090: | recognize all revenue.
6091: |
6220:
6221: BEGIN
6222:
6223: IF pg_debug IN ('Y', 'C') THEN
6224: arp_standard.debug('ar_revenue_management_pvt.receipt_analyzer +');
6225: END IF;
6226:
6227: get_receipt_parameters (
6228: p_mode => p_mode,
6247: x_gl_date => l_gl_date);
6248:
6249: IF NOT monitored_transaction (l_customer_trx_id) THEN
6250: IF pg_debug IN ('Y', 'C') THEN
6251: arp_standard.debug('receipt_analyzer: ' ||
6252: '*** This Transaction Is Not Being Monitored ***');
6253: END IF;
6254: RETURN;
6255: END IF;
6254: RETURN;
6255: END IF;
6256:
6257: IF pg_debug IN ('Y', 'C') THEN
6258: arp_standard.debug('Functional Currency Code : ' || g_currency_code_f);
6259: arp_standard.debug(' Precision : ' || g_precision_f);
6260: arp_standard.debug(' accountable unit : ' ||
6261: g_minimum_accountable_unit_f);
6262: arp_standard.debug('Invoice Currency Code : ' ||
6255: END IF;
6256:
6257: IF pg_debug IN ('Y', 'C') THEN
6258: arp_standard.debug('Functional Currency Code : ' || g_currency_code_f);
6259: arp_standard.debug(' Precision : ' || g_precision_f);
6260: arp_standard.debug(' accountable unit : ' ||
6261: g_minimum_accountable_unit_f);
6262: arp_standard.debug('Invoice Currency Code : ' ||
6263: p_invoice_currency_code);
6256:
6257: IF pg_debug IN ('Y', 'C') THEN
6258: arp_standard.debug('Functional Currency Code : ' || g_currency_code_f);
6259: arp_standard.debug(' Precision : ' || g_precision_f);
6260: arp_standard.debug(' accountable unit : ' ||
6261: g_minimum_accountable_unit_f);
6262: arp_standard.debug('Invoice Currency Code : ' ||
6263: p_invoice_currency_code);
6264: END IF;
6258: arp_standard.debug('Functional Currency Code : ' || g_currency_code_f);
6259: arp_standard.debug(' Precision : ' || g_precision_f);
6260: arp_standard.debug(' accountable unit : ' ||
6261: g_minimum_accountable_unit_f);
6262: arp_standard.debug('Invoice Currency Code : ' ||
6263: p_invoice_currency_code);
6264: END IF;
6265:
6266: -- sum of all lines for this transaction
6269: FETCH amounts INTO l_sum_of_all_lines, l_acctd_sum_of_all_lines;
6270: CLOSE amounts;
6271:
6272: IF pg_debug IN ('Y', 'C') THEN
6273: arp_standard.debug('Sum of All Lines : ' ||
6274: l_sum_of_all_lines);
6275: arp_standard.debug('Sum of All Lines (Accounted) : ' ||
6276: l_acctd_sum_of_all_lines);
6277: END IF;
6271:
6272: IF pg_debug IN ('Y', 'C') THEN
6273: arp_standard.debug('Sum of All Lines : ' ||
6274: l_sum_of_all_lines);
6275: arp_standard.debug('Sum of All Lines (Accounted) : ' ||
6276: l_acctd_sum_of_all_lines);
6277: END IF;
6278:
6279: -- get total receipt application to this transaction so far
6282: get_total_application (
6283: p_customer_trx_id => l_customer_trx_id);
6284:
6285: IF pg_debug IN ('Y', 'C') THEN
6286: arp_standard.debug('Total Application Amount: ' || l_total_application);
6287: END IF;
6288:
6289: IF (g_currency_code_f <> p_invoice_currency_code) THEN
6290:
6294: -- and tax buckets. So, a call is placed to distribute the amount into the
6295: -- buckets. So that we can figure out what the acctd_line_amount would be.
6296:
6297: IF pg_debug IN ('Y', 'C') THEN
6298: arp_standard.debug('Invoice currency and functional currency DIFFER');
6299: END IF;
6300:
6301: arp_util.set_buckets(
6302: p_header_acctd_amt => l_acctd_amount_applied,
6313: p_line_acctd_amt => l_acctd_line_applied,
6314: p_freight_acctd_amt => l_acctd_freight_applied);
6315:
6316: IF pg_debug IN ('Y', 'C') THEN
6317: arp_standard.debug('Acctd Tax Applied : ' || l_acctd_tax_applied);
6318: arp_standard.debug('Acctd Charges Applied : ' ||
6319: l_acctd_charges_applied);
6320: arp_standard.debug('Acctd Freight Applied : ' ||
6321: l_acctd_freight_applied);
6314: p_freight_acctd_amt => l_acctd_freight_applied);
6315:
6316: IF pg_debug IN ('Y', 'C') THEN
6317: arp_standard.debug('Acctd Tax Applied : ' || l_acctd_tax_applied);
6318: arp_standard.debug('Acctd Charges Applied : ' ||
6319: l_acctd_charges_applied);
6320: arp_standard.debug('Acctd Freight Applied : ' ||
6321: l_acctd_freight_applied);
6322: END IF;
6316: IF pg_debug IN ('Y', 'C') THEN
6317: arp_standard.debug('Acctd Tax Applied : ' || l_acctd_tax_applied);
6318: arp_standard.debug('Acctd Charges Applied : ' ||
6319: l_acctd_charges_applied);
6320: arp_standard.debug('Acctd Freight Applied : ' ||
6321: l_acctd_freight_applied);
6322: END IF;
6323:
6324: -- get acctd total application to this transaction so far.
6326: get_acctd_total_application (
6327: p_customer_trx_id => l_customer_trx_id);
6328:
6329: IF pg_debug IN ('Y', 'C') THEN
6330: arp_standard.debug('Total Application Amount (acctd): ' ||
6331: l_acctd_total_application);
6332: END IF;
6333:
6334: ELSE
6333:
6334: ELSE
6335:
6336: IF pg_debug IN ('Y', 'C') THEN
6337: arp_standard.debug('Invoice currency and functional currency MATCH');
6338: END IF;
6339:
6340: l_acctd_line_applied := l_line_applied;
6341: l_acctd_total_application := l_total_application;
6342:
6343: END IF;
6344:
6345: IF pg_debug IN ('Y', 'C') THEN
6346: arp_standard.debug('Acctd Line Applied : ' || l_acctd_line_applied);
6347: END IF;
6348:
6349: OPEN rev_lines(l_customer_trx_id);
6350: LOOP
6376: LIMIT c_max_bulk_fetch_size;
6377:
6378: IF rev_lines%NOTFOUND THEN
6379: IF pg_debug IN ('Y', 'C') THEN
6380: arp_standard.debug('rev_lines%NOTFOUND');
6381: END IF;
6382: l_last_fetch := TRUE;
6383: END IF;
6384:
6383: END IF;
6384:
6385: IF lr_customer_trx_line_id_tbl.COUNT = 0 AND l_last_fetch THEN
6386: IF pg_debug IN ('Y', 'C') THEN
6387: arp_standard.debug('No more rows');
6388: END IF;
6389: EXIT;
6390: END IF;
6391:
6392: FOR i IN lr_customer_trx_line_id_tbl.FIRST ..
6393: lr_customer_trx_line_id_tbl.LAST LOOP
6394:
6395: IF pg_debug IN ('Y', 'C') THEN
6396: arp_standard.debug('Receipt Analyzer Loop - Line ID: ' ||
6397: lr_customer_trx_line_id_tbl(i));
6398: END IF;
6399:
6400:
6433: p_running_allocated_balance => l_running_allocated_balance);
6434:
6435:
6436: IF pg_debug IN ('Y', 'C') THEN
6437: arp_standard.debug('l_computed_line_amount: ' ||
6438: l_computed_line_amount);
6439: END IF;
6440:
6441: IF (g_currency_code_f <> p_invoice_currency_code) THEN
6442:
6443: -- INVOICE CURRENCY DOES NOT EQUAL FUNCTIONAL CURRENCY
6444:
6445: IF pg_debug IN ('Y', 'C') THEN
6446: arp_standard.debug('Invoice and functional currency DIFFER');
6447: END IF;
6448: -- at all times one of the columns would always have to be zero
6449: l_acctd_current_line_balance := lr_acctd_amount_pending_tbl(i) +
6450: lr_acctd_amt_recognized_tbl(i);
6462:
6463: ELSE
6464:
6465: IF pg_debug IN ('Y', 'C') THEN
6466: arp_standard.debug('Invoice and functional currency MATCH');
6467: END IF;
6468: l_acctd_computed_line_amount := l_computed_line_amount;
6469:
6470: END IF;
6469:
6470: END IF;
6471:
6472: IF pg_debug IN ('Y', 'C') THEN
6473: arp_standard.debug('l_acctd_computed_line_amount: ' ||
6474: l_acctd_computed_line_amount);
6475: END IF;
6476:
6477:
6487: l_line_status := get_line_status (
6488: p_cust_trx_line_id => lr_customer_trx_line_id_tbl(i));
6489:
6490: IF pg_debug IN ('Y', 'C') THEN
6491: arp_standard.debug('Scenario : ' || l_line_status);
6492: END IF;
6493:
6494: -- set the common attributes for the revenue adjustment
6495:
6503: IF (p_mode = c_receipt_application_mode AND
6504: l_line_status = c_recognizable) THEN
6505:
6506: IF pg_debug IN ('Y', 'C') THEN
6507: arp_standard.debug('No Issues Remain- Recognizing The Whole Amount '
6508: || lr_customer_trx_line_id_tbl(i));
6509: END IF;
6510:
6511: l_amount_adjusted := lr_amount_due_original_tbl(i);
6547: -- removed by the periodic sweeper engine.
6548: -----------------------------------------------------------------------
6549:
6550: IF pg_debug IN ('Y', 'C') THEN
6551: arp_standard.debug('Cash Based Scenario- Recognizing For Line ' ||
6552: lr_customer_trx_line_id_tbl(i));
6553: END IF;
6554:
6555: l_amount_adjusted := (lr_amount_recognized_tbl(i) +
6566: l_acctd_amount_adjusted := lr_acctd_amount_due_orig_tbl(i);
6567:
6568: END IF;
6569:
6570: arp_standard.debug('Amount: ' || l_amount_adjusted);
6571: arp_standard.debug('Acctd Amount: ' || l_acctd_amount_adjusted);
6572:
6573: update_deferred_lines (
6574: p_customer_trx_line_id => lr_customer_trx_line_id_tbl(i),
6567:
6568: END IF;
6569:
6570: arp_standard.debug('Amount: ' || l_amount_adjusted);
6571: arp_standard.debug('Acctd Amount: ' || l_acctd_amount_adjusted);
6572:
6573: update_deferred_lines (
6574: p_customer_trx_line_id => lr_customer_trx_line_id_tbl(i),
6575: p_line_status => l_line_status,
6590: lr_acctd_amount_pending_tbl(i);
6591:
6592: l_rev_adj_rec.amount := l_ram_amount;
6593:
6594: arp_standard.debug('RAM Amount : ' || l_ram_amount);
6595: arp_standard.debug('Acctd RAM Amount: ' || l_acctd_ram_amount);
6596:
6597: adjust_revenue(
6598: p_mode => c_earn_revenue,
6591:
6592: l_rev_adj_rec.amount := l_ram_amount;
6593:
6594: arp_standard.debug('RAM Amount : ' || l_ram_amount);
6595: arp_standard.debug('Acctd RAM Amount: ' || l_acctd_ram_amount);
6596:
6597: adjust_revenue(
6598: p_mode => c_earn_revenue,
6599: p_customer_trx_id => l_customer_trx_id,
6621: -- should still be considered recognized.
6622: ----------------------------------------------------------------------
6623:
6624: IF pg_debug IN ('Y', 'C') THEN
6625: arp_standard.debug('Header Only Scenario - Reversing For Line ' ||
6626: lr_customer_trx_line_id_tbl(i));
6627: END IF;
6628:
6629: l_amount_adjusted := (lr_amount_recognized_tbl(i) -
6652: l_ram_amount := l_computed_line_amount;
6653: l_acctd_ram_amount := l_acctd_computed_line_amount;
6654: END IF;
6655:
6656: arp_standard.debug('Amount : ' || l_amount_adjusted);
6657: arp_standard.debug('Acctd. Amount : ' || l_acctd_amount_adjusted);
6658:
6659: update_deferred_lines (
6660: p_customer_trx_line_id => lr_customer_trx_line_id_tbl(i),
6653: l_acctd_ram_amount := l_acctd_computed_line_amount;
6654: END IF;
6655:
6656: arp_standard.debug('Amount : ' || l_amount_adjusted);
6657: arp_standard.debug('Acctd. Amount : ' || l_acctd_amount_adjusted);
6658:
6659: update_deferred_lines (
6660: p_customer_trx_line_id => lr_customer_trx_line_id_tbl(i),
6661: p_line_status => l_line_status,
6663: p_acctd_amount_recognized => l_acctd_amount_adjusted);
6664:
6665: l_rev_adj_rec.amount := l_ram_amount;
6666:
6667: arp_standard.debug('RAM Amount : ' || l_ram_amount);
6668: arp_standard.debug('Acctd RAM Amount: ' || l_acctd_ram_amount);
6669:
6670: adjust_revenue(
6671: p_mode => c_unearn_revenue,
6664:
6665: l_rev_adj_rec.amount := l_ram_amount;
6666:
6667: arp_standard.debug('RAM Amount : ' || l_ram_amount);
6668: arp_standard.debug('Acctd RAM Amount: ' || l_acctd_ram_amount);
6669:
6670: adjust_revenue(
6671: p_mode => c_unearn_revenue,
6672: p_customer_trx_id => l_customer_trx_id,
6692: -- the sweeper can recognize this amount. So, we put it in pending.
6693: -----------------------------------------------------------------------
6694:
6695: IF pg_debug IN ('Y', 'C') THEN
6696: arp_standard.debug('Move the pending amount to recognized for line '
6697: || lr_customer_trx_line_id_tbl(i));
6698: END IF;
6699:
6700: l_amount_adjusted := (lr_amount_pending_tbl(i) +
6725: | was applied.
6726: +--------------------------------------------------------------------*/
6727:
6728: IF pg_debug IN ('Y', 'C') THEN
6729: arp_standard.debug('Reversing The Pending Amount For Line ' ||
6730: lr_customer_trx_line_id_tbl(i));
6731: END IF;
6732:
6733: l_amount_adjusted := (lr_amount_pending_tbl(i) -
6755:
6756: END IF; -- (scenario #)
6757:
6758: IF pg_debug IN ('Y', 'C') THEN
6759: arp_standard.debug('amount adjusted : ' || l_amount_adjusted);
6760: arp_standard.debug('acctd amount adjusted: ' ||
6761: l_acctd_amount_adjusted);
6762: arp_standard.debug('Done for the line');
6763: END IF;
6756: END IF; -- (scenario #)
6757:
6758: IF pg_debug IN ('Y', 'C') THEN
6759: arp_standard.debug('amount adjusted : ' || l_amount_adjusted);
6760: arp_standard.debug('acctd amount adjusted: ' ||
6761: l_acctd_amount_adjusted);
6762: arp_standard.debug('Done for the line');
6763: END IF;
6764:
6758: IF pg_debug IN ('Y', 'C') THEN
6759: arp_standard.debug('amount adjusted : ' || l_amount_adjusted);
6760: arp_standard.debug('acctd amount adjusted: ' ||
6761: l_acctd_amount_adjusted);
6762: arp_standard.debug('Done for the line');
6763: END IF;
6764:
6765: END LOOP; -- FOR i IN l_customer_trx_line_id_tbl.FIRST ..LAST
6766:
6766:
6767: END LOOP; -- (rev_lines => bulk collect)
6768:
6769: IF pg_debug IN ('Y', 'C') THEN
6770: arp_standard.debug('ar_revenue_management_pvt.receipt_analyzer()-');
6771: END IF;
6772:
6773: EXCEPTION
6774:
6773: EXCEPTION
6774:
6775: WHEN NO_DATA_FOUND THEN
6776: IF pg_debug IN ('Y', 'C') THEN
6777: arp_standard.debug(' (1) NO_DATLR_FOUND: receipt_analyzer)');
6778: arp_standard.debug(sqlerrm);
6779: END IF;
6780: RAISE;
6781:
6774:
6775: WHEN NO_DATA_FOUND THEN
6776: IF pg_debug IN ('Y', 'C') THEN
6777: arp_standard.debug(' (1) NO_DATLR_FOUND: receipt_analyzer)');
6778: arp_standard.debug(sqlerrm);
6779: END IF;
6780: RAISE;
6781:
6782: WHEN OTHERS THEN
6780: RAISE;
6781:
6782: WHEN OTHERS THEN
6783: IF pg_debug IN ('Y', 'C') THEN
6784: arp_standard.debug(' (1) OTHERS: receipt_analyzer');
6785: arp_standard.debug(sqlerrm);
6786: END IF;
6787: RAISE;
6788:
6781:
6782: WHEN OTHERS THEN
6783: IF pg_debug IN ('Y', 'C') THEN
6784: arp_standard.debug(' (1) OTHERS: receipt_analyzer');
6785: arp_standard.debug(sqlerrm);
6786: END IF;
6787: RAISE;
6788:
6789: END receipt_analyzer;
7003: EXCEPTION
7004:
7005: WHEN NO_DATA_FOUND THEN
7006: IF pg_debug IN ('Y', 'C') THEN
7007: arp_standard.debug(' (1) NO_DATA_FOUND: line_collectibility');
7008: arp_standard.debug(sqlerrm);
7009: END IF;
7010: RAISE;
7011:
7004:
7005: WHEN NO_DATA_FOUND THEN
7006: IF pg_debug IN ('Y', 'C') THEN
7007: arp_standard.debug(' (1) NO_DATA_FOUND: line_collectibility');
7008: arp_standard.debug(sqlerrm);
7009: END IF;
7010: RAISE;
7011:
7012: WHEN OTHERS THEN
7010: RAISE;
7011:
7012: WHEN OTHERS THEN
7013: IF pg_debug IN ('Y', 'C') THEN
7014: arp_standard.debug(' (1) OTHERS: line_collectibility');
7015: arp_standard.debug(sqlerrm);
7016: END IF;
7017: RAISE;
7018:
7011:
7012: WHEN OTHERS THEN
7013: IF pg_debug IN ('Y', 'C') THEN
7014: arp_standard.debug(' (1) OTHERS: line_collectibility');
7015: arp_standard.debug(sqlerrm);
7016: END IF;
7017: RAISE;
7018:
7019: END line_collectibility;
7164:
7165: EXCEPTION
7166:
7167: WHEN NO_DATA_FOUND THEN
7168: arp_standard.debug(' ar_revenue_management_pvt.initialize');
7169: arp_standard.debug(sqlerrm);
7170: RAISE;
7171:
7172: WHEN OTHERS THEN
7165: EXCEPTION
7166:
7167: WHEN NO_DATA_FOUND THEN
7168: arp_standard.debug(' ar_revenue_management_pvt.initialize');
7169: arp_standard.debug(sqlerrm);
7170: RAISE;
7171:
7172: WHEN OTHERS THEN
7173: arp_standard.debug(' ar_revenue_management_pvt.initialize');
7169: arp_standard.debug(sqlerrm);
7170: RAISE;
7171:
7172: WHEN OTHERS THEN
7173: arp_standard.debug(' ar_revenue_management_pvt.initialize');
7174: arp_standard.debug(sqlerrm);
7175: RAISE;
7176:
7177: END ar_revenue_management_pvt;
7170: RAISE;
7171:
7172: WHEN OTHERS THEN
7173: arp_standard.debug(' ar_revenue_management_pvt.initialize');
7174: arp_standard.debug(sqlerrm);
7175: RAISE;
7176:
7177: END ar_revenue_management_pvt;