Featured post

General Ledger Revaluation

General Ledger Revaluation Account balances denominated in foreign currencies are adjusted through the revaluation procedure. Revaluat...

Sunday, 8 October 2017

FA query

select distinct th.asset_id "ID",th.book_type_code "BOOK"
,th.invoice_transaction_id "TRX_ID"
,ai.fixed_assets_cost "COST"
,ai.payables_code_combination_id "CC_ID"
from fa_transaction_headers th,
fa_asset_invoices ai,
fa_deprn_periods dp
where (th.transaction_type_code = 'ADJUSTMENT'
or th.transaction_type_code = 'ADDITION')
and dp.book_type_code = th.book_type_code
and dp.period_close_date is not null
and th.date_effective between
dp.period_open_date and nvl(dp.period_close_date, sysdate)
and th.asset_id = ai.asset_id
and th.invoice_transaction_id = ai.invoice_transaction_id_in
and ai.payables_code_combination_id = gcc.code_combination_id
and (0 =
(select sum (ai1.fixed_assets_cost)
from fa_asset_invoices ai1
where th.asset_id = ai1.asset_id
and th.invoice_transaction_id = ai1.invoice_transaction_id_in
and ai1.fixed_assets_cost != 0
and ( ai1.merged_code = 'MC'
or ai1.merged_code = 'MP')))
and not exists
( select ad2.transaction_header_id
from fa_adjustments ad2,
fa_asset_invoices ai2
where th.asset_id = ad2.asset_id
and th.asset_id = ai2.asset_id
and th.invoice_transaction_id = ai2.invoice_transaction_id_in
and th.book_type_code = ad2.book_type_code
and th.transaction_header_id = ad2.transaction_header_id
and ( ad2.source_type_code = 'ADJUSTMENT'
or ad2.source_type_code = 'ADDITION')
and ad2.adjustment_type = 'COST CLEARING'
and ad2.code_combination_id = ai2.payables_code_combination_id
and ad2.adjustment_amount = ai2.fixed_assets_cost );

No comments:

Post a Comment

Please review my topic and update your comments

Note: only a member of this blog may post a comment.