103: fa_transaction_headers fth
104: , fa_additions fa
105: , fa_books fb
106: , fa_book_controls_sec fbcs
107: , fa_distribution_history fdh
108: , fa_deprn_periods fdp
109: WHERE fth.transaction_type_code IN
110: ('ADDITION', 'ADJUSTMENT', 'RECLASS', 'REINSTATEMENT',
111: 'REVALUATION', 'TRANSFER', 'UNIT ADJUSTMENT',
236: SUM(fdh.units_assigned)
237: INTO
238: ln_total_unit
239: FROM
240: fa_distribution_history fdh
241: WHERE fdh.asset_id = v_row.asset_id
242: AND fdh.date_effective < nvl(ld_dp_close_date, SYSDATE)
243: AND (fdh.date_ineffective > nvl(ld_dp_close_date, SYSDATE) OR
244: fdh.date_ineffective IS NULL);
247: SUM(fdh.units_assigned)
248: INTO
249: ln_assigned_unit
250: FROM
251: fa_distribution_history fdh
252: WHERE fdh.asset_id = v_row.asset_id
253: AND fdh.date_effective < nvl(ld_dp_close_date, SYSDATE)
254: AND (fdh.date_ineffective > nvl(ld_dp_close_date, SYSDATE) OR
255: fdh.date_ineffective IS NULL)
320: THEN
321: --get the total unit at the transaction time, before the unit adjustment
322: SELECT SUM(fdh.units_assigned)
323: INTO ln_total_unit_before
324: FROM fa_distribution_history fdh
325: WHERE fdh.asset_id = v_row.asset_id
326: AND fdh.transaction_header_id_in < v_row.transaction_header_id
327: AND fdh.date_effective < nvl(ld_dp_close_date, SYSDATE)
328: AND (fdh.date_ineffective > nvl(ld_dp_close_date, SYSDATE) OR
330: --get the assigned unit at the transaction time
331: --,before the unit adjustment
332: SELECT SUM(fdh.units_assigned)
333: INTO ln_assigned_unit_before
334: FROM fa_distribution_history fdh
335: WHERE fdh.asset_id = v_row.asset_id
336: AND fdh.transaction_header_id_in < v_row.transaction_header_id
337: AND fdh.date_effective < nvl(ld_dp_close_date, SYSDATE)
338: AND (fdh.date_ineffective > nvl(ld_dp_close_date, SYSDATE) OR