[Home] [Help]
PACKAGE BODY: APPS.IGI_IAC_ADJ_PKG
Source
1 PACKAGE BODY IGI_IAC_ADJ_PKG AS
2 -- $Header: igiiadjb.pls 120.8.12000000.2 2007/10/16 14:17:36 sharoy noship $
3
4
5 g_debug_adj boolean := FALSE;
6 g_output_dir varchar2(255);
7 g_debug_log varchar2(255);
8 g_debug_output varchar2(255);
9 g_debug_print boolean := FALSE;
10 g_number number:=0;
11
12 -- global vlaue for allow reval index and prof flag
13 g_asset_iac_info igi_iac_types.iac_adj_asset_info_tab;
14 g_asset_iac_adj_info igi_iac_types.iac_adj_hist_asset_info;
15 g_asset_iac_dist_info igi_iac_types.iac_adj_dist_info_tab;
16 g_category_id_g number :=0;
17 g_asset_idx1 binary_integer DEFAULT 0;
18 g_dist_idx2 binary_integer DEFAULT 0;
19 g_calling_function varchar2(250) := 'do_adjustments';
20
21 --===========================FND_LOG.START=====================================
22
23 g_state_level NUMBER := FND_LOG.LEVEL_STATEMENT;
24 g_proc_level NUMBER := FND_LOG.LEVEL_PROCEDURE;
25 g_event_level NUMBER := FND_LOG.LEVEL_EVENT;
26 g_excep_level NUMBER := FND_LOG.LEVEL_EXCEPTION;
27 g_error_level NUMBER := FND_LOG.LEVEL_ERROR;
28 g_unexp_level NUMBER := FND_LOG.LEVEL_UNEXPECTED;
29 g_path VARCHAR2(100) := 'IGI.PLSQL.igiiadjb.igi_iac_adj_pkg.';
30
31 --===========================FND_LOG.END=====================================
32
33 -- ======================================================================
34 -- adjustments
35 -- ======================================================================
36 /*=========================================================================+
37 | function name: |
38 | do_adjusments
39 | |
40 | description: |
41 | this iac function is to record adjutsments for iac and |
42 | called from adjutsments api . |
43 | |
44 +=========================================================================*/
45
46 FUNCTION Do_Record_Adjustments(
47 p_trans_rec fa_api_types.trans_rec_type,
48 p_asset_hdr_rec fa_api_types.asset_hdr_rec_type,
49 p_asset_cat_rec fa_api_types.asset_cat_rec_type,
50 p_asset_desc_rec fa_api_types.asset_desc_rec_type,
51 p_asset_type_rec fa_api_types.asset_type_rec_type,
52 p_asset_fin_rec fa_api_types.asset_fin_rec_type,
53 p_asset_deprn_rec fa_api_types.asset_deprn_rec_type,
54 p_calling_function varchar2
55 ) RETURN boolean IS
56
57 -- cursor to get asset category
58 CURSOR c_get_category IS
59 SELECT asset_category_id
60 FROM fa_additions
61 WHERE asset_id =p_asset_hdr_rec.asset_id;
62
63
64 -- to get fa_books previous entry before current adjustment
65 CURSOR c_get_fa_book_info(p_book_type_code
66 fa_transaction_headers.book_type_code%TYPE,
67 p_asset_id fa_transaction_headers.asset_id%TYPE,
68 p_transaction_header_id
69 fa_transaction_headers.transaction_header_id%TYPE ) IS
70 SELECT *
71 FROM fa_books
72 WHERE book_type_code = p_book_type_code
73 AND asset_id = p_asset_id
74 AND transaction_header_id_out = p_transaction_header_id;
75
76
77 -- to verify adjustments for an asset in the same period
78 CURSOR c_get_asset_adj (p_book_type_code fa_transaction_headers.book_type_code%TYPE,
79 p_asset_id fa_transaction_headers.asset_id%TYPE,
80 p_period_counter number) IS
81 SELECT *
82 FROM igi_iac_adjustments_history
83 WHERE book_type_code = p_book_type_code
84 AND period_counter = p_period_counter
85 AND asset_id = p_asset_id
86 AND NVL(active_flag,'N') = 'N' ;
87
88 l_get_asset_adj c_get_asset_adj%ROWTYPE;
89 l_set_of_books_id number :=0;
90 l_chart_of_accounts_id number :=0;
91 l_currency varchar2(5);
92 l_precision number:=0;
93 l_category_id number;
94 l_amort_period_info igi_iac_types.prd_rec;
95 l_open_period igi_iac_types.prd_rec;
96 l_iac_adjustment_history igi_iac_adjustments_history%ROWTYPE;
97 l_get_fa_book_info fa_books%ROWTYPE;
98 l_last_update_date date;
99 l_last_updated_by number;
100 l_last_update_login number;
101 l_creation_date date;
102 l_created_by number;
103 l_period_rec fa_api_types.period_rec_type;
104
105
106 cat_not_defined_failed EXCEPTION;
107 period_info_failed EXCEPTION;
108 book_row_failed EXCEPTION;
109 Multiple_Adjustments EXCEPTION;
110 Amortization_Fiscal_year EXCEPTION;
111
112 l_path_name VARCHAR2(150) := g_path||'do_record_adjustments';
113
114 /* this function returns true if asset is revalued atleast once in iac else returns false */
115 FUNCTION is_asset_revalued_once(p_asset_id igi_iac_asset_balances.asset_id%TYPE,
116 p_book_type_code igi_iac_asset_balances.book_type_code%TYPE )
117 RETURN boolean IS
118 /* this function returns true if asset is revalued atleast once in iac else returns false */
119 CURSOR c_asset_reval_info IS
120 SELECT COUNT(*)
121 FROM igi_iac_asset_balances
122 WHERE asset_id = p_asset_id
123 AND book_type_code = p_book_type_code ;
124
125 l_reval_count number;
126
127 BEGIN
128 OPEN c_asset_reval_info;
129 FETCH c_asset_reval_info INTO l_reval_count;
130 CLOSE c_asset_reval_info;
131
132 IF (l_reval_count > 0) THEN
133 RETURN TRUE;
134 ELSE
135 RETURN FALSE;
136 END IF;
137 END is_asset_revalued_once;
138
139 /* this function checks if the category is attched to the book in iac setup */
140 FUNCTION is_iac_cat_book_defined(l_book_type_code varchar2,
141 l_category_id number)
142 RETURN boolean IS
143
144 CURSOR c_cat_book_defined IS
145 SELECT 'x'
146 FROM igi_iac_category_books
147 WHERE book_type_code = l_book_type_code
148 AND category_id = l_category_id
149 AND ROWNUM = 1;
150
151 l_dummy varchar2(1) DEFAULT NULL;
152 BEGIN
153 OPEN c_cat_book_defined;
154 FETCH c_cat_book_defined INTO l_dummy;
155
156 IF c_cat_book_defined%FOUND THEN
157 CLOSE c_cat_book_defined;
158 RETURN TRUE;
159 ELSE
160 CLOSE c_cat_book_defined;
161 RETURN FALSE;
162 END IF;
163
164 EXCEPTION
165 WHEN others THEN
166 RETURN FALSE ;
167 END is_iac_cat_book_defined;
168
169 PROCEDURE print_parameter_values IS
170 l_path_name VARCHAR2(150) := g_path||'print_parameter_values';
171 BEGIN
172 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
173 p_full_path => l_path_name,
174 p_string => '+paramter values received to do_adjustments');
175 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
176 p_full_path => l_path_name,
177 p_string => ' +asset_trans_hdr_rec');
178 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
179 p_full_path => l_path_name,
180 p_string => ' +transaction_header_id.......... '||p_trans_rec.transaction_header_id );
181 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
182 p_full_path => l_path_name,
183 p_string => ' +transaction_type_code.......... '||p_trans_rec.transaction_type_code );
184 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
185 p_full_path => l_path_name,
186 p_string => ' +transaction_date_entered....... '||p_trans_rec.transaction_date_entered );
187 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
188 p_full_path => l_path_name,
189 p_string => ' +transaction_name............... '||p_trans_rec.transaction_name);
190 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
191 p_full_path => l_path_name,
192 p_string => ' +source_transaction_header_id... '||p_trans_rec.source_transaction_header_id);
193 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
194 p_full_path => l_path_name,
195 p_string => ' +mass_reference_id.............. '|| p_trans_rec.mass_reference_id);
196 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
197 p_full_path => l_path_name,
198 p_string => ' +transaction_subtype............ '|| p_trans_rec.transaction_subtype);
199 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
200 p_full_path => l_path_name,
201 p_string => ' +transaction_key................ '|| p_trans_rec.transaction_key);
202 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
203 p_full_path => l_path_name,
204 p_string => ' +amortization_start_date........ '||p_trans_rec.amortization_start_date);
205 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
206 p_full_path => l_path_name,
207 p_string => ' +calling_interface.............. '||p_trans_rec.calling_interface);
208 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
209 p_full_path => l_path_name,
210 p_string => ' +mass_transaction_id............ '||p_trans_rec.mass_transaction_id);
211 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
212 p_full_path => l_path_name,
213 p_string => ' +asset_hdr_rec');
214 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
215 p_full_path => l_path_name,
216 p_string => ' +asset_id....................... '|| p_asset_hdr_rec.asset_id );
217 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
218 p_full_path => l_path_name,
219 p_string => ' +book_type_code................. '|| p_asset_hdr_rec.book_type_code );
220 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
221 p_full_path => l_path_name,
222 p_string => ' +set_of_books_id................ '|| p_asset_hdr_rec.set_of_books_id);
223 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
224 p_full_path => l_path_name,
225 p_string => ' +period_of_addition............. '||p_asset_hdr_rec.period_of_addition);
226 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
227 p_full_path => l_path_name,
228 p_string => ' +asset_fin_rec_type');
229 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
230 p_full_path => l_path_name,
231 p_string => ' +set_of_books_id........................'||p_asset_fin_rec.set_of_books_id);
232 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
233 p_full_path => l_path_name,
234 p_string => ' +date_placed_in_service ........................'||p_asset_fin_rec.date_placed_in_service);
235 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
236 p_full_path => l_path_name,
237 p_string => ' +deprn_start_date ........................'||p_asset_fin_rec.deprn_start_date);
238 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
239 p_full_path => l_path_name,
240 p_string => ' +deprn_method_code ........................'||p_asset_fin_rec. deprn_method_code);
241 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
242 p_full_path => l_path_name,
243 p_string => ' +life_in_months ........................'||p_asset_fin_rec.life_in_months);
244 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
245 p_full_path => l_path_name,
246 p_string => ' +rate_adjustment_factor ........................'||p_asset_fin_rec.rate_adjustment_factor);
247 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
248 p_full_path => l_path_name,
249 p_string => ' +adjusted_cost ........................'||p_asset_fin_rec.adjusted_cost);
250 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
251 p_full_path => l_path_name,
252 p_string => ' +cost ........................'||p_asset_fin_rec.cost);
253 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
254 p_full_path => l_path_name,
255 p_string => ' +original_cost ........................'||p_asset_fin_rec.original_cost);
256 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
257 p_full_path => l_path_name,
258 p_string => ' +salvage_value ........................'||p_asset_fin_rec.salvage_value);
259 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
260 p_full_path => l_path_name,
261 p_string => ' +prorate_convention_code ........................'||p_asset_fin_rec.prorate_convention_code);
262 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
263 p_full_path => l_path_name,
264 p_string => ' +prorate_date ........................'||p_asset_fin_rec.prorate_date);
265 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
266 p_full_path => l_path_name,
267 p_string => ' +cost_change_flag ........................'||p_asset_fin_rec.cost_change_flag);
268 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
269 p_full_path => l_path_name,
270 p_string => ' +adjustment_required_status ........................'||p_asset_fin_rec.adjustment_required_status);
271 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
272 p_full_path => l_path_name,
273 p_string => ' +capitalize_flag ........................'||p_asset_fin_rec.capitalize_flag);
274 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
275 p_full_path => l_path_name,
276 p_string => ' +retirement_pending_flag ........................'||p_asset_fin_rec.retirement_pending_flag);
277 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
278 p_full_path => l_path_name,
279 p_string => ' +depreciate_flag ........................'||p_asset_fin_rec.depreciate_flag);
280 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
281 p_full_path => l_path_name,
282 p_string => ' +itc_amount_id ........................'||p_asset_fin_rec.itc_amount_id);
283 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
284 p_full_path => l_path_name,
285 p_string => ' +itc_amount ........................'||p_asset_fin_rec.itc_amount);
286 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
287 p_full_path => l_path_name,
288 p_string => ' +retirement_id ........................'||p_asset_fin_rec.retirement_id);
289 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
290 p_full_path => l_path_name,
291 p_string => ' +tax_request_id ........................'||p_asset_fin_rec.tax_request_id);
292 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
293 p_full_path => l_path_name,
294 p_string => ' +itc_basis ........................'||p_asset_fin_rec.itc_basis);
295 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
296 p_full_path => l_path_name,
297 p_string => ' +basic_rate ........................'||p_asset_fin_rec.basic_rate);
301 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
298 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
299 p_full_path => l_path_name,
300 p_string => ' +adjusted_rate ........................'||p_asset_fin_rec.adjusted_rate);
302 p_full_path => l_path_name,
303 p_string => ' +bonus_rule ........................'||p_asset_fin_rec.bonus_rule);
304 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
305 p_full_path => l_path_name,
306 p_string => ' +ceiling_name ........................'||p_asset_fin_rec.ceiling_name);
307 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
308 p_full_path => l_path_name,
309 p_string => ' +recoverable_cost ........................'||p_asset_fin_rec.recoverable_cost);
310 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
311 p_full_path => l_path_name,
312 p_string => ' +adjusted_capacity ........................'||p_asset_fin_rec.adjusted_capacity);
313 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
314 p_full_path => l_path_name,
315 p_string => ' +fully_rsvd_revals_counter ........................'||p_asset_fin_rec.fully_rsvd_revals_counter);
316 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
317 p_full_path => l_path_name,
318 p_string => ' +idled_flag ........................'||p_asset_fin_rec.idled_flag);
319 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
320 p_full_path => l_path_name,
321 p_string => ' +period_counter_capitalized ........................'||p_asset_fin_rec.period_counter_capitalized);
322 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
323 p_full_path => l_path_name,
324 p_string => ' +period_counter_fully_reserved ........................'||p_asset_fin_rec.period_counter_fully_reserved);
325 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
326 p_full_path => l_path_name,
327 p_string => ' +period_counter_fully_retired ........................'||p_asset_fin_rec.period_counter_fully_retired);
328 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
329 p_full_path => l_path_name,
330 p_string => ' +production_capacity ........................'||p_asset_fin_rec.production_capacity);
331 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
332 p_full_path => l_path_name,
333 p_string => ' +reval_amortization_basis ........................'||p_asset_fin_rec.reval_amortization_basis);
334 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
335 p_full_path => l_path_name,
336 p_string => ' +reval_ceiling ........................'||p_asset_fin_rec.reval_ceiling);
337 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
338 p_full_path => l_path_name,
339 p_string => ' +unit_of_measure ........................'||p_asset_fin_rec.unit_of_measure);
340 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
341 p_full_path => l_path_name,
342 p_string => ' +unrevalued_cost ........................'||p_asset_fin_rec.unrevalued_cost);
343 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
344 p_full_path => l_path_name,
345 p_string => ' +annual_deprn_rounding_flag ........................'||p_asset_fin_rec.annual_deprn_rounding_flag);
346 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
347 p_full_path => l_path_name,
348 p_string => ' +percent_salvage_value ........................'||p_asset_fin_rec.percent_salvage_value);
349 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
350 p_full_path => l_path_name,
351 p_string => ' +allowed_deprn_limit ........................'||p_asset_fin_rec.allowed_deprn_limit);
352 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
353 p_full_path => l_path_name,
354 p_string => ' +allowed_deprn_limit_amount ........................'||p_asset_fin_rec.allowed_deprn_limit_amount);
355 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
356 p_full_path => l_path_name,
357 p_string => ' +period_counter_life_complete ........................'||p_asset_fin_rec.period_counter_life_complete);
358 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
359 p_full_path => l_path_name,
360 p_string => ' +adjusted_recoverable_cost ........................'||p_asset_fin_rec.adjusted_recoverable_cost);
361 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
362 p_full_path => l_path_name,
363 p_string => ' +annual_rounding_flag ........................'||p_asset_fin_rec.annual_rounding_flag);
364 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
365 p_full_path => l_path_name,
366 p_string => ' +eofy_adj_cost ........................'||p_asset_fin_rec.eofy_adj_cost);
367 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
368 p_full_path => l_path_name,
372 p_string => ' +short_fiscal_year_flag ........................'||p_asset_fin_rec.short_fiscal_year_flag);
369 p_string => ' +eofy_formula_factor ........................'||p_asset_fin_rec.eofy_formula_factor);
370 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
371 p_full_path => l_path_name,
373 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
374 p_full_path => l_path_name,
375 p_string => ' +conversion_date ........................'||p_asset_fin_rec.conversion_date);
376 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
377 p_full_path => l_path_name,
378 p_string => ' +orig_deprn_start_date ........................'||p_asset_fin_rec.orig_deprn_start_date);
379 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
380 p_full_path => l_path_name,
381 p_string => ' +remaining_life1 ........................'||p_asset_fin_rec.remaining_life1);
382 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
383 p_full_path => l_path_name,
384 p_string => ' +remaining_life2 ........................'||p_asset_fin_rec.remaining_life2);
385 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
386 p_full_path => l_path_name,
387 p_string => ' +group_asset_id ........................'||p_asset_fin_rec.group_asset_id);
388 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
389 p_full_path => l_path_name,
390 p_string => ' +old_adjusted_cost ........................'||p_asset_fin_rec.old_adjusted_cost);
391 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
392 p_full_path => l_path_name,
393 p_string => ' +formula_factor ........................'||p_asset_fin_rec.formula_factor );
394 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
395 p_full_path => l_path_name,
396 p_string => ' +asset_deprn_rec_type');
397 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
398 p_full_path => l_path_name,
399 p_string => ' +set_of_books_id ........................'||p_asset_deprn_rec.set_of_books_id);
400 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
401 p_full_path => l_path_name,
402 p_string => ' +deprn_amount ........................'||p_asset_deprn_rec.deprn_amount);
403 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
404 p_full_path => l_path_name,
405 p_string => ' +ytd_deprn ........................'||p_asset_deprn_rec.ytd_deprn);
406 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
407 p_full_path => l_path_name,
408 p_string => ' +deprn_reserve ........................'||p_asset_deprn_rec.deprn_reserve);
409 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
410 p_full_path => l_path_name,
411 p_string => ' +prior_fy_expense ........................'||p_asset_deprn_rec.prior_fy_expense);
412 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
413 p_full_path => l_path_name,
414 p_string => ' +bonus_deprn_amount ........................'||p_asset_deprn_rec.bonus_deprn_amount);
415 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
416 p_full_path => l_path_name,
417 p_string => ' +bonus_ytd_deprn ........................'||p_asset_deprn_rec.bonus_ytd_deprn);
418 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
419 p_full_path => l_path_name,
420 p_string => ' +bonus_deprn_reserve ........................'||p_asset_deprn_rec.bonus_deprn_reserve);
421 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
422 p_full_path => l_path_name,
423 p_string => ' +prior_fy_bonus_expense ........................'||p_asset_deprn_rec.prior_fy_bonus_expense);
424 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
425 p_full_path => l_path_name,
426 p_string => ' +reval_amortization ........................'||p_asset_deprn_rec.reval_amortization);
427 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
428 p_full_path => l_path_name,
432 p_string => ' +reval_deprn_expense ........................'||p_asset_deprn_rec.reval_deprn_expense);
429 p_string => ' +reval_amortization_basis ........................'||p_asset_deprn_rec.reval_amortization_basis);
430 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
431 p_full_path => l_path_name,
433 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
434 p_full_path => l_path_name,
435 p_string => ' +reval_ytd_deprn ........................'||p_asset_deprn_rec.reval_ytd_deprn);
436 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
437 p_full_path => l_path_name,
438 p_string => ' +reval_deprn_reserve ........................'||p_asset_deprn_rec.reval_deprn_reserve);
439 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
440 p_full_path => l_path_name,
441 p_string => ' +production ........................'||p_asset_deprn_rec.production);
442 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
443 p_full_path => l_path_name,
444 p_string => ' +ytd_production ........................'||p_asset_deprn_rec.ytd_production);
445 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
446 p_full_path => l_path_name,
447 p_string => ' +ltd_production ........................'||p_asset_deprn_rec.ltd_production);
448 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
449 p_full_path => l_path_name,
450 p_string => ' +asset_type_rec');
451 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
452 p_full_path => l_path_name,
453 p_string => ' +asset_type..................... '|| p_asset_type_rec.asset_type );
454 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
455 p_full_path => l_path_name,
456 p_string => ' +calling function................... ' || p_calling_function);
457 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
458 p_full_path => l_path_name,
459 p_string => '+paramter values received to do_adjustments');
460 END;
461
462 BEGIN -- do_record_adjustments
463
464 IF fnd_profile.value('PRINT_DEBUG') = 'Y' THEN
465 SELECT SUBSTR(VALUE,1,DECODE ((INSTR(VALUE,',', 1, 1)-1),0,LENGTH(VALUE)
466 ,(INSTR(VALUE,',', 1, 1)-1)))
467 INTO g_output_dir
468 FROM v$parameter
469 WHERE name LIKE 'utl%';
470 g_debug_log := 'iacadj.log';
471 g_debug_output := 'iacadj.out';
472 g_debug_print := TRUE;
473 ELSE
474 g_debug_print := FALSE;
475 END IF;
476
477 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
478 p_full_path => l_path_name,
479 p_string => 'creating a message log file for adjustments');
480 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
481 p_full_path => l_path_name,
482 p_string => 'calling function '||p_calling_function);
483
484 --validate the iac book
485 IF NOT (igi_iac_common_utils.is_iac_book(p_asset_hdr_rec.book_type_code)) THEN
486 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
487 p_full_path => l_path_name,
488 p_string => 'not an iac book ..'||p_asset_hdr_rec.book_type_code);
489 RETURN TRUE;
490 END IF;
491
492 -- check if the adjusment is in period of addition
493 IF ( p_asset_hdr_rec.period_of_addition ='Y') THEN
494 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
495 p_full_path => l_path_name,
496 p_string => 'No iac adjustments required since current period addition');
497 RETURN TRUE;
498 END IF ;
499
500 -- check if asset is revalued atleast ocnce to verify asset is in place in iac
501
502 IF NOT is_asset_revalued_once(p_asset_hdr_rec.asset_id,p_asset_hdr_rec.book_type_code) THEN
503 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
504 p_full_path => l_path_name,
505 p_string => 'Asset not revalued by iac');
506 FA_SRVR_MSG.Add_Message(
507 CALLING_FN => p_calling_function,
508 NAME => 'IGI_IAC_NO_IAC_EFFECT',
509 TRANSLATE => TRUE,
513
510 APPLICATION => 'IGI');
511 RETURN TRUE;
512 END IF;
514 -- debug messages
515 print_parameter_values;
516
517 OPEN c_get_category;
518 FETCH c_get_category INTO l_category_id;
519 CLOSE c_get_category;
520
521 -- validate category
522 g_category_id_g := l_category_id;
523 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
524 p_full_path => l_path_name,
525 p_string => 'category id .... '|| g_category_id_g);
526 IF NOT is_iac_cat_book_defined(p_asset_hdr_rec.book_type_code,
527 g_category_id_g) THEN
528
529 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
530 p_full_path => l_path_name,
531 p_string => '*** error the category is not set up for book in iac options');
532 RAISE cat_not_defined_failed;
533 END IF;
534
535 IF NOT igi_iac_common_utils.get_open_period_info(p_asset_hdr_rec.book_type_code,
536 l_open_period) THEN
537 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
538 p_full_path => l_path_name,
539 p_string => '*** error in fetching open period info for book');
540 RAISE period_info_failed;
541 END IF;
542 l_iac_adjustment_history.current_period_amortization:=NULL;
543
544 IF (p_trans_rec.transaction_subtype = 'AMORTIZED') THEN
545
546 -- Prevent backdate amortizations to previous fiscal year
547
548 IF NOT igi_iac_common_utils.get_period_info_for_date( p_asset_hdr_rec.book_type_code ,
549 p_trans_rec.amortization_start_date,
550 l_amort_period_info
551 ) THEN
552 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
553 p_full_path => l_path_name,
554 p_string => '*** error in fetching period info');
555 RAISE period_info_failed;
556 END IF;
557
558 IF (l_open_period.fiscal_year <> l_amort_period_info.fiscal_year) THEN
559 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
560 p_full_path => l_path_name,
561 p_string => 'amortization adjustment backdate previous fiscal year');
562 -- not in same year raise exception
563 RAISE amortization_fiscal_year;
564 END IF;
565
566 IF (l_open_period.period_counter=l_amort_period_info.period_counter) THEN
567 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
568 p_full_path => l_path_name,
569 p_string => 'current period amortization not processed by iac');
570 -- set the current flag;
571 l_iac_adjustment_history.current_period_amortization := 'Y';
572 END IF;
573 END IF;
574
575 OPEN c_get_fa_book_info(p_asset_hdr_rec.book_type_code,
576 p_asset_hdr_rec.asset_id,
577 p_trans_rec.transaction_header_id);
578 FETCH c_get_fa_book_info INTO l_get_fa_book_info;
579 IF c_get_fa_book_info%NOTFOUND THEN
580 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
581 p_full_path => l_path_name,
582 p_string => '*** error cannot find record in fa_book');
583 CLOSE c_get_fa_book_info;
584 RAISE book_row_failed;
585 END IF;
586 CLOSE c_get_fa_book_info;
587
588 -- verify if cost adjustment
589 IF p_asset_fin_rec.cost <> l_get_fa_book_info.cost THEN
590 -- set the cost adjustment
591 l_iac_adjustment_history.adjustment_reval_type := 'C';
592 ELSE
593 l_iac_adjustment_history.adjustment_reval_type := 'D';
594 END IF;
595
596 l_iac_adjustment_history.book_type_code:= p_asset_hdr_rec.book_type_code;
597 l_iac_adjustment_history.asset_id:= p_asset_hdr_rec.asset_id;
598 l_iac_adjustment_history.category_id:= l_category_id;
599 l_iac_adjustment_history.date_placed_in_service:=p_asset_fin_rec.date_placed_in_service;
600 l_iac_adjustment_history.period_counter:= l_open_period.period_counter;
601 l_iac_adjustment_history.transaction_type_code:=p_trans_rec.transaction_type_code;
602 l_iac_adjustment_history.transaction_subtype :=p_trans_rec.transaction_subtype;
603 l_iac_adjustment_history.amortization_start_date:=p_trans_rec.amortization_start_date;
604 l_iac_adjustment_history.transaction_header_id_in :=p_trans_rec.transaction_header_id;
605 l_iac_adjustment_history.transaction_header_id_out:=NULL;
606 l_iac_adjustment_history.pre_life_in_months:=l_get_fa_book_info.life_in_months;
607 l_iac_adjustment_history.pre_rate_adjustment_factor:=l_get_fa_book_info.rate_adjustment_factor;
608 l_iac_adjustment_history.pre_adjusted_cost:=l_get_fa_book_info.cost;
609 l_iac_adjustment_history.pre_salvage_value:=l_get_fa_book_info.salvage_value;
610 l_iac_adjustment_history.life_in_months:=p_asset_fin_rec.life_in_months;
611 l_iac_adjustment_history.rate_adjustment_factor:=p_asset_fin_rec.rate_adjustment_factor;
615 l_iac_adjustment_history.active_flag:=NULL;
612 l_iac_adjustment_history.adjusted_cost:=p_asset_fin_rec.cost;
613 l_iac_adjustment_history.salvage_value:=p_asset_fin_rec.salvage_value;
614 l_iac_adjustment_history.adjustment_id:=NULL;
616
617 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
618 p_full_path => l_path_name,
619 p_string => 'adjustment details .....');
620 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
621 p_full_path => l_path_name,
622 p_string => 'book_type_code..........'|| l_iac_adjustment_history.book_type_code);
623 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
624 p_full_path => l_path_name,
625 p_string => 'asset_id................'|| l_iac_adjustment_history.asset_id );
626 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
627 p_full_path => l_path_name,
628 p_string => 'category_id.............'|| l_iac_adjustment_history.category_id );
629 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
630 p_full_path => l_path_name,
631 p_string => 'date_placed_in_service..'||l_iac_adjustment_history.date_placed_in_service);
632 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
633 p_full_path => l_path_name,
634 p_string => 'period_counter..........'||l_iac_adjustment_history.period_counter );
635 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
636 p_full_path => l_path_name,
637 p_string => 'transaction_type_code...'||l_iac_adjustment_history.transaction_type_code );
638 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
639 p_full_path => l_path_name,
640 p_string => 'transaction_subtype.....'||l_iac_adjustment_history.transaction_subtype );
641 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
642 p_full_path => l_path_name,
643 p_string => 'current_period_amortization'||l_iac_adjustment_history.current_period_amortization);
644 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
645 p_full_path => l_path_name,
646 p_string => 'amortization_start_date....'||l_iac_adjustment_history.amortization_start_date );
647 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
648 p_full_path => l_path_name,
649 p_string => 'transaction_header_id_in....'||l_iac_adjustment_history.transaction_header_id_in );
650 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
651 p_full_path => l_path_name,
652 p_string => 'transaction_header_id_out...'|| l_iac_adjustment_history.transaction_header_id_out );
653 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
654 p_full_path => l_path_name,
655 p_string => 'pre_life_in_months..........'|| l_iac_adjustment_history.pre_life_in_months );
656 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
657 p_full_path => l_path_name,
658 p_string => 'pre_rate_adjustment_factor..'||l_iac_adjustment_history.pre_rate_adjustment_factor );
659 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
660 p_full_path => l_path_name,
661 p_string => 'pre_adjusted_cost...........'||l_iac_adjustment_history.pre_adjusted_cost );
662 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
663 p_full_path => l_path_name,
664 p_string => 'pre_salvage_value...........'||l_iac_adjustment_history.pre_salvage_value );
665 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
666 p_full_path => l_path_name,
667 p_string => 'life_in_months..............'||l_iac_adjustment_history.life_in_months );
668 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
669 p_full_path => l_path_name,
670 p_string => 'rate_adjustment_factor......'||l_iac_adjustment_history.rate_adjustment_factor );
671 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
672 p_full_path => l_path_name,
673 p_string => 'adjusted_cost...............'||l_iac_adjustment_history.adjusted_cost );
674 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
675 p_full_path => l_path_name,
676 p_string => 'salvage_value...............'||l_iac_adjustment_history.salvage_value );
677 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
678 p_full_path => l_path_name,
679 p_string => 'adjustment_id...............'||l_iac_adjustment_history.adjustment_id );
680 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
681 p_full_path => l_path_name,
682 p_string => 'active_flag.................'||l_iac_adjustment_history.active_flag );
683 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
684 p_full_path => l_path_name,
685 p_string => 'Reval type.................'||l_iac_adjustment_history.adjustment_reval_type );
686
687 OPEN c_get_asset_adj( l_iac_adjustment_history.book_type_code,
688 l_iac_adjustment_history.asset_id,
689 l_iac_adjustment_history.period_counter);
690 FETCH c_get_asset_adj INTO l_get_asset_adj;
691 IF c_get_asset_adj%FOUND THEN
692
693 CLOSE c_get_asset_adj;
694 IF (p_trans_rec.transaction_subtype = 'AMORTIZED') AND
695 (l_get_asset_adj.transactioN_subtype='EXPENSED') THEN
696
700 RAISE multiple_adjustments;
697 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
698 p_full_path => l_path_name,
699 p_string => 'Amortization and Expensed adjustments are not allowed in same period');
701 END IF;
702
703 IF l_get_asset_adj.adjustment_reval_type = 'C' THEN
704 -- set the cost adjustment
705 l_iac_adjustment_history.adjustment_reval_type := 'C';
706 END IF;
707
708 UPDATE igi_iac_adjustments_history
709 SET active_flag = 'Y'
710 WHERE asset_id = l_iac_adjustment_history.asset_id
711 AND book_type_code =l_iac_adjustment_history.book_type_code
712 AND period_counter = l_iac_adjustment_history.period_counter;
713 ELSE
714 CLOSE c_get_asset_adj;
715 END IF;
716
717 l_last_update_date := SYSDATE;
718 l_creation_date := SYSDATE;
719 l_created_by := fnd_global.user_id;
720 IF (l_created_by IS NULL) THEN
721 l_created_by := -1;
722 END IF;
723 l_last_updated_by := fnd_global.user_id;
724 IF (l_last_updated_by IS NULL) THEN
725 l_last_updated_by := -1;
726 END IF;
727 l_last_update_login := fnd_global.login_id;
728 IF (l_last_update_login IS NULL) THEN
729 l_last_update_login := -1;
730 END IF;
731
732 INSERT INTO igi_iac_adjustments_history
733 (book_type_code,
734 asset_id ,
735 category_id ,
736 date_placed_in_service,
737 period_counter ,
738 transaction_type_code ,
739 transaction_subtype ,
740 current_period_amortization,
741 amortization_start_date ,
742 transaction_header_id_in ,
743 transaction_header_id_out ,
744 pre_life_in_months ,
745 pre_rate_adjustment_factor ,
746 pre_adjusted_cost ,
747 pre_salvage_value ,
748 life_in_months ,
749 rate_adjustment_factor ,
750 adjusted_cost ,
751 salvage_value ,
752 adjustment_id ,
753 active_flag,
754 created_date,
755 created_by,
756 last_update_date,
757 last_updated_by,
758 last_update_login,
759 adjustment_reval_type
760 )
761 VALUES
762 (l_iac_adjustment_history.book_type_code,
763 l_iac_adjustment_history.asset_id ,
764 l_iac_adjustment_history.category_id ,
765 l_iac_adjustment_history.date_placed_in_service,
766 l_iac_adjustment_history.period_counter ,
767 l_iac_adjustment_history.transaction_type_code,
768 l_iac_adjustment_history.transaction_subtype,
769 l_iac_adjustment_history.current_period_amortization,
770 l_iac_adjustment_history.amortization_start_date,
771 l_iac_adjustment_history.transaction_header_id_in,
772 l_iac_adjustment_history.transaction_header_id_out,
773 l_iac_adjustment_history.pre_life_in_months,
774 l_iac_adjustment_history.pre_rate_adjustment_factor,
775 l_iac_adjustment_history.pre_adjusted_cost,
776 l_iac_adjustment_history.pre_salvage_value,
777 l_iac_adjustment_history.life_in_months,
778 l_iac_adjustment_history.rate_adjustment_factor,
779 l_iac_adjustment_history.adjusted_cost,
780 l_iac_adjustment_history.salvage_value,
781 l_iac_adjustment_history.adjustment_id,
782 l_iac_adjustment_history.active_flag,
783 l_creation_date,
784 l_created_by,
785 l_last_update_date,
786 l_last_updated_by,
787 l_last_update_login,
788 l_iac_adjustment_history.adjustment_reval_type);
789
790 RETURN TRUE;
791
792 -- return false;
793
794 EXCEPTION
795
796 WHEN Amortization_fiscal_year THEN
797 FA_SRVR_MSG.Add_Message(
798 CALLING_FN => p_calling_function,
799 NAME => 'IGI_IAC_AMORT_NOT_FISCAL_YEAR',
800 TRANSLATE => TRUE,
801 APPLICATION => 'IGI');
802
803 RETURN FALSE;
804
805 WHEN Multiple_Adjustments THEN
806
807 FA_SRVR_MSG.Add_Message(
808 CALLING_FN => p_calling_function,
809 NAME => 'IGI_IAC_NO_MULTIPLE_TYPE_ADJ',
810 TRANSLATE => TRUE,
811 APPLICATION => 'IGI');
812 RETURN FALSE;
813
814 WHEN period_info_failed THEN
815 fa_srvr_msg.add_message(
816 calling_fn => p_calling_function ,
817 name => 'IGI_IAC_EXCEPTION',
818 token1 => 'PACKAGE',
819 value1 => 'adjustments',
820 token2 => 'ERROR_MESSAGE',
824 RETURN FALSE;
821 value2 => 'Error while getting period information for record',
822 TRANSLATE => TRUE,
823 application => 'IGI');
825
826 WHEN book_row_failed THEN
827 fa_srvr_msg.add_message(
828 calling_fn => p_calling_function ,
829 name => 'IGI_IAC_EXCEPTION',
830 token1 => 'PACKAGE',
831 value1 => 'adjustments',
832 token2 => 'ERROR_MESSAGE',
833 value2 => 'Error while fetching the books row prior to adjustment',
834 TRANSLATE => TRUE,
835 application => 'IGI');
836 RETURN FALSE;
837
838 WHEN cat_not_defined_failed THEN
839 fa_srvr_msg.add_message(
840 calling_fn => p_calling_function ,
841 name => 'IGI_IAC_EXCEPTION',
842 token1 => 'PACKAGE',
843 value1 => 'adjustments',
844 token2 => 'ERROR_MESSAGE',
845 value2 => 'Category not defined for Inflation Accounting',
846 TRANSLATE => TRUE,
847 application => 'IGI');
848 RETURN FALSE;
849
850 WHEN others THEN
851 fa_srvr_msg.add_message(
852 calling_fn => p_calling_function ,
853 name => 'IGI_IAC_EXCEPTION',
854 token1 => 'PACKAGE',
855 value1 => 'adjustments',
856 token2 => 'ERROR_MESSAGE',
857 value2 => 'Error while recording adjustments in Inflation Accounting',
858 TRANSLATE => TRUE,
859 application => 'IGI');
860 RETURN FALSE;
861
862 END do_record_adjustments;
863
864
865 FUNCTION Prepare_Adjustment(p_book_type_code igi_iac_det_balances.book_type_code%TYPE,
866 p_period_counter igi_iac_det_balances.period_counter%TYPE,
867 p_asset_id igi_iac_det_balances.asset_id%TYPE,
868 p_adjustment_type igi_iac_adjustments_history.transaction_subtype%TYPE
869 ,p_asset_iac_adj_info IN OUT NOCOPY igi_iac_types.iac_adj_hist_asset_info
870 ,p_asset_dist_iac_adj_info IN OUT NOCOPY igi_iac_types.iac_adj_dist_info_tab
871 ,p_asset_adj_hist_info igi_iac_adjustments_history%ROWTYPE)
872
873 RETURN boolean IS
874
875 CURSOR c_get_fa_book_info(p_book_type_code fa_transaction_headers.book_type_code%TYPE,
876 p_asset_id fa_transaction_headers.asset_id%TYPE
877 ) IS
878 SELECT *
879 FROM fa_books
880 WHERE book_type_code = p_book_type_code
881 AND asset_id = p_asset_id
882 AND transaction_header_id_out IS NULL;
883
884 CURSOR c_get_fa_headers_info(p_book_type_code fa_transaction_headers.book_type_code%TYPE,
885 p_asset_id fa_transaction_headers.asset_id%TYPE,
886 p_transaction_header_id fa_transaction_headers.transaction_header_id%TYPE
887 ) IS
888 SELECT *
889 FROM fa_transaction_headers
890 WHERE book_type_code = p_book_type_code
891 AND asset_id = p_asset_id
892 AND transaction_header_id = p_transaction_header_id;
893
894 CURSOR c_get_fa_deprn_summary(p_book_type_code fa_transaction_headers.book_type_code%TYPE,
895 p_asset_id fa_transaction_headers.asset_id%TYPE,
896 p_period_counter fa_deprn_summary.period_counter%TYPE
897 ) IS
898 SELECT *
899 FROM fa_deprn_summary
900 WHERE book_type_code = p_book_type_code
901 AND asset_id = p_asset_id
902 AND period_counter = p_period_counter;
903
904 CURSOR c_get_sum_fa_deprn(p_book_type_code fa_transaction_headers.book_type_code%TYPE,
905 p_asset_id fa_transaction_headers.asset_id%TYPE,
906 p_period_counter fa_deprn_summary.period_counter%TYPE
907 ) IS
908 SELECT SUM(nvl(deprn_amount,0)) depreciation_amount,
909 SUM(nvl(deprn_adjustment_amount,0)) depreciation_adjustment_amount,
910 SUM(nvl(deprn_reserve,0)) depreciation_reserve
911 FROM fa_deprn_detail
912 WHERE book_type_code = p_book_type_code
913 AND asset_id = p_asset_id
914 AND period_counter = p_period_counter;
915
916
917 CURSOR c_get_fa_deprn_detail
918 IS
919 SELECT *
920 FROM fa_deprn_detail
921 WHERE book_type_code = p_book_type_code
922 AND asset_id = p_asset_id
923 AND period_counter = p_period_counter;
924
925
926 l_get_fa_book_info c_get_fa_book_info%ROWTYPE;
927 l_get_fa_deprn_summary c_get_fa_deprn_summary%ROWTYPE;
928 -- p_asset_iac_adj_info igi_iac_types.iac_adj_hist_asset_info;
929 l_get_fa_deprn_detail c_get_fa_deprn_detail%ROWTYPE;
930 l_get_fa_headers_info c_get_fa_headers_info%ROWTYPE;
931 l_adj_prd_rec igi_iac_types.prd_rec;
935
932 l_get_sum_fa_deprn c_get_sum_fa_deprn%ROWTYPE;
933
934 l_path_name VARCHAR2(150) := g_path||'prepare_adjustment';
936 PROCEDURE debug_adj_asset(p_asset igi_iac_types.iac_adj_hist_asset_info) IS
937 l_path_name VARCHAR2(150) := g_path||'debug_adj_asset';
938 BEGIN
939 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
940 p_full_path => l_path_name,
941 p_string => 'prepare adj:asset_id...............'|| p_asset.asset_id);
942 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
943 p_full_path => l_path_name,
944 p_string => 'prepare adj:book_type_code.........'|| p_asset.book_type_code);
945 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
946 p_full_path => l_path_name,
947 p_string => 'prepare adj:cost...................'|| p_asset.cost );
948 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
949 p_full_path => l_path_name,
950 p_string => 'prepare adj:original_cost..........'|| p_asset.original_cost);
951 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
952 p_full_path => l_path_name,
953 p_string => 'prepare adj:adjusted_cost..........'|| p_asset.adjusted_cost );
954 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
955 p_full_path => l_path_name,
956 p_string => 'prepare adj:salvage_value..........'|| p_asset.salvage_value );
957 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
958 p_full_path => l_path_name,
959 p_string => 'prepare adj:life_in_months.........'|| p_asset.life_in_months);
960 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
961 p_full_path => l_path_name,
962 p_string => 'prepare adj:rate_adjustment_factor..'||p_asset.rate_adjustment_factor);
963 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
964 p_full_path => l_path_name,
965 p_string => 'prepare adj:period_counter_fully_reserved '|| p_asset.period_counter_fully_reserved);
966 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
967 p_full_path => l_path_name,
968 p_string => 'prepare adj:recoverable_cost.......'|| p_asset.recoverable_cost);
969 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
970 p_full_path => l_path_name,
971 p_string => 'prepare adj:date_placed_in_service..'||p_asset.date_placed_in_service);
972 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
973 p_full_path => l_path_name,
974 p_string => 'prepare adj:deprn_start_date........'||p_asset.deprn_start_date);
975 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
976 p_full_path => l_path_name,
977 p_string => 'prepare adj:deprn_periods_elapsed...'||p_asset.deprn_periods_elapsed);
978 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
979 p_full_path => l_path_name,
980 p_string => 'prepare adj:deprn_periods_current_year..'||p_asset.deprn_periods_current_year);
981 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
982 p_full_path => l_path_name,
983 p_string => 'prepare adj: prior year periods..'|| p_asset.deprn_periods_prior_year);
984 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
985 p_full_path => l_path_name,
986 p_string => 'prepare adj:last_period_counter.........'|| p_asset.last_period_counter);
987 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
988 p_full_path => l_path_name,
989 p_string => 'prepare adj:ytd_deprn...................'|| p_asset.ytd_deprn);
990 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
991 p_full_path => l_path_name,
992 p_string => 'prepare adj:deprn_reserve................'|| p_asset.deprn_reserve);
993 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
994 p_full_path => l_path_name,
995 p_string => 'prepare adj:pys_deprn_reserve............'|| p_asset.pys_deprn_reserve);
996 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
997 p_full_path => l_path_name,
998 p_string => 'prepare adj:deprn_amount................'|| p_asset.deprn_amount);
999 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1000 p_full_path => l_path_name,
1001 p_string => 'prepare adj:depreciate_flag................'|| p_asset.depreciate_flag);
1002 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1003 p_full_path => l_path_name,
1004 p_string => 'prepare adj:deprn_adjustment_amount................'|| p_asset.deprn_adjustment_amount);
1005
1006 END debug_adj_asset;
1007 BEGIN -- prepare adjustments
1008 g_asset_idx1:=0;
1009 g_dist_idx2 :=0;
1010
1011 OPEN c_get_fa_book_info(p_book_type_code,p_asset_id);
1012 FETCH c_get_fa_book_info INTO l_get_fa_book_info;
1013 IF c_get_fa_book_info%NOTFOUND THEN
1014 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1015 p_full_path => l_path_name,
1016 p_string => '*** error cannot find record in fa_book');
1020
1017 CLOSE c_get_fa_book_info;
1018 RETURN FALSE;
1019 END IF;
1021 CLOSE c_get_fa_book_info;
1022
1023 g_asset_idx1:=g_asset_idx1 +1;
1024
1025
1026 p_asset_iac_adj_info.asset_id := l_get_fa_book_info.asset_id;
1027 p_asset_iac_adj_info.book_type_code := l_get_fa_book_info.book_type_code;
1028 p_asset_iac_adj_info.cost := l_get_fa_book_info.cost;
1029 p_asset_iac_adj_info.original_cost := l_get_fa_book_info.original_cost;
1030 p_asset_iac_adj_info.adjusted_cost := l_get_fa_book_info.adjusted_cost;
1031 p_asset_iac_adj_info.salvage_value := l_get_fa_book_info.salvage_value;
1032 p_asset_iac_adj_info.life_in_months := l_get_fa_book_info.life_in_months;
1033 p_asset_iac_adj_info.rate_adjustment_factor := l_get_fa_book_info.rate_adjustment_factor;
1034 p_asset_iac_adj_info.period_counter_fully_reserved := l_get_fa_book_info.period_counter_fully_reserved;
1035 p_asset_iac_adj_info.recoverable_cost := l_get_fa_book_info.recoverable_cost;
1036 p_asset_iac_adj_info.date_placed_in_service := l_get_fa_book_info.date_placed_in_service;
1037 p_asset_iac_adj_info.deprn_start_date:=l_get_fa_book_info.deprn_start_date;
1038 p_asset_iac_adj_info.last_period_counter :=p_period_counter;
1039 p_asset_iac_adj_info.deprn_amount:=0;
1040 p_asset_iac_adj_info.depreciate_flag:=l_get_fa_book_info.depreciate_flag;
1041 p_asset_iac_adj_info.deprn_adjustment_amount:=0;
1042 p_asset_iac_adj_info.deprn_periods_elapsed := 0;
1043 p_asset_iac_adj_info.deprn_periods_current_year :=0;
1044 p_asset_iac_adj_info.ytd_deprn:=0;
1045 p_asset_iac_adj_info.deprn_reserve:=0;
1046 p_asset_iac_adj_info.pys_deprn_reserve:=0;
1047
1048
1049 debug_adj_asset( p_asset_iac_adj_info);
1050
1051 IF p_asset_iac_adj_info.depreciate_flag = 'YES' THEN
1052
1053 IF p_adjustment_type = 'AMORTIZED' THEN
1054
1055 OPEN c_get_sum_fa_deprn (p_book_type_code,p_asset_id,p_period_counter);
1056 FETCH c_get_sum_fa_deprn INTO l_get_sum_fa_deprn;
1057 IF c_get_sum_fa_deprn%NOTFOUND THEN
1058 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1059 p_full_path => l_path_name,
1060 p_string => 'prepare adj:*** error cannot find record in fa_book');
1061 CLOSE c_get_sum_fa_deprn;
1062 RETURN FALSE;
1063 ELSE
1064 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1065 p_full_path => l_path_name,
1066 p_string => 'prepare adj: fa deprn summary');
1067 END IF;
1068 CLOSE c_get_sum_fa_deprn;
1069 p_asset_iac_adj_info.deprn_adjustment_amount:=l_get_sum_fa_deprn.depreciation_adjustment_amount;
1070 p_asset_iac_adj_info.deprn_amount := l_get_sum_fa_deprn.depreciation_amount;
1071 p_asset_iac_adj_info.deprn_reserve := l_get_sum_fa_deprn.depreciation_reserve;
1072 /* salvage value correction */
1073 If l_get_fa_book_info.salvage_value <> 0 Then
1074 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1075 p_full_path => l_path_name,
1076 p_string => ' FA Deprn adj amount for period before salvage correction:'||p_asset_iac_adj_info.deprn_adjustment_amount);
1080 P_cost=>l_get_fa_book_info.cost,
1077 IF NOT igi_iac_salvage_pkg.correction(p_asset_id => l_get_fa_book_info.asset_id,
1078 P_book_type_code =>l_get_fa_book_info.book_type_code,
1079 P_value=>p_asset_iac_adj_info.deprn_adjustment_amount,
1081 P_salvage_value=>l_get_fa_book_info.salvage_value,
1082 P_calling_program=>'ADJUSTMENTS') THEN
1083 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1084 p_full_path => l_path_name,
1085 p_string => '+Salvage Value Correction Failed : ');
1086 return false;
1087 END IF;
1088 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1089 p_full_path => l_path_name,
1090 p_string => ' FA Deprn adj amount for period after salvage correction:'||p_asset_iac_adj_info.deprn_adjustment_amount);
1091 END IF;
1092 /* salvage value correction */
1093
1094
1095 ELSIF p_adjustment_type = 'EXPENSED' THEN
1096
1097 OPEN c_get_fa_deprn_summary(p_book_type_code,p_asset_id,p_period_counter);
1098 FETCH c_get_fa_deprn_summary INTO l_get_fa_deprn_summary;
1099 IF c_get_fa_deprn_summary%NOTFOUND THEN
1100 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1101 p_full_path => l_path_name,
1102 p_string => 'prepare adj:*** error cannot find record in fa_book');
1103 CLOSE c_get_fa_deprn_summary;
1104 RETURN FALSE;
1105 ELSE
1106 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1107 p_full_path => l_path_name,
1108 p_string => 'prepare adj: fa deprn summary');
1109 END IF;
1110 CLOSE c_get_fa_deprn_summary;
1111 p_asset_iac_adj_info.deprn_reserve:=l_get_fa_deprn_summary.deprn_reserve - l_get_fa_deprn_summary.system_deprn_amount;
1112 p_asset_iac_adj_info.deprn_amount:=l_get_fa_deprn_summary.system_deprn_amount;
1113 /* salvage value correction */
1114 If l_get_fa_book_info.salvage_value <> 0 Then
1115 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1116 p_full_path => l_path_name,
1117 p_string => ' FA Deprn reserve amount for period before salvage correction:'||p_asset_iac_adj_info.deprn_reserve);
1118 IF NOT igi_iac_salvage_pkg.correction(p_asset_id => l_get_fa_book_info.asset_id,
1119 P_book_type_code =>l_get_fa_book_info.book_type_code,
1120 P_value=>p_asset_iac_adj_info.deprn_reserve,
1121 P_cost=>l_get_fa_book_info.cost,
1122 P_salvage_value=>l_get_fa_book_info.salvage_value,
1123 P_calling_program=>'ADJUSTMENTS') THEN
1124 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1125 p_full_path => l_path_name,
1126 p_string => '+Salvage Value Correction Failed : ');
1127 return false;
1128 END IF;
1129 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1130 p_full_path => l_path_name,
1131 p_string => ' FA Deprn reserve amount for period after salvage correction:'||p_asset_iac_adj_info.deprn_reserve);
1132 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1133 p_full_path => l_path_name,
1134 p_string => ' FA Deprn amount for period before salvage correction:'||p_asset_iac_adj_info.deprn_amount);
1135 IF NOT igi_iac_salvage_pkg.correction(p_asset_id => l_get_fa_book_info.asset_id,
1136 P_book_type_code =>l_get_fa_book_info.book_type_code,
1137 P_value=>p_asset_iac_adj_info.deprn_amount,
1138 P_cost=>l_get_fa_book_info.cost,
1139 P_salvage_value=>l_get_fa_book_info.salvage_value,
1140 P_calling_program=>'ADJUSTMENTS') THEN
1141 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1142 p_full_path => l_path_name,
1143 p_string => '+Salvage Value Correction Failed : ');
1144 return false;
1145 END IF;
1146 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1147 p_full_path => l_path_name,
1148 p_string => ' FA Deprn amount for period after salvage correction:'||p_asset_iac_adj_info.deprn_amount);
1149
1150 END IF;
1151 /* salvage value correction */
1152
1153 END IF;
1154
1155 END IF;
1156
1157 debug_adj_asset( p_asset_iac_adj_info);
1158
1159
1160 --- get the distributions and for the asset from fa_deprn_detail
1161
1162 FOR l_get_fa_deprn_detail IN c_get_fa_deprn_detail
1163 LOOP
1164 -- increment the index and copy the details into pl/sql table
1165 g_dist_idx2:=g_dist_idx2 + 1;
1166
1167 p_asset_dist_iac_adj_info(g_dist_idx2).asset_id:=l_get_fa_deprn_detail.asset_id;
1168 p_asset_dist_iac_adj_info(g_dist_idx2).book_type_code:=l_get_fa_deprn_detail.book_type_code;
1169 p_asset_dist_iac_adj_info(g_dist_idx2).distribution_id:=l_get_fa_deprn_detail.distribution_id;
1170 p_asset_dist_iac_adj_info(g_dist_idx2).period_counter :=l_get_fa_deprn_detail.period_counter;
1171
1172 p_asset_dist_iac_adj_info(g_dist_idx2).deprn_amount :=l_get_fa_deprn_detail.deprn_amount;
1173 p_asset_dist_iac_adj_info(g_dist_idx2).ytd_deprn :=l_get_fa_deprn_detail.ytd_deprn;
1174 p_asset_dist_iac_adj_info(g_dist_idx2).deprn_reserve :=l_get_fa_deprn_detail.deprn_reserve;
1175 p_asset_dist_iac_adj_info(g_dist_idx2).deprn_adjustment_amount :=l_get_fa_deprn_detail.deprn_adjustment_amount;
1176
1177 p_asset_dist_iac_adj_info(g_dist_idx2).deprn_periods_elapsed :=0;
1178 p_asset_dist_iac_adj_info(g_dist_idx2).deprn_periods_current_year :=0;
1179 p_asset_dist_iac_adj_info(g_dist_idx2).deprn_periods_prior_year :=0;
1180 p_asset_dist_iac_adj_info(g_dist_idx2).start_period_counter := 0;
1181 p_asset_dist_iac_adj_info(g_dist_idx2).last_period_counter :=0;
1182 p_asset_dist_iac_adj_info(g_dist_idx2).pys_deprn_reserve :=0;
1183 p_asset_dist_iac_adj_info(g_dist_idx2).current_deprn_reserve :=0;
1184
1185
1186 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1187 p_full_path => l_path_name,
1188 p_string => 'prepare adj:asset_id.................'|| p_asset_dist_iac_adj_info(g_dist_idx2).asset_id);
1189 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1190 p_full_path => l_path_name,
1191 p_string => 'prepare adj:book_type_code...........'|| p_asset_dist_iac_adj_info(g_dist_idx2).book_type_code);
1192 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1193 p_full_path => l_path_name,
1194 p_string => 'prepare adj:distribution_id..........'|| p_asset_dist_iac_adj_info(g_dist_idx2).distribution_id);
1195 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1196 p_full_path => l_path_name,
1197 p_string => 'prepare adj:period_counter...........'|| p_asset_dist_iac_adj_info(g_dist_idx2).period_counter );-- tested
1198 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1199 p_full_path => l_path_name,
1200 p_string => 'prepare adj:deprn_amount.............'|| p_asset_dist_iac_adj_info(g_dist_idx2).deprn_amount );
1201 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1202 p_full_path => l_path_name,
1203 p_string => 'prepare adj:ytd_deprn................'|| p_asset_dist_iac_adj_info(g_dist_idx2).ytd_deprn);
1204 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1205 p_full_path => l_path_name,
1206 p_string => 'prepare adj:deprn_reserve............'|| p_asset_dist_iac_adj_info(g_dist_idx2).deprn_reserve);
1207 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1208 p_full_path => l_path_name,
1209 p_string => 'prepare adj:deprn_adjustment_amount..'|| p_asset_dist_iac_adj_info(g_dist_idx2).deprn_adjustment_amount);
1213 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1210 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1211 p_full_path => l_path_name,
1212 p_string => 'prepare adj:deprn_periods_elapsed....'|| p_asset_dist_iac_adj_info(g_dist_idx2).deprn_periods_elapsed );
1214 p_full_path => l_path_name,
1215 p_string => 'prepare adj:deprn_periods_current_year..'||p_asset_dist_iac_adj_info(g_dist_idx2).deprn_periods_current_year);
1216 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1217 p_full_path => l_path_name,
1218 p_string => 'prepare adj:deprn_periods_prior_year....'||p_asset_dist_iac_adj_info(g_dist_idx2).deprn_periods_prior_year );
1219 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1220 p_full_path => l_path_name,
1221 p_string => 'prepare adj:start_period_counter......'|| p_asset_dist_iac_adj_info(g_dist_idx2).start_period_counter );
1222 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1223 p_full_path => l_path_name,
1224 p_string => 'prepare adj:last_period_counter.......'|| p_asset_dist_iac_adj_info(g_dist_idx2).last_period_counter );
1225 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1226 p_full_path => l_path_name,
1227 p_string => 'prepare adj:pys_deprn_reserve.........'|| p_asset_dist_iac_adj_info(g_dist_idx2).pys_deprn_reserve );
1228 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1229 p_full_path => l_path_name,
1230 p_string => 'prepare adj:current_deprn_reserve....'|| p_asset_dist_iac_adj_info(g_dist_idx2).current_deprn_reserve);
1231
1232 END LOOP;
1233
1234 RETURN TRUE;
1235
1236 END prepare_adjustment;
1237
1238
1239 FUNCTION Do_Process_Adjustments(
1240 p_book_type_code varchar2,
1241 p_period_counter number ,
1242 p_calling_function varchar2
1243 ) RETURN boolean IS
1244
1245 CURSOR c_get_asset_adj IS
1246 SELECT *
1247 FROM igi_iac_adjustments_history
1248 WHERE book_type_code = p_book_type_code
1249 AND period_counter = p_period_counter
1250 AND NVL(active_flag,'N') = 'N' ;
1251
1252 l_get_asset_adj c_get_asset_adj%ROWTYPE;
1253 l_last_update_date date;
1254 l_last_updated_by number;
1255 l_last_update_login number;
1256 l_user_id number;
1257 l_login_id number;
1258 l_path_name VARCHAR2(150) := g_path||'do_process_adjustments';
1259 p_event_id number(15); --R12 uptake
1260 BEGIN
1261
1262 -- start preparation for iac adjutsments processing
1263 IF fnd_profile.value('PRINT_DEBUG') = 'Y' THEN
1264 SELECT SUBSTR(VALUE,1,DECODE ((INSTR(VALUE,',', 1, 1)-1),0,LENGTH(VALUE)
1265 ,(INSTR(VALUE,',', 1, 1)-1)))
1266 INTO g_output_dir
1267 FROM v$parameter
1268 WHERE name LIKE 'utl%';
1269 g_debug_log := 'iacadj.log';
1270 g_debug_output := 'iacadj.out';
1271 g_debug_print := TRUE;
1272 ELSE
1273 g_debug_print := FALSE;
1274 END IF;
1275
1276 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1277 p_full_path => l_path_name,
1278 p_string => 'creating a message log file for adjustments from depreciation');
1279 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1280 p_full_path => l_path_name,
1281 p_string => 'calling function '||p_calling_function);
1282 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1283 p_full_path => l_path_name,
1284 p_string => ' in iac adjustments');
1285 l_user_id := fnd_global.user_id;
1286 l_login_id := fnd_global.login_id;
1287
1288 FOR l_get_asset_adj IN c_get_asset_adj
1289 LOOP
1290 select event_id into p_event_id from fa_deprn_summary
1291 where asset_id=l_get_asset_adj.asset_id
1292 and book_type_code=p_book_type_code
1293 and period_counter=p_period_counter;
1294
1295 IF NOT prepare_adjustment(p_book_type_code,
1296 p_period_counter,
1297 l_get_asset_adj.asset_id,
1298 l_get_asset_adj.transaction_subtype,
1299 g_asset_iac_adj_info,
1300 g_asset_iac_dist_info,
1301 l_get_asset_adj ) THEN
1302 RETURN FALSE;
1303 END IF;
1304
1305 IF l_get_asset_adj.adjustment_reval_type ='C' THEN
1306 -- call cost adjustments package
1307 IF NOT IGI_IAC_ADJ_COST_REVAL_PKG.Do_Cost_Revaluation(
1308 g_asset_iac_adj_info,
1309 g_asset_iac_dist_info,
1310 l_get_asset_adj,
1311 p_event_id) THEN --- function to process cost
1312
1313 RETURN FALSE;
1314 END IF;
1315
1316 END IF;
1317 IF g_asset_iac_adj_info.Depreciate_flag = 'YES' THEN
1318 If l_get_asset_adj.transaction_subtype = 'AMORTIZED' THEN
1319 -- Call amortization processing depreciation revalution.
1320 IF Not IGI_IAC_ADJ_AMORT_PKG. Do_Amort_Deprn_Reval(
1321 g_asset_iac_adj_info,
1325 THEN --- function to process amortization depreciation
1322 g_asset_iac_dist_info,
1323 l_get_asset_adj,
1324 p_event_id)
1326
1327 RETURN FALSE;
1328 END IF;
1329
1330 ELSIF l_get_asset_adj.transaction_subtype = 'EXPENSED' THEN
1331 IF Not IGI_IAC_ADJ_EXPENSED_PKG.Do_Expensed_Adj (
1332 g_asset_iac_adj_info,
1333 g_asset_iac_dist_info,
1334 l_get_asset_adj,
1335 p_event_id) THEN --- function to process expensed depreciation
1336
1337 RETURN FALSE;
1338 END IF;
1339
1340 END IF;
1341 END IF;
1342
1343 l_last_update_date := SYSDATE;
1344 l_last_updated_by := l_user_id;
1345 IF (l_last_updated_by IS NULL) THEN
1346 l_last_updated_by := -1;
1347 END IF;
1348 l_last_update_login := l_login_id;
1349 IF (l_last_update_login IS NULL) THEN
1350 l_last_update_login := -1;
1351 END IF;
1352
1353 UPDATE igi_iac_adjustments_history
1354 SET active_flag = 'Y',
1355 last_updated_by = l_last_updated_by,
1356 last_update_date =l_last_update_date,
1357 last_update_login =l_last_update_login
1358 WHERE asset_id = l_get_asset_adj.asset_id
1359 AND book_type_code = l_get_asset_adj.book_type_code;
1360
1361 END LOOP;
1362 RETURN TRUE;
1363 --return false;
1364
1365 END do_process_adjustments;
1366
1367
1368 END igi_iac_adj_pkg;