442:
443: if (g_print_debug) then
444: fa_debug_pkg.add
445: (fname => l_calling_fn,
446: element => 'Get category from fa_asset_history',
447: value => '');
448: end if;
449:
450: if (g_print_debug) then
455: end if;
456:
457: SELECT category_id
458: INTO h_category_id
459: FROM fa_asset_history
460: WHERE asset_id = RET.asset_id
461: AND date_ineffective is null;
462:
463: if (g_print_debug) then
1870: element => '+++ Step 5',
1871: value => '');
1872: end if;
1873:
1874: -- UPDATING FA_ASSET_HISTORY,
1875: -- INSERTING FA_ASSET_HISTORY,
1876: -- UPDATING FA_ADDITIONS
1877: -- if (h_mrc_primary_book_flag = 1) then
1878: if (ret.mrc_sob_type_code <> 'R') then
1871: value => '');
1872: end if;
1873:
1874: -- UPDATING FA_ASSET_HISTORY,
1875: -- INSERTING FA_ASSET_HISTORY,
1876: -- UPDATING FA_ADDITIONS
1877: -- if (h_mrc_primary_book_flag = 1) then
1878: if (ret.mrc_sob_type_code <> 'R') then
1879:
1886:
1887: -- select rowidtochar(rowid)
1888: select rowid
1889: into h_rowid
1890: from fa_asset_history
1891: where asset_id = RET.asset_id
1892: and date_ineffective is null;
1893:
1894: if g_print_debug then
1897: element => '+++ Step 5.1.5',
1898: value => '');
1899: end if;
1900:
1901: update fa_asset_history
1902: set date_ineffective = today,
1903: transaction_header_id_out = h_rethdrout
1904: where rowid = h_rowid;
1905:
1909: element => '+++ Step 5.2',
1910: value => '');
1911: end if;
1912:
1913: insert into fa_asset_history
1914: (asset_id, category_id, units, asset_type,
1915: date_effective, date_ineffective, last_update_date,
1916: last_updated_by,transaction_header_id_in
1917: )
1918: select asset_id, category_id, units + RET.units_retired,
1919: asset_type, today,
1920: null, today,
1921: user_id, h_rethdrout
1922: from fa_asset_history
1923: where rowid = h_rowid;
1924:
1925: if g_print_debug then
1926: fa_debug_pkg.add
1945: value => '');
1946: end if;
1947:
1948: end if;
1949: -- END UPDATING FA_ASSET_HISTORY,
1950: -- END INSERTING FA_ASSET_HISTORY,
1951: -- END UPDATING FA_ADDITIONS
1952:
1953: if g_print_debug then
1946: end if;
1947:
1948: end if;
1949: -- END UPDATING FA_ASSET_HISTORY,
1950: -- END INSERTING FA_ASSET_HISTORY,
1951: -- END UPDATING FA_ADDITIONS
1952:
1953: if g_print_debug then
1954: fa_debug_pkg.add
2701:
2702: if g_print_debug then
2703: fa_debug_pkg.add
2704: (fname => l_calling_fn,
2705: element => 'Get category from fa_asset_history',
2706: value => '');
2707: end if;
2708:
2709: SELECT category_id
2707: end if;
2708:
2709: SELECT category_id
2710: INTO h_category_id
2711: FROM fa_asset_history
2712: WHERE asset_id = RET.asset_id
2713: AND date_ineffective is null;
2714:
2715: if RET.units_retired > 0 then /* not partial cost retirement */
3234: * expense_amount -
3235: nvl(adj.adjustment_amount, 0)
3236: FROM
3237: FA_DISTRIBUTION_HISTORY dh,
3238: FA_ASSET_HISTORY ah,
3239: FA_ADJUSTMENTS adj
3240: WHERE dh.asset_id = RET.asset_id
3241: AND dh.book_type_code = BK.dis_book
3242: AND dh.date_ineffective is null
3257: * expense_amount -
3258: nvl(adj.adjustment_amount, 0)
3259: FROM
3260: FA_DISTRIBUTION_HISTORY dh,
3261: FA_ASSET_HISTORY ah,
3262: FA_ADJUSTMENTS_MRC_V adj
3263: WHERE dh.asset_id = RET.asset_id
3264: AND dh.book_type_code = BK.dis_book
3265: AND dh.date_ineffective is null
3465: -- old structs are kept here.
3466:
3467: SELECT category_id
3468: INTO h_category_id
3469: FROM fa_asset_history
3470: WHERE asset_id = RET.asset_id
3471: AND date_ineffective is null;
3472:
3473: if not fa_cache_pkg.fazccb(