使用API获取(默认付款条件和到期日)

1. 目的:使用API取到应收事务处理的付款条件(实现标准功能的付款条件和到期日)
2. 实现方法:调用 ARP_TRX_DEFAULTS_3.get_term_default获得付款条件

3.实现代码:

/* =======================================================
    *  FUNCTION / PROCEDURE
    *       get_cust_trx_type_id
    *   DESCRIPTION:
    *      获得付款方式的id
    *   ARGUMENT:
    *     p_customer_id               :客户id
    *     p_customer_site_use_id      :客户地点用途id 
    *     p_trx_date                  :事务处理日期
    *     p_cust_trx_class            :事务处理分类
    *     p_cust_trx_type_id          :事务处理类型
    *   RETURN:  
    *       N/A
    *   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
    l_default_term_id     
NUMBER -- 付款条件id
    l_default_term_name   ra_terms.name % TYPE;  -- 付款条件名称
    l_number_of_due_dates  NUMBER ;
    l_term_due_date       DATE; 
-- 到期日
   BEGIN
    
-- 调用标准的应收的(默认付款条件)的API,得到默认的付款条件
  
    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(
' 默认付款条件id: '   ||  l_default_term_id);
    put_log(
' 默认付款条件名称: '   ||  l_default_term_name);
    put_log(
' 到期日: '   ||  l_term_due_date);
    
IF  l_default_term_id  IS   NOT   NULL   THEN
       
RETURN  l_default_term_id;  -- 返回付款条件
     ELSE
       
RETURN   NULL ;   
    
END   IF ;
  EXCEPTION
    
WHEN  NO_DATA_FOUND  THEN
      
RETURN   NULL ;
    
WHEN  TOO_MANY_ROWS  THEN
      put_log(
' 获得付款方式的id时候出现错误返回多个行! ' );
    
WHEN  OTHERS  THEN
      put_log(
' 获得付款方式的id时候出现错误: '   ||  SQLERRM);
  
END  get_default_term_id;

 

你可能感兴趣的:(api)