表名: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;
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;
select * from gl_je_headers gjh, gl_je_lines gjl, gl_import_references gir, ra_cust_trx_line_gl_dist_all rcl 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 = 'Receivables' and gjh.je_category in ('Credit Memos', 'Sales Invoices') and gir.reference_3 = to_char(rcl.cust_trx_line_gl_dist_id);
decode(sign(rcl.acctd_amount), 1, rcl.acctd_amount, 0, 0, -1, 0) acctd_dr;
decode(sign(rcl.acctd_amount), 1, 0, 0, 0, -1, rcl.acctd_amount * -1) acctd_cr;
select * from gl_je_headers gjh, gl_je_lines gjl, gl_import_references gir, ar_receivable_applications_all ara where gjh.je_header_id = gjl.je_header_id and gjl.je_header_id = gir.je_header_id 3 and gjl.je_line_num = gir.je_line_num and gjh.je_source = 'Receivables' and gjh.je_category in ('Trade Receipts', 'Credit Memo Applications') and decode(gjh.je_category, 'Trade Receipts', substr(gir.reference_2, instr(gir.reference_2, 'C', 1) + 1), gir.reference_2) = ara.receivable_application_id;
decode(gjh.je_category, 'Trade Receipts', decode(sign(ara.acctd_amount_applied_to), 0, 0, 1, 0, ara.acctd_amount_applied_to * -1), decode(sign(ara.acctd_amount_applied_to), 0, 0, 1, decode(gjl.accounted_dr, null, 0, ara.acctd_amount_applied_to), decode(gjl.accounted_dr, null, 0, ara.acctd_amount_applied_to * -1))) acctd_dr;
decode(gjh.je_category, 'Trade Receipts', decode(sign(ara.acctd_amount_applied_to), 0, 0, 1, ara.acctd_amount_applied_to, 4 0), decode(sign(ara.acctd_amount_applied_to), 0, 0, 1, decode(gjl.accounted_dr, null, ara.acctd_amount_applied_to, 0), decode(gjl.accounted_dr, null, ara.acctd_amount_applied_to * -1, 0))) acctd_cr;
select * from gl_je_headers gjh, gl_je_lines gjl, gl_import_references gir, mtl_transaction_accounts mta, mtl_material_transactions mmt where gjh.je_header_id = gjl.je_header_id and gir.je_header_id = gjl.je_header_id and gir.je_line_num = gjl.je_line_num and gjh.je_source = 'Inventory' and gir.reference_1 = to_char(mta.gl_batch_id) and mta.transaction_id = mmt.transaction_id;
decode(sign(mta.base_transaction_value), 5 1, mta.base_transaction_value, 0) acctd_dr; 贷项: decode(sign(mta.base_transaction_value), -1, mta.base_transaction_value * -1, 0) acctd_cr;
select * from gl_je_headers gjh, gl_je_lines gjl, gl_import_references gir, rcv_receiving_sub_ledger rcs where gjh.je_header_id = gjl.je_header_id and gir.je_header_id = gjl.je_header_id and gir.je_line_num = gjl.je_line_num and gjh.je_source = 'Purchasing' and gir.reference_5 = to_char(rcs.rcv_transaction_id);
select * from gl_je_headers gjh, gl_je_lines gjl, gl_import_references gir, fa_adjustments fad where gjh.je_header_id = gjl.je_header_id and gir.je_header_id = gjl.je_header_id 6 and gir.je_line_num = gjl.je_line_num and gjh.je_source = 'Assets' and gir.je_header_id = fad.je_header_id and gir.je_line_num = fad.je_line_num;