82: AND fdh.code_combination_id = p_ccid_in
83: AND fdh.transaction_header_id_in =
84: (SELECT MAX(fdh1.transaction_header_id_in)
85: FROM fa_distribution_history fdh1
86: ,fa_transaction_headers fth1
87: WHERE fdh1.asset_id = p_asset_id_in
88: AND fdh1.book_type_code = P_BOOK_NAME
89: AND fdh1.code_combination_id = p_ccid_in
90: AND fdh1.transaction_header_id_in = fth1.transaction_header_id
115: INTO ln_amount
116: FROM fa_deprn_detail fdd
117: ,fa_distribution_history fdh
118: ,fa_asset_history fah
119: ,fa_transaction_headers fth
120: WHERE fdd.period_counter = (
121: SELECT MAX(fdd1.period_counter)
122: FROM fa_deprn_detail fdd1
123: WHERE fdd1.book_type_code = P_BOOK_NAME
178: BEGIN
179: SELECT SUM(NVL(DECODE(fadj.debit_credit_flag, 'CR', -1 * fadj.adjustment_amount
180: , fadj.adjustment_amount), 0)) additions
181: INTO ln_amount
182: FROM fa_transaction_headers fth
183: ,fa_adjustments fadj
184: ,fa_asset_history fah
185: ,fa_distribution_history fdh
186: WHERE fth.asset_id = fah.asset_id
235: BEGIN
236: SELECT SUM(NVL(DECODE(fadj.debit_credit_flag, 'DR',(-1)*fadj.adjustment_amount,fadj.adjustment_amount), 0)) retirements
237: INTO ln_amount
238: FROM fa_books fb
239: ,fa_transaction_headers fth
240: ,fa_adjustments fadj
241: ,fa_asset_history fah
242: ,fa_distribution_history fdh
243: WHERE fth.asset_id = fah.asset_id
289: SELECT SUM(x.all_transferred)
290: INTO ln_amount
291: FROM (
292: SELECT DECODE(fadj.debit_credit_flag, 'CR', -1 * fadj.adjustment_amount, fadj.adjustment_amount) all_transferred
293: FROM fa_transaction_headers fth
294: ,fa_adjustments fadj
295: ,fa_asset_history fah1
296: ,fa_distribution_history fdh
297: WHERE EXISTS (
330: AND fth.transaction_header_id >= fah1.transaction_header_id_in
331: AND fth.transaction_header_id < NVL(fah1.transaction_header_id_out, fth.transaction_header_id + 1)
332: UNION ALL
333: SELECT DECODE(fadj.debit_credit_flag, 'CR', -1 * fadj.adjustment_amount, fadj.adjustment_amount) all_transferred
334: FROM fa_transaction_headers fth
335: ,fa_adjustments fadj
336: ,fa_asset_history fah1
337: ,fa_asset_history fah2
338: ,fa_distribution_history fdh
404: BEGIN
405: BEGIN
406: SELECT SUM(DECODE(fadj.debit_credit_flag, 'CR', -1 * fadj.adjustment_amount, fadj.adjustment_amount))
407: INTO ln_amount
408: FROM fa_transaction_headers fth
409: ,fa_adjustments fadj
410: ,fa_asset_history fah
411: ,fa_distribution_history fdh
412: WHERE fth.asset_id = fah.asset_id
454: BEGIN
455: SELECT SUM(DECODE(fadj.debit_credit_flag, 'CR', -1 * fadj.adjustment_amount, fadj.adjustment_amount))
456: INTO ln_amount
457: FROM fa_books fb
458: ,fa_transaction_headers fth
459: ,fa_adjustments fadj
460: ,fa_asset_history fah
461: ,fa_distribution_history fdh
462: WHERE fth.asset_id = fah.asset_id
729: ,SUM(DECODE(fth.transaction_subtype,'APPREC',0,
730: DECODE(fadj.debit_credit_flag,'CR',-1*fadj.adjustment_amount
731: ,fadj.adjustment_amount))) adjustment_amount
732: FROM fa_adjustments fadj
733: ,fa_transaction_headers fth
734: WHERE fadj.transaction_header_id = fth.transaction_header_id(+)
735: and fth.transaction_type_code IN ('ADJUSTMENT','ADDITION')
736: and fadj.adjustment_type(+) = 'EXPENSE'
737: and fadj.book_type_code = P_BOOK_NAME
777: BEGIN
778: SELECT SUM(NVL(DECODE(fadj.debit_credit_flag, 'DR',(-1)*fadj.adjustment_amount,fadj.adjustment_amount), 0)) retirements
779: INTO ln_amount
780: FROM fa_books fb
781: ,fa_transaction_headers fth
782: ,fa_adjustments fadj
783: ,fa_asset_history fah
784: ,fa_distribution_history fdh
785: WHERE fth.asset_id = fah.asset_id