DBA Data[Home] [Help]

PACKAGE: APPS.FA_AMORT_PVT

Source


1 PACKAGE FA_AMORT_PVT AUTHID CURRENT_USER as
2 /* $Header: FAVAMRTS.pls 120.8 2009/03/26 23:37:11 bridgway ship $ */
3 
4   --
5   -- Datatypes for pl/sql tables below
6   --
7   TYPE tab_num15_type IS TABLE OF NUMBER(15) INDEX BY BINARY_INTEGER;
8   TYPE tab_num_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
9   TYPE tab_date_type IS TABLE OF DATE INDEX BY BINARY_INTEGER;
10   TYPE tab_char1_type IS TABLE OF VARCHAR2(15) INDEX BY BINARY_INTEGER;
11   TYPE tab_char3_type IS TABLE OF VARCHAR2(3) INDEX BY BINARY_INTEGER;
12   TYPE tab_char15_type IS TABLE OF VARCHAR2(15) INDEX BY BINARY_INTEGER;
13   TYPE tab_char30_type IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
14 
15   --
16   -- PL/SQL tables used in package body as well as FA_CDE_PKG.faxcde
17   --
18   t_period_counter              tab_num15_type;
19   t_fiscal_year                 tab_num15_type;
20   t_period_num                  tab_num15_type;
21   t_calendar_period_open_date   tab_date_type;
22   t_calendar_period_close_date  tab_date_type;
23   t_reset_adjusted_cost_flag    tab_char1_type;
24   t_change_in_cost              tab_num_type;
25   t_change_in_cip_cost          tab_num_type;
26   t_cost                        tab_num_type;
27   t_cip_cost                    tab_num_type;
28   t_salvage_type                tab_char30_type;
29   t_percent_salvage_value       tab_num_type;
30   t_salvage_value               tab_num_type;
31   t_member_salvage_value        tab_num_type;
32   t_recoverable_cost            tab_num_type;
33   t_deprn_limit_type            tab_char30_type;
34   t_allowed_deprn_limit         tab_num_type;
35   t_allowed_deprn_limit_amount  tab_num_type;
36   t_member_deprn_limit_amount   tab_num_type;
37   t_adjusted_recoverable_cost   tab_num_type;
38   t_adjusted_cost               tab_num_type;
39   t_depreciate_flag             tab_char3_type;
40   t_date_placed_in_Service      tab_date_type;
41   t_deprn_method_code           tab_char15_type;
42   t_life_in_months              tab_num_type;
43   t_rate_adjustment_factor      tab_num_type;
44   t_adjusted_rate               tab_num_type;
45   t_bonus_rule                  tab_char30_type;
46   t_adjusted_capacity           tab_num_type;
47   t_production_capacity         tab_num_type;
48   t_unit_of_measure             tab_char30_type;
49   t_remaining_life1             tab_num15_type;
50   t_remaining_life2             tab_num15_type;
51   t_old_adjusted_cost           tab_num_type;
52   t_formula_factor              tab_num_type;
53   t_unrevalued_cost             tab_num_type;
54   t_reval_amortization_basis    tab_num_type;
55   t_reval_ceiling               tab_num_type;
56   t_ceiling_name                tab_char30_type;
57   t_eofy_adj_cost               tab_num_type;
58   t_eofy_formula_factor         tab_num_type;
59   t_eofy_reserve                tab_num_type;
60   t_prior_eofy_reserve          tab_num_type;
61   t_eop_adj_cost                tab_num_type;
62   t_eop_formula_factor          tab_num_type;
63   t_short_fiscal_year_flag      tab_char3_type;
64   t_group_asset_id              tab_num15_type;
65   t_super_group_id              tab_num15_type;
66   t_over_depreciate_option      tab_char30_type;
67 
68   t_deprn_amount                tab_num_type;
69   t_ytd_deprn                   tab_num_type;
70   t_deprn_reserve               tab_num_type;
71   t_bonus_deprn_amount          tab_num_type;
72   t_bonus_ytd_deprn             tab_num_type;
73   t_bonus_deprn_reserve         tab_num_type;
74   t_bonus_rate                  tab_num_type;
75   t_impairment_amount           tab_num_type;
76   t_ytd_impairment              tab_num_type;
77   t_impairment_reserve          tab_num_type;
78   t_ltd_production              tab_num_type;
79   t_ytd_production              tab_num_type;
80   t_production                  tab_num_type;
81   t_reval_amortization          tab_num_type;
82   t_reval_deprn_expense         tab_num_type;
83   t_reval_reserve               tab_num_type;
84   t_ytd_reval_deprn_expense     tab_num_type;
85   t_prior_fy_expense            tab_num_type;
86   t_prior_fy_bonus_expense      tab_num_type;
87   t_deprn_override_flag         tab_char1_type;
88   t_system_deprn_amount         tab_num_type;
89   t_system_bonus_deprn_amount   tab_num_type;
90   t_ytd_proceeds_of_sale        tab_num_type;
91   t_ltd_proceeds_of_sale        tab_num_type;
92   t_ytd_cost_of_removal         tab_num_type;
93   t_ltd_cost_of_removal         tab_num_type;
94   t_deprn_adjustment_amount     tab_num_type;
95   t_expense_adjustment_amount   tab_num_type;
96   t_reserve_adjustment_amount   tab_num_type;
97   t_change_in_eofy_reserve      tab_num_type;
98   t_capitalized_flag            tab_char1_type;
99   t_unplanned_amount            tab_num_type;
100   t_fully_reserved_flag         tab_char1_type;
101   t_fully_retired_flag          tab_char1_type;
102   t_life_complete_flag          tab_char1_type;
103 
104   tmd_period_counter            tab_num15_type;
105   tmd_cost                      tab_num_type;
106   tm_cost                       tab_num_type;
107   tmd_cip_cost                  tab_num_type;
108   tm_cip_cost                   tab_num_type;
109   tmd_salvage_value             tab_num_type;
110   tm_salvage_value              tab_num_type;
111   tmd_deprn_limit_amount        tab_num_type;
112   tm_deprn_limit_amount         tab_num_type;
113 
114 ---------------------------------------------------------------------
115 --
116 -- Procedure Name: initMemberTable
117 --
118 --
119 -- Description
120 --
121 --------------------------------------------------------------------
122 PROCEDURE initMemberTable;
123 
124 
125  ---------------------------------------------------------------------
126  --
127  -- Function Name:    faxama
128  --
129  --
130  -- Description
131  --
132  --------------------------------------------------------------------
133 
134 FUNCTION faxama
135          (px_trans_rec           IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
136           p_asset_hdr_rec                      FA_API_TYPES.asset_hdr_rec_type,
137           p_asset_desc_rec                     FA_API_TYPES.asset_desc_rec_type,
138           p_asset_cat_rec                      FA_API_TYPES.asset_cat_rec_type,
139           p_asset_type_rec                     FA_API_TYPES.asset_type_rec_type,
140           p_asset_fin_rec_old                  FA_API_TYPES.asset_fin_rec_type,
141           p_asset_fin_rec_adj                  FA_API_TYPES.asset_fin_rec_type default null,
142           px_asset_fin_rec_new   IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
143           p_asset_deprn_rec                    FA_API_TYPES.asset_deprn_rec_type,
144           p_asset_deprn_rec_adj                FA_API_TYPES.asset_deprn_rec_type default null,
145           p_period_rec                         FA_API_TYPES.period_rec_type,
146           p_mrc_sob_type_code                  VARCHAR2,
147           p_running_mode                       NUMBER,
148           p_used_by_revaluation                NUMBER,
149           p_reclassed_asset_id                 NUMBER default null,
150           p_reclass_src_dest                   VARCHAR2 default null,
151           p_reclassed_asset_dpis               DATE default null,
152           p_update_books_summary               BOOLEAN default FALSE,
153           p_proceeds_of_sale                   NUMBER default 0,
154           p_cost_of_removal                    NUMBER default 0,
155           x_deprn_exp               OUT NOCOPY NUMBER,
156           x_bonus_deprn_exp         OUT NOCOPY NUMBER,
157           x_impairment_exp          OUT NOCOPY NUMBER,
158           x_deprn_rsv               OUT NOCOPY NUMBER
159          , p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type) return boolean;
160 
161 --
162 -- Relocated from FAVCALB.pls
163 --
164 FUNCTION calc_raf_adj_cost
165    (p_trans_rec           IN            FA_API_TYPES.trans_rec_type,
166     p_asset_hdr_rec       IN            FA_API_TYPES.asset_hdr_rec_type,
167     p_asset_desc_rec      IN            FA_API_TYPES.asset_desc_rec_type,
168     p_asset_type_rec      IN            FA_API_TYPES.asset_type_rec_type,
169     p_asset_fin_rec_old   IN            FA_API_TYPES.asset_fin_rec_type,
170     px_asset_fin_rec_new  IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
171     p_asset_deprn_rec_adj IN            FA_API_TYPES.asset_deprn_rec_type,
172     p_asset_deprn_rec_new IN            FA_API_TYPES.asset_deprn_rec_type,
173     p_period_rec          IN            FA_API_TYPES.period_rec_type,
174     p_group_reclass_options_rec IN      FA_API_TYPES.group_reclass_options_rec_type default null,
175     p_mrc_sob_type_code   IN            VARCHAR2
176    , p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type) RETURN BOOLEAN;
177 
178 --
179 -- Functioins from original FA_AMORT_PVT
180 --
181 
182 /*
183  ---------------------------------------------------------------------
184  *
185  * Name         faxraf
186  *
187  *
188  * Description
189  *      This function calculates the new rate adjustment factor and the
190  *      new adjusted cost.
191  *
192  * Parameters
193  *               X_fin_info_ptr         FA_STD_TYPES.fin_info_struct
194  *               X_new_raf              number
195  *               X_adj_cost             number
196  *               X_adj_capacity         number
197  *               X_new_reval_amo_basis  number
198  *               X_new_salvage_value    number
199  *               X_reval_deprn_rsv_adj  number
200  *
201  * Modifies
202  *              X_new_raf,X_new_reval_amo_basis,X_new_salvage_value
203  * Returns
204  *              True on successful retrieval. Otherwise False.
205  *
206  * Notes
207  *
208  * History
209  *  03/24/97    tpershad        Created
210  *--------------------------------------------------------------------
211 */
212 
213 FUNCTION faxraf
214          (px_trans_rec           IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
215           p_asset_hdr_rec        IN     FA_API_TYPES.asset_hdr_rec_type,
216           p_asset_desc_rec       IN     FA_API_TYPES.asset_desc_rec_type,
217           p_asset_cat_rec        IN     FA_API_TYPES.asset_cat_rec_type,
218           p_asset_type_rec       IN     FA_API_TYPES.asset_type_rec_type,
219           p_asset_fin_rec_old    IN     FA_API_TYPES.asset_fin_rec_type,
220           px_asset_fin_rec_new   IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
221           p_asset_deprn_rec      IN     FA_API_TYPES.asset_deprn_rec_type,
222           p_period_rec           IN     FA_API_TYPES.period_rec_type,
223           px_deprn_exp           IN OUT NOCOPY number,
224           px_bonus_deprn_exp     IN OUT NOCOPY number,
225           px_impairment_exp      IN OUT NOCOPY number,
226           px_reval_deprn_rsv_adj IN out NOCOPY number,
227           p_mrc_sob_type_code    IN     VARCHAR2,
228           p_running_mode         IN     NUMBER,
229           p_used_by_revaluation  IN     NUMBER
230          , p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type) return boolean;
231 
232 /*
233  ---------------------------------------------------------------------
234  *
235  * Name         faxama
236  *
237  *
238  * Description
239  *      Calls faxraf to calculate the new raf. This is the main
240  *      routine for Amortized user exit function.
241  *      This function calls faxraf to calculate the new rate adjustment
242  *      factor and the new adjusted cost.
243  *
244  * Parameters
245  *               X_fin_info_ptr         FA_STD_TYPES.fin_info_struct
246  *               X_new_raf              number
247  *               X_adj_cost             number
248  *               X_adj_capacity         number
249  *               X_new_reval_amo_basis  number
250  *               X_new_salvage_value    number
251  *               X_ccid                 number
252  *               X_ins_adjust_flag      boolean  - This is to indicate
253  *                                                 whether to call faxiat
254  *                                                 or not. If called from
255  *                                                 whatif deprn then it is
256  *                                                 FALSE and we do not insert
257  *                                                 rows in fa_adjustments.
258  *               X_deprn_exp            number - deprn expense inserted into
259  *                                               fa_adjustment
260  *
261  * Modifies
262  *              X_new_raf,X_new_reval_amo_basis,X_new_salvage_value
263  * Returns
264  *              True on successful retrieval. Otherwise False.
265  *
266  * Notes
267  *
268  * History
269  *  03/24/97    tpershad        Created
270  *--------------------------------------------------------------------
271 */
272 
273 FUNCTION faxama
274          (px_trans_rec          IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
275           p_asset_hdr_rec       IN     FA_API_TYPES.asset_hdr_rec_type,
276           p_asset_desc_rec      IN     FA_API_TYPES.asset_desc_rec_type,
277           p_asset_cat_rec       IN     FA_API_TYPES.asset_cat_rec_type,
278           p_asset_type_rec      IN     FA_API_TYPES.asset_type_rec_type,
279           p_asset_fin_rec_old   IN     FA_API_TYPES.asset_fin_rec_type,
280           p_asset_fin_rec_adj   IN     FA_API_TYPES.asset_fin_rec_type default null,
281           px_asset_fin_rec_new  IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
282           p_asset_deprn_rec     IN     FA_API_TYPES.asset_deprn_rec_type,
283           p_asset_deprn_rec_adj IN     FA_API_TYPES.asset_deprn_rec_type default null,
284           p_period_rec          IN     FA_API_TYPES.period_rec_type,
285           p_mrc_sob_type_code   IN     VARCHAR2,
286           p_running_mode        IN     NUMBER,
287           p_used_by_revaluation IN     NUMBER,
288           p_reclassed_asset_id         NUMBER default null,
289           p_reclass_src_dest           VARCHAR2 default null,
290           p_reclassed_asset_dpis       DATE default null,
291           x_deprn_exp              OUT NOCOPY number,
292           x_bonus_deprn_exp        OUT NOCOPY number,
293           x_impairment_exp         OUT NOCOPY number
294          , p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type) return boolean;
295 
296 /*
297  ---------------------------------------------------------------------
298  *
299  * Name         get_reserve
300  *
301  *
302  * Description
303  *              This function is called when user tries to do amoritization
304  *              and specified amortization start date is eariler than the
305  *              addition for those assets that are added with reserve
306  *              or added with prior period dpis.
307  *              It will return reserve accumulated for up to the period right before the
308  *              amortization period.
309  *
310  * Parameters
311  *              X_fin_info_ptr     in out fa_std_types.fin_info_struct,
312  *              x_add_txn_id       in number  -- transaction id of addition txn
313  *              x_amortize_fy      in integer
314  *              x_amortize_per_num in integer
315  *              x_pers_per_yr      in integer
316  *              x_deprn_rsv        out number -- reserve upto the period prior to amort period
317  *              x_bonus_deprn_rsv  out number
318  *
319  *
320  * Modifies
321  *              X_deprn_rsv, X_bonus_deprn_rsv
322  * Returns
323  *              True on successful retrieval. Otherwise False.
324  *
325  * Notes
326  * History
327  *  06/23/00    lson        Created
328  *--------------------------------------------------------------------
329 */
330 
331 
332 FUNCTION get_reserve(px_trans_rec        in out nocopy FA_API_TYPES.trans_rec_type,
333                      p_asset_hdr_rec     in     FA_API_TYPES.asset_hdr_rec_type,
334                      p_asset_desc_rec    in     FA_API_TYPES.asset_desc_rec_type,
335                      px_asset_fin_rec    in out nocopy FA_API_TYPES.asset_fin_rec_type,
336                      p_add_txn_id        in     number,
337                      p_amortize_fy       in     integer,
338                      p_amortize_per_num  in     integer,
339                      p_pers_per_yr       in     integer,
340                      p_mrc_sob_type_code in     varchar2,
341                      x_deprn_rsv            out nocopy number,
342                      x_bonus_deprn_rsv      out nocopy number,
343                      x_impairment_rsv       out nocopy number, p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type) return boolean;
344 
345 
346 /*
347  ---------------------------------------------------------------------
348  *
349  * Name         faxnac
350  *
351  *
352  * Description
353  *      Calls faxnac to check if the calculation method of depreciation
354  *      is "Strict Calculation Basis".   If so, it will either return the
355  *      recoverable cost(for cost based methods), or return the NBV as of
356  *      the beginning of the fiscal year
357  *
358  * Parameters
359  *               X_method_code         FA_STD_TYPES.fin_info_struct
360  *               X_life                FA_STD_TYPES.fin_info_struct
361  *               X_rec_cost            FA_STD_TYPES.dpr_struct
362  *               X_prior_fy_exp        FA_STD_TYPES.dprn_out_struct
363  *               X_deprn_rsv           null
364  *               X_ytd_deprn           null
365  *               X_new_adj_cost        new adjusted cost  -- in out
366  *
367  * Modifies
368  *              X_new_adj_cost
369  * Returns
370  *              True on successful retrieval. Otherwise False.
371  *
372  * Notes
373  * History
374  *  05/11/00    astakaha        Created
375  *--------------------------------------------------------------------
376 */
377 
378 FUNCTION faxnac(p_method_code          in varchar2,
379                 p_life                 in number,
380                 p_rec_cost             in number,
381                 p_prior_fy_exp         in number,
382                 p_deprn_rsv            in number,
383                 p_ytd_deprn            in number,
384                 px_adj_cost            in out nocopy number, p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type)
385 return boolean;
386 
387 END FA_AMORT_PVT;