DBA Data[Home] [Help]

PACKAGE: APPS.FA_AMORT_PVT

Source


1 PACKAGE FA_AMORT_PVT as
2 /* $Header: FAVAMRTS.pls 120.7.12010000.1 2008/07/28 13:18:11 appldev 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_ltd_production              tab_num_type;
76   t_ytd_production              tab_num_type;
77   t_production                  tab_num_type;
78   t_reval_amortization          tab_num_type;
79   t_reval_deprn_expense         tab_num_type;
80   t_reval_reserve               tab_num_type;
81   t_ytd_reval_deprn_expense     tab_num_type;
82   t_prior_fy_expense            tab_num_type;
83   t_prior_fy_bonus_expense      tab_num_type;
84   t_deprn_override_flag         tab_char1_type;
85   t_system_deprn_amount         tab_num_type;
86   t_system_bonus_deprn_amount   tab_num_type;
87   t_ytd_proceeds_of_sale        tab_num_type;
88   t_ltd_proceeds_of_sale        tab_num_type;
89   t_ytd_cost_of_removal         tab_num_type;
90   t_ltd_cost_of_removal         tab_num_type;
91   t_deprn_adjustment_amount     tab_num_type;
92   t_expense_adjustment_amount   tab_num_type;
93   t_reserve_adjustment_amount   tab_num_type;
94   t_change_in_eofy_reserve      tab_num_type;
95 
96   tmd_period_counter            tab_num15_type;
97   tmd_cost                      tab_num_type;
98   tm_cost                       tab_num_type;
99   tmd_cip_cost                  tab_num_type;
100   tm_cip_cost                   tab_num_type;
101   tmd_salvage_value             tab_num_type;
102   tm_salvage_value              tab_num_type;
103   tmd_deprn_limit_amount        tab_num_type;
104   tm_deprn_limit_amount         tab_num_type;
105 
106 ---------------------------------------------------------------------
107 --
108 -- Procedure Name: initMemberTable
109 --
110 --
111 -- Description
112 --
113 --------------------------------------------------------------------
114 PROCEDURE initMemberTable(p_log_level_rec      IN     FA_API_TYPES.log_level_rec_type default null);
115 
116 
117  ---------------------------------------------------------------------
118  --
119  -- Function Name:    faxama
120  --
121  --
122  -- Description
123  --
124  --------------------------------------------------------------------
125 
126 FUNCTION faxama
127          (px_trans_rec           IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
128           p_asset_hdr_rec                      FA_API_TYPES.asset_hdr_rec_type,
129           p_asset_desc_rec                     FA_API_TYPES.asset_desc_rec_type,
130           p_asset_cat_rec                      FA_API_TYPES.asset_cat_rec_type,
131           p_asset_type_rec                     FA_API_TYPES.asset_type_rec_type,
132           p_asset_fin_rec_old                  FA_API_TYPES.asset_fin_rec_type,
133           p_asset_fin_rec_adj                  FA_API_TYPES.asset_fin_rec_type default null,
134           px_asset_fin_rec_new   IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
135           p_asset_deprn_rec                    FA_API_TYPES.asset_deprn_rec_type,
136           p_asset_deprn_rec_adj                FA_API_TYPES.asset_deprn_rec_type default null,
137           p_period_rec                         FA_API_TYPES.period_rec_type,
138           p_mrc_sob_type_code                  VARCHAR2,
139           p_running_mode                       NUMBER,
140           p_used_by_revaluation                NUMBER,
141           p_reclassed_asset_id                 NUMBER default null,
142           p_reclass_src_dest                   VARCHAR2 default null,
143           p_group_reclass_type                 VARCHAR2 default null, -- Bug : 6792185
144           p_reclassed_asset_dpis               DATE default null,
145           p_update_books_summary               BOOLEAN default FALSE,
146           p_proceeds_of_sale                   NUMBER default 0,
147           p_cost_of_removal                    NUMBER default 0,
148           x_deprn_exp               OUT NOCOPY NUMBER,
149           x_bonus_deprn_exp         OUT NOCOPY NUMBER,
150           x_deprn_rsv               OUT NOCOPY NUMBER,
151 	  p_log_level_rec               IN     FA_API_TYPES.log_level_rec_type default null
152          ) return boolean;
153 
154 --
155 -- Relocated from FAVCALB.pls
156 --
157 FUNCTION calc_raf_adj_cost
158    (p_trans_rec           IN            FA_API_TYPES.trans_rec_type,
159     p_asset_hdr_rec       IN            FA_API_TYPES.asset_hdr_rec_type,
160     p_asset_desc_rec      IN            FA_API_TYPES.asset_desc_rec_type,
161     p_asset_type_rec      IN            FA_API_TYPES.asset_type_rec_type,
162     p_asset_fin_rec_old   IN            FA_API_TYPES.asset_fin_rec_type,
163     px_asset_fin_rec_new  IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
164     p_asset_deprn_rec_adj IN            FA_API_TYPES.asset_deprn_rec_type,
165     p_asset_deprn_rec_new IN            FA_API_TYPES.asset_deprn_rec_type,
166     p_period_rec          IN            FA_API_TYPES.period_rec_type,
167     p_group_reclass_options_rec IN      FA_API_TYPES.group_reclass_options_rec_type default null,
168     p_mrc_sob_type_code   IN            VARCHAR2,
169     p_log_level_rec       IN            FA_API_TYPES.log_level_rec_type default null
170    ) RETURN BOOLEAN;
171 
172 --
173 -- Functioins from original FA_AMORT_PVT
174 --
175 
176 /*
177  ---------------------------------------------------------------------
178  *
179  * Name         faxraf
180  *
181  *
182  * Description
183  *      This function calculates the new rate adjustment factor and the
184  *      new adjusted cost.
185  *
186  * Parameters
187  *               X_fin_info_ptr         FA_STD_TYPES.fin_info_struct
188  *               X_new_raf              number
189  *               X_adj_cost             number
190  *               X_adj_capacity         number
191  *               X_new_reval_amo_basis  number
192  *               X_new_salvage_value    number
193  *               X_reval_deprn_rsv_adj  number
194  *
195  * Modifies
196  *              X_new_raf,X_new_reval_amo_basis,X_new_salvage_value
197  * Returns
198  *              True on successful retrieval. Otherwise False.
199  *
200  * Notes
201  *
202  * History
203  *  03/24/97    tpershad        Created
204  *--------------------------------------------------------------------
205 */
206 
207 FUNCTION faxraf
208          (px_trans_rec           IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
209           p_asset_hdr_rec        IN     FA_API_TYPES.asset_hdr_rec_type,
210           p_asset_desc_rec       IN     FA_API_TYPES.asset_desc_rec_type,
211           p_asset_cat_rec        IN     FA_API_TYPES.asset_cat_rec_type,
212           p_asset_type_rec       IN     FA_API_TYPES.asset_type_rec_type,
213           p_asset_fin_rec_old    IN     FA_API_TYPES.asset_fin_rec_type,
214           px_asset_fin_rec_new   IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
215           p_asset_deprn_rec      IN     FA_API_TYPES.asset_deprn_rec_type,
216           p_period_rec           IN     FA_API_TYPES.period_rec_type,
217           px_deprn_exp           IN OUT NOCOPY number,
218           px_bonus_deprn_exp     IN OUT NOCOPY number,
219           px_reval_deprn_rsv_adj IN out NOCOPY number,
220           p_mrc_sob_type_code    IN     VARCHAR2,
221           p_running_mode         IN     NUMBER,
222           p_used_by_revaluation  IN     NUMBER,
223 	  p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null
224          ) return boolean;
225 
226 /*
227  ---------------------------------------------------------------------
228  *
229  * Name         faxama
230  *
231  *
232  * Description
233  *      Calls faxraf to calculate the new raf. This is the main
234  *      routine for Amortized user exit function.
235  *      This function calls faxraf to calculate the new rate adjustment
236  *      factor and the new adjusted cost.
237  *
238  * Parameters
239  *               X_fin_info_ptr         FA_STD_TYPES.fin_info_struct
240  *               X_new_raf              number
241  *               X_adj_cost             number
242  *               X_adj_capacity         number
243  *               X_new_reval_amo_basis  number
244  *               X_new_salvage_value    number
245  *               X_ccid                 number
246  *               X_ins_adjust_flag      boolean  - This is to indicate
247  *                                                 whether to call faxiat
248  *                                                 or not. If called from
249  *                                                 whatif deprn then it is
250  *                                                 FALSE and we do not insert
251  *                                                 rows in fa_adjustments.
252  *               X_deprn_exp            number - deprn expense inserted into
253  *                                               fa_adjustment
254  *
255  * Modifies
256  *              X_new_raf,X_new_reval_amo_basis,X_new_salvage_value
257  * Returns
258  *              True on successful retrieval. Otherwise False.
259  *
260  * Notes
261  *
262  * History
263  *  03/24/97    tpershad        Created
264  *--------------------------------------------------------------------
265 */
266 
267 FUNCTION faxama
268          (px_trans_rec          IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
269           p_asset_hdr_rec       IN     FA_API_TYPES.asset_hdr_rec_type,
270           p_asset_desc_rec      IN     FA_API_TYPES.asset_desc_rec_type,
271           p_asset_cat_rec       IN     FA_API_TYPES.asset_cat_rec_type,
272           p_asset_type_rec      IN     FA_API_TYPES.asset_type_rec_type,
273           p_asset_fin_rec_old   IN     FA_API_TYPES.asset_fin_rec_type,
274           p_asset_fin_rec_adj   IN     FA_API_TYPES.asset_fin_rec_type default null,
275           px_asset_fin_rec_new  IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
276           p_asset_deprn_rec     IN     FA_API_TYPES.asset_deprn_rec_type,
277           p_asset_deprn_rec_adj IN     FA_API_TYPES.asset_deprn_rec_type default null,
278           p_period_rec          IN     FA_API_TYPES.period_rec_type,
279           p_mrc_sob_type_code   IN     VARCHAR2,
280           p_running_mode        IN     NUMBER,
281           p_used_by_revaluation IN     NUMBER,
282           p_reclassed_asset_id         NUMBER default null,
283           p_reclass_src_dest           VARCHAR2 default null,
284           p_reclassed_asset_dpis       DATE default null,
285           x_deprn_exp              OUT NOCOPY number,
286           x_bonus_deprn_exp        OUT NOCOPY number,
287 	  p_log_level_rec       IN     FA_API_TYPES.log_level_rec_type default null
288          ) return boolean;
289 
290 /*
291  ---------------------------------------------------------------------
292  *
293  * Name         get_reserve
294  *
295  *
296  * Description
297  *              This function is called when user tries to do amoritization
298  *              and specified amortization start date is eariler than the
299  *              addition for those assets that are added with reserve
300  *              or added with prior period dpis.
301  *              It will return reserve accumulated for up to the period right before the
302  *              amortization period.
303  *
304  * Parameters
305  *              X_fin_info_ptr     in out fa_std_types.fin_info_struct,
306  *              x_add_txn_id       in number  -- transaction id of addition txn
307  *              x_amortize_fy      in integer
308  *              x_amortize_per_num in integer
309  *              x_pers_per_yr      in integer
310  *              x_deprn_rsv        out number -- reserve upto the period prior to amort period
311  *              x_bonus_deprn_rsv  out number
312  *
313  *
314  * Modifies
315  *              X_deprn_rsv, X_bonus_deprn_rsv
316  * Returns
317  *              True on successful retrieval. Otherwise False.
318  *
319  * Notes
320  * History
321  *  06/23/00    lson        Created
322  *--------------------------------------------------------------------
323 */
324 
325 
326 FUNCTION get_reserve(px_trans_rec        in out nocopy FA_API_TYPES.trans_rec_type,
327                      p_asset_hdr_rec     in     FA_API_TYPES.asset_hdr_rec_type,
328                      p_asset_desc_rec    in     FA_API_TYPES.asset_desc_rec_type,
329                      px_asset_fin_rec    in out nocopy FA_API_TYPES.asset_fin_rec_type,
330                      p_add_txn_id        in     number,
331                      p_amortize_fy       in     integer,
332                      p_amortize_per_num  in     integer,
333                      p_pers_per_yr       in     integer,
334                      p_mrc_sob_type_code in     varchar2,
335                      x_deprn_rsv            out nocopy number,
336                      x_bonus_deprn_rsv      out nocopy number,
337 		     p_log_level_rec      IN     FA_API_TYPES.log_level_rec_type default null) return boolean;
338 
339 
340 /*
341  ---------------------------------------------------------------------
342  *
343  * Name         faxnac
344  *
345  *
346  * Description
352  * Parameters
347  *      Calls faxnac to check if the calculation method of depreciation
348  *      is "Strict Calculation Basis".   If so, it will either return the
349  *      recoverable cost(for cost based methods), or return the NBV as of
350  *      the beginning of the fiscal year
351  *
353  *               X_method_code         FA_STD_TYPES.fin_info_struct
357  *               X_deprn_rsv           null
354  *               X_life                FA_STD_TYPES.fin_info_struct
355  *               X_rec_cost            FA_STD_TYPES.dpr_struct
356  *               X_prior_fy_exp        FA_STD_TYPES.dprn_out_struct
358  *               X_ytd_deprn           null
359  *               X_new_adj_cost        new adjusted cost  -- in out
360  *
361  * Modifies
362  *              X_new_adj_cost
363  * Returns
364  *              True on successful retrieval. Otherwise False.
365  *
366  * Notes
367  * History
368  *  05/11/00    astakaha        Created
369  *--------------------------------------------------------------------
370 */
371 
372 FUNCTION faxnac(p_method_code          in varchar2,
373                 p_life                 in number,
374                 p_rec_cost             in number,
375                 p_prior_fy_exp         in number,
376                 p_deprn_rsv            in number,
377                 p_ytd_deprn            in number,
378                 px_adj_cost            in out nocopy number,
379 		p_log_level_rec      IN     FA_API_TYPES.log_level_rec_type default null)
380 return boolean;
381 
382 END FA_AMORT_PVT;