[Home] [Help]
546:
547: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
548: trace
549: (p_module => l_log_module
550: ,p_msg => 'trying to lock xla_control_balances'
551: ,p_level => C_LEVEL_STATEMENT
552: );
553: END IF;
554: LOCK TABLE xla_control_balances IN EXCLUSIVE MODE NOWAIT;
550: ,p_msg => 'trying to lock xla_control_balances'
551: ,p_level => C_LEVEL_STATEMENT
552: );
553: END IF;
554: LOCK TABLE xla_control_balances IN EXCLUSIVE MODE NOWAIT;
555:
556: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
557: trace
558: (p_module => l_log_module
652:
653: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
654: trace
655: (p_module => l_log_module
656: ,p_msg => 'trying to lock xla_control_balances'
657: ,p_level => C_LEVEL_STATEMENT
658: );
659: END IF;
660: LOCK TABLE xla_control_balances IN EXCLUSIVE MODE NOWAIT;
656: ,p_msg => 'trying to lock xla_control_balances'
657: ,p_level => C_LEVEL_STATEMENT
658: );
659: END IF;
660: LOCK TABLE xla_control_balances IN EXCLUSIVE MODE NOWAIT;
661:
662: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
663: trace
664: (p_module => l_log_module
682: ,cp_request_id => NVL(l_req_id, -1)
683: );
684: CLOSE lc_lock_balance_statuses;
685:
686: INSERT INTO xla_control_balances
687: ( application_id
688: ,ledger_id
689: ,code_combination_id
690: ,party_type_code
797: ,l_prog_id --program_id
798: ,NVL(l_req_id, -1) --request_id
799: ,l_dest_effective_period_num
800: FROM xla_balance_statuses xbs
801: ,xla_control_balances xba
802: ,xla_control_balances xbanew
803: WHERE xbs.application_id = p_application_id
804: AND xbs.ledger_id = p_ledger_id
805: AND xbs.balance_source_code = 'C'
798: ,NVL(l_req_id, -1) --request_id
799: ,l_dest_effective_period_num
800: FROM xla_balance_statuses xbs
801: ,xla_control_balances xba
802: ,xla_control_balances xbanew
803: WHERE xbs.application_id = p_application_id
804: AND xbs.ledger_id = p_ledger_id
805: AND xbs.balance_source_code = 'C'
806: AND xbs.balance_status_code = p_balance_status_code_selected
1855: ,-NVL(xba.draft_beginning_balance_cr, 0)
1856: ) change_draft_balance_cr
1857: ,ctr.balance_status_eff_per_num
1858: FROM xla_bal_ctrl_ctrbs_gt ctr
1859: ,xla_control_balances xba
1860: WHERE ctr.application_id = p_application_id
1861: AND ctr.ledger_id = p_ledger_id
1862: AND ctr.effective_period_num = p_effective_period_num
1863: AND xba.application_id (+)= ctr.application_id
2020: g_date := SYSDATE;
2021:
2022: --Update balances same year
2023: FORALL i IN 1..la_code_combination_id.LAST
2024: UPDATE xla_control_balances xba
2025: SET xba.beginning_balance_dr =
2026: DECODE( xba.period_name
2027: ,la_contribution_period_name (i)
2028: ,xba.beginning_balance_dr
2142: g_date := SYSDATE;
2143:
2144: --UPDATE balances following years
2145: FORALL i IN 1..la_code_combination_id.LAST
2146: UPDATE xla_control_balances xba
2147: SET xba.beginning_balance_dr =
2148: DECODE( la_change_balance_dr(i)
2149: ,0
2150: ,xba.beginning_balance_dr
2223: l_begin_bal_cr := null; --7608545 - Reset begin_bal_cr to null
2224: FOR j IN (select nvl(beginning_balance_dr,0) + nvl(period_balance_dr,0) begin_dr
2225: ,nvl(beginning_balance_cr,0) + nvl(period_balance_cr,0) begin_cr
2226: from(select xcb.*
2227: from xla_control_balances xcb, gl_period_statuses gps
2228: where xcb.application_id = la_application_id(i)
2229: and xcb.application_id = gps.application_id
2230: and xcb.ledger_id = gps.ledger_id
2231: and xcb.ledger_id = la_ledger_id(i)
2241: l_begin_bal_cr := j.begin_cr;
2242:
2243: END LOOP;
2244:
2245: INSERT INTO xla_control_balances xba
2246: ( application_id
2247: ,ledger_id
2248: ,code_combination_id
2249: ,party_type_code
2378: ,g_prog_id
2379: ,g_req_id
2380: ,gps.effective_period_num
2381: FROM xla_bal_period_stats_gt gps
2382: ,xla_control_balances xba
2383: WHERE gps.ledger_id = la_ledger_id (i)
2384: AND gps.effective_period_num >= la_contribution_eff_per_num(i)
2385: AND gps.effective_period_num <= la_balance_stat_eff_per_num(i)
2386: AND xba.application_id (+)= la_application_id(i)
3361: l_return_value := 0;
3362:
3363: IF NVL(p_balance_source_code, 'C') = 'C'
3364: THEN
3365: INSERT INTO xla_control_balances xba
3366: ( application_id
3367: ,ledger_id
3368: ,code_combination_id
3369: ,party_type_code
3500: ,NVL(l_req_id, -1)
3501: ,gpsbs.effective_period_num
3502: FROM xla_balance_statuses xbs
3503: ,gl_period_statuses gpsbs
3504: ,xla_control_balances xba
3505: ,gl_period_statuses gpsnew
3506: WHERE xbs.application_id = p_application_id
3507: AND xbs.ledger_id = p_ledger_id
3508: AND xbs.balance_source_code = 'C'
3524: AND gpsnew.effective_period_num <= p_dest_effective_period_num
3525: AND gpsnew.effective_period_num >
3526: (
3527: SELECT MAX(gpsint.effective_period_num)
3528: FROM xla_control_balances xbanew
3529: ,gl_period_statuses gpsint
3530: WHERE xbanew.ledger_id = p_ledger_id
3531: AND xbanew.application_id = p_application_id
3532: AND xbanew.code_combination_id = p_code_combination_id
3543: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3544: trace
3545: ( p_module => l_log_module
3546: ,p_msg => l_row_count ||
3547: ' xla_control_balances created'
3548: ,p_level => C_LEVEL_STATEMENT
3549: );
3550: END IF;
3551: END IF;
8060:
8061: --delete control balances
8062: LOOP
8063: DELETE
8064: FROM xla_control_balances xcbext
8065: WHERE xcbext.ROWID IN
8066: ( SELECT xcb.ROWID
8067: FROM xla_balance_statuses xbs
8068: ,xla_control_balances xcb
8064: FROM xla_control_balances xcbext
8065: WHERE xcbext.ROWID IN
8066: ( SELECT xcb.ROWID
8067: FROM xla_balance_statuses xbs
8068: ,xla_control_balances xcb
8069: ,gl_period_statuses gps
8070: WHERE xbs.balance_source_code = 'C'
8071: AND xbs.balance_status_code = 'R'
8072: AND xbs.request_id = NVL(l_req_id, -1)
8103:
8104: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
8105: trace
8106: (p_module => l_log_module
8107: ,p_msg => l_row_count || ' xla_control_balances deleted'
8108: ,p_level => C_LEVEL_STATEMENT
8109: );
8110: END IF;
8111:
9756: COMMIT;
9757: END IF;
9758: END LOOP;
9759:
9760: --delete xla_control_balances
9761: LOOP
9762: DELETE
9763: FROM xla_control_balances xcb
9764: WHERE xcb.code_combination_id IN
9759:
9760: --delete xla_control_balances
9761: LOOP
9762: DELETE
9763: FROM xla_control_balances xcb
9764: WHERE xcb.code_combination_id IN
9765: (
9766: SELECT xbt.code_combination_id
9767: FROM xla_bal_synchronize_gt xbt
10524: INTO l_existing_balance_period_name
10525: ,l_existing_begin_balance_dr
10526: ,l_existing_begin_balance_cr
10527: ,l_existing_balance_rowid
10528: FROM xla_control_balances xba
10529: WHERE xba.ledger_id = p_ledger_id
10530: AND xba.application_id = p_application_id
10531: AND xba.code_combination_id = p_code_combination_id
10532: AND xba.initial_balance_flag = 'Y'
10565: xla_exceptions_pkg.raise_message
10566: (p_location => 'xla_balances_pkg.initialize');
10567: END IF;
10568:
10569: UPDATE xla_control_balances xba
10570: SET xba.initial_balance_flag = 'N'
10571: WHERE xba.rowid = l_existing_balance_rowid;
10572:
10573: l_row_count := SQL%ROWCOUNT;
10653: ( p_mode => 'D'
10654: ,p_ae_header_id => l_ae_header_id
10655: );
10656:
10657: UPDATE xla_control_balances xba
10658: SET xba.beginning_balance_dr = xba.beginning_balance_dr + xba.period_balance_dr
10659: ,xba.beginning_balance_cr = xba.beginning_balance_cr + xba.period_balance_cr
10660: ,xba.period_balance_dr = 0
10661: ,xba.period_balance_cr = 0