/* Payable Invoice Accounting Query */
SELECT aia.INVOICE_ID "Invoice Id",
aia.INVOICE_NUM "Invoice Number",
aia.INVOICE_DATE "Invoice Date",
aia.INVOICE_AMOUNT "Amount",
xal.ENTERED_DR "Entered DR in SLA",
xal.ENTERED_CR "Entered CR in SLA",
xal.ACCOUNTED_DR "Accounted DR in SLA",
xal.ACCOUNTED_CR "Accounted CR in SLA",
gjl.ENTERED_DR "Entered DR in GL",
gjl.ACCOUNTED_DR "Accounted DR in GL",
xal.ACCOUNTING_CLASS_CODE "Accounting Class",
gl_flexfields_pkg.get_description_sql (50354, 4,
gcc.segment4) account_description,
gcc.segment1
|| '.'
|| gcc.segment2
|| '.'
|| gcc.segment3
|| '.'
|| gcc.segment4
|| '.'
|| gcc.segment5
|| '.'
|| gcc.segment6
|| '.'
|| gcc.segment7 "Code Combination",
xah.ae_header_id,gcc.CODE_COMBINATION_ID --,aida.DIST_CODE_COMBINATION_ID
FROM ap_invoices_all aia /*,
ap_invoice_lines_all aila,
ap_invoice_distributions_all aida*/,
gl_code_combinations gcc,
xla.xla_transaction_entities xte,
xla.xla_events xev,
xla.xla_ae_headers xah,
xla.xla_ae_lines xal,
gl_import_references gir,
gl_je_headers gjh,
gl_je_lines gjl
WHERE aia.invoice_id = 76201
/*and aia.INVOICE_ID=aila.INVOICE_ID
and aida.INVOICE_ID=aila.INVOICE_ID
and aida.INVOICE_LINE_NUMBER=aila.LINE_NUMBER
and aida.DIST_CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID*/
AND xah.gl_transfer_status_code = 'Y'
AND gcc.code_combination_id = xal.code_combination_id
AND aia.invoice_id = xte.source_id_int_1
AND xte.entity_id = xev.entity_id
AND xah.entity_id = xte.entity_id
AND xah.event_id = xev.event_id
AND xah.ae_header_id = xal.ae_header_id
AND xal.gl_sl_link_id = gir.gl_sl_link_id
AND gir.gl_sl_link_table = xal.gl_sl_link_table
AND gjl.je_header_id = gjh.je_header_id
AND gjh.je_header_id = gir.je_header_id
AND gjl.je_header_id = gir.je_header_id
AND gir.je_line_num = gjl.je_line_num
AND xal.code_combination_id = gjl.code_combination_id
AND gcc.code_combination_id = gjl.code_combination_id
/* Payable Invoice Payment Accounting Query */
select XAH.je_category_name,xev.EVENT_ID,xte.entity_id,XAL.ae_header_id,xal.AE_LINE_NUM, xte.source_id_int_1,
xal.ENTERED_DR "Entered DR in SLA",
xal.ENTERED_CR "Entered CR in SLA",
xal.ACCOUNTED_DR "Accounted DR in SLA",
xal.ACCOUNTED_CR "Accounted CR in SLA"/*,
gjl.ENTERED_DR "Entered DR in GL",
gjl.ACCOUNTED_DR "Accounted DR in GL"*/,
xal.CODE_COMBINATION_ID,xal.ACCOUNTING_CLASS_CODE "Accounting Class",
gl_flexfields_pkg.get_description_sql (50354,
4,
gcc.SEGMENT4
)accountx,
gcc.SEGMENT1||'.'||gcc.SEGMENT2||'.'
||gcc.SEGMENT3||'.'||gcc.SEGMENT4||'.'
||gcc.SEGMENT5||'.'||gcc.SEGMENT6||'.'
||gcc.SEGMENT7 "Code Combination",
xah.JE_CATEGORY_NAME "JE Category Name" ,XAL.GL_SL_LINK_ID
from AP_INVOICE_PAYMENTS_ALL aipa,
xla.xla_events xev,
xla.xla_transaction_entities XTE,
xla.xla_ae_headers XAH,
xla.xla_ae_lines XAL,
gl_code_combinations gcc/*,
GL_IMPORT_REFERENCES gir*/
where/* aipa.INVOICE_PAYMENT_ID=36799
and */ aipa.INVOICE_ID=76201
and aipa.ACCOUNTING_EVENT_ID=xev.EVENT_ID
AND xev.entity_id= xte.entity_id
AND xah.entity_id= xte.entity_id
AND xah.event_id= xev.event_id
AND XAH.ae_header_id = XAL.ae_header_id
and XAH.je_category_name='Payments'
and xal.CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID
-- AND XAL.GL_SL_LINK_ID=gir.GL_SL_LINK_ID
--AND gir.GL_SL_LINK_TABLE = xal.GL_SL_LINK_TABLE
SELECT aia.INVOICE_ID "Invoice Id",
aia.INVOICE_NUM "Invoice Number",
aia.INVOICE_DATE "Invoice Date",
aia.INVOICE_AMOUNT "Amount",
xal.ENTERED_DR "Entered DR in SLA",
xal.ENTERED_CR "Entered CR in SLA",
xal.ACCOUNTED_DR "Accounted DR in SLA",
xal.ACCOUNTED_CR "Accounted CR in SLA",
gjl.ENTERED_DR "Entered DR in GL",
gjl.ACCOUNTED_DR "Accounted DR in GL",
xal.ACCOUNTING_CLASS_CODE "Accounting Class",
gl_flexfields_pkg.get_description_sql (50354, 4,
gcc.segment4) account_description,
gcc.segment1
|| '.'
|| gcc.segment2
|| '.'
|| gcc.segment3
|| '.'
|| gcc.segment4
|| '.'
|| gcc.segment5
|| '.'
|| gcc.segment6
|| '.'
|| gcc.segment7 "Code Combination",
xah.ae_header_id,gcc.CODE_COMBINATION_ID --,aida.DIST_CODE_COMBINATION_ID
FROM ap_invoices_all aia /*,
ap_invoice_lines_all aila,
ap_invoice_distributions_all aida*/,
gl_code_combinations gcc,
xla.xla_transaction_entities xte,
xla.xla_events xev,
xla.xla_ae_headers xah,
xla.xla_ae_lines xal,
gl_import_references gir,
gl_je_headers gjh,
gl_je_lines gjl
WHERE aia.invoice_id = 76201
/*and aia.INVOICE_ID=aila.INVOICE_ID
and aida.INVOICE_ID=aila.INVOICE_ID
and aida.INVOICE_LINE_NUMBER=aila.LINE_NUMBER
and aida.DIST_CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID*/
AND xah.gl_transfer_status_code = 'Y'
AND gcc.code_combination_id = xal.code_combination_id
AND aia.invoice_id = xte.source_id_int_1
AND xte.entity_id = xev.entity_id
AND xah.entity_id = xte.entity_id
AND xah.event_id = xev.event_id
AND xah.ae_header_id = xal.ae_header_id
AND xal.gl_sl_link_id = gir.gl_sl_link_id
AND gir.gl_sl_link_table = xal.gl_sl_link_table
AND gjl.je_header_id = gjh.je_header_id
AND gjh.je_header_id = gir.je_header_id
AND gjl.je_header_id = gir.je_header_id
AND gir.je_line_num = gjl.je_line_num
AND xal.code_combination_id = gjl.code_combination_id
AND gcc.code_combination_id = gjl.code_combination_id
/* Payable Invoice Payment Accounting Query */
select XAH.je_category_name,xev.EVENT_ID,xte.entity_id,XAL.ae_header_id,xal.AE_LINE_NUM, xte.source_id_int_1,
xal.ENTERED_DR "Entered DR in SLA",
xal.ENTERED_CR "Entered CR in SLA",
xal.ACCOUNTED_DR "Accounted DR in SLA",
xal.ACCOUNTED_CR "Accounted CR in SLA"/*,
gjl.ENTERED_DR "Entered DR in GL",
gjl.ACCOUNTED_DR "Accounted DR in GL"*/,
xal.CODE_COMBINATION_ID,xal.ACCOUNTING_CLASS_CODE "Accounting Class",
gl_flexfields_pkg.get_description_sql (50354,
4,
gcc.SEGMENT4
)accountx,
gcc.SEGMENT1||'.'||gcc.SEGMENT2||'.'
||gcc.SEGMENT3||'.'||gcc.SEGMENT4||'.'
||gcc.SEGMENT5||'.'||gcc.SEGMENT6||'.'
||gcc.SEGMENT7 "Code Combination",
xah.JE_CATEGORY_NAME "JE Category Name" ,XAL.GL_SL_LINK_ID
from AP_INVOICE_PAYMENTS_ALL aipa,
xla.xla_events xev,
xla.xla_transaction_entities XTE,
xla.xla_ae_headers XAH,
xla.xla_ae_lines XAL,
gl_code_combinations gcc/*,
GL_IMPORT_REFERENCES gir*/
where/* aipa.INVOICE_PAYMENT_ID=36799
and */ aipa.INVOICE_ID=76201
and aipa.ACCOUNTING_EVENT_ID=xev.EVENT_ID
AND xev.entity_id= xte.entity_id
AND xah.entity_id= xte.entity_id
AND xah.event_id= xev.event_id
AND XAH.ae_header_id = XAL.ae_header_id
and XAH.je_category_name='Payments'
and xal.CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID
-- AND XAL.GL_SL_LINK_ID=gir.GL_SL_LINK_ID
--AND gir.GL_SL_LINK_TABLE = xal.GL_SL_LINK_TABLE
No comments:
Post a Comment