RA_CUST_TRX_LINE_GL_DIST_ALL - AR行分配表

AR/AP/GL中当前帐套本位币金额

在总账模块中总账行表GL_JE_LINES中ENTERED_DR和ENTERED_CR字段表示总账日记账凭证收入的金额,如果当前输入的金额不是当前帐套的本位币,则在输入时,需要选择汇率折算,折算后数据记录在ACCOUNTED_DR和ACCOUNTED_CR字段中,因此,日记账ACCOUNTED_DR和ACCOUNTED_CR字段金额的币别和当前帐套本位币是一致的。

在应收模块中,RA_CUST_TRX_LINE_GL_DIST_ALL为行分配表,AMOUNT字段为收入金额,ACCTD_AMOUNT字段为折算后本位币金额。

在应付模块中,AP_INVOICES_ALL为发票头表,INVOICE_AMOUNT为发票输入金额,BASE_AMOUNT为本位币金额,AP_INVOICE_DISTRIBUTIONS_ALL发票分配表AMOUNT为行输入金额,BASE_AMOUNT为本位币金额


AR中收入和税的抓取

在表RA_CUST_TRX_LINE_GL_DIST_ALL中,ACCOUNT_CLASS字段标识收入、应收账款或税,收入为REV,税为TAX,应收账款为REC,如果需要同时显示收入和税,并用事务处理编号关联,可以用下面方式取得:

select rev.trx_number as ar_invoice_no,
       (rev.rev_amount + tax.tax_amount) as rev_amount,
       tax.tax_amount
  from (  select arh.customer_trx_id,
                 arh.trx_number,
                 sum (arldis.amount) as rev_amount
            from ra_customer_trx_all arh, ra_cust_trx_line_gl_dist_all arldis
           where     arh.customer_trx_id = arldis.customer_trx_id
                 and arh.set_of_books_id = :p_set_of_books_id                            --key
                 and arh.trx_date between to_date (:p_trx_df, 'YYYY-MM-DD')  --key
                                      and to_date (:p_trx_dt, 'YYYY-MM-DD')              --key
                 and arldis.account_class = 'REV'
        group by arh.customer_trx_id, arh.trx_number) rev,
       (  select arh.customer_trx_id, sum (arldis.amount) as tax_amount
            from ra_customer_trx_all arh, ra_cust_trx_line_gl_dist_all arldis
           where     arh.customer_trx_id = arldis.customer_trx_id
                 and arh.set_of_books_id = :p_set_of_books_id                           --key
                 and arh.trx_date between to_date (:p_trx_df, 'YYYY-MM-DD')  --key
                                      and to_date (:p_trx_dt, 'YYYY-MM-DD')              --key
                 and arldis.account_class = 'TAX'
        group by arh.customer_trx_id) tax
where rev.customer_trx_id = tax.customer_trx_id(+)

posted @ 2012-11-06 17:40  全威儒  阅读(1707)  评论(0编辑  收藏  举报