[Home] [Help]
PACKAGE BODY: APPS.IGI_IAC_ADJ_EXPENSED_PKG
Source
1 PACKAGE BODY IGI_IAC_ADJ_EXPENSED_PKG AS
2 -- $Header: igiiadxb.pls 120.17.12010000.2 2010/06/24 11:52:50 schakkin ship $
3
4 --===========================FND_LOG.START=====================================
5
6 g_state_level NUMBER;
7 g_proc_level NUMBER;
8 g_event_level NUMBER;
9 g_excep_level NUMBER;
10 g_error_level NUMBER;
11 g_unexp_level NUMBER;
12 g_path VARCHAR2(100);
13
14 --===========================FND_LOG.END=====================================
15
16 PROCEDURE do_round ( p_amount in out NOCOPY number, p_book_type_code in varchar2) is
17 l_path varchar2(150) := g_path||'do_round(p_amount,p_book_type_code)';
18 l_amount number := p_amount;
19 l_amount_old number := p_amount;
20 --l_path varchar2(150) := g_path||'do_round';
21 begin
22 igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'--- Inside Round() ---');
23 IF IGI_IAC_COMMON_UTILS.Iac_Round(X_Amount => l_amount, X_Book => p_book_type_code)
24 THEN
25 p_amount := l_amount;
26 igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'IGI_IAC_COMMON_UTILS.Iac_Round is TRUE');
27 igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'p_amount = '||p_amount);
28 ELSE
29 p_amount := round( l_amount, 2);
30 igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'IGI_IAC_COMMON_UTILS.Iac_Round is FALSE');
31 igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'p_amount = '||p_amount);
32 END IF;
33 exception when others then
34 p_amount := l_amount_old;
35 igi_iac_debug_pkg.debug_unexpected_msg(l_path);
36 Raise;
37 END;
38
39 PROCEDURE debug_adj_asset(p_asset igi_iac_types.iac_adj_hist_asset_info) IS
40 l_path_name VARCHAR2(150);
41 BEGIN
42 l_path_name := g_path||'debug_adj_asset';
43 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
44 p_full_path => l_path_name,
45 p_string => 'asset_id...............'|| p_asset.asset_id);
46 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
47 p_full_path => l_path_name,
48 p_string => 'book_type_code.........'|| p_asset.book_type_code);
49 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
50 p_full_path => l_path_name,
51 p_string => 'cost...................'|| p_asset.cost );
52 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
53 p_full_path => l_path_name,
54 p_string => 'original_Expensed..........'|| p_asset.original_cost);
55 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
56 p_full_path => l_path_name,
57 p_string => 'adjusted_Expensed..........'|| p_asset.adjusted_cost);
58 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
59 p_full_path => l_path_name,
60 p_string => 'salvage_value..........'|| p_asset.salvage_value );
61 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
62 p_full_path => l_path_name,
63 p_string => 'life_in_months.........'|| p_asset.life_in_months);
64 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
65 p_full_path => l_path_name,
66 p_string => 'rate_adjustment_factor..'||p_asset.rate_adjustment_factor);
67 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
68 p_full_path => l_path_name,
69 p_string => 'period_counter_fully_reserved '|| p_asset.period_counter_fully_reserved);
70 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
71 p_full_path => l_path_name,
72 p_string => 'recoverable_Expensed.......'|| p_asset.recoverable_cost);
73 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
74 p_full_path => l_path_name,
75 p_string => 'date_placed_in_service..'||p_asset.date_placed_in_service);
76 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
77 p_full_path => l_path_name,
78 p_string => 'deprn_start_date........'||p_asset.deprn_start_date);
79 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
80 p_full_path => l_path_name,
81 p_string => 'deprn_periods_elapsed...'||p_asset.deprn_periods_elapsed);
82 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
83 p_full_path => l_path_name,
84 p_string => 'deprn_periods_current_year..'||p_asset.deprn_periods_current_year);
85 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
86 p_full_path => l_path_name,
87 p_string => 'prior year periods..'|| p_asset.deprn_periods_prior_year);
88 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
89 p_full_path => l_path_name,
90 p_string => 'last_period_counter.........'|| p_asset.last_period_counter);
91 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
92 p_full_path => l_path_name,
93 p_string => 'ytd_deprn...................'|| p_asset.ytd_deprn);
94 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
95 p_full_path => l_path_name,
96 p_string => 'deprn_reserve................'|| p_asset.deprn_reserve);
97 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
98 p_full_path => l_path_name,
99 p_string => 'pys_deprn_reserve............'|| p_asset.pys_deprn_reserve);
100 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
101 p_full_path => l_path_name,
102 p_string => 'deprn_amount................'|| p_asset.deprn_amount);
103 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
104 p_full_path => l_path_name,
105 p_string => 'depreciate_flag................'|| p_asset.depreciate_flag);
106 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
107 p_full_path => l_path_name,
108 p_string => 'deprn_adjustment_amount................'|| p_asset.deprn_adjustment_amount);
109 END debug_adj_asset;
110
111 FUNCTION Calculate_New_Balances( p_asset_iac_adj_info IN OUT NOCOPY igi_iac_types.iac_adj_hist_asset_info,
112 P_asset_balance IN OUT NOCOPY igi_iac_asset_balances%ROWTYPE,
113 p_adj_hist IN igi_iac_adjustments_history%ROWTYPE)
114 RETURN boolean IS
115
116 CURSOR c_period_num_for_catchup IS
117 SELECT period_num_for_catchup
118 FROM igi_iac_book_controls
119 WHERE book_type_code = p_asset_iac_adj_info.book_type_code;
120
121 CURSOR C_get_curr_reval_rate IS
122 SELECT irr.*
123 FROM igi_iac_revaluation_rates irr
124 WHERE irr.asset_id = p_asset_iac_adj_info.asset_id
125 AND irr.book_type_code = p_asset_iac_adj_info.book_type_code
126 AND irr.latest_record = 'Y'
127 AND irr.revaluation_id = (SELECT max(iar.revaluation_id)
128 FROM igi_iac_revaluation_rates iar ,
129 igi_iac_transaction_headers ith
130 WHERE iar.asset_id = p_asset_iac_adj_info.asset_id
131 AND iar.book_type_code = p_asset_iac_adj_info.book_type_code
132 AND ith.book_type_code = p_asset_iac_adj_info.book_type_code
133 AND ith.asset_id = p_asset_iac_adj_info.asset_id
134 AND iar.adjustment_id = ith.adjustment_id
135 AND ith.adjustment_status IN ('COMPLETE','RUN'));
136
137 l_get_curr_reval_rate igi_iac_revaluation_rates%ROWTYPE;
138 l_cumulative_backlog igi_iac_asset_balances.backlog_deprn_reserve%TYPE;
139 l_current_backlog igi_iac_asset_balances.backlog_deprn_reserve%TYPE;
140 l_Reval_rsv_backlog igi_iac_asset_balances.backlog_deprn_reserve%TYPE;
141 l_operating_acct_backlog igi_iac_asset_balances.backlog_deprn_reserve%TYPE;
142 l_dpis_period_info igi_iac_types.prd_rec;
143 l_period_info igi_iac_types.prd_rec;
144 l_latest_reval_period_info igi_iac_types.prd_rec;
145 l_dpis_price_index Number;
146 l_prev_price_index Number;
147 l_period_num_for_catchup Number;
148 l_curr_price_index Number;
149 l_reval_factor Number;
150 l_prev_reval_factor Number;
151 l_Prev_cumm_reval_factor Number;
152 l_cumm_reval_factor Number;
153 l_period_counter Number;
154 l_fa_asset_info igi_iac_types.fa_hist_asset_info;
155 l_latest_closed_period fa_deprn_periods.period_counter%TYPE;
156 l_last_deprn_period igi_iac_types.prd_rec;
157 l_deprn_periods_elapsed NUMBER;
158 l_deprn_periods_current_year NUMBER;
159
160 l_path_name VARCHAR2(150);
161 BEGIN
162 l_path_name := g_path||'Calculate_New_Balances';
163
164 IF NOT igi_iac_common_utils.get_Period_Info_for_Date(p_asset_iac_adj_info.book_type_code,
165 P_asset_iac_adj_info.date_placed_in_service,
166 l_dpis_period_info) THEN
167 RETURN FALSE;
168 END IF;
169
170 IF NOT igi_iac_common_utils.get_price_index_value(
171 p_asset_iac_adj_info.book_type_code,
172 p_asset_iac_adj_info.asset_id,
173 l_dpis_period_info.period_name,
174 l_dpis_price_index) THEN
175 RETURN FALSE;
176 END IF;
177 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
178 p_full_path => l_path_name,
179 p_string => 'Backlog:Price Index for DPIS :'||TO_CHAR(l_dpis_price_index));
180 l_prev_price_index := l_dpis_price_index;
181
182 -- get revalaution period num
183 OPEN c_period_num_for_catchup;
184 FETCH c_period_num_for_catchup INTO l_period_num_for_catchup;
185 CLOSE c_period_num_for_catchup;
186
187 -- get the latest revaluation of the asset
188 OPEN C_get_curr_reval_rate;
189 FETCH C_get_curr_reval_rate INTO l_get_curr_reval_rate;
190 CLOSE c_get_curr_reval_rate;
191
192 l_fa_asset_info.cost := p_asset_iac_adj_info.cost;
193 l_fa_asset_info.adjusted_cost := p_asset_iac_adj_info.adjusted_cost;
194 l_fa_asset_info.original_cost := p_asset_iac_adj_info.original_cost;
195 l_fa_asset_info.salvage_value := p_asset_iac_adj_info.salvage_value;
196 l_fa_asset_info.life_in_months := p_asset_iac_adj_info.life_in_months;
197 l_fa_asset_info.rate_adjustment_factor := p_asset_iac_adj_info.rate_adjustment_factor;
198 l_fa_asset_info.period_counter_fully_reserved := p_asset_iac_adj_info.period_counter_fully_reserved;
199 l_fa_asset_info.adjusted_recoverable_cost := p_asset_iac_adj_info.adjusted_recoverable_cost;
200 l_fa_asset_info.recoverable_cost := p_asset_iac_adj_info.recoverable_cost;
201 l_fa_asset_info.date_placed_in_service := p_asset_iac_adj_info.date_placed_in_service;
202 l_fa_asset_info.deprn_periods_elapsed := p_asset_iac_adj_info.deprn_periods_elapsed;
203 l_fa_asset_info.deprn_periods_current_year := p_asset_iac_adj_info.deprn_periods_current_year;
204 l_fa_asset_info.deprn_periods_prior_year := p_asset_iac_adj_info.deprn_periods_prior_year;
205 l_fa_asset_info.last_period_counter := p_asset_iac_adj_info.last_period_counter;
206 l_fa_asset_info.gl_posting_allowed_flag := p_asset_iac_adj_info.gl_posting_allowed_flag;
207 l_fa_asset_info.ytd_deprn := p_asset_iac_adj_info.ytd_deprn;
208 l_fa_asset_info.deprn_reserve := p_asset_iac_adj_info.deprn_reserve;
209 l_fa_asset_info.pys_deprn_reserve := p_asset_iac_adj_info.pys_deprn_reserve;
210 l_fa_asset_info.deprn_amount := p_asset_iac_adj_info.deprn_amount;
211 l_fa_asset_info.deprn_start_date := p_asset_iac_adj_info.deprn_start_date;
212 l_fa_asset_info.depreciate_flag := p_asset_iac_adj_info.depreciate_flag;
213
214 l_latest_closed_period := p_adj_hist.period_counter - 1;
215 IF NOT igi_iac_ytd_engine.Calculate_YTD
216 ( p_asset_iac_adj_info.book_type_code,
217 p_asset_iac_adj_info.asset_id,
218 l_fa_asset_info,
219 l_dpis_period_info.period_counter,
220 l_latest_closed_period,
221 'EXPENSED') THEN
222 RETURN FALSE;
223 END IF;
224
225 p_asset_iac_adj_info.last_period_counter := l_fa_asset_info.last_period_counter ;
226 p_asset_iac_adj_info.ytd_deprn := l_fa_asset_info.ytd_deprn ;
227 p_asset_iac_adj_info.deprn_amount := l_fa_asset_info.deprn_amount ;
228
229 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
230 p_full_path => l_path_name,
231 p_string => 'ytd_deprn from YTD engine :'||l_fa_asset_info.ytd_deprn);
232 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
233 p_full_path => l_path_name,
234 p_string => 'deprn_amount from YTD engine :'||l_fa_asset_info.deprn_amount);
235 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
236 p_full_path => l_path_name,
237 p_string => 'Last period counter from YTD engine :'||l_fa_asset_info.last_period_counter);
238 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
239 p_full_path => l_path_name,
240 p_string => 'Last revaluation period for the asset : '|| to_char(l_get_curr_reval_rate.period_counter));
241
242 IF NOT igi_iac_common_utils.get_period_info_for_counter(p_asset_iac_adj_info.book_type_code,
243 l_get_curr_reval_rate.period_counter,
244 l_latest_reval_period_info) THEN
245 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
246 p_full_path => l_path_name,
247 p_string => 'Backlog:*** Error in fetching period information');
248 RETURN FALSE;
249 END IF;
250
251 l_cumulative_backlog:= 0;
252 l_reval_rsv_backlog := 0;
253 l_operating_acct_backlog := 0;
254 l_Prev_cumm_reval_factor := 1;
255 l_cumm_reval_factor := 1;
256 l_current_backlog:=0;
257
258 FOR l_period_counter IN l_dpis_period_info.period_counter..(l_latest_reval_period_info.period_counter) LOOP
259
260 IF NOT igi_iac_common_utils.get_period_info_for_counter(p_asset_iac_adj_info.book_type_code,
261 l_period_counter,
262 l_period_info) THEN
263 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
264 p_full_path => l_path_name,
265 p_string => 'Backlog:*** Error in fetching period information');
266 RETURN FALSE;
267 END IF;
268
269 /* if the period in the loop is a catchup period for revaluation
270 then initialize revaluation structures */
271 IF (l_period_num_for_catchup = l_period_info.period_num)
272 OR (l_period_info.period_counter = l_latest_reval_period_info.period_counter) THEN
273
274 IF (l_period_info.period_counter = l_latest_reval_period_info.period_counter) THEN
275 l_cumm_reval_factor := l_get_curr_reval_rate.cumulative_reval_factor;
276 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
277 p_full_path => l_path_name,
278 p_string => 'Cumulative reval factor from last reval : '||l_cumm_reval_factor);
279 ELSE
280 IF NOT (igi_iac_common_utils.get_price_index_value(
281 p_asset_iac_adj_info.book_type_code,
282 p_asset_iac_adj_info.asset_id,
283 l_period_info.period_name,
284 l_curr_price_index)) THEN
285 RETURN FALSE;
286 END IF;
287 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
288 p_full_path => l_path_name,
289 p_string => ' Backlog: Period counter for revaluation :'|| l_period_info.period_counter);
290 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
291 p_full_path => l_path_name,
292 p_string => 'Backlog: Price Index for current revaluation catchup period :'||TO_CHAR(l_curr_price_index));
293
294 IF (l_prev_price_index = 9999.99 OR l_curr_price_index = 9999.99 OR l_prev_price_index = 0) THEN
295 RETURN FALSE;
296 END IF;
297 l_reval_factor := l_curr_price_index / l_prev_price_index ;
298 l_cumm_reval_factor := l_reval_factor * l_Prev_cumm_reval_factor;
299 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
300 p_full_path => l_path_name,
301 p_string => 'Current Price Index value :'||l_curr_price_index);
302 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
303 p_full_path => l_path_name,
304 p_string => 'Cumulative reval factor from catchup : '||l_cumm_reval_factor);
305 END IF;
306
307 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
308 p_full_path => l_path_name,
309 p_string => 'Backlog: Current Reval Factor : '||TO_CHAR(l_reval_factor));
310 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
311 p_full_path => l_path_name,
312 p_string => 'Backlog: Cummulative Reval Factor : '||TO_CHAR(l_cumm_reval_factor));
313 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
314 p_full_path => l_path_name,
315 p_string => 'Backlog: Previous Cummulative Reval Factor : '||TO_CHAR(l_Prev_cumm_reval_factor));
316
317 l_deprn_periods_elapsed := l_period_info.period_counter - l_dpis_period_info.period_counter + 1;
318 l_deprn_periods_current_year := l_period_info.period_num;
319 IF (l_period_info.fiscal_year = l_dpis_period_info.fiscal_year) THEN
320 l_deprn_periods_current_year := l_period_info.period_counter - l_dpis_period_info.period_counter + 1;
321 l_deprn_periods_elapsed := l_deprn_periods_current_year;
322 END IF;
323
324 IF (l_fa_asset_info.last_period_counter < l_period_info.period_counter) THEN
325
326 IF NOT igi_iac_common_utils.get_period_info_for_counter(p_asset_iac_adj_info.book_type_code,
327 l_fa_asset_info.last_period_counter,
328 l_last_deprn_period) THEN
329 RETURN FALSE;
330 END IF;
331
332 l_deprn_periods_elapsed := l_last_deprn_period.period_counter - l_dpis_period_info.period_counter + 1;
333 IF (l_period_info.fiscal_year = l_last_deprn_period.fiscal_year) THEN
334 l_deprn_periods_current_year := l_last_deprn_period.period_num;
335 END IF;
336
337 IF (l_dpis_period_info.fiscal_year = l_last_deprn_period.fiscal_year) THEN
338 l_deprn_periods_current_year := l_last_deprn_period.period_num - l_dpis_period_info.period_num + 1;
339 END IF;
340
341 IF (l_last_deprn_period.fiscal_year < l_period_info.fiscal_year ) THEN
342 l_deprn_periods_current_year := 0;
343 END IF;
344 END IF;
345
346 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
347 p_full_path => l_path_name,
348 p_string => 'periods elapsed..'|| l_deprn_periods_elapsed);
349 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
350 p_full_path => l_path_name,
351 p_string => 'current year periods ...'|| l_deprn_periods_current_year);
352 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
353 p_full_path => l_path_name,
354 p_string => 'FA deprn period..'||l_fa_asset_info.deprn_amount);
355 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
356 p_full_path => l_path_name,
357 p_string => 'previous factor..'|| l_Prev_cumm_reval_factor);
358 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
359 p_full_path => l_path_name,
360 p_string => 'current factor..'|| l_cumm_reval_factor);
361
362 IF (l_cumm_reval_factor >= 1 AND l_Prev_cumm_reval_factor < 1) THEN
363 /* Movement from <1 to 1 */
364 l_current_backlog := ((l_deprn_periods_elapsed - l_deprn_periods_current_year)
365 * l_fa_asset_info.deprn_amount) * (1 - l_prev_cumm_reval_factor);
366 do_round(l_current_backlog,p_asset_iac_adj_info.book_type_code);
367 l_operating_acct_backlog := l_Operating_acct_backlog + l_current_backlog;
368 l_cumulative_backlog := l_cumulative_backlog + l_current_backlog;
369 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
370 p_full_path => l_path_name,
371 p_string => 'current backlog1 ..'|| l_current_backlog);
372
373 /* Movement from 1 to >1 */
374 l_current_backlog := ((l_deprn_periods_elapsed - l_deprn_periods_current_year)
375 * l_fa_asset_info.deprn_amount) * (l_cumm_reval_factor - 1);
376 do_round(l_current_backlog,p_asset_iac_adj_info.book_type_code);
377 l_Reval_Rsv_Backlog := l_Reval_Rsv_Backlog + l_current_backlog;
378 l_cumulative_backlog := l_cumulative_backlog + l_current_backlog;
379 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
380 p_full_path => l_path_name,
381 p_string => 'current backlog2 ..'|| l_current_backlog);
382
383 ELSIF (l_cumm_reval_factor < 1 AND l_Prev_cumm_reval_factor >= 1) THEN
384 /* Movement from >1 to 1 */
385 l_current_backlog := ((l_deprn_periods_elapsed - l_deprn_periods_current_year)
386 * l_fa_asset_info.deprn_amount) * (1 - l_Prev_cumm_reval_factor);
387 do_round(l_current_backlog,p_asset_iac_adj_info.book_type_code);
388 l_Reval_Rsv_Backlog := l_Reval_Rsv_Backlog + l_current_backlog;
389 l_cumulative_backlog := l_cumulative_backlog + l_current_backlog;
390 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
391 p_full_path => l_path_name,
392 p_string => 'current backlog3 ..'|| l_current_backlog);
393
394 /* Movement from 1 to <1 */
395 l_current_backlog := ((l_deprn_periods_elapsed - l_deprn_periods_current_year)
396 * l_fa_asset_info.deprn_amount) * (l_cumm_reval_factor - 1);
397 do_round(l_current_backlog,p_asset_iac_adj_info.book_type_code);
398 l_Operating_Acct_Backlog := l_Operating_Acct_Backlog + l_current_backlog;
399 l_cumulative_backlog := l_cumulative_backlog + l_current_backlog;
400 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
401 p_full_path => l_path_name,
402 p_string => 'current backlog4 ..'|| l_current_backlog);
403 ELSE
404 l_current_backlog := ((l_deprn_periods_elapsed - l_deprn_periods_current_year)
405 * l_fa_asset_info.deprn_amount) * (l_cumm_reval_factor - l_Prev_cumm_reval_factor);
406 do_round(l_current_backlog,p_asset_iac_adj_info.book_type_code);
407 l_cumulative_backlog := l_cumulative_backlog + l_current_backlog;
408
409 IF (l_cumm_reval_factor >= 1) THEN
410 l_Reval_Rsv_Backlog := l_Reval_Rsv_Backlog + l_current_backlog;
411 ELSE
412 l_Operating_Acct_Backlog := l_Operating_Acct_Backlog + l_current_backlog;
413
414 END IF;
415
416 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
417 p_full_path => l_path_name,
418 p_string => 'current backlog5 ..'|| l_current_backlog);
419 END IF;
420 l_prev_price_index := l_curr_price_index;
421 l_Prev_cumm_reval_factor := l_cumm_reval_factor;
422
423 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
424 p_full_path => l_path_name,
425 p_string => 'Backlog Accumalted...'|| l_cumulative_backlog);
426 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
427 p_full_path => l_path_name,
428 p_string => 'Backlog RR...'|| l_Reval_Rsv_backlog);
429 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
430 p_full_path => l_path_name,
431 p_string => 'Backlog OP...'|| l_Operating_Acct_backlog);
432 END IF;
433
434 END LOOP;
435
436 IF NOT (igi_iac_common_utils.iac_round(l_cumulative_backlog,p_asset_iac_adj_info.book_type_code)) THEN
437 RETURN FALSE;
438 END IF;
439 IF NOT (igi_iac_common_utils.iac_round(l_Reval_Rsv_backlog,p_asset_iac_adj_info.book_type_code)) THEN
440 RETURN FALSE;
441 END IF;
442 IF NOT (igi_iac_common_utils.iac_round(l_Operating_Acct_backlog,p_asset_iac_adj_info.book_type_code)) THEN
443 RETURN FALSE;
444 END IF;
445
446 p_asset_balance.backlog_deprn_reserve := l_cumulative_backlog;
447 p_asset_balance.deprn_reserve := p_asset_iac_adj_info.deprn_reserve * (l_cumm_reval_factor - 1)
448 - l_cumulative_backlog;
449 do_round(p_asset_balance.deprn_reserve,p_asset_iac_adj_info.book_type_code);
450 IF NOT (igi_iac_common_utils.iac_round(p_asset_balance.deprn_reserve,p_asset_iac_adj_info.book_type_code)) THEN
451 RETURN FALSE;
452 END IF;
453
454 p_asset_balance.net_book_value := p_asset_balance.adjusted_cost - p_asset_balance.deprn_reserve
455 - l_cumulative_backlog;
456
457 IF l_cumm_reval_factor >= 1 THEN
458 p_asset_balance.reval_reserve := p_asset_balance.net_book_value;
459 p_asset_balance.Operating_acct := 0 - l_Operating_Acct_backlog;
460 p_asset_balance.General_Fund := p_asset_balance.adjusted_cost - l_Reval_Rsv_backlog - p_asset_balance.reval_reserve;
461 ELSE
462 p_asset_balance.reval_reserve := 0;
463 p_asset_balance.Operating_acct := p_asset_balance.adjusted_cost - l_Operating_Acct_backlog;
464 p_asset_balance.General_Fund := 0 - l_Reval_Rsv_backlog - p_asset_balance.reval_reserve;
465 END IF;
466
467 RETURN TRUE;
468 EXCEPTION
469 WHEN OTHERS THEN
470 igi_iac_debug_pkg.debug_unexpected_msg(p_full_path => l_path_name);
471 RETURN FALSE;
472 END Calculate_New_Balances;
473
474 FUNCTION Do_Expensed_Adj
475 (p_asset_iac_adj_info igi_iac_types.iac_adj_hist_asset_info,
476 P_asset_iac_dist_info igi_iac_types.iac_adj_dist_info_tab,
477 p_adj_hist igi_iac_adjustments_history%ROWTYPE,
478 p_event_id number) --R12 uptake
479 RETURN BOOLEAN
480 IS
481
482 CURSOR c_get_asset_balance (p_asset_id igi_iac_asset_balances.asset_id%TYPE,
483 P_book_type_code igi_iac_asset_balances.book_type_code%TYPE
484 ) IS
485 SELECT *
486 FROM igi_iac_asset_balances
487 WHERE asset_id = p_asset_id
488 AND book_type_code = p_book_type_code
489 AND period_counter = (SELECT MAX(period_counter)
490 FROM igi_iac_asset_balances
491 WHERE asset_id = p_asset_id
492 AND book_type_code = p_book_type_code);
493
494 /* Cursor to get balance information for each distribution of asset */
495 CURSOR c_get_inactive_det_balances(p_asset_id igi_iac_det_balances.asset_id%TYPE,
496 P_book_type_code igi_iac_asset_balances.book_type_code%TYPE,
497 p_prev_adjustment_id igi_iac_det_balances.adjustment_id%TYPE) IS
498 SELECT *
499 FROM igi_iac_det_balances
500 WHERE asset_id = p_asset_id
501 AND book_type_code = p_book_type_code
502 AND adjustment_id = p_prev_adjustment_id
503 AND NVL(active_flag,'Y') = 'N' ;
504
505 CURSOR C_get_iac_fa_deprn(P_book_type_code igi_iac_asset_balances.book_type_code%TYPE,
506 p_asset_id igi_iac_det_balances.asset_id%TYPE ,
507 P_distribution_id igi_iac_det_balances.distribution_id%TYPE
508 , p_prev_adjustment_id igi_iac_det_balances.adjustment_id%TYPE) IS
509
510 SELECT *
511 FROM igi_iac_fa_deprn
512 WHERE book_type_code =P_book_type_code
513 AND asset_id =p_asset_id
514 AND adjustment_id =p_prev_adjustment_id
515 AND distribution_id = P_distribution_id;
516
517 /* Cursor to get total units assigned for the Asset from FA */
518 CURSOR c_get_fa_asset(p_asset_id fa_additions.asset_id%TYPE) IS
519 SELECT asset_category_id,current_units
520 FROM fa_additions
521 WHERE asset_id = p_asset_id;
522
523 CURSOR c_get_active_det_balances (cp_book_type_code in varchar2
524 , cp_asset_id in number
525 , cp_adjustment_id in number
526 ) is
527 SELECT fdh.units_assigned,
528 idb.*
529 FROM fa_distribution_history fdh,
530 igi_iac_det_balances idb
531 WHERE fdh.book_type_code = cp_book_type_code
532 AND fdh.asset_id = cp_asset_id
533 AND fdh.date_ineffective IS NULL
534 AND idb.book_type_code = cp_book_type_code
535 AND idb.asset_id = cp_asset_id
536 AND idb.distribution_id = fdh.distribution_id
537 AND idb.adjustment_id = cp_adjustment_id;
538
539 l_prev_asset_balance igi_iac_asset_balances%ROWTYPE;
540 l_asset_balance_mvmt igi_iac_asset_balances%ROWTYPE;
541 l_curr_asset_balance igi_iac_asset_balances%ROWTYPE;
542 l_det_balances igi_iac_det_balances%ROWTYPE;
543 l_get_iac_fa_deprn C_get_iac_fa_deprn%ROWTYPE;
544 l_adjustment_id igi_iac_adjustments.adjustment_id%TYPE;
545 l_adjustment_id_out igi_iac_adjustments.adjustment_id%TYPE;
546 l_prev_adjustment_id igi_iac_adjustments.adjustment_id%TYPE;
547 l_category_id fa_additions.asset_category_id%TYPE;
548 l_asset_units fa_additions.current_units%TYPE;
549 l_distribution_units fa_distribution_history.units_assigned%TYPE;
550 l_Transaction_Type_Code igi_iac_transaction_headers.transaction_type_code%TYPE;
551 l_Transaction_Id igi_iac_transaction_headers.transaction_header_id%TYPE;
552 l_Mass_Reference_ID igi_iac_transaction_headers.mass_reference_id%TYPE;
553 l_Adjustment_Status igi_iac_transaction_headers.adjustment_status%TYPE;
554 l_backlog Number;
555 l_rowid ROWID;
556 l_sob_id number;
557 l_coa_id number;
558 l_currency varchar2(30);
559 l_precision number;
560 l_revl_rsv_ccid gl_code_combinations.code_combination_id%TYPE;
561 l_blog_rsv_ccid gl_code_combinations.code_combination_id%TYPE;
562 l_op_exp_ccid gl_code_combinations.code_combination_id%TYPE;
563 l_gen_fund_ccid gl_code_combinations.code_combination_id%TYPE;
564 l_asset_cost_ccid gl_code_combinations.code_combination_id%TYPE;
565 l_deprn_rsv_ccid gl_code_combinations.code_combination_id%TYPE;
566 l_deprn_exp_ccid gl_code_combinations.code_combination_id%TYPE;
567 l_asset_iac_adj_info igi_iac_types.Iac_adj_hist_asset_info;
568 l_iac_inactive_dists_ytd NUMBER ;
569 l_iac_current_ytd NUMBER ;
570 l_iac_active_dists_ytd NUMBER ;
571 l_fa_inactive_dists_ytd NUMBER ;
572 l_fa_current_ytd NUMBER ;
573 l_fa_active_dists_ytd NUMBER ;
574 l_total_dist_units NUMBER ;
575 l_dist_prorate_factor NUMBER;
576 l_total_db IGI_IAC_TYPES.iac_det_balances;
577 l_remaining_db IGI_IAC_TYPES.iac_det_balances;
578 l_current_db IGI_IAC_TYPES.iac_det_balances;
579 l_operatg_cost NUMBER ;
580 l_operatg_net NUMBER ;
581 l_operatg_blog NUMBER ;
582 l_reserve_blog NUMBER ;
583 l_deprn_blog NUMBER ;
584 l_reserve_cost NUMBER ;
585 l_operatg_ytd NUMBER ;
586 l_total_db_fa igi_iac_fa_deprn%ROWTYPE;
587 l_remaining_db_fa igi_iac_fa_deprn%ROWTYPE;
588 l_current_db_fa igi_iac_fa_deprn%ROWTYPE;
589 l_ytd_prorate_dists_tab igi_iac_types.prorate_dists_tab;
590 l_ytd_prorate_dists_idx binary_integer;
591 l_path_name VARCHAR2(150);
592 l_dist_ytd_factor NUMBER;
593 idx_YTD BINARY_INTEGER;
594
595
596 BEGIN -- do expensed adj
597 l_Transaction_Type_Code := NULL;
598 l_Transaction_Id := NULL;
599 l_Mass_Reference_ID := NULL;
600 l_Adjustment_Status := NULL;
601
602 l_iac_inactive_dists_ytd := 0;
603 l_iac_current_ytd := 0;
604 l_iac_active_dists_ytd := 0;
605 l_fa_inactive_dists_ytd := 0;
606 l_fa_current_ytd := 0;
607 l_fa_active_dists_ytd := 0;
608 l_total_dist_units := 0;
609 l_operatg_cost := 0;
610 l_operatg_net := 0;
611 l_operatg_blog := 0;
612 l_reserve_blog := 0;
613 l_deprn_blog := 0;
614 l_reserve_cost := 0;
615 l_operatg_ytd := 0;
616 l_path_name := g_path||'do_expensed_adj';
617
618 debug_adj_asset( p_asset_iac_adj_info);
619
620 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
621 p_full_path => l_path_name,
622 p_string => ' IN Process adjustments');
623 l_Transaction_Type_Code := NULL;
624 l_Transaction_Id := NULL;
625 l_Mass_Reference_ID := NULL;
626 l_adjustment_id_out := NULL;
627 l_prev_adjustment_id := NULL;
628 l_Adjustment_Status := NULL;
629
630 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
631 p_full_path => l_path_name,
632 p_string => ' Get previous adjustment');
633 IF NOT igi_iac_common_utils.Get_Latest_Transaction (
634 X_book_type_code => p_asset_iac_adj_info.book_type_code,
635 X_asset_id => p_asset_iac_adj_info.asset_id,
636 X_Transaction_Type_Code => l_Transaction_Type_Code,
637 X_Transaction_Id => l_Transaction_Id,
638 X_Mass_Reference_ID => l_Mass_Reference_ID,
639 X_Adjustment_Id => l_adjustment_id_out,
640 X_Prev_Adjustment_Id => l_prev_adjustment_id,
641 X_Adjustment_Status => l_Adjustment_Status) THEN
642 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
643 p_full_path => l_path_name,
644 p_string => '*** Error in fetching the latest transaction');
645 RETURN FALSE;
646 END IF;
647 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
648 p_full_path => l_path_name,
649 p_string => ' previous adjustment..is '||l_prev_adjustment_id);
650 l_adjustment_id := NULL;
651 l_rowid := NULL;
652
653 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
654 p_full_path => l_path_name,
655 p_string => ' Create a new adjustment');
656 igi_iac_trans_headers_pkg.insert_row(
657 X_rowid => l_rowid ,
658 X_adjustment_id => l_adjustment_id ,
659 X_transaction_header_id => P_adj_hist.transaction_header_id_in,
660 X_adjustment_id_out => NULL ,
661 X_transaction_type_code => 'DEPRECIATION' ,
662 X_transaction_date_entered => SYSDATE ,
663 X_mass_refrence_id => NULL ,
664 X_transaction_sub_type => 'ADJUSTMENT',
665 X_book_type_code => p_asset_iac_adj_info.book_type_code,
666 X_asset_id => p_asset_iac_adj_info.asset_id,
667 X_category_id => P_adj_hist.category_id, -- p_asset_iac_adj_info.category_id ,
668 X_adj_deprn_start_date => NULL, --p_asset_iac_adj_info.last_period_counter ,
669 X_revaluation_type_flag => NULL,
670 X_adjustment_status => 'COMPLETE' ,
671 X_period_counter => p_adj_hist.period_counter,
672 X_event_id => p_event_id ) ;
673
674 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
675 p_full_path => l_path_name,
676 p_string => ' New adjustment id :'||TO_CHAR(l_adjustment_id));
677
678 -- get the IAC asset balance record;
679 OPEN c_get_asset_balance(p_asset_iac_adj_info.asset_id,
680 p_asset_iac_adj_info.book_type_code);
681 FETCH c_get_asset_balance INTO l_prev_asset_balance;
682 CLOSE c_get_asset_balance;
683
684 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
685 p_full_path => l_path_name,
686 p_string => ' Asset_id:'||l_prev_asset_balance.asset_id);
687 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
688 p_full_path => l_path_name,
689 p_string => ' Period_counter :'||l_prev_asset_balance.period_counter);
690 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
691 p_full_path => l_path_name,
692 p_string => ' Net book value :'||TO_CHAR(l_prev_asset_balance.net_book_value));
693 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
694 p_full_path => l_path_name,
695 p_string => ' Adjusted Cost :'||TO_CHAR(l_prev_asset_balance.adjusted_cost));
696 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
697 p_full_path => l_path_name,
698 p_string => ' Operating Account :'||TO_CHAR(l_prev_asset_balance.operating_acct));
699 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
700 p_full_path => l_path_name,
701 p_string => ' Reval Reserve :'||TO_CHAR(l_prev_asset_balance.reval_reserve));
702 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
703 p_full_path => l_path_name,
704 p_string => ' Deprn Amount :'||TO_CHAR(l_prev_asset_balance.deprn_amount));
705 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
706 p_full_path => l_path_name,
707 p_string => ' Deprn Reserve :'||TO_CHAR(l_prev_asset_balance.deprn_reserve));
708 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
709 p_full_path => l_path_name,
710 p_string => ' Backlog Deprn Reserve :'||TO_CHAR(l_prev_asset_balance.backlog_deprn_reserve));
711 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
712 p_full_path => l_path_name,
713 p_string => ' General Fund :'||TO_CHAR(l_prev_asset_balance.general_fund));
714 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
715 p_full_path => l_path_name,
716 p_string => ' Current Reval Factor :'||TO_CHAR(l_prev_asset_balance.current_reval_factor));
717 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
718 p_full_path => l_path_name,
719 p_string => ' Cumulative Reval Factor :'||TO_CHAR(l_prev_asset_balance.Cumulative_reval_factor));
720
721 -- get the movement of the adjustment amount ;
722 l_curr_asset_balance := l_prev_asset_balance;
723 l_asset_iac_adj_info := p_asset_iac_adj_info;
724
725 IF NOT Calculate_New_Balances( l_asset_iac_adj_info,
726 l_curr_asset_balance,
727 p_adj_hist)THEN
728 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
729 p_full_path => l_path_name,
730 p_string => ' Error in backlog calculation');
731 RETURN FALSE;
732 END IF;
733
734 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
735 p_full_path => l_path_name,
736 p_string => ' Asset: after new calucation ');
737 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
738 p_full_path => l_path_name,
739 p_string => ' Asset_id:'||l_curr_asset_balance.asset_id);
740 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
741 p_full_path => l_path_name,
742 p_string => ' Period_counter :'||l_curr_asset_balance.period_counter);
743 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
744 p_full_path => l_path_name,
745 p_string => ' Net book value :'||TO_CHAR(l_curr_asset_balance.net_book_value));
746 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
747 p_full_path => l_path_name,
748 p_string => ' Adjusted Cost :'||TO_CHAR(l_curr_asset_balance.adjusted_cost));
749 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
750 p_full_path => l_path_name,
751 p_string => ' Operating Account :'||TO_CHAR(l_curr_asset_balance.operating_acct));
752 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
753 p_full_path => l_path_name,
754 p_string => ' Reval Reserve :'||TO_CHAR(l_curr_asset_balance.reval_reserve));
755 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
756 p_full_path => l_path_name,
757 p_string => ' Deprn Amount :'||TO_CHAR(l_curr_asset_balance.deprn_amount));
758 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
759 p_full_path => l_path_name,
760 p_string => ' Deprn Reserve :'||TO_CHAR(l_curr_asset_balance.deprn_reserve));
761 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
762 p_full_path => l_path_name,
763 p_string => ' Backlog Deprn Reserve :'||TO_CHAR(l_curr_asset_balance.backlog_deprn_reserve));
764 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
765 p_full_path => l_path_name,
766 p_string => ' General Fund :'||TO_CHAR(l_curr_asset_balance.general_fund));
767 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
768 p_full_path => l_path_name,
769 p_string => ' Current Reval Factor :'||TO_CHAR(l_curr_asset_balance.current_reval_factor));
770 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
771 p_full_path => l_path_name,
772 p_string => ' Cumulative Reval Factor :'||TO_CHAR(l_curr_asset_balance.Cumulative_reval_factor));
773 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
774 p_full_path => l_path_name,
775 p_string => ' IAC deprn resrevre..... amount '||P_asset_iac_adj_info.deprn_reserve);
776
777 IF (p_adj_hist.period_counter > l_asset_iac_adj_info.last_period_counter) THEN
778 l_curr_asset_balance.deprn_amount := 0;
779 ELSE
780 l_curr_asset_balance.deprn_amount := l_asset_iac_adj_info.deprn_amount * (l_curr_asset_balance.Cumulative_reval_factor-1);
781 do_round(l_curr_asset_balance.deprn_amount,p_asset_iac_adj_info.book_type_code);
782 IF NOT (igi_iac_common_utils.iac_round(l_curr_asset_balance.deprn_amount,l_curr_asset_balance.book_type_code)) THEN
783 RETURN FALSE;
784 END IF;
785 END IF;
786 l_iac_current_ytd := l_asset_iac_adj_info.ytd_deprn * (l_curr_asset_balance.Cumulative_reval_factor-1);
787 do_round(l_iac_current_ytd,p_asset_iac_adj_info.book_type_code);
788 IF NOT (igi_iac_common_utils.iac_round(l_iac_current_ytd,l_curr_asset_balance.book_type_code)) THEN
789 RETURN FALSE;
790 END IF;
791 l_fa_current_ytd := l_asset_iac_adj_info.ytd_deprn;
792 IF NOT (igi_iac_common_utils.iac_round(l_fa_current_ytd,l_curr_asset_balance.book_type_code)) THEN
793 RETURN FALSE;
794 END IF;
795
796 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
797 p_full_path => l_path_name,
798 p_string => ' Asset: after new calucation ');
799 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
800 p_full_path => l_path_name,
801 p_string => ' Asset_id:'||l_curr_asset_balance.asset_id);
802 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
803 p_full_path => l_path_name,
804 p_string => ' Period_counter :'||l_curr_asset_balance.period_counter);
805 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
806 p_full_path => l_path_name,
807 p_string => ' Net book value :'||TO_CHAR(l_curr_asset_balance.net_book_value));
808 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
809 p_full_path => l_path_name,
810 p_string => ' Adjusted Cost :'||TO_CHAR(l_curr_asset_balance.adjusted_cost));
811 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
812 p_full_path => l_path_name,
813 p_string => ' Operating Account :'||TO_CHAR(l_curr_asset_balance.operating_acct));
814 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
815 p_full_path => l_path_name,
816 p_string => ' Reval Reserve :'||TO_CHAR(l_curr_asset_balance.reval_reserve));
817 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
818 p_full_path => l_path_name,
819 p_string => ' Deprn Amount :'||TO_CHAR(l_curr_asset_balance.deprn_amount));
820 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
821 p_full_path => l_path_name,
822 p_string => ' Deprn Reserve :'||TO_CHAR(l_curr_asset_balance.deprn_reserve));
823 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
824 p_full_path => l_path_name,
825 p_string => ' Backlog Deprn Reserve :'||TO_CHAR(l_curr_asset_balance.backlog_deprn_reserve));
826 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
827 p_full_path => l_path_name,
828 p_string => ' General Fund :'||TO_CHAR(l_curr_asset_balance.general_fund));
829 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
830 p_full_path => l_path_name,
831 p_string => ' Current Reval Factor :'||TO_CHAR(l_curr_asset_balance.current_reval_factor));
832 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
833 p_full_path => l_path_name,
834 p_string => ' Cumulative Reval Factor :'||TO_CHAR(l_curr_asset_balance.Cumulative_reval_factor));
835
836 l_asset_balance_mvmt.asset_id := l_curr_asset_balance.asset_id;
837 l_asset_balance_mvmt.book_type_code := l_curr_asset_balance.book_type_code;
838 l_asset_balance_mvmt.period_counter := p_adj_hist.period_counter;
839 l_asset_balance_mvmt.net_book_value := l_curr_asset_balance.net_book_value - l_prev_asset_balance.net_book_value;
840 l_asset_balance_mvmt.adjusted_cost := l_curr_asset_balance.adjusted_cost - l_prev_asset_balance.adjusted_cost;
841 l_asset_balance_mvmt.operating_acct := l_curr_asset_balance.operating_acct - l_prev_asset_balance.operating_acct;
842 l_asset_balance_mvmt.reval_reserve := l_curr_asset_balance.reval_reserve - l_prev_asset_balance.reval_reserve;
843 l_asset_balance_mvmt.deprn_amount := l_curr_asset_balance.deprn_amount;
844 l_asset_balance_mvmt.deprn_reserve := l_curr_asset_balance.deprn_reserve - l_prev_asset_balance.deprn_reserve;
845 l_asset_balance_mvmt.backlog_deprn_reserve := l_curr_asset_balance.backlog_deprn_reserve - l_prev_asset_balance.backlog_deprn_reserve;
846 l_asset_balance_mvmt.General_Fund := l_curr_asset_balance.General_Fund - l_prev_asset_balance.General_Fund;
847
848 OPEN c_get_fa_asset(l_curr_asset_balance.asset_id);
849 FETCH c_get_fa_asset INTO l_category_id,l_asset_units;
850 CLOSE c_get_fa_asset;
851 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
852 p_full_path => l_path_name,
853 p_string => ' Units assigned for the asset :'||TO_CHAR(l_asset_units));
854
855 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
856 p_full_path => l_path_name,
857 p_string => ' Processing incative distributions ');
858 FOR l_det_balances IN c_get_inactive_det_balances(l_asset_balance_mvmt.asset_id,
859 l_asset_balance_mvmt.book_type_code,
860 l_prev_adjustment_id )
861 LOOP
862 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
863 p_full_path => l_path_name,
864 p_string => ' Inactive distribution' || l_det_balances.distribution_id);
865 l_rowid := NULL;
866 IGI_IAC_DET_BALANCES_PKG.insert_row (
867 x_rowid => l_rowid,
868 x_adjustment_id => l_adjustment_id,
869 x_asset_id => l_det_balances.asset_id,
870 x_distribution_id => l_det_balances.distribution_id,
871 x_book_type_code => l_det_balances.book_type_code,
872 x_period_counter => l_asset_balance_mvmt.period_counter,
873 x_adjustment_cost => l_det_balances.adjustment_cost,
874 x_net_book_value => l_det_balances.net_book_value,
875 x_reval_reserve_cost => l_det_balances.reval_reserve_cost,
876 x_reval_reserve_backlog => l_det_balances.reval_reserve_backlog,
877 x_reval_reserve_gen_fund => l_det_balances.reval_reserve_gen_fund,
878 x_reval_reserve_net => l_det_balances.reval_reserve_net,
879 x_operating_acct_cost => l_det_balances.operating_acct_cost,
880 x_operating_acct_backlog => l_det_balances.operating_acct_backlog,
881 x_operating_acct_net => l_det_balances.operating_acct_net,
882 x_operating_acct_ytd => l_det_balances.operating_acct_ytd,
883 x_deprn_period => l_det_balances.deprn_period,
884 x_deprn_ytd => l_det_balances.deprn_ytd,
885 x_deprn_reserve => l_det_balances.deprn_reserve,
886 x_deprn_reserve_backlog => l_det_balances.deprn_reserve_backlog,
887 x_general_fund_per => l_det_balances.general_fund_per,
888 x_general_fund_acc => l_det_balances.general_fund_acc,
889 x_last_reval_date => l_det_balances.last_reval_date,
890 x_current_reval_factor => l_det_balances.current_reval_factor,
891 x_cumulative_reval_factor => l_det_balances.cumulative_reval_factor,
892 x_active_flag => l_det_balances.active_flag,
893 x_mode => 'R' );
894 l_iac_inactive_dists_ytd := l_iac_inactive_dists_ytd + l_det_balances.deprn_ytd;
895
896 OPEN C_get_iac_fa_deprn(l_det_balances.book_type_code,
897 l_det_balances.asset_id,
898 l_det_balances.distribution_id,
899 l_prev_adjustment_id
900 );
901 FETCH c_get_iac_fa_deprn INTO l_get_iac_fa_deprn;
902 IF C_get_iac_fa_deprn%FOUND THEN
903 l_rowid := NULL;
904 igi_iac_fa_deprn_pkg.insert_row(
905 x_rowid => l_rowid,
906 x_book_type_code => l_det_balances.book_type_code,
907 x_asset_id => l_det_balances.asset_id,
908 x_distribution_id => l_det_balances.distribution_id,
909 x_period_counter => l_asset_balance_mvmt.period_counter,
910 x_adjustment_id => l_adjustment_id,
911 x_deprn_period => l_get_iac_fa_deprn.deprn_period,
912 x_deprn_ytd => l_get_iac_fa_deprn.deprn_ytd ,
913 x_deprn_reserve => l_get_iac_fa_deprn.deprn_reserve,
914 x_active_flag => l_get_iac_fa_deprn.active_flag,
915 x_mode => 'R');
916 END IF;
917 CLOSE c_get_iac_fa_deprn;
918 l_fa_inactive_dists_ytd := l_fa_inactive_dists_ytd + l_get_iac_fa_deprn.deprn_ytd;
919 END LOOP;
920
921 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
922 p_full_path => l_path_name,
923 p_string => ' End of Processing incative distributions ');
924 l_iac_active_dists_ytd := l_iac_current_ytd - l_iac_inactive_dists_ytd;
925 l_fa_active_dists_ytd := l_fa_current_ytd - l_fa_inactive_dists_ytd;
926
927 if l_curr_asset_balance.adjusted_cost >= 0 then
928 l_operatg_cost := 0;
929 l_operatg_net := l_asset_balance_mvmt.Operating_Acct;
930 l_operatg_blog := l_operatg_cost - l_operatg_net;
931
932 l_reserve_blog := l_asset_balance_mvmt.backlog_deprn_reserve + l_asset_balance_mvmt.Operating_acct;
933 l_deprn_blog := l_asset_balance_mvmt.backlog_deprn_reserve;
934 l_reserve_cost := l_asset_balance_mvmt.adjusted_cost;
935 else
936 l_operatg_net := l_asset_balance_mvmt.operating_acct;
937 l_operatg_blog := l_asset_balance_mvmt.backlog_deprn_reserve + l_asset_balance_mvmt.General_Fund;
938 l_operatg_cost := l_asset_balance_mvmt.adjusted_cost;
939 l_deprn_blog := l_asset_balance_mvmt.backlog_deprn_reserve;
940
941 l_reserve_cost := 0;
942 l_reserve_blog := l_reserve_cost - l_asset_balance_mvmt.General_Fund;
943 end if;
944
945 IF p_asset_iac_adj_info.period_counter_fully_reserved IS NOT NULL THEN
946 l_asset_balance_mvmt.deprn_amount := 0;
947 l_asset_iac_adj_info.deprn_amount := 0;
948 l_curr_asset_balance.deprn_amount := 0;
949 END IF;
950
951 l_total_db.adjustment_id := l_adjustment_id;
952 l_total_db.asset_id := l_asset_balance_mvmt.asset_id;
953 l_total_db.distribution_id := -1;
954 l_total_db.book_type_code := l_asset_balance_mvmt.book_type_code;
955 l_total_db.period_counter := l_asset_balance_mvmt.period_counter;
956 l_total_db.adjustment_cost := l_asset_balance_mvmt.adjusted_cost;
957 l_total_db.reval_reserve_cost := l_reserve_cost;
958 l_total_db.reval_reserve_backlog := l_reserve_blog;
959 l_total_db.reval_reserve_gen_fund := l_asset_balance_mvmt.general_fund;
960 l_total_db.reval_reserve_net := l_asset_balance_mvmt.reval_reserve;
961 l_total_db.operating_acct_cost := l_operatg_cost ;
962 l_total_db.operating_acct_backlog := l_operatg_blog;
963 l_total_db.operating_acct_net := l_operatg_net;
964 l_total_db.operating_acct_ytd := l_operatg_ytd;
965 l_total_db.deprn_period := l_asset_balance_mvmt.deprn_amount;
966 l_total_db.deprn_ytd := l_iac_active_dists_ytd;
967
968 l_total_db.deprn_reserve := l_asset_balance_mvmt.deprn_reserve;
969 l_total_db.deprn_reserve_backlog := l_deprn_blog;
970
971 l_total_db.general_fund_per := l_asset_balance_mvmt.deprn_amount;
972 l_total_db.general_fund_acc := l_asset_balance_mvmt.general_fund;
973 l_total_db.last_reval_date := sysdate;
974 l_total_db.current_reval_factor := l_asset_balance_mvmt.current_reval_factor;
975 l_total_db.cumulative_reval_factor := l_asset_balance_mvmt.cumulative_reval_factor;
976 l_total_db.net_book_value := l_total_db.adjustment_cost - l_total_db.deprn_reserve -
977 l_total_db.deprn_reserve_backlog;
978 l_total_db.active_flag := NULL;
979
980 l_total_db_fa.deprn_period := l_asset_iac_adj_info.deprn_amount;
981 l_total_db_fa.deprn_ytd := l_fa_active_dists_ytd;
982 l_total_db_fa.deprn_reserve := l_asset_iac_adj_info.deprn_reserve;
983 l_remaining_db := l_total_db;
984 l_remaining_db_fa := l_total_db_fa;
985
986 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
987 p_full_path => l_path_name,
988 p_string => ' +acctg creation get gl information');
989 IF NOT IGI_IAC_COMMON_UTILS.GET_BOOK_GL_INFO
990 ( X_BOOK_TYPE_CODE => l_asset_balance_mvmt.book_type_code
991 , SET_OF_BOOKS_ID => l_sob_id
992 , CHART_OF_ACCOUNTS_ID => l_coa_id
993 , CURRENCY => l_currency
994 , PRECISION => l_precision
995 )
996 THEN
997 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
998 p_full_path => l_path_name,
999 p_string => ' +acctg creation unable to get gl info');
1000 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1001 p_full_path => l_path_name,
1002 p_string => ' end create_iac_acctg');
1003 RETURN FALSE;
1004 END IF;
1005
1006 IF NOT igi_iac_reval_utilities.prorate_active_dists_YTD ( fp_asset_id => l_asset_balance_mvmt.asset_id
1007 , fp_book_type_code => l_asset_balance_mvmt.book_type_code
1008 , fp_current_period_counter => l_asset_balance_mvmt.period_counter
1009 , fp_prorate_dists_tab => l_ytd_prorate_dists_tab
1010 , fp_prorate_dists_idx => l_ytd_prorate_dists_idx
1011 ) THEN
1012 RETURN FALSE;
1013 END IF;
1014
1015 FOR l_det_balances IN c_get_active_det_balances(l_asset_balance_mvmt.book_type_code,l_asset_balance_mvmt.asset_id,l_prev_adjustment_id)
1016 LOOP
1017 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1018 p_full_path => l_path_name,
1019 p_string => ' +DET BALANCES');
1020 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1021 p_full_path => l_path_name,
1022 p_string => ' x_adjustment_id => '|| l_det_balances.adjustment_id);
1023 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1024 p_full_path => l_path_name,
1025 p_string => ' x_asset_id =>'|| l_det_balances.asset_id);
1026 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1027 p_full_path => l_path_name,
1028 p_string => ' x_distribution_id => '||l_det_balances.distribution_id);
1029 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1030 p_full_path => l_path_name,
1031 p_string => ' x_book_type_code => '||l_det_balances.book_type_code);
1032 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1033 p_full_path => l_path_name,
1034 p_string => ' x_period_counter => '||l_det_balances.period_counter);
1035 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1036 p_full_path => l_path_name,
1037 p_string => ' x_adjustment_cost => '||l_det_balances.adjustment_cost);
1038 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1039 p_full_path => l_path_name,
1040 p_string => ' x_net_book_value => '||l_det_balances.net_book_value);
1041 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1042 p_full_path => l_path_name,
1043 p_string => ' x_reval_reserve_cost => '||l_det_balances.reval_reserve_cost);
1044 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1045 p_full_path => l_path_name,
1046 p_string => ' x_reval_reserve_backlog => '||l_det_balances.reval_reserve_backlog);
1047 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1048 p_full_path => l_path_name,
1049 p_string => ' x_reval_reserve_gen_fund => '||l_det_balances.reval_reserve_gen_fund);
1050 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1051 p_full_path => l_path_name,
1052 p_string => ' x_reval_reserve_net => '||l_det_balances.reval_reserve_net);
1053 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1054 p_full_path => l_path_name,
1055 p_string => ' x_operating_acct_cost => '||l_det_balances.operating_acct_cost);
1056 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1057 p_full_path => l_path_name,
1058 p_string => ' x_operating_acct_backlog => '||l_det_balances.operating_acct_backlog);
1059 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1060 p_full_path => l_path_name,
1061 p_string => ' x_operating_acct_net => '||l_det_balances.operating_acct_net);
1062 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1063 p_full_path => l_path_name,
1064 p_string => ' x_operating_acct_ytd => '||l_det_balances.operating_acct_ytd);
1065 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1066 p_full_path => l_path_name,
1067 p_string => ' x_deprn_period => '||l_det_balances.deprn_period);
1068 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1069 p_full_path => l_path_name,
1070 p_string => ' x_deprn_ytd => '||l_det_balances.deprn_ytd);
1071 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1072 p_full_path => l_path_name,
1073 p_string => ' x_deprn_reserve => '||l_det_balances.deprn_reserve);
1074 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1075 p_full_path => l_path_name,
1076 p_string => ' x_deprn_reserve_backlog => '||l_det_balances.deprn_reserve_backlog);
1077 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1078 p_full_path => l_path_name,
1079 p_string => ' x_general_fund_per => '||l_det_balances.general_fund_per);
1080 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1081 p_full_path => l_path_name,
1082 p_string => ' x_general_fund_acc => '||l_det_balances.general_fund_acc);
1083 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1084 p_full_path => l_path_name,
1085 p_string => ' x_last_reval_date => '||l_det_balances.last_reval_date);
1086 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1087 p_full_path => l_path_name,
1088 p_string => ' x_current_reval_factor => '||l_det_balances.current_reval_factor);
1089 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1090 p_full_path => l_path_name,
1091 p_string => ' x_cumulative_reval_factor => '||l_det_balances.cumulative_reval_factor);
1092 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1093 p_full_path => l_path_name,
1094 p_string => ' x_active_flag => '||l_det_balances.active_flag);
1095
1096 l_total_dist_units := l_total_dist_units + l_det_balances.units_assigned;
1097 l_dist_prorate_factor := l_det_balances.units_assigned / l_asset_units;
1098
1099 l_dist_ytd_factor := 0;
1100 idx_YTD := l_YTD_prorate_dists_tab.FIRST;
1101 WHILE idx_YTD <= l_YTD_prorate_dists_tab.LAST LOOP
1102 IF l_YTD_prorate_dists_tab(idx_YTD).distribution_id = l_det_balances.distribution_id THEN
1103 l_dist_ytd_factor := l_YTD_prorate_dists_tab(idx_YTD).ytd_prorate_factor;
1104 EXIT;
1105 END IF;
1106 idx_ytd := l_YTD_prorate_dists_tab.Next(idx_ytd);
1107 END LOOP;
1108
1109 IF l_curr_asset_balance.adjusted_cost >= 0 THEN
1110 l_reserve_cost := l_dist_prorate_factor * l_total_db.adjustment_cost;
1111 do_round(l_reserve_cost,l_det_balances.book_type_code);
1112 l_reserve_blog := l_dist_prorate_factor * l_total_db.reval_reserve_backlog;
1113 do_round(l_reserve_blog,l_det_balances.book_type_code);
1114 l_operatg_cost := 0;
1115 l_operatg_blog := l_dist_prorate_factor * l_total_db.operating_acct_backlog;
1116 do_round(l_operatg_blog,l_det_balances.book_type_code);
1117 l_operatg_net := l_operatg_cost - l_operatg_blog;
1118 l_deprn_blog := l_dist_prorate_factor * l_total_db.deprn_reserve_backlog;
1119 do_round(l_deprn_blog,l_det_balances.book_type_code);
1120 ELSE
1121 l_operatg_blog := l_dist_prorate_factor * l_total_db.operating_acct_backlog;
1122 do_round(l_operatg_blog,l_det_balances.book_type_code);
1123 l_operatg_cost := l_dist_prorate_factor * l_total_db.operating_acct_cost;
1124 do_round(l_operatg_cost,l_det_balances.book_type_code);
1125 l_operatg_net := l_operatg_cost - l_operatg_blog;
1126 l_reserve_cost := 0;
1127 l_reserve_blog := l_dist_prorate_factor * l_total_db.reval_reserve_backlog;
1128 do_round(l_reserve_blog,l_det_balances.book_type_code);
1129 l_deprn_blog := l_dist_prorate_factor * l_total_db.deprn_reserve_backlog;
1130 do_round(l_deprn_blog,l_det_balances.book_type_code);
1131 END IF;
1132
1133 IF (l_total_dist_units < l_asset_units) THEN
1134 l_current_db.adjustment_id := l_adjustment_id;
1135 l_current_db.asset_id := l_det_balances.asset_id;
1136 l_current_db.distribution_id := l_det_balances.distribution_id;
1137 l_current_db.book_type_code := l_det_balances.book_type_code;
1138 l_current_db.period_counter := l_asset_balance_mvmt.period_counter;
1139 l_current_db.adjustment_cost := l_dist_prorate_factor * l_total_db.adjustment_cost;
1140 do_round(l_current_db.adjustment_cost,l_det_balances.book_type_code);
1141 l_current_db.net_book_value := l_dist_prorate_factor * l_total_db.net_book_value;
1142 do_round(l_current_db.net_book_value,l_det_balances.book_type_code);
1143 l_current_db.reval_reserve_cost := l_reserve_cost;
1144 l_current_db.reval_reserve_backlog := l_reserve_blog;
1145 l_current_db.reval_reserve_gen_fund := l_dist_prorate_factor * l_total_db.reval_reserve_gen_fund;
1146 do_round(l_current_db.reval_reserve_gen_fund,l_det_balances.book_type_code);
1147 l_current_db.reval_reserve_net := l_dist_prorate_factor * l_total_db.reval_reserve_net;
1148 do_round(l_current_db.reval_reserve_net,l_det_balances.book_type_code);
1149 l_current_db.operating_acct_cost := l_operatg_cost;
1150 l_current_db.operating_acct_backlog := l_operatg_blog;
1151 l_current_db.operating_acct_net := l_operatg_net;
1152 l_current_db.operating_acct_ytd := l_det_balances.operating_acct_ytd + l_operatg_net;
1153 l_current_db.deprn_period := l_dist_prorate_factor * l_total_db.deprn_period;
1154 do_round(l_current_db.deprn_period,l_det_balances.book_type_code);
1155 l_current_db.deprn_ytd := l_dist_ytd_factor * l_total_db.deprn_ytd;
1156 do_round(l_current_db.deprn_ytd,l_det_balances.book_type_code);
1157 l_current_db.deprn_reserve := l_dist_prorate_factor * l_total_db.deprn_reserve;
1158 do_round(l_current_db.deprn_reserve,l_det_balances.book_type_code);
1159 l_current_db.deprn_reserve_backlog := l_deprn_blog;
1160 l_current_db.general_fund_per := l_dist_prorate_factor * l_total_db.general_fund_per;
1161 do_round(l_current_db.general_fund_per,l_det_balances.book_type_code);
1162 l_current_db.general_fund_acc := l_dist_prorate_factor * l_total_db.general_fund_acc;
1163 do_round(l_current_db.general_fund_acc,l_det_balances.book_type_code);
1164 l_current_db.last_reval_date := l_det_balances.last_reval_date;
1165 l_current_db.current_reval_factor := l_det_balances.current_reval_factor;
1166 l_current_db.cumulative_reval_factor := l_det_balances.cumulative_reval_factor;
1167 l_current_db.active_flag := l_det_balances.active_flag;
1168
1169 IF NOT (igi_iac_common_utils.iac_round(l_current_db.adjustment_cost,l_det_balances.book_type_code)) THEN
1170 RETURN FALSE;
1171 END IF;
1172 IF NOT (igi_iac_common_utils.iac_round(l_current_db.net_book_value,l_det_balances.book_type_code)) THEN
1173 RETURN FALSE;
1174 END IF;
1175 IF NOT (igi_iac_common_utils.iac_round(l_current_db.reval_reserve_cost,l_det_balances.book_type_code)) THEN
1176 RETURN FALSE;
1177 END IF;
1178 IF NOT (igi_iac_common_utils.iac_round(l_current_db.reval_reserve_backlog,l_det_balances.book_type_code)) THEN
1179 RETURN FALSE;
1180 END IF;
1181 IF NOT (igi_iac_common_utils.iac_round(l_current_db.reval_reserve_gen_fund,l_det_balances.book_type_code)) THEN
1182 RETURN FALSE;
1183 END IF;
1184 IF NOT (igi_iac_common_utils.iac_round(l_current_db.reval_reserve_net,l_det_balances.book_type_code)) THEN
1185 RETURN FALSE;
1186 END IF;
1187 IF NOT (igi_iac_common_utils.iac_round(l_current_db.operating_acct_cost,l_det_balances.book_type_code)) THEN
1188 RETURN FALSE;
1189 END IF;
1190 IF NOT (igi_iac_common_utils.iac_round(l_current_db.operating_acct_backlog,l_det_balances.book_type_code)) THEN
1191 RETURN FALSE;
1192 END IF;
1193 IF NOT (igi_iac_common_utils.iac_round(l_current_db.operating_acct_net,l_det_balances.book_type_code)) THEN
1194 RETURN FALSE;
1195 END IF;
1196 IF NOT (igi_iac_common_utils.iac_round(l_current_db.operating_acct_ytd,l_det_balances.book_type_code)) THEN
1197 RETURN FALSE;
1198 END IF;
1199 IF NOT (igi_iac_common_utils.iac_round(l_current_db.deprn_period,l_det_balances.book_type_code)) THEN
1200 RETURN FALSE;
1201 END IF;
1202 IF NOT (igi_iac_common_utils.iac_round(l_current_db.deprn_ytd,l_det_balances.book_type_code)) THEN
1203 RETURN FALSE;
1204 END IF;
1205 IF NOT (igi_iac_common_utils.iac_round(l_current_db.deprn_reserve,l_det_balances.book_type_code)) THEN
1206 RETURN FALSE;
1207 END IF;
1208 IF NOT (igi_iac_common_utils.iac_round(l_current_db.deprn_reserve_backlog,l_det_balances.book_type_code)) THEN
1209 RETURN FALSE;
1210 END IF;
1211 IF NOT (igi_iac_common_utils.iac_round(l_current_db.general_fund_per,l_det_balances.book_type_code)) THEN
1212 RETURN FALSE;
1213 END IF;
1214 IF NOT (igi_iac_common_utils.iac_round(l_current_db.general_fund_acc,l_det_balances.book_type_code)) THEN
1215 RETURN FALSE;
1216 END IF;
1217 IF NOT (igi_iac_common_utils.iac_round(l_current_db_fa.deprn_period,l_det_balances.book_type_code)) THEN
1218 RETURN FALSE;
1219 END IF;
1220 IF NOT (igi_iac_common_utils.iac_round(l_current_db_fa.deprn_ytd,l_det_balances.book_type_code)) THEN
1221 RETURN FALSE;
1222 END IF;
1223 IF NOT (igi_iac_common_utils.iac_round(l_current_db_fa.deprn_reserve,l_det_balances.book_type_code)) THEN
1224 RETURN FALSE;
1225 END IF;
1226
1227 l_remaining_db.adjustment_cost := nvl(l_remaining_db.adjustment_cost,0)
1228 - nvl(l_current_db.adjustment_cost,0) ;
1229 l_remaining_db.reval_reserve_cost := nvl(l_remaining_db.reval_reserve_cost,0)
1230 - nvl(l_current_db.reval_reserve_cost,0) ;
1231 l_remaining_db.reval_reserve_backlog := nvl(l_remaining_db.reval_reserve_backlog,0)
1232 - nvl(l_current_db.reval_reserve_backlog,0) ;
1233 l_remaining_db.reval_reserve_gen_fund := nvl(l_remaining_db.reval_reserve_gen_fund,0)
1234 - nvl(l_current_db.reval_reserve_gen_fund,0) ;
1235 l_remaining_db.reval_reserve_net := nvl(l_remaining_db.reval_reserve_cost,0)
1236 - nvl(l_remaining_db.reval_reserve_backlog,0)
1237 - nvl(l_remaining_db.reval_reserve_gen_fund,0) ;
1238 l_remaining_db.operating_acct_cost := nvl(l_remaining_db.operating_acct_cost,0)
1239 - nvl(l_current_db.operating_acct_cost,0) ;
1240 l_remaining_db.operating_acct_backlog := nvl(l_remaining_db.operating_acct_backlog,0)
1241 - nvl(l_current_db.operating_acct_backlog,0) ;
1242 l_remaining_db.operating_acct_net := l_remaining_db.operating_acct_cost
1243 - l_remaining_db.operating_acct_backlog ;
1244 l_remaining_db.operating_acct_ytd := nvl(l_remaining_db.operating_acct_ytd ,0)
1245 - l_current_db.operating_acct_ytd;
1246 l_remaining_db.deprn_period := nvl(l_remaining_db.deprn_period,0)
1247 - nvl(l_current_db.deprn_period,0) ;
1248 l_remaining_db.deprn_ytd := nvl(l_remaining_db.deprn_ytd ,0)
1249 - nvl(l_current_db.deprn_ytd,0) ;
1250 l_remaining_db.deprn_reserve := nvl(l_remaining_db.deprn_reserve ,0)
1251 - nvl(l_current_db.deprn_reserve,0) ;
1252 l_remaining_db.deprn_reserve_backlog := nvl(l_remaining_db.deprn_reserve_backlog ,0)
1253 - nvl(l_current_db.deprn_reserve_backlog,0) ;
1254 l_remaining_db.general_fund_per := nvl(l_remaining_db.general_fund_per ,0)
1255 - nvl(l_current_db.general_fund_per,0) ;
1256 l_remaining_db.general_fund_acc := nvl(l_remaining_db.general_fund_acc ,0)
1257 - nvl(l_current_db.general_fund_acc,0) ;
1258
1259 l_current_db_fa.deprn_period := l_dist_prorate_factor * l_total_db_fa.deprn_period;
1260 do_round(l_current_db.deprn_period,l_det_balances.book_type_code);
1261 l_current_db_fa.deprn_ytd := l_dist_ytd_factor * l_total_db_fa.deprn_ytd;
1262 do_round(l_current_db.deprn_ytd,l_det_balances.book_type_code);
1263 l_current_db_fa.deprn_reserve := l_dist_prorate_factor * l_total_db_fa.deprn_reserve;
1264 do_round(l_current_db.deprn_reserve,l_det_balances.book_type_code);
1265
1266 l_remaining_db_fa.deprn_period := l_remaining_db_fa.deprn_period - l_current_db_fa.deprn_period;
1267 l_remaining_db_fa.deprn_ytd := l_remaining_db_fa.deprn_ytd - l_current_db_fa.deprn_ytd;
1268 l_remaining_db_fa.deprn_reserve := l_remaining_db_fa.deprn_reserve - l_current_db_fa.deprn_reserve;
1269
1270 ELSE
1271 l_current_db.adjustment_id := l_adjustment_id;
1272 l_current_db.asset_id := l_det_balances.asset_id;
1273 l_current_db.distribution_id := l_det_balances.distribution_id;
1274 l_current_db.book_type_code := l_det_balances.book_type_code;
1275 l_current_db.period_counter := l_asset_balance_mvmt.period_counter;
1276 l_current_db.adjustment_cost := l_remaining_db.adjustment_cost;
1277 l_current_db.net_book_value := l_remaining_db.net_book_value;
1278 l_current_db.reval_reserve_cost := l_remaining_db.reval_reserve_cost;
1279 l_current_db.reval_reserve_backlog := l_remaining_db.reval_reserve_backlog;
1280 l_current_db.reval_reserve_gen_fund := l_remaining_db.reval_reserve_gen_fund;
1281 l_current_db.reval_reserve_net := l_remaining_db.reval_reserve_net;
1282 l_current_db.operating_acct_cost := l_remaining_db.operating_acct_cost;
1283 l_current_db.operating_acct_backlog := l_remaining_db.operating_acct_backlog;
1284 l_current_db.operating_acct_net := l_remaining_db.operating_acct_net;
1285 l_current_db.operating_acct_ytd := l_det_balances.operating_acct_ytd + l_current_db.operating_acct_net;
1286 l_current_db.deprn_period := l_remaining_db.deprn_period;
1287 l_current_db.deprn_ytd := l_remaining_db.deprn_ytd;
1288 l_current_db.deprn_reserve := l_remaining_db.deprn_reserve;
1289 l_current_db.deprn_reserve_backlog := l_remaining_db.deprn_reserve_backlog;
1290 l_current_db.general_fund_per := l_remaining_db.general_fund_per;
1291 l_current_db.general_fund_acc := l_remaining_db.general_fund_acc;
1292 l_current_db.last_reval_date := l_det_balances.last_reval_date;
1293 l_current_db.current_reval_factor := l_det_balances.current_reval_factor;
1294 l_current_db.cumulative_reval_factor := l_det_balances.cumulative_reval_factor;
1295 l_current_db.active_flag := l_det_balances.active_flag;
1296
1297 l_current_db_fa.deprn_period := l_remaining_db_fa.deprn_period;
1298 l_current_db_fa.deprn_ytd := l_remaining_db_fa.deprn_ytd;
1299 l_current_db_fa.deprn_reserve := l_remaining_db_fa.deprn_reserve;
1300
1301 IF NOT (igi_iac_common_utils.iac_round(l_current_db_fa.deprn_period,l_det_balances.book_type_code)) THEN
1302 RETURN FALSE;
1303 END IF;
1304
1305 END IF;
1306
1307 -- get the account details for adjustments
1308 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1309 p_full_path => l_path_name,
1310 p_string => ' +acctg creation get all accounts');
1311 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1312 p_full_path => l_path_name,
1313 p_string => ' +distribution id '|| l_det_balances.distribution_id );
1314
1315 IF NOT IGI_IAC_COMMON_UTILS.get_account_ccid
1316 ( X_book_type_code => l_det_balances.book_type_code
1317 , X_asset_id => l_det_balances.asset_id
1318 , X_distribution_id => l_det_balances.distribution_id
1319 , X_account_type => 'REVAL_RESERVE_ACCT'
1320 , account_ccid => l_revl_rsv_ccid
1321 )
1322 THEN
1323 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1324 p_full_path => l_path_name,
1325 p_string => ' Error in fetching reval reserve');
1326 RETURN FALSE;
1327 END IF;
1328
1329 IF NOT IGI_IAC_COMMON_UTILS.get_account_ccid
1330 ( X_book_type_code => l_det_balances.book_type_code
1331 , X_asset_id => l_det_balances.asset_id
1332 , X_distribution_id => l_det_balances.distribution_id
1333 , X_account_type => 'GENERAL_FUND_ACCT'
1334 , account_ccid => l_gen_fund_ccid
1335 )
1336 THEN
1337 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1338 p_full_path => l_path_name,
1339 p_string => ' Error in fetching general fund');
1340 RETURN FALSE;
1341 END IF;
1342
1343 IF NOT IGI_IAC_COMMON_UTILS.get_account_ccid
1344 ( X_book_type_code => l_det_balances.book_type_code
1345 , X_asset_id => l_det_balances.asset_id
1346 , X_distribution_id => l_det_balances.distribution_id
1347 , X_account_type => 'BACKLOG_DEPRN_RSV_ACCT'
1348 , account_ccid => l_blog_rsv_ccid
1349 )
1350 THEN
1351 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1352 p_full_path => l_path_name,
1353 p_string => ' Error in fetching backlog deprn rsv acct');
1354 RETURN FALSE;
1355 END IF;
1356
1357 IF NOT IGI_IAC_COMMON_UTILS.get_account_ccid
1358 ( X_book_type_code => l_det_balances.book_type_code
1359 , X_asset_id => l_det_balances.asset_id
1360 , X_distribution_id => l_det_balances.distribution_id
1361 , X_account_type => 'OPERATING_EXPENSE_ACCT'
1362 , account_ccid => l_op_exp_ccid
1363 )
1364 THEN
1365 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1366 p_full_path => l_path_name,
1367 p_string => ' Error in fetching operating expense acct');
1368 RETURN FALSE;
1369 END IF;
1370
1371 IF NOT IGI_IAC_COMMON_UTILS.get_account_ccid
1372 ( X_book_type_code => l_det_balances.book_type_code
1373 , X_asset_id => l_det_balances.asset_id
1374 , X_distribution_id => l_det_balances.distribution_id
1375 , X_account_type => 'DEPRN_RESERVE_ACCT'
1376 , account_ccid => l_deprn_rsv_ccid
1377 )
1378 THEN
1379 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1380 p_full_path => l_path_name,
1381 p_string => ' Error in fetching deprn reserve');
1382 RETURN FALSE;
1383 END IF;
1384
1385 IF NOT IGI_IAC_COMMON_UTILS.get_account_ccid
1386 ( X_book_type_code => l_det_balances.book_type_code
1387 , X_asset_id => l_det_balances.asset_id
1388 , X_distribution_id => l_det_balances.distribution_id
1389 , X_account_type => 'DEPRN_EXPENSE_ACCT'
1390 , account_ccid => l_deprn_exp_ccid
1391 )
1392 THEN
1393 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1394 p_full_path => l_path_name,
1395 p_string => ' Error in fecthing deprn expense acct');
1396 RETURN FALSE;
1397 END IF;
1398
1399 /* Create accounting entries for non zero values*/
1400 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1401 p_full_path => l_path_name,
1402 p_string => ' Creating accounting entries in igi_iac_adjustments');
1403 IF l_current_db.deprn_reserve <> 0 THEN
1404 l_rowid := NULL ;
1405 igi_iac_adjustments_pkg.insert_row(
1406 X_rowid => l_rowid ,
1407 X_adjustment_id => l_adjustment_id ,
1408 X_book_type_code => l_det_balances.book_type_code ,
1409 X_code_combination_id => l_deprn_exp_ccid,
1410 X_set_of_books_id => l_sob_id ,
1411 X_dr_cr_flag => 'DR' ,
1412 X_amount => l_current_db.deprn_reserve,
1413 X_adjustment_type => 'EXPENSE' ,
1414 X_transfer_to_gl_flag => 'Y' ,
1415 X_units_assigned => l_det_balances.units_assigned ,
1416 X_asset_id => l_det_balances.asset_id ,
1417 X_distribution_id => l_det_balances.distribution_id ,
1418 X_period_counter => l_asset_balance_mvmt.period_counter,
1419 X_adjustment_offset_type => 'RESERVE',
1420 X_report_ccid => Null,
1421 x_mode => 'R',
1422 X_event_id => p_event_id
1423 ) ;
1424
1425 l_rowid := NULL ;
1426 igi_iac_adjustments_pkg.insert_row(
1427 X_rowid => l_rowid ,
1428 X_adjustment_id => l_adjustment_id ,
1429 X_book_type_code => l_det_balances.book_type_code ,
1430 X_code_combination_id => l_deprn_rsv_ccid,
1431 X_set_of_books_id => l_sob_id ,
1432 X_dr_cr_flag => 'CR' ,
1433 X_amount =>l_current_db.deprn_reserve,
1434 X_adjustment_type => 'RESERVE' ,
1435 X_transfer_to_gl_flag => 'Y' ,
1436 X_units_assigned => l_det_balances.units_assigned ,
1437 X_asset_id => l_det_balances.asset_id ,
1438 X_distribution_id => l_det_balances.distribution_id ,
1439 X_period_counter => l_asset_balance_mvmt.period_counter,
1440 X_adjustment_offset_type => 'EXPENSE',
1441 X_report_ccid => Null,
1442 x_mode => 'R',
1443 X_event_id => p_event_id
1444 ) ;
1445 END IF;
1446
1447 IF l_current_db.reval_reserve_gen_fund <> 0 THEN
1448 l_rowid := NULL ;
1449 igi_iac_adjustments_pkg.insert_row(
1450 X_rowid => l_rowid ,
1451 X_adjustment_id => l_adjustment_id ,
1452 X_book_type_code => l_det_balances.book_type_code ,
1453 X_code_combination_id => l_revl_rsv_ccid,
1454 X_set_of_books_id => l_sob_id ,
1455 X_dr_cr_flag => 'DR' ,
1456 X_amount => l_current_db.reval_reserve_gen_fund ,
1457 X_adjustment_type => 'REVAL RESERVE' ,
1458 X_transfer_to_gl_flag => 'Y' ,
1459 X_units_assigned => l_det_balances.units_assigned ,
1460 X_asset_id => l_det_balances.asset_id ,
1461 X_distribution_id => l_det_balances.distribution_id ,
1462 X_period_counter => l_asset_balance_mvmt.period_counter,
1463 X_adjustment_offset_type => 'GENERAL FUND',
1464 X_report_ccid => Null,
1465 x_mode => 'R',
1466 X_event_id => p_event_id
1467 ) ;
1468
1469 l_rowid := NULL ;
1470 igi_iac_adjustments_pkg.insert_row(
1471 X_rowid => l_rowid ,
1472 X_adjustment_id => l_adjustment_id ,
1473 X_book_type_code => l_det_balances.book_type_code ,
1474 X_code_combination_id => l_gen_fund_ccid,
1475 X_set_of_books_id => l_sob_id ,
1476 X_dr_cr_flag => 'CR' ,
1477 X_amount =>l_current_db.reval_reserve_gen_fund ,
1478 X_adjustment_type => 'GENERAL FUND' ,
1479 X_transfer_to_gl_flag => 'Y' ,
1480 X_units_assigned => l_det_balances.units_assigned ,
1481 X_asset_id => l_det_balances.asset_id ,
1482 X_distribution_id => l_det_balances.distribution_id ,
1483 X_period_counter => l_asset_balance_mvmt.period_counter,
1484 X_adjustment_offset_type => 'REVAL RESERVE',
1485 X_report_ccid => l_revl_rsv_ccid,
1486 x_mode => 'R',
1487 X_event_id => p_event_id
1488 ) ;
1489 END IF;
1490
1491 IF l_current_db.reval_reserve_backlog <> 0 THEN
1492 l_rowid := NULL;
1493 igi_iac_adjustments_pkg.insert_row(
1494 X_rowid => l_rowid ,
1495 X_adjustment_id => l_adjustment_id ,
1496 X_book_type_code => l_det_balances.book_type_code ,
1497 X_code_combination_id => l_blog_rsv_ccid,
1498 X_set_of_books_id => l_sob_id ,
1499 X_dr_cr_flag => 'CR' ,
1500 X_amount =>l_current_db.reval_reserve_backlog ,
1501 X_adjustment_type => 'BL RESERVE' ,
1502 X_transfer_to_gl_flag => 'Y' ,
1503 X_units_assigned => l_det_balances.units_assigned ,
1504 X_asset_id => l_det_balances.asset_id ,
1505 X_distribution_id => l_det_balances.distribution_id ,
1506 X_period_counter => l_asset_balance_mvmt.period_counter,
1507 X_adjustment_offset_type => 'REVAL RESERVE',
1508 X_report_ccid => l_revl_rsv_ccid,
1509 x_mode => 'R',
1510 X_event_id => p_event_id
1511 ) ;
1512
1513
1514 l_rowid := NULL;
1515 igi_iac_adjustments_pkg.insert_row(
1516 X_rowid => l_rowid ,
1517 X_adjustment_id => l_adjustment_id ,
1518 X_book_type_code => l_det_balances.book_type_code ,
1519 X_code_combination_id => l_revl_rsv_ccid,
1520 X_set_of_books_id => l_sob_id ,
1521 X_dr_cr_flag => 'DR' ,
1522 X_amount =>l_current_db.reval_reserve_backlog ,
1523 X_adjustment_type => 'REVAL RESERVE' ,
1524 X_transfer_to_gl_flag => 'Y' ,
1525 X_units_assigned => l_det_balances.units_assigned ,
1526 X_asset_id => l_det_balances.asset_id ,
1527 X_distribution_id => l_det_balances.distribution_id ,
1528 X_period_counter => l_asset_balance_mvmt.period_counter,
1529 X_adjustment_offset_type => 'BL RESERVE',
1530 X_report_ccid => Null,
1531 x_mode => 'R',
1532 X_event_id => p_event_id
1533 ) ;
1534
1535 END IF;
1536
1537 IF l_current_db.operating_acct_backlog <> 0 THEN
1538 l_rowid := NULL;
1539 igi_iac_adjustments_pkg.insert_row(
1540 X_rowid => l_rowid ,
1541 X_adjustment_id => l_adjustment_id ,
1542 X_book_type_code => l_det_balances.book_type_code ,
1543 X_code_combination_id => l_blog_rsv_ccid,
1544 X_set_of_books_id => l_sob_id ,
1545 X_dr_cr_flag => 'CR' ,
1546 X_amount =>l_current_db.operating_acct_backlog ,
1547 X_adjustment_type => 'BL RESERVE' ,
1548 X_transfer_to_gl_flag => 'Y' ,
1549 X_units_assigned => l_det_balances.units_assigned ,
1550 X_asset_id => l_det_balances.asset_id ,
1551 X_distribution_id => l_det_balances.distribution_id ,
1552 X_period_counter => l_asset_balance_mvmt.period_counter,
1553 X_adjustment_offset_type => 'OP EXPENSE',
1554 X_report_ccid => l_op_exp_ccid,
1555 x_mode => 'R',
1556 X_event_id => p_event_id
1557 ) ;
1558
1559 l_rowid := NULL;
1560 igi_iac_adjustments_pkg.insert_row(
1561 X_rowid => l_rowid ,
1562 X_adjustment_id => l_adjustment_id ,
1563 X_book_type_code => l_det_balances.book_type_code ,
1564 X_code_combination_id => l_op_exp_ccid,
1565 X_set_of_books_id => l_sob_id ,
1566 X_dr_cr_flag => 'DR' ,
1567 X_amount =>l_current_db.operating_acct_backlog ,
1568 X_adjustment_type => 'OP EXPENSE' ,
1569 X_transfer_to_gl_flag => 'Y' ,
1570 X_units_assigned => l_det_balances.units_assigned ,
1571 X_asset_id => l_det_balances.asset_id ,
1572 X_distribution_id => l_det_balances.distribution_id ,
1573 X_period_counter => l_asset_balance_mvmt.period_counter,
1574 X_adjustment_offset_type => 'BL RESERVE',
1575 X_report_ccid => Null,
1576 x_mode => 'R',
1577 X_event_id => p_event_id
1578 ) ;
1579
1580 END IF;
1581
1582 l_det_balances.adjustment_cost := l_det_balances.adjustment_cost + l_current_db.adjustment_cost;
1583 l_det_balances.net_book_value := l_det_balances.net_book_value + l_current_db.net_book_value;
1584 l_det_balances.reval_reserve_cost := l_det_balances.reval_reserve_cost + l_current_db.reval_reserve_cost;
1585 l_det_balances.reval_reserve_backlog := l_det_balances.reval_reserve_backlog + l_current_db.reval_reserve_backlog;
1586 l_det_balances.reval_reserve_gen_fund := l_det_balances.reval_reserve_gen_fund + l_current_db.reval_reserve_gen_fund;
1587 l_det_balances.reval_reserve_net := l_det_balances.reval_reserve_net + l_current_db.reval_reserve_net;
1588 l_det_balances.operating_acct_cost := l_det_balances.operating_acct_cost + l_current_db.operating_acct_cost;
1589 l_det_balances.operating_acct_backlog := l_det_balances.operating_acct_backlog + l_current_db.operating_acct_backlog;
1590 l_det_balances.operating_acct_net := l_det_balances.operating_acct_net + l_current_db.operating_acct_net;
1591 l_det_balances.deprn_reserve := l_det_balances.deprn_reserve + l_current_db.deprn_reserve;
1592 l_det_balances.deprn_reserve_backlog := l_det_balances.deprn_reserve_backlog + l_current_db.deprn_reserve_backlog;
1593 l_det_balances.general_fund_acc := l_det_balances.general_fund_acc + l_current_db.general_fund_acc;
1594
1595 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1596 p_full_path => l_path_name,
1597 p_string => ' +DET BALANCES..... AFTER');
1598 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1599 p_full_path => l_path_name,
1600 p_string => ' x_adjustment_id => '|| l_current_db.adjustment_id);
1601 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1602 p_full_path => l_path_name,
1603 p_string => ' x_asset_id =>'|| l_current_db.asset_id);
1604 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1605 p_full_path => l_path_name,
1606 p_string => ' x_distribution_id => '||l_current_db.distribution_id);
1607 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1608 p_full_path => l_path_name,
1609 p_string => ' x_book_type_code => '||l_current_db.book_type_code);
1610 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1611 p_full_path => l_path_name,
1612 p_string => ' x_period_counter => '||l_current_db.period_counter);
1613 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1614 p_full_path => l_path_name,
1615 p_string => ' x_adjustment_cost => '||l_det_balances.adjustment_cost);
1616 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1617 p_full_path => l_path_name,
1618 p_string => ' x_net_book_value => '||l_det_balances.net_book_value);
1619 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1620 p_full_path => l_path_name,
1621 p_string => ' x_reval_reserve_cost => '||l_det_balances.reval_reserve_cost);
1622 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1623 p_full_path => l_path_name,
1624 p_string => ' x_reval_reserve_backlog => '||l_det_balances.reval_reserve_backlog);
1625 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1626 p_full_path => l_path_name,
1627 p_string => ' x_reval_reserve_gen_fund => '||l_det_balances.reval_reserve_gen_fund);
1628 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1629 p_full_path => l_path_name,
1630 p_string => ' x_reval_reserve_net => '||l_det_balances.reval_reserve_net);
1631 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1632 p_full_path => l_path_name,
1633 p_string => ' x_operating_acct_cost => '||l_det_balances.operating_acct_cost);
1634 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1635 p_full_path => l_path_name,
1636 p_string => ' x_operating_acct_backlog => '||l_det_balances.operating_acct_backlog);
1637 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1638 p_full_path => l_path_name,
1639 p_string => ' x_operating_acct_net => '||l_det_balances.operating_acct_net);
1640 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1641 p_full_path => l_path_name,
1642 p_string => ' x_operating_acct_ytd => '||l_current_db.operating_acct_ytd);
1643 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1644 p_full_path => l_path_name,
1645 p_string => ' x_deprn_period => '||l_current_db.deprn_period);
1646 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1647 p_full_path => l_path_name,
1648 p_string => ' x_deprn_ytd => '||l_current_db.deprn_ytd);
1649 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1650 p_full_path => l_path_name,
1651 p_string => ' x_deprn_reserve => '||l_det_balances.deprn_reserve);
1652 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1653 p_full_path => l_path_name,
1654 p_string => ' x_deprn_reserve_backlog => '||l_det_balances.deprn_reserve_backlog);
1655 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1656 p_full_path => l_path_name,
1657 p_string => ' x_general_fund_per => '||l_current_db.general_fund_per);
1658 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1659 p_full_path => l_path_name,
1660 p_string => ' x_general_fund_acc => '||l_det_balances.general_fund_acc);
1661 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1662 p_full_path => l_path_name,
1663 p_string => ' x_last_reval_date => '||l_det_balances.last_reval_date);
1664 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1665 p_full_path => l_path_name,
1666 p_string => ' x_current_reval_factor => '||l_det_balances.current_reval_factor);
1667 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1668 p_full_path => l_path_name,
1669 p_string => ' x_cumulative_reval_factor => '||l_det_balances.cumulative_reval_factor);
1670 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1671 p_full_path => l_path_name,
1672 p_string => ' x_active_flag => '||l_det_balances.active_flag);
1673
1674 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1675 p_full_path => l_path_name,
1676 p_string => 'IGI_IAC_DET_BALANCES_PKG.insert_row');
1677 l_rowid := NULL;
1678 IGI_IAC_DET_BALANCES_PKG.insert_row (
1679 x_rowid => l_rowid,
1680 x_adjustment_id => l_current_db.adjustment_id,
1681 x_asset_id => l_current_db.asset_id,
1682 x_distribution_id => l_current_db.distribution_id,
1683 x_book_type_code => l_current_db.book_type_code,
1684 x_period_counter => l_current_db.period_counter,
1685 x_adjustment_cost => l_det_balances.adjustment_cost ,
1686 x_net_book_value => l_det_balances.net_book_value ,
1687 x_reval_reserve_cost => l_det_balances.reval_reserve_cost ,
1688 x_reval_reserve_backlog => l_det_balances.reval_reserve_backlog ,
1689 x_reval_reserve_gen_fund => l_det_balances.reval_reserve_gen_fund ,
1690 x_reval_reserve_net => l_det_balances.reval_reserve_net ,
1691 x_operating_acct_cost => l_det_balances.operating_acct_cost ,
1692 x_operating_acct_backlog => l_det_balances.operating_acct_backlog ,
1693 x_operating_acct_net => l_det_balances.operating_acct_net ,
1694 x_operating_acct_ytd => l_current_db.operating_acct_ytd,
1695 x_deprn_period => l_current_db.deprn_period,
1696 x_deprn_ytd => l_current_db.deprn_ytd,
1697 x_deprn_reserve => l_det_balances.deprn_reserve ,
1698 x_deprn_reserve_backlog => l_det_balances.deprn_reserve_backlog ,
1699 x_general_fund_per => l_current_db.general_fund_per,
1700 x_general_fund_acc => l_det_balances.general_fund_acc ,
1701 x_last_reval_date => l_current_db.last_reval_date,
1702 x_current_reval_factor => l_current_db.current_reval_factor,
1703 x_cumulative_reval_factor => l_current_db.cumulative_reval_factor,
1704 x_active_flag => l_current_db.active_flag,
1705 x_mode => 'R' );
1706
1707 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1708 p_full_path => l_path_name,
1709 p_string => 'Before igi_iac_fa_deprn_pkg.insert_row');
1710 l_rowid := NULL;
1711 igi_iac_fa_deprn_pkg.insert_row(
1712 x_rowid => l_rowid,
1713 x_book_type_code => l_det_balances.book_type_code,
1714 x_asset_id => l_det_balances.asset_id,
1715 x_distribution_id => l_det_balances.distribution_id,
1716 x_period_counter => l_asset_balance_mvmt.period_counter,
1717 x_adjustment_id => l_adjustment_id,
1718 x_deprn_period => l_current_db_fa.deprn_period,
1719 x_deprn_ytd => l_current_db_fa.deprn_ytd ,
1720 x_deprn_reserve => l_current_db_fa.deprn_reserve,
1721 x_active_flag => l_det_balances.active_flag,
1722 x_mode => 'R');
1723 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1724 p_full_path => l_path_name,
1725 p_string => 'After igi_iac_fa_deprn_pkg.insert_row');
1726 END LOOP;
1727
1728 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1729 p_full_path => l_path_name,
1730 p_string => ' Asset_id:'||l_curr_asset_balance.asset_id);
1731 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1732 p_full_path => l_path_name,
1733 p_string => ' Period_counter :'||l_curr_asset_balance.period_counter);
1734 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1735 p_full_path => l_path_name,
1736 p_string => ' Net book value :'||TO_CHAR(l_curr_asset_balance.net_book_value));
1737 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1738 p_full_path => l_path_name,
1739 p_string => ' Adjusted Cost :'||TO_CHAR(l_curr_asset_balance.adjusted_cost));
1740 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1741 p_full_path => l_path_name,
1742 p_string => ' Operating Account :'||TO_CHAR(l_curr_asset_balance.operating_acct));
1743 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1744 p_full_path => l_path_name,
1745 p_string => ' Reval Reserve :'||TO_CHAR(l_curr_asset_balance.reval_reserve));
1746 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1747 p_full_path => l_path_name,
1748 p_string => ' Deprn Amount :'||TO_CHAR(l_curr_asset_balance.deprn_amount));
1749 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1750 p_full_path => l_path_name,
1751 p_string => ' Deprn Reserve :'||TO_CHAR(l_curr_asset_balance.deprn_reserve));
1752 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1753 p_full_path => l_path_name,
1754 p_string => ' Backlog Deprn Reserve :'||TO_CHAR(l_curr_asset_balance.backlog_deprn_reserve));
1755 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1756 p_full_path => l_path_name,
1757 p_string => ' General Fund :'||TO_CHAR(l_curr_asset_balance.general_fund));
1758 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1759 p_full_path => l_path_name,
1760 p_string => ' Current Reval Factor :'||TO_CHAR(l_curr_asset_balance.current_reval_factor));
1761 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1762 p_full_path => l_path_name,
1763 p_string => ' Cumulative Reval Factor :'||TO_CHAR(l_curr_asset_balance.Cumulative_reval_factor));
1764
1765 IGI_IAC_ASSET_BALANCES_PKG.update_row (
1766 x_asset_id => l_curr_asset_balance.asset_id,
1767 x_book_type_code => l_curr_asset_balance.book_type_code,
1768 x_period_counter => l_asset_balance_mvmt.period_counter,
1769 x_net_book_value => l_curr_asset_balance.net_book_value,
1770 x_adjusted_cost => l_curr_asset_balance.adjusted_cost,
1771 x_operating_acct => l_curr_asset_balance.operating_acct,
1772 x_reval_reserve => l_curr_asset_balance.reval_reserve,
1773 x_deprn_amount => l_curr_asset_balance.deprn_amount,
1774 x_deprn_reserve => l_curr_asset_balance.deprn_reserve,
1775 x_backlog_deprn_reserve => l_curr_asset_balance.backlog_deprn_reserve,
1776 x_general_fund => l_curr_asset_balance.general_fund,
1777 x_last_reval_date => l_curr_asset_balance.last_reval_date,
1778 x_current_reval_factor => l_curr_asset_balance.current_reval_factor,
1779 x_cumulative_reval_factor => l_curr_asset_balance.cumulative_reval_factor,
1780 x_mode => 'R'
1781 );
1782
1783 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1784 p_full_path => l_path_name,
1785 p_string => ' Making previous transaction inactive.');
1786 igi_iac_trans_headers_pkg.update_row(
1787 X_prev_adjustment_id => l_adjustment_id_out ,
1788 X_adjustment_id => l_adjustment_id ) ;
1789
1790 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1791 p_full_path => l_path_name,
1792 p_string => ' Expensed Adjustment Success.');
1793
1794 Return TRUE;
1795
1796 EXCEPTION
1797 WHEN others THEN
1798 igi_iac_debug_pkg.debug_unexpected_msg(p_full_path => l_path_name);
1799 RETURN FALSE;
1800 END Do_Expensed_Adj;
1801 BEGIN
1802 --===========================FND_LOG.START=====================================
1803 g_state_level := FND_LOG.LEVEL_STATEMENT;
1804 g_proc_level := FND_LOG.LEVEL_PROCEDURE;
1805 g_event_level := FND_LOG.LEVEL_EVENT;
1806 g_excep_level := FND_LOG.LEVEL_EXCEPTION;
1807 g_error_level := FND_LOG.LEVEL_ERROR;
1808 g_unexp_level := FND_LOG.LEVEL_UNEXPECTED;
1809 g_path := 'IGI.PLSQL.igiiadxb.igi_iac_adj_expensed_pkg.';
1810 --===========================FND_LOG.END=====================================
1811
1812 END igi_iac_adj_expensed_pkg;