40: FROM igi_iac_transaction_headers
41: WHERE book_type_code = p_book_type_code
42: AND period_counter = p_period_counter
43: AND transaction_type_code = 'ADDITION';
44: CURSOR c_get_distributions(p_asset_id igi_iac_det_balances.asset_id%TYPE,
45: p_adjustment_id igi_iac_det_balances.adjustment_id%TYPE) IS
46: SELECT distribution_id
47: FROM igi_iac_det_balances
48: WHERE book_type_code = p_book_type_code
41: WHERE book_type_code = p_book_type_code
42: AND period_counter = p_period_counter
43: AND transaction_type_code = 'ADDITION';
44: CURSOR c_get_distributions(p_asset_id igi_iac_det_balances.asset_id%TYPE,
45: p_adjustment_id igi_iac_det_balances.adjustment_id%TYPE) IS
46: SELECT distribution_id
47: FROM igi_iac_det_balances
48: WHERE book_type_code = p_book_type_code
49: AND asset_id = p_asset_id;
43: AND transaction_type_code = 'ADDITION';
44: CURSOR c_get_distributions(p_asset_id igi_iac_det_balances.asset_id%TYPE,
45: p_adjustment_id igi_iac_det_balances.adjustment_id%TYPE) IS
46: SELECT distribution_id
47: FROM igi_iac_det_balances
48: WHERE book_type_code = p_book_type_code
49: AND asset_id = p_asset_id;
50: /* Bug 2425914 vgadde 21/06/2002 */
51: /* Modified query to fecth records created by ADDITION only */
48: WHERE book_type_code = p_book_type_code
49: AND asset_id = p_asset_id;
50: /* Bug 2425914 vgadde 21/06/2002 */
51: /* Modified query to fecth records created by ADDITION only */
52: CURSOR c_get_revaluation_info(p_asset_id igi_iac_det_balances.asset_id%TYPE) IS
53: SELECT a.revaluation_id
54: FROM igi_iac_revaluations r,igi_iac_reval_asset_rules a
55: WHERE a.revaluation_id = r.revaluation_id
56: AND a.book_type_code = p_book_type_code
77: FROM igi_iac_revaluation_rates
78: WHERE asset_id = p_asset_id
79: AND book_type_code = p_book_type_code
80: AND revaluation_id = p_revaluation_id;
81: CURSOR c_get_fa_distributions(cp_asset_id igi_iac_det_balances.asset_id%TYPE,
82: cp_adjustment_id igi_iac_det_balances.adjustment_id%TYPE) IS
83: SELECT distribution_id
84: FROM igi_iac_fa_deprn
85: WHERE book_type_code = p_book_type_code
78: WHERE asset_id = p_asset_id
79: AND book_type_code = p_book_type_code
80: AND revaluation_id = p_revaluation_id;
81: CURSOR c_get_fa_distributions(cp_asset_id igi_iac_det_balances.asset_id%TYPE,
82: cp_adjustment_id igi_iac_det_balances.adjustment_id%TYPE) IS
83: SELECT distribution_id
84: FROM igi_iac_fa_deprn
85: WHERE book_type_code = p_book_type_code
86: AND asset_id = cp_asset_id
117: p_full_path => l_path_name,
118: p_string => ' No records found in igi_iac_adjustments for delete');
119: END IF;
120: CLOSE c_get_adjustments;
121: /* Delete records from igi_iac_det_balances */
122: igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
123: p_full_path => l_path_name,
124: p_string => ' Deleting records from igi_iac_det_balances');
125: FOR l_det_balance IN c_get_distributions(l_asset_info.asset_id,
120: CLOSE c_get_adjustments;
121: /* Delete records from igi_iac_det_balances */
122: igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
123: p_full_path => l_path_name,
124: p_string => ' Deleting records from igi_iac_det_balances');
125: FOR l_det_balance IN c_get_distributions(l_asset_info.asset_id,
126: l_asset_info.adjustment_id) LOOP
127: igi_iac_det_balances_pkg.delete_row(
128: x_adjustment_id => l_asset_info.adjustment_id,
123: p_full_path => l_path_name,
124: p_string => ' Deleting records from igi_iac_det_balances');
125: FOR l_det_balance IN c_get_distributions(l_asset_info.asset_id,
126: l_asset_info.adjustment_id) LOOP
127: igi_iac_det_balances_pkg.delete_row(
128: x_adjustment_id => l_asset_info.adjustment_id,
129: x_asset_id => l_asset_info.asset_id,
130: x_distribution_id => l_det_balance.distribution_id,
131: x_book_type_code => p_book_type_code,
248: AND period_counter=p_period_counter
249: AND transaction_type_code='TRANSFER';
250:
251:
252: CURSOR c_deprn_expense(cp_asset_id igi_iac_det_balances.asset_id%TYPE,
253: cp_adjustment_id IGI_IAC_DET_BALANCES.adjustment_id%type) IS
254: SELECT sum(deprn_period)
255: FROM igi_iac_det_balances
256: WHERE book_type_code = p_book_type_code
249: AND transaction_type_code='TRANSFER';
250:
251:
252: CURSOR c_deprn_expense(cp_asset_id igi_iac_det_balances.asset_id%TYPE,
253: cp_adjustment_id IGI_IAC_DET_BALANCES.adjustment_id%type) IS
254: SELECT sum(deprn_period)
255: FROM igi_iac_det_balances
256: WHERE book_type_code = p_book_type_code
257: AND asset_id = cp_asset_id
251:
252: CURSOR c_deprn_expense(cp_asset_id igi_iac_det_balances.asset_id%TYPE,
253: cp_adjustment_id IGI_IAC_DET_BALANCES.adjustment_id%type) IS
254: SELECT sum(deprn_period)
255: FROM igi_iac_det_balances
256: WHERE book_type_code = p_book_type_code
257: AND asset_id = cp_asset_id
258: AND adjustment_id = cp_adjustment_id;
259:
278: /* Cursor to select impacted distributions for roll back */
279:
280: CURSOR c_dist(c_adjustment_id igi_iac_adjustments.adjustment_id%type) IS
281: SELECT distribution_id
282: FROM igi_iac_det_balances
283: WHERE adjustment_id=c_adjustment_id;
284:
285: CURSOR c_fa_dist(cp_adjustment_id igi_iac_adjustments.adjustment_id%type,
286: cp_asset_id igi_iac_fa_deprn.asset_id%TYPE) IS
296: l_amounts c_amounts%rowtype;
297: l_prd_rec_prior igi_iac_types.prd_rec;
298:
299: l_deprn_expense FA_DEPRN_SUMMARY.deprn_amount%type;
300: l_Expense_diff IGI_IAC_DET_BALANCES.deprn_period%type;
301: l_prior_period_counter IGI_IAC_DET_BALANCES.period_counter%type;
302: l_current_period_counter IGI_IAC_DET_BALANCES.period_counter%type;
303: l_prev_adjustment igi_iac_transaction_headers%ROWTYPE;
304:
297: l_prd_rec_prior igi_iac_types.prd_rec;
298:
299: l_deprn_expense FA_DEPRN_SUMMARY.deprn_amount%type;
300: l_Expense_diff IGI_IAC_DET_BALANCES.deprn_period%type;
301: l_prior_period_counter IGI_IAC_DET_BALANCES.period_counter%type;
302: l_current_period_counter IGI_IAC_DET_BALANCES.period_counter%type;
303: l_prev_adjustment igi_iac_transaction_headers%ROWTYPE;
304:
305: l_path varchar2(150);
298:
299: l_deprn_expense FA_DEPRN_SUMMARY.deprn_amount%type;
300: l_Expense_diff IGI_IAC_DET_BALANCES.deprn_period%type;
301: l_prior_period_counter IGI_IAC_DET_BALANCES.period_counter%type;
302: l_current_period_counter IGI_IAC_DET_BALANCES.period_counter%type;
303: l_prev_adjustment igi_iac_transaction_headers%ROWTYPE;
304:
305: l_path varchar2(150);
306: BEGIN
340: igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'============================================================');
341: igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'Deleting From detail balances...');
342: igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'============================================================');
343:
344: /*DELETE from igi_iac_det_balances
345: WHERE book_type_code=p_book_type_code
346: AND period_counter=p_period_counter
347: AND adjustment_id=l_trans_headers.adjustment_id;*/
348:
348:
349:
350: FOR l_dist in c_dist(l_trans_headers.adjustment_id)
351: loop
352: IGI_IAC_DET_BALANCES_PKG.delete_row(
353: x_adjustment_id =>l_trans_headers.adjustment_id,
354: x_asset_id =>l_trans_headers.asset_id,
355: x_distribution_id =>l_dist.distribution_id,
356: x_book_type_code =>l_trans_headers.book_type_code,