zoukankan      html  css  js  c++  java
  • AR 客户本月回款

    function returnmoneyformula return number is
        l_receive_amount1 
    number;
        l_receive_amount2 
    number;
        returnmoney       
    number;
    begin
        
    select nvl(sum(acr.functional_amount), 0--付款
          into l_receive_amount1
          
    from ar_cash_receipts_v acr
         
    where to_char(acr.gl_date, 'YYYY-MM-DD'between
               to_char(:startdate, 
    'YYYY-MM-DD'and
               to_char(:enddate, 
    'YYYY-MM-DD')
           
    and acr.state != 'REVERSED'
           
    and acr.customer_id =
               (
    select a.customer_id
                  
    from ar_customers a
                 
    where a.customer_number = :customer_number);
        
    select nvl(sum(araa.amount_applied), 0--退款
          into l_receive_amount2
          
    from ar_cash_receipt_history_all    acrh,
               ar_cash_receipts_all           acr,
               ar_receivable_applications_all araa
         
    where to_char(acrh.gl_date, 'YYYY-MM-DD'between
               to_char(:startdate, 
    'YYYY-MM-DD'and
               to_char(:enddate, 
    'YYYY-MM-DD')
           
    and acrh.status != 'REVERSED'
           
    and acr.cash_receipt_id = acrh.cash_receipt_id
           
    and acrh.cash_receipt_history_id = araa.cash_receipt_history_id
           
    and araa.applied_customer_trx_id is null
           
    and acrh.org_id = acr.org_id
           
    and araa.display = 'Y'
           
    and araa.status = 'ACTIVITY'
           
    and acr.pay_from_customer =
               (
    select a.customer_id
                  
    from ar_customers a
                 
    where a.customer_number = :customer_number);
        returnmoney :
    = (l_receive_amount1 - l_receive_amount2);
        
    return nvl(returnmoney, 0);
    end;


             

                成长

           /      |     \

        学习   总结   分享

    QQ交流群:122230156

  • 相关阅读:
    ie条件注释
    css3之图片一闪而过特效
    css帧动画之图片发亮
    css3动画
    解决ie6不兼容透明图片
    jquery实现拖拽的效果
    原生js实现拖拽弹框的效果
    C++学习笔记十之连接数据库
    C++学习笔记九之异常处理
    C++学习笔记八之STL内置算法
  • 原文地址:https://www.cnblogs.com/benio/p/1923536.html
Copyright © 2011-2022 走看看