[Home] [Help]
PACKAGE BODY: APPS.FAP_CALCULATE
Source
1 PACKAGE BODY FAP_CALCULATE as
2 /* $Header: fapkcab.pls 120.3 2005/07/25 09:58:20 yyoon 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,
12 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) is
13 rc_no_ceiling number;
14 begin
15 select cost - salvage_value -
16 (nvl(itc_basis, 0) * nvl( min(ir.basis_reduction_rate), 0))
17 into rc_no_ceiling
18 from fa_itc_rates ir
19 where ir.itc_amount_id = calc_recoverable_cost.itc_amount_id;
20
21 select least (rc_no_ceiling, nvl (min (ce.limit), rc_no_ceiling))
22 into recoverable_cost
23 from fa_ceilings ce,
24 fa_ceiling_types ct
25 where ce.ceiling_name =
26 decode (ct.ceiling_type,
27 'RECOVERABLE COST CEILING',
28 calc_recoverable_cost.ceiling_name,
29 NULL) and
30 date_placed_in_service between
31 nvl(ce.start_date, date_placed_in_service) and
32 nvl(ce.end_date, date_placed_in_service)
33 and ct.ceiling_name = calc_recoverable_cost.ceiling_name;
34 exception
35 when NO_DATA_FOUND then
36 FND_MESSAGE.SET_NAME('OFA', 'FA_FE_CANT_GEN_RECOV_COST');
37 FND_MESSAGE.RAISE_ERROR;
38 end;
39
40 END FAP_CALCULATE;