表名:GL_IMPORT_REFERENCES
说明:总账导入附加信息表
用途:用来追溯从子模块传入总账模块的明细,对于报表开发很有帮助
SQL 语句:
select *
from gl_je_headers gjh,
gl_je_lines gjl,
gl_import_references gir
where gjh.je_header_id = gjl.je_header_id
and gjl.je_header_id = gir.je_header_id
and gjl.je_line_num = gir.je_line_num;
1、gjh.je_source = 'Payables':
1)与 AP 模块关联表:ap_ae_lines_all
2)SQL 语句:
select *
from gl_je_headers gjh,
gl_je_lines gjl,
gl_import_references gir,
ap_ae_lines_all ael,
ap_ae_headers_all aeh
where gjh.je_header_id = gjl.je_header_id
and gjl.je_header_id = gir.je_header_id
and gjl.je_line_num = gir.je_line_num
and gjh.je_source = 'Payables'
and gir.gl_sl_link_id = ael.gl_sl_link_id
and ael.ae_header_id = aeh.ae_header_id;
3)根据 aeh.ae_category 或 aeh.accounting_event_id 判断业务性质,从而关联以下数据
库表进行取值;
ap_invoices_all
ap_invoice_distributions_all
ap_checks_all
ap_invoice_payments_all
ap_accounting_events_all
4)借贷金额计算逻辑:
直接取 ap_ae_lines_all 的 ael.accounted_dr,ael.accounted_cr 字段值
借项:
ael.accounted_dr;
贷项:
ael.accounted_cr;
2、gjh.je_source = 'Receivables':
1)gjh.je_category in ('Credit Memos', 'Sales Invoices')
A. 与 AR 关联表:ra_cust_trx_line_gl_dist_all
2
B. SQL 语句: