--总账分录追溯发票 SELECT DISTINCT AIA.* FROM AP_AE_HEADERS_ALL AAH, --帐户分录头表 AP_AE_LINES_ALL AAL, --账户分录行表,每一个会计事件都会在此表中产生会计分录 GL_JE_BATCHES GJB, GL_JE_HEADERS GJH, GL_JE_LINES GJL, AP_INVOICES_ALL AIA, AP_ACCOUNTING_EVENTS_ALL AAE --会计帐户事件表,一种能产生帐户的事务处理活动, 如:发票调整, 预付款, 付款等. WHERE 1 = 1 AND AAH.AE_HEADER_ID = AAL.AE_HEADER_ID AND GJB.JE_BATCH_ID = GJH.JE_BATCH_ID AND GJH.JE_HEADER_ID = GJL.JE_HEADER_ID AND GJL.GL_SL_LINK_ID = AAL.GL_SL_LINK_ID --关键点 AND GJH.JE_SOURCE = ‘Payables‘ AND AIA.INVOICE_ID = AAE.SOURCE_ID AND AAE.SOURCE_TABLE = ‘AP_INVOICES‘ AND AAH.ACCOUNTING_EVENT_ID = AAE.ACCOUNTING_EVENT_ID --关键点 AND GJB.NAME = ‘3292 应付款 1047558: A 29786‘
时间: 2024-10-09 08:01:56