1. Purpose: To use the API to obtain the payment conditions for the transactions to be processed (the payment conditions and expiration dates for implementing standard functions)
2. Implementation Method: Call ARP_TRX_DEFAULTS_3.get_term_default to obtain the payment conditions.
3. Implementation Code:
/* ===================================================== ========================
* FUNCTION/PROCEDURE
* Get_cust_trx_type_id
* DESCRIPTION:
* Get the payment method id
* ARGUMENT:
* P_customer_id: Customer id
* P_customer_site_use_id: Customer location usage id
* P_trx_date: Transaction processing date
* P_cust_trx_class: Transaction Processing type
* P_cust_trx_type_id: Transaction Processing type
* RETURN:
* N/
* HISTORY:
* 1.00 15/12/2010 cxy
========================================================== =========================== */
FUNCTION get_default_term_id (p_customer_id in number,
P_customer_site_use_id in number,
P_trx_date in date,
P_cust_trx_class IN VARCHAR2,
P_cust_trx_type_id in number)
RETURN NUMBER IS
Rochelle default_term_id NUMBER; -- payment condition id
Rochelle default_term_name ra_terms.name % TYPE; -- Name of the payment condition
Rochelle number_of_due_dates NUMBER;
L_term_due_date DATE; -- expiration DATE
BEGIN
-- Call the standard receivables (default payment conditions) API to obtain the default payment conditions
ARP_TRX_DEFAULTS_3.get_term_default (p_term_id => NULL,
P_type_term_id => NULL,
P_type_term_name => NULL,
P_customer_id => p_customer_id,
P_site_use_id => p_customer_site_use_id,
P_trx_date => p_trx_date,
P_class => p_cust_trx_class,
P_cust_trx_type_id => p_cust_trx_type_id,
P_default_term_id => l_default_term_id,
P_default_term_name => l_default_term_name,
P_number_of_due_dates => l_number_of_due_dates,
P_term_due_date => l_term_due_date );
Put_log ('default payment condition id: '| l_default_term_id );
Put_log ('default payment condition name: '| l_default_term_name );
Put_log ('expiration Date: '| l_term_due_date );
IF l_default_term_id IS NOT NULL THEN
RETURN l_default_term_id; -- RETURN the payment condition.
ELSE
Return null;
End if;
EXCEPTION
WHEN NO_DATA_FOUND THEN
Return null;
WHEN TOO_MANY_ROWS THEN
Put_log ('multiple rows are returned if an error occurs when the payment method id is obtained! ');
WHEN OTHERS THEN
Put_log ('error when obtaining the payment method id: '| SQLERRM );
END get_default_term_id;