[Home] [Help]
33: reported_value jl_co_gl_mg_configs.reported_value%TYPE,
34: nit_id jl_co_gl_nits.nit_id%TYPE,
35: config_id jl_co_gl_mg_configs.config_id%TYPE,
36: literal_literal_id jl_co_gl_mg_configs.literal_literal_id%TYPE,
37: range_id jl_co_gl_mg_ranges.range_id%TYPE,
38: send_back_flag jl_co_gl_mg_lines.send_back_flag%TYPE,
39: origin jl_co_gl_mg_lines.origin%TYPE,
40: amount jl_co_gl_mg_lines.first_reported_value%TYPE
41: );
404: x_mg_hdr_count NUMBER;
405:
406: /********************************************************************
407: Cursor to select rows from jl_co_gl_mg_literals, jl_co_gl_mg_configs
408: and jl_co_gl_mg_ranges (accounting ranges) tables
409: ********************************************************************/
410:
411: CURSOR literal_cur IS
412:
419: mgc.movement_type movement_type,
420: mgc.threshold_value rep_threshold_value,
421: mgc.literal_literal_id literal_literal_id,
422: mgr.range_id range_id
423: FROM jl_co_gl_mg_ranges mgr,
424: jl_co_gl_mg_configs mgc,
425: jl_co_gl_mg_literals mgl
426: WHERE mgr.config_id = mgc.config_id
427: AND mgc.literal_id = mgl.literal_id
437: Cursor for selecting rows from jl_co_gl_trx table
438: *************************************************/
439:
440: CURSOR trx_cur (x_movement_type jl_co_gl_mg_configs.movement_type%TYPE,
441: x_range_id jl_co_gl_mg_ranges.range_id%TYPE) IS
442:
443: SELECT t.nit_id nit_id,
444: DECODE(x_movement_type,
445: '1', SUM(NVL(t.accounted_dr, 0)),
472: --AND t.code_combination_id IN
473: AND exists
474: (SELECT 1
475: FROM gl_code_combinations cc,
476: jl_co_gl_mg_ranges r
477: WHERE cc.code_combination_id = t.code_combination_id
478: AND r.range_id = x_range_id
479: AND cc.chart_of_accounts_id = sob1.chart_of_accounts_id
480: AND NVL(cc.segment1,0) BETWEEN NVL(r.segment1_low,0) AND NVL(r.segment1_high,0)
517: -- Bug 4018828 - Comment out the join to period_name in the subquery retrieving
518: -- the max period num. This ensures that only the balances for last active
519: -- period for which there exists transactions are taken into account
520: CURSOR bal_cur (x_movement_type jl_co_gl_mg_configs.movement_type%TYPE,
521: x_range_id jl_co_gl_mg_ranges.range_id%TYPE) IS
522:
523: SELECT b.nit_id nit_id,
524: DECODE(x_movement_type,
525: '5', SUM(NVL(b.begin_balance_dr, 0)) - SUM(NVL(b.begin_balance_cr, 0)) +
561: )
562: AND b.code_combination_id IN
563: (SELECT code_combination_id
564: FROM gl_code_combinations cc,
565: jl_co_gl_mg_ranges r,
566: gl_sets_of_books sob3
567: WHERE r.range_id = x_range_id
568: AND cc.chart_of_accounts_id = sob3.chart_of_accounts_id
569: AND sob3.set_of_books_id = p_set_of_books_id