[Home] [Help]
PACKAGE BODY: APPS.FAP_CALCULATE
Source
1 PACKAGE BODY FAP_CALCULATE as
2 /* $Header: fapkcab.pls 120.4 2009/03/26 22:35:04 bridgway ship $ */
3
4 procedure CALC_RECOVERABLE_COST
5 (cost in number,
6 salvage_value in number,
7 itc_basis in number,
8 itc_amount_id in number,
9 ceiling_name in varchar2,
10 date_placed_in_service in date,
11 recoverable_cost out nocopy number, p_log_level_rec IN FA_API_TYPES.log_level_rec_type) is
12 rc_no_ceiling number;
13 begin
14 select cost - salvage_value -
15 (nvl(itc_basis, 0) * nvl( min(ir.basis_reduction_rate), 0))
16 into rc_no_ceiling
17 from fa_itc_rates ir
18 where ir.itc_amount_id = calc_recoverable_cost.itc_amount_id;
19
20 select least (rc_no_ceiling, nvl (min (ce.limit), rc_no_ceiling))
21 into recoverable_cost
22 from fa_ceilings ce,
23 fa_ceiling_types ct
24 where ce.ceiling_name =
25 decode (ct.ceiling_type,
26 'RECOVERABLE COST CEILING',
27 calc_recoverable_cost.ceiling_name,
28 NULL) and
29 date_placed_in_service between
30 nvl(ce.start_date, date_placed_in_service) and
31 nvl(ce.end_date, date_placed_in_service)
32 and ct.ceiling_name = calc_recoverable_cost.ceiling_name;
33 exception
34 when NO_DATA_FOUND then
35 FND_MESSAGE.SET_NAME('OFA', 'FA_FE_CANT_GEN_RECOV_COST');
36 FND_MESSAGE.RAISE_ERROR;
37 end;
38
39 END FAP_CALCULATE;