Thursday, 13 June 2013

Gl Trail Balance Budget

SELECT   glcc.concatenated_segments gl_account_string,
          glcc.code_combination_id code_combination_id,
          l.description ACCOUNT_TYPE,
         glcc.gl_account_type GL_ACCOUNT_TYPE,
         be.period_name TO_PERIOD_NAME,
         bb.period_name FROM_PERIOD_NAME,
         be.currency_code CURRENCY_CODE,
         bv.budget_name BUDGET_NAME,
         led.name LEDGER_NAME,
         led.currency_code LEDGER_CURRENCY,
         NVL (be.translated_flag, 'R') TRANSLATED_FLAG,
         NVL (bb.begin_balance_dr, 0) - NVL (bb.begin_balance_cr, 0)
            BEGIN_BAL,
           NVL (be.begin_balance_dr, 0)
         - NVL (be.begin_balance_cr, 0)
         + NVL (be.period_net_dr, 0)
         - NVL (be.period_net_cr, 0)
            END_BAL,
         (  NVL (be.begin_balance_dr, 0)
          - NVL (be.begin_balance_cr, 0)
          + NVL (be.period_net_dr, 0)
          - NVL (be.period_net_cr, 0))
         - (NVL (bb.begin_balance_dr, 0) - NVL (bb.begin_balance_cr, 0))
            PERIOD_ACTIVITY              
                           ,
         BV.BUDGET_VERSION_ID
  FROM   gl_lookups l,
         gl_code_combinations_kfv glcc,
         gl_balances bb,
         gl_balances be,
         gl_budget_versions bv,
         gl_ledgers led
 WHERE       gl_security_pkg.validate_access (led.ledger_id) = 'TRUE'
         AND be.ledger_id = led.ledger_id
         AND be.actual_flag = 'B'
         AND be.budget_version_id = bv.budget_version_id
         AND be.template_id IS NULL
         AND bb.ledger_id(+) = be.ledger_id
         AND bb.code_combination_id(+) = be.code_combination_id + 0
         AND bb.currency_code(+) = be.currency_code
         AND bb.actual_flag(+) = 'B'
         AND bb.budget_version_id(+) = be.budget_version_id
         AND bb.template_id(+) IS NULL
         AND be.code_combination_id + 0 = glcc.code_combination_id
         AND l.lookup_type = 'ACCOUNT TYPE'
         AND l.lookup_code = glcc.gl_account_type
         AND NVL (be.translated_flag, 'R') = NVL (bb.translated_flag, 'R')

No comments:

Post a Comment