SELECT
gl.name ledger,
gjh.ledger_id,
gjh.name,
gjh.period_name,
WE.wip_entity_name,
gjh.JE_CATEGORY,
gjh.je_source,
gjh.status,
gjh.currency_code,
gjh.je_batch_id,
gjh.posted_date,
gjh.ACCRUAL_REV_STATUS,
gjh.accrual_rev_period_name,
glcc.segment3,
glcc.segment4,
apps.gl_flexfields_pkg.get_description_sql (
glcc.chart_of_accounts_id,
3,
glcc.segment3)
gl_branch_desc,
glcc.segment4
gl_account,
apps.gl_flexfields_pkg.get_description_sql (
glcc.chart_of_accounts_id,
4,
glcc.segment4)
gl_account_desc,
SUM (NVL (gjl.ACCOUNTED_DR, 0))
accounted_dr,
SUM (NVL (gjl.accounted_Cr, 0))
accounted_cr,
SUM (NVL (gjl.ACCOUNTED_DR, 0)) - SUM (NVL (gjl.accounted_Cr, 0))
diff
FROM
gl_ledgers gl,
apps.gl_je_batches GJB,
apps.gl_je_headers GJH,
apps.gl_je_lines GJL,
apps.gl_import_references GIR,
apps.gl_code_combinations_kfv GLCC,
apps.xla_ae_headers XAH,
apps.xla_ae_lines XAL,
xla.xla_distribution_links XDL,
WIP_TRANSACTION_ACCOUNTS wta,
apps.wip_entities WE,
apps.wip_transactions WT
WHERE 1 = 1
and gl.ledger_id=GJH.ledger_id
and gl.ledger_id=GJl.ledger_id
AND GJH.je_batch_id = GJB.je_batch_id
AND GLCC.code_combination_id = GJL.code_combination_id
AND GJH.je_header_id = GJL.je_header_id
AND GJH.je_batch_id = GIR.je_batch_id
AND GJL.je_header_id = GIR.je_header_id
AND GJL.je_line_num = GIR.je_line_num
AND GIR.gl_sl_link_table = XAL.gl_sl_link_table
AND GIR.gl_sl_link_id = XAL.gl_sl_link_id
AND XAH.ae_header_id = XAL.ae_header_id
AND XAH.application_id = XAL.application_id
AND XDL.ae_header_id = XAL.ae_header_id
AND XDL.ae_line_num = XAL.ae_line_num
AND XDL.source_distribution_type = 'WIP_TRANSACTION_ACCOUNTS'
AND UPPER (NVL (GJH.je_source, 'NA')) = 'COST MANAGEMENT'
AND XDL.source_distribution_id_num_1 = WTA.wip_sub_ledger_id
AND WE.wip_entity_id = WTA.wip_entity_id
AND WTA.wip_entity_id = WT.wip_entity_id
AND WTA.organization_id = WT.organization_id
AND WTA.transaction_id = WT.transaction_id
AND gjl.effective_date <= '31-DEC-2022'
GROUP BY
gl.name,
gjh.ledger_id,
gjh.name,
gjh.period_name,
WE.wip_entity_name,
gjh.JE_CATEGORY,
gjh.je_source,
gjh.status,
gjh.currency_code,
gjh.je_batch_id,
gjh.posted_date,
gjh.ACCRUAL_REV_STATUS,
gjh.accrual_rev_period_name,
glcc.segment3,
glcc.segment4,
glcc.chart_of_accounts_id |