313: AND dtn2.year < p_year)
314: group by dtn.year;
315:
316: --
317: -- Get total asset untis from FA_ASSET_HISTORY at target_date
318: CURSOR c_total_units_cost (
319: p_book_type_code VARCHAR2,
320: p_asset_id NUMBER,
321: p_target_date DATE)
322:
323: is
324: select AH.UNITS,
325: bk.cost
326: from FA_ASSET_HISTORY AH,
327: FA_BOOKS BK
328: Where AH.ASSET_ID = p_asset_id
329: and AH.ASSET_ID = BK.ASSET_ID
330: and BK.BOOK_TYPE_CODE = p_book_type_code
329: and AH.ASSET_ID = BK.ASSET_ID
330: and BK.BOOK_TYPE_CODE = p_book_type_code
331: and AH.TRANSACTION_HEADER_ID_IN =
332: (select max(AH.TRANSACTION_HEADER_ID_IN )
333: from FA_ASSET_HISTORY AH,
334: FA_TRANSACTION_HEADERS TH1,
335: FA_TRANSACTION_HEADERS TH2
336: where AH.ASSET_ID = p_asset_id
337: and AH.TRANSACTION_HEADER_ID_IN =TH1.TRANSACTION_HEADER_ID
390:
391: cursor c_ah_max_date_effective(p_asset_id number,
392: p_prior_date date) is
393: SELECT MAX(ah1.date_effective)
394: from FA_ASSET_HISTORY ah1 ,
395: FA_TRANSACTION_HEADERS TH1,
396: FA_TRANSACTION_HEADERS TH2
397: where ah1.asset_id= p_asset_id
398: and ah1.transaction_header_id_in = TH1.transaction_header_id
430:
431: cursor c_ah_max_thid_in(p_asset_id number,
432: p_date_effective date) is
433: SELECT MAX(ah1.transaction_header_id_in)
434: from FA_ASSET_HISTORY ah1
435: where ah1.asset_id= p_asset_id
436: and ah1.date_effective = p_date_effective;
437:
438: h_prior_bk_thid_in number;
645: | |-|FA_TRANSACTION_HEADERS (THD2)|
646: | +-----------------------------+
647: |
648: | +-----------------+ +----------------------+
649: |--------------|FA_ADDITIONS (AD)|----|FA_ASSET_HISTORY (AH) |
650: | +-----------------+ +----------------------+
651: | | |
652: +--------------+ | | +--------------------+
653: |TEMP VIEW (SM)| | |-|FA_CATEGORIES (CAT) |
849: ' From
850: FA_ADDITIONS AD,
851: FA_BOOKS BK,
852: FA_DISTRIBUTION_HISTORY DH,
853: FA_ASSET_HISTORY AH,
854: FA_TRANSACTION_HEADERS THA1,
855: FA_TRANSACTION_HEADERS THA2,
856: FA_TRANSACTION_HEADERS THB1,
857: FA_TRANSACTION_HEADERS THB2,
960: l_from_nbv :=
961: 'From
962: FA_ADDITIONS AD,
963: FA_BOOKS BK,
964: FA_ASSET_HISTORY AH,
965: FA_CATEGORIES CAT,
966: FA_METHODS MTH,
967: FA_DEPRN_TAX_REP_NBVS NBV
968: ';
1059: BK.ASSET_ID
1060: From FA_BOOKS BK,
1061: FA_ADDITIONS AD,
1062: FA_DISTRIBUTION_HISTORY DH,
1063: FA_ASSET_HISTORY AH,
1064: FA_LOCATIONS LOC,
1065: FA_CATEGORIES CAT,
1066: FA_METHODS MTH,
1067: FA_TRANSACTION_HEADERS TH1,