GL_OFSAA_BALANCES_V
Details
-
Schema: FUSION
-
Object owner: GL
-
Object type: VIEW
Columns
Name |
---|
ACCOUNTING_DATE PERIOD_NAME LEDGER_NAME SHORT_NAME BALANCE_TYPE ENTERED_CURRENCY_CODE CHART_OF_ACCOUNTS_ID COA_SEGMENT1 COA_SEGMENT2 COA_SEGMENT3 COA_SEGMENT4 COA_SEGMENT5 COA_SEGMENT6 COA_SEGMENT7 COA_SEGMENT8 COA_SEGMENT9 COA_SEGMENT10 COA_SEGMENT11 COA_SEGMENT12 COA_SEGMENT13 COA_SEGMENT14 COA_SEGMENT15 COA_SEGMENT16 COA_SEGMENT17 COA_SEGMENT18 COA_SEGMENT19 COA_SEGMENT20 COA_SEGMENT21 COA_SEGMENT22 COA_SEGMENT23 COA_SEGMENT24 COA_SEGMENT25 COA_SEGMENT26 COA_SEGMENT27 COA_SEGMENT28 COA_SEGMENT29 COA_SEGMENT30 PERIOD_NET_ENTERED PERIOD_NET PERIOD_AVG_BALANCE QUARTER_TO_DATE_AVG_BALANCE YEAR_TO_DATE_AVG_BALANCE BEGIN_BALANCE BEGIN_BALANCE_ENTERED |
Query
SQL_Statement |
---|
select null accounting_date, glb.period_name period_name, ledgers.name ledger_name, ledgers.short_name short_name, glb.actual_flag balance_type, glb.currency_code entered_currency_code, ledgers.chart_of_accounts_id chart_of_accounts_id, cc.segment1 coa_segment1, cc.segment2 coa_segment2, cc.segment3 coa_segment3, cc.segment4 coa_segment4, cc.segment5 coa_segment5, cc.segment6 coa_segment6, cc.segment7 coa_segment7, cc.segment8 coa_segment8, cc.segment9 coa_segment9, cc.segment10 coa_segment10, cc.segment11 coa_segment11, cc.segment12 coa_segment12, cc.segment13 coa_segment13, cc.segment14 coa_segment14, cc.segment15 coa_segment15, cc.segment16 coa_segment16, cc.segment17 coa_segment17, cc.segment18 coa_segment18, cc.segment19 coa_segment19, cc.segment20 coa_segment20, cc.segment21 coa_segment21, cc.segment22 coa_segment22, cc.segment23 coa_segment23, cc.segment24 coa_segment24, cc.segment25 coa_segment25, cc.segment26 coa_segment26, cc.segment27 coa_segment27, cc.segment28 coa_segment28, cc.segment29 coa_segment29, cc.segment30 coa_segment30, decode(cc.account_type, 'A', decode(glb.translated_flag, null, glb.period_net_dr_beq, glb.period_net_dr) - decode(glb.translated_flag, null, glb.period_net_cr_beq, glb.period_net_cr), 'E', decode(glb.translated_flag, null, glb.period_net_dr_beq, glb.period_net_dr) - decode(glb.translated_flag, null, glb.period_net_cr_beq, glb.period_net_cr), decode(glb.translated_flag, null, glb.period_net_cr_beq, glb.period_net_cr) - decode(glb.translated_flag, null, glb.period_net_dr_beq, glb.period_net_dr)) period_net_entered, decode(cc.account_type, 'A', glb.period_net_dr_beq - glb.period_net_cr_beq, 'E', glb.period_net_dr_beq - glb.period_net_cr_beq, glb.period_net_cr_beq - glb.period_net_dr_beq) period_net, null period_avg_balance, null quarter_to_date_avg_balance, null year_to_date_avg_balance, decode(cc.account_type, 'A', glb.begin_balance_dr_beq - glb.begin_balance_cr_beq, 'E', glb.begin_balance_dr_beq - glb.begin_balance_cr_beq, glb.begin_balance_cr_beq - glb.begin_balance_dr_beq) begin_balance, decode(cc.account_type, 'A', decode(glb.translated_flag, null, glb.begin_balance_dr_beq, glb.begin_balance_dr) - decode(glb.translated_flag, null, glb.begin_balance_cr_beq, glb.begin_balance_cr), 'E', decode(glb.translated_flag, null, glb.begin_balance_dr_beq, glb.begin_balance_dr) - decode(glb.translated_flag, null, glb.begin_balance_cr_beq, glb.begin_balance_cr), decode(glb.translated_flag, null, glb.begin_balance_cr_beq, glb.begin_balance_cr) - decode(glb.translated_flag, null, glb.begin_balance_dr_beq, glb.begin_balance_dr)) begin_balance_entered from gl_balances glb, gl_ledgers ledgers, gl_code_combinations cc where ledgers.ledger_id = glb.ledger_id and cc.code_combination_id = glb.code_combination_id and nvl(glb.translated_flag, 'R') = 'R' and glb.actual_flag = 'A' and glb.currency_code != 'STAT' union all select dpm.accounting_date accounting_date, dpm.period_name period_name, ledgers.name ledger_name, ledgers.short_name short_name, db.actual_flag balance_type, null entered_currency_code, ledgers.chart_of_accounts_id chart_of_accounts_id, cc.segment1 coa_segment1, cc.segment2 coa_segment2, cc.segment3 coa_segment3, cc.segment4 coa_segment4, cc.segment5 coa_segment5, cc.segment6 coa_segment6, cc.segment7 coa_segment7, cc.segment8 coa_segment8, cc.segment9 coa_segment9, cc.segment10 coa_segment10, cc.segment11 coa_segment11, cc.segment12 coa_segment12, cc.segment13 coa_segment13, cc.segment14 coa_segment14, cc.segment15 coa_segment15, cc.segment16 coa_segment16, cc.segment17 coa_segment17, cc.segment18 coa_segment18, cc.segment19 coa_segment19, cc.segment20 coa_segment20, cc.segment21 coa_segment21, cc.segment22 coa_segment22, cc.segment23 coa_segment23, cc.segment24 coa_segment24, cc.segment25 coa_segment25, cc.segment26 coa_segment26, cc.segment27 coa_segment27, cc.segment28 coa_segment28, cc.segment29 coa_segment29, cc.segment30 coa_segment30, null period_net_entered, null period_net, round ( (decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 1, db.period_aggregate1, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 2, db.period_aggregate2, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 3, db.period_aggregate3, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 4, db.period_aggregate4, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 5, db.period_aggregate5, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 6, db.period_aggregate6, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 7, db.period_aggregate7, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 8, db.period_aggregate8, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 9, db.period_aggregate9, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 10, db.period_aggregate10, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 11, db.period_aggregate11, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 12, db.period_aggregate12, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 13, db.period_aggregate13, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 14, db.period_aggregate14, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 15, db.period_aggregate15, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 16, db.period_aggregate16, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 17, db.period_aggregate17, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 18, db.period_aggregate18, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 19, db.period_aggregate19, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 20, db.period_aggregate20, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 21, db.period_aggregate21, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 22, db.period_aggregate22, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 23, db.period_aggregate23, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 24, db.period_aggregate24, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 25, db.period_aggregate25, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 26, db.period_aggregate26, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 27, db.period_aggregate27, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 28, db.period_aggregate28, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 29, db.period_aggregate29, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 30, db.period_aggregate30, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 31, db.period_aggregate31, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 32, db.period_aggregate32, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 33, db.period_aggregate33, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 34, db.period_aggregate34, 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 35, db.period_aggregate35, 0)) / ( dpm.accounting_date - db.period_start_date + 1 ) / nvl (fc.minimum_accountable_unit, power (10, -fc.precision))) * nvl (fc.minimum_accountable_unit, power (10, -fc.precision)) period_avg_balance, round ( (decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 1, nvl(db.quarter_aggregate1, opening_quarter_aggregate + db.period_aggregate1), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 2, nvl(db.quarter_aggregate2, opening_quarter_aggregate + db.period_aggregate2), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 3, nvl(db.quarter_aggregate3, opening_quarter_aggregate + db.period_aggregate3), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 4, nvl(db.quarter_aggregate4, opening_quarter_aggregate + db.period_aggregate4), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 5, nvl(db.quarter_aggregate5, opening_quarter_aggregate + db.period_aggregate5), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 6, nvl(db.quarter_aggregate6, opening_quarter_aggregate + db.period_aggregate6), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 7, nvl(db.quarter_aggregate7, opening_quarter_aggregate + db.period_aggregate7), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 8, nvl(db.quarter_aggregate8, opening_quarter_aggregate + db.period_aggregate8), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 9, nvl(db.quarter_aggregate9, opening_quarter_aggregate + db.period_aggregate9), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 10, nvl(db.quarter_aggregate10, opening_quarter_aggregate + db.period_aggregate10), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 11, nvl(db.quarter_aggregate11, opening_quarter_aggregate + db.period_aggregate11), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 12, nvl(db.quarter_aggregate12, opening_quarter_aggregate + db.period_aggregate12), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 13, nvl(db.quarter_aggregate13, opening_quarter_aggregate + db.period_aggregate13), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 14, nvl(db.quarter_aggregate14, opening_quarter_aggregate + db.period_aggregate14), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 15, nvl(db.quarter_aggregate15, opening_quarter_aggregate + db.period_aggregate15), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 16, nvl(db.quarter_aggregate16, opening_quarter_aggregate + db.period_aggregate16), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 17, nvl(db.quarter_aggregate17, opening_quarter_aggregate + db.period_aggregate17), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 18, nvl(db.quarter_aggregate18, opening_quarter_aggregate + db.period_aggregate18), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 19, nvl(db.quarter_aggregate19, opening_quarter_aggregate + db.period_aggregate19), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 20, nvl(db.quarter_aggregate20, opening_quarter_aggregate + db.period_aggregate20), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 21, nvl(db.quarter_aggregate21, opening_quarter_aggregate + db.period_aggregate21), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 22, nvl(db.quarter_aggregate22, opening_quarter_aggregate + db.period_aggregate22), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 23, nvl(db.quarter_aggregate23, opening_quarter_aggregate + db.period_aggregate23), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 24, nvl(db.quarter_aggregate24, opening_quarter_aggregate + db.period_aggregate24), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 25, nvl(db.quarter_aggregate25, opening_quarter_aggregate + db.period_aggregate25), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 26, nvl(db.quarter_aggregate26, opening_quarter_aggregate + db.period_aggregate26), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 27, nvl(db.quarter_aggregate27, opening_quarter_aggregate + db.period_aggregate27), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 28, nvl(db.quarter_aggregate28, opening_quarter_aggregate + db.period_aggregate28), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 29, nvl(db.quarter_aggregate29, opening_quarter_aggregate + db.period_aggregate29), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 30, nvl(db.quarter_aggregate30, opening_quarter_aggregate + db.period_aggregate30), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 31, nvl(db.quarter_aggregate31, opening_quarter_aggregate + db.period_aggregate31), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 32, nvl(db.quarter_aggregate32, opening_quarter_aggregate + db.period_aggregate32), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 33, nvl(db.quarter_aggregate33, opening_quarter_aggregate + db.period_aggregate33), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 34, nvl(db.quarter_aggregate34, opening_quarter_aggregate + db.period_aggregate34), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 35, nvl(db.quarter_aggregate35, opening_quarter_aggregate + db.period_aggregate35), 0)) / ( dpm.accounting_date - db.quarter_start_date + 1 ) / nvl (fc.minimum_accountable_unit, power (10, -fc.precision))) * nvl (fc.minimum_accountable_unit, power (10, -fc.precision)) quarter_to_date_avg_balance, round ( (decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 1, nvl(db.year_aggregate1, opening_year_aggregate + db.period_aggregate1), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 2, nvl(db.year_aggregate2, opening_year_aggregate + db.period_aggregate2), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 3, nvl(db.year_aggregate3, opening_year_aggregate + db.period_aggregate3), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 4, nvl(db.year_aggregate4, opening_year_aggregate + db.period_aggregate4), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 5, nvl(db.year_aggregate5, opening_year_aggregate + db.period_aggregate5), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 6, nvl(db.year_aggregate6, opening_year_aggregate + db.period_aggregate6), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 7, nvl(db.year_aggregate7, opening_year_aggregate + db.period_aggregate7), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 8, nvl(db.year_aggregate8, opening_year_aggregate + db.period_aggregate8), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 9, nvl(db.year_aggregate9, opening_year_aggregate + db.period_aggregate9), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 10, nvl(db.year_aggregate10, opening_year_aggregate + db.period_aggregate10), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 11, nvl(db.year_aggregate11, opening_year_aggregate + db.period_aggregate11), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 12, nvl(db.year_aggregate12, opening_year_aggregate + db.period_aggregate12), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 13, nvl(db.year_aggregate13, opening_year_aggregate + db.period_aggregate13), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 14, nvl(db.year_aggregate14, opening_year_aggregate + db.period_aggregate14), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 15, nvl(db.year_aggregate15, opening_year_aggregate + db.period_aggregate15), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 16, nvl(db.year_aggregate16, opening_year_aggregate + db.period_aggregate16), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 17, nvl(db.year_aggregate17, opening_year_aggregate + db.period_aggregate17), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 18, nvl(db.year_aggregate18, opening_year_aggregate + db.period_aggregate18), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 19, nvl(db.year_aggregate19, opening_year_aggregate + db.period_aggregate19), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 20, nvl(db.year_aggregate20, opening_year_aggregate + db.period_aggregate20), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 21, nvl(db.year_aggregate21, opening_year_aggregate + db.period_aggregate21), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 22, nvl(db.year_aggregate22, opening_year_aggregate + db.period_aggregate22), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 23, nvl(db.year_aggregate23, opening_year_aggregate + db.period_aggregate23), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 24, nvl(db.year_aggregate24, opening_year_aggregate + db.period_aggregate24), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 25, nvl(db.year_aggregate25, opening_year_aggregate + db.period_aggregate25), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 26, nvl(db.year_aggregate26, opening_year_aggregate + db.period_aggregate26), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 27, nvl(db.year_aggregate27, opening_year_aggregate + db.period_aggregate27), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 28, nvl(db.year_aggregate28, opening_year_aggregate + db.period_aggregate28), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 29, nvl(db.year_aggregate29, opening_year_aggregate + db.period_aggregate29), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 30, nvl(db.year_aggregate30, opening_year_aggregate + db.period_aggregate30), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 31, nvl(db.year_aggregate31, opening_year_aggregate + db.period_aggregate31), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 32, nvl(db.year_aggregate32, opening_year_aggregate + db.period_aggregate32), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 33, nvl(db.year_aggregate33, opening_year_aggregate + db.period_aggregate33), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 34, nvl(db.year_aggregate34, opening_year_aggregate + db.period_aggregate34), 0) + decode(trunc(dpm.accounting_date) - trunc(db.period_start_date) + 1, 35, nvl(db.year_aggregate35, opening_year_aggregate + db.period_aggregate35), 0)) / ( dpm.accounting_date - db.year_start_date + 1 ) / nvl (fc.minimum_accountable_unit, power (10, -fc.precision))) * nvl (fc.minimum_accountable_unit, power (10, -fc.precision)) year_to_date_avg_balance, null begin_balance, null begin_balance_entered from gl_daily_balances db, gl_date_period_map dpm, fnd_currencies fc, gl_ledger_relationships lr, gl_ledgers ledgers, gl_code_combinations cc where dpm.period_name || '' = db.period_name and fc.currency_code = db.currency_code and lr.source_ledger_id = db.ledger_id and lr.target_ledger_id = db.ledger_id and lr.application_id = 101 and ledgers.ledger_id = db.ledger_id and ledgers.currency_code = lr.target_currency_code and lr.target_currency_code = db.currency_code and db.currency_type = 'U' and dpm.period_set_name = ledgers.period_set_name and dpm.period_type = ledgers.accounted_period_type and db.actual_flag = 'A' and cc.code_combination_id = db.code_combination_id |