zoukankan      html  css  js  c++  java
  • 拆分日记账追溯视图来源应收日记帐(销售发票)

    --来源于应收日记帐类型为销售发票(标准视图:XLA_AR_INV_AEL_GL_V)
    --取凭证行追溯到的应收业务数据

    select gjh.je_header_id,
           
           gjl.je_line_num,
           
           gjh.description, 
    --摘要
           
           gjh.doc_sequence_value, 
    --凭证号
           
           gjh.period_name, 
    --期间
           
           gcc.segment6 item_number, 
    --产品
           
           gcc.segment4 sub_accounts, 
    --科目
           
           to_char(xag.trx_date, 
    'YYYY-MM-DD') trx_date, nvl(ctl.quantity_credited, ctl.quantity_invoiced) quantity, --数量
           
           nvl(ctl.revenue_amount, 
    0) rev_amount --金额

      
    from gl_je_headers_v gjh,
           
           gl_je_lines_v gjl,
           
           (
    select jeh.je_header_id je_header_id,
                   
                   r.je_line_num je_line_num,
                   
                   ct.trx_number trx_number_displayed,
                   
                   ctl.line_number trx_line_number,
                   
                   ct.trx_date
            
              
    from gl_je_headers jeh,
                   
                   gl_import_references r,
                   
                   ra_cust_trx_line_gl_dist ctlgd,
                   
                   ra_customer_trx ct,
                   
                   ra_customer_trx_lines ctl
            
             
    where ctlgd.customer_trx_line_id = ctl.customer_trx_line_id(+)
                  
               
    and nvl(ctlgd.org_id, -99= nvl(ctl.org_id(+), -99)
                  
               
    and ctlgd.account_set_flag = 'N'
                  
               
    and ct.customer_trx_id = ctlgd.customer_trx_id
                  
               
    and nvl(ct.org_id, -99= nvl(ctlgd.org_id, -99)
                  
               
    and ctlgd.cust_trx_line_gl_dist_id = to_number(r.reference_3)
                  
               
    and r.reference_10 = 'RA_CUST_TRX_LINE_GL_DIST'
                  
               
    and r.je_header_id = jeh.je_header_id
                  
               
    and jeh.je_category in ('Sales Invoices''Credit Memos',
                   
                    
    'Debit Memos''Chargebacks')) xag,
           
           ra_customer_trx ct,
           
           ra_customer_trx_lines ctl,
           
           gl_code_combinations_kfv gcc

     
    where gjh.je_source = 'Receivables' --应收款管理系统
          
       
    and gjl.je_header_id = gjh.je_header_id
          
       
    and gjh.status = 'P' --已过帐
          
       
    and gjl.code_combination_id = gcc.code_combination_id
          
       
    and gcc.segment1 = '330007' --公司段
          
       
    and gcc.segment4 = '600101' --科目段:主营业务收入-内部主营业务收入
          
       
    and xag.application_id = 222
          
       
    and xag.je_header_id = gjl.je_header_id
          
       
    and xag.je_line_num = gjl.je_line_num
          
       
    and xag.trx_number_displayed = ct.trx_number
          
       
    and xag.trx_line_number = ctl.line_number
          
       
    and ct.customer_trx_id = ctl.customer_trx_id(+)
          
       
    and ctl.line_type(+= 'LINE'
          
       
    and gjh.period_name = '2008-05'


             

                成长

           /      |     \

        学习   总结   分享

    QQ交流群:122230156

  • 相关阅读:
    ultraEdit使用utf8乱码的解决办法
    利用替换字符串的函数StringReplace删除字符串中指定的字符或字符串
    COBID,CanID,NodeID的不同
    随机生成一个10位的数字(来自大富翁)
    Delphi2010下,Unit aliases会影响到Code Insight功能?
    使用鼠标拖曳的方式移动、更改panel控件的大小
    将四个BYTE数值转换成IEEE754标准的浮点数
    判断shift,ctrl,alt键是否按下
    获取邮箱中的用户名
    IFM控制器中关于支线长度的说明
  • 原文地址:https://www.cnblogs.com/benio/p/1923386.html
Copyright © 2011-2022 走看看