1 PACKAGE FA_WHATIF_DEPRN_PKG AUTHID CURRENT_USER as
2 /* $Header: FAWDPRS.pls 120.9.12020000.2 2012/07/19 10:45:58 mswetha ship $ */
3
4
5 -- store deprn expense values for each period in these globally-declared
6 -- arrays temporarily. insert into interface table once deprn is
7 -- completed for an asset.
8
9 TYPE whatif_itf_table_rec is RECORD (
10 new_deprn number,
11 deprn number,
12 new_bonus_deprn number,
13 bonus_deprn number,
14 fiscal_year number,
15 period_name varchar2(15),
16 new_rsv number,
17 period_num number
18 );
19
20 TYPE whatif_itf_table is TABLE of whatif_itf_table_rec
21 index by binary_integer;
22
23 G_deprn whatif_itf_table;
24
25 TYPE tab_num_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
26 TYPE tab_num15_type IS TABLE OF NUMBER(15) INDEX BY BINARY_INTEGER;
27 TYPE tab_char15_type IS TABLE OF VARCHAR2(15) INDEX BY BINARY_INTEGER;
28 TYPE tab_char30_type IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
29 TYPE tab_char35_type IS TABLE OF VARCHAR2(35) INDEX BY BINARY_INTEGER;
30 TYPE tab_char80_type IS TABLE OF VARCHAR2(80) INDEX BY BINARY_INTEGER;
31 TYPE tab_char240_type IS TABLE OF VARCHAR2(240) INDEX BY BINARY_INTEGER;
32 TYPE tab_char500_type IS TABLE OF VARCHAR2(500) INDEX BY BINARY_INTEGER;
33 TYPE tab_date_type IS TABLE OF DATE INDEX BY BINARY_INTEGER;
34
35 tb_period_name tab_char30_type;
36 tb_period_num tab_num15_type;
37 tb_fiscal_year tab_num15_type;
38
39 t_request_id tab_num15_type;
40 t_book_type_code tab_char15_type;
41 t_asset_id tab_num15_type;
42 t_asset_number tab_char15_type;
43 t_description tab_char80_type;
44 t_tag_number tab_char15_type;
45 t_serial_number tab_char35_type;
46 t_period_name tab_char15_type;
47 t_fiscal_year tab_num15_type;
48 t_expense_acct tab_char500_type;
49 t_location tab_char500_type;
50 t_units tab_num_type;
51 t_employee_name tab_char240_type;
52 t_employee_number tab_char30_type;
53 t_asset_key tab_char500_type;
54 t_current_cost tab_num_type;
55 t_current_prorate_conv tab_char15_type;
56 t_current_method tab_char15_type;
57 t_current_life tab_num15_type;
58 t_current_basic_rate tab_num_type;
59 t_current_adjusted_rate tab_num_type;
60 t_current_salvage_value tab_num_type;
61 t_depreciation tab_num_type;
62 t_new_depreciation tab_num_type;
63 t_created_by tab_num15_type;
64 t_creation_date tab_date_type;
65 t_last_update_date tab_date_type;
66 t_last_updated_by tab_num15_type;
67 t_last_update_login tab_num15_type;
68 t_date_placed_in_service tab_date_type;
69 t_category tab_char500_type;
70 t_accumulated_deprn tab_num_type;
71 t_bonus_depreciation tab_num_type;
72 t_new_bonus_depreciation tab_num_type;
73 t_current_bonus_rule tab_char30_type;
74 t_period_num tab_num15_type;
75 t_currency_code tab_char15_type;
76 --Bug 12695030
77 t_tot_new_bonus_deprn tab_num_type;
78 t_tot_bonus_deprn tab_num_type;
79 t_tot_new_rsv tab_num_type;
80 t_tot_new_deprn tab_num_type;
81 t_tot_deprn tab_num_type;
82 t_ind BINARY_INTEGER := 0;
83
84 -- function whatif_deprn_asset:
85 --
86 -- Perform depreciation on an asset using the given properties.
87 -- Includes effects of adjusting the asset first.
88 -- Places deprn expense for each period in global arrays (to be committed
89 -- to interface table later, in whatif_insert_itf).
90 -- Arguments to this function include all parameters needed to fully
91 -- load a dpr_in structure (remaining dpr_in elements can be either
92 -- deduced or selected given these parameters).
93 -- Deprn runs beginning in X_start_per and continuing for X_num_per
94 -- periods.
95 --
96 -- X_mode contains one of several values that determine how this
97 -- procedure executes:
98 -- 'E'... Asset exists, but some of the input parameters differ
99 -- from the asset's current state. Hypothetically perform the
100 -- expensed adjustment, then run deprn for the given periods,
101 -- storing expense in G_new_deprn.
102 -- 'A'... Asset exists, but some of the input parameters differ
103 -- from the asset's current state. Hypothetically perform the
104 -- amortized adjustment, then run deprn for the given periods,
105 -- storing expense in G_new_deprn.
106 -- 'N'... Asset exists, and we've already run this procedure in 'E'
107 -- or 'A' mode. Now run deprn for given periods again, this time
108 -- given asset's current state, storing expense in G_deprn.
109 -- Select asset's current state from DB, ignoring parameters.
110 -- 'H'... Hypothetical asset which doesn't exist. Just run deprn
111 -- for the indicated periods given the hypothetical parameters,
112 -- storing expense in G_new_deprn.
113 -- Also runs whatif_insert_itf when done. Should be called only from form.
114 --
115 -- This procedure can be called by whatif_deprn (E,A,N modes)
116 -- or from a R11 form (H mode). Could also be called by new Projections
117 -- code (N mode).
118
119 function whatif_deprn_asset (
120 X_asset_id in number,
121 X_mode in varchar2,
122 X_book in varchar2,
123 X_start_per in varchar2,
124 X_num_pers in number,
125 X_dpis in date default null,
126 X_prorate_date in date default null,
127 X_prorate_conv in varchar2 default null,
128 X_deprn_start_date in date default null,
129 X_ceiling_name in varchar2 default null,
130 X_bonus_rule in varchar2 default null,
131 X_method_code in varchar2 default null,
132 X_cost in number default null,
133 X_old_cost in number default null,
134 X_adj_cost in number default null,
135 X_rec_cost in number default null,
136 X_raf in number default null,
137 X_adj_rate in number default null,
138 X_reval_amo_basis in number default null,
139 X_capacity in number default null,
140 X_adj_capacity in number default null,
141 X_life in number default null,
142 X_adj_rec_cost in number default null,
143 X_salvage_value in number default null,
144 X_salvage_pct in number default null,
145 X_category_id in number default null,
146 X_deprn_rnd_flag in varchar2 default null,
147 X_calendar_type in varchar2 default null,
148 X_prior_fy_exp in number default null,
149 X_deprn_rsv in number default null,
150 X_reval_rsv in number default null,
151 X_ytd_deprn in number default null,
152 X_ltd_prod in number default null,
153 x_return_status out nocopy number)
154 return boolean;
155
156 -- function whatif_insert_itf
157
158 -- Commit rows into whatif_commit_itf,
159 -- using deprn stored in global arrays G_new_deprn and G_deprn.
160 -- X_request_id is 0 if not called from within a concurrent req.
161
162 function whatif_insert_itf (
163 X_asset_id in number,
164 X_book in varchar2,
165 X_request_id in number,
166 X_num_pers in number,
167 X_acct_struct in number,
168 X_key_struct in number,
169 X_cat_struct in number,
170 X_loc_struct in number,
171 X_precision in number,
172 X_user_id in number,
173 X_login_id in number,
174 X_last_asset in boolean default false,
175 x_return_status out nocopy number)
176 return boolean;
177
178 END FA_WHATIF_DEPRN_PKG;