DBA Data[Home] [Help]

APPS.CN_FORMULA_COMMON_PKG dependencies on CN_PROCESS_BATCHES

Line 1690: FROM cn_process_batches_all batch

1686: UPDATE cn_srp_periods_all
1687: SET consistency_flag = 'Y'
1688: WHERE (salesrep_id, period_id, org_id) IN
1689: ( SELECT batch.salesrep_id, batch.period_id, batch.org_id
1690: FROM cn_process_batches_all batch
1691: WHERE batch.physical_batch_id = x_calc_batch_id);
1692: END update_consistency_flag;
1693:
1694:

Line 1725: FROM cn_process_batches_all batch,

1721: spa.srp_plan_assign_id,
1722: prd.period_id,
1723: prd.process_all_flag,
1724: decode(prd.period_id, batch.period_id, batch.start_date, prd.start_date) start_date
1725: FROM cn_process_batches_all batch,
1726: cn_srp_plan_assigns_all spa,
1727: cn_srp_intel_periods_all prd
1728: WHERE batch.physical_batch_id = p_physical_batch_id
1729: AND prd.salesrep_id = batch.salesrep_id

Line 1790: cn_process_batches_all batch

1786: batch.end_period_id end_period_id, batch.end_date end_date, pe.quota_id quota_id, pe.interval_type_id interval_type_id
1787: FROM cn_srp_plan_assigns_all spa,
1788: cn_quota_assigns_all qa,
1789: cn_quotas_all pe,
1790: cn_process_batches_all batch
1791: WHERE batch.physical_batch_id = p_physical_batch_id
1792: AND batch.salesrep_id = spa.salesrep_id
1793: AND spa.org_id = batch.org_id
1794: -- find comp plans active on batch.end_date

Line 1818: cn_process_batches_all batch

1814: batch.end_period_id end_period_id, batch.end_date end_date, pe.quota_id quota_id, pe.interval_type_id interval_type_id
1815: FROM cn_srp_plan_assigns_all spa,
1816: cn_quota_assigns_all qa,
1817: cn_quotas_all pe,
1818: cn_process_batches_all batch
1819: WHERE batch.physical_batch_id = p_physical_batch_id
1820: AND batch.salesrep_id = spa.salesrep_id
1821: AND spa.org_id = batch.org_id
1822: -- find comp plans active between batch start and end date

Line 1852: from cn_process_batches_all

1848: 'Beginning of calculate_batch ...');
1849: end if;
1850:
1851: select org_id into l_org_id
1852: from cn_process_batches_all
1853: where physical_batch_id = p_physical_batch_id and rownum = 1;
1854:
1855: -- for maintaining cn_repositories.latest_processed_date
1856: SELECT nvl(latest_processed_date, to_date('01/01/1900', 'DD/MM/YYYY'))

Line 1884: FROM cn_process_batches_all batch,

1880: last_updated_by = g_last_updated_by,
1881: last_update_login = g_last_update_login
1882: WHERE line.commission_line_id in
1883: (SELECT line2.commission_line_id
1884: FROM cn_process_batches_all batch,
1885: cn_commission_lines_all line2,
1886: cn_commission_headers_all ch
1887: WHERE batch.physical_batch_id = p_physical_batch_id
1888: AND line2.commission_header_id = ch.commission_header_id

Line 1913: FROM cn_process_batches_all batch,

1909: last_updated_by = g_last_updated_by,
1910: last_update_login = g_last_update_login
1911: WHERE line.commission_line_id in
1912: (SELECT line2.commission_line_id
1913: FROM cn_process_batches_all batch,
1914: cn_commission_lines_all line2,
1915: cn_commission_headers_all ch
1916: WHERE batch.physical_batch_id = p_physical_batch_id
1917: AND line2.commission_header_id = ch.commission_header_id

Line 2085: FROM cn_process_batches_all batch,

2081: last_updated_by = g_last_updated_by,
2082: last_update_login = g_last_update_login
2083: WHERE line.commission_line_id IN
2084: (SELECT line2.commission_line_id
2085: FROM cn_process_batches_all batch,
2086: cn_commission_lines_all line2
2087: WHERE batch.physical_batch_id = p_physical_batch_id
2088: AND line2.org_id = batch.org_id
2089: AND line2.credited_salesrep_id = batch.salesrep_id

Line 2104: cn_process_batches_all batch

2100: SET Log.status = 'COMPLETE'
2101: WHERE Log.notify_log_id IN
2102: (SELECT log2.notify_log_id
2103: FROM cn_notify_log_all log2,
2104: cn_process_batches_all batch
2105: WHERE batch.physical_batch_id = p_physical_batch_id
2106: AND log2.org_id = batch.org_id
2107: AND log2.salesrep_id = batch.salesrep_id
2108: AND log2.period_id BETWEEN batch.period_id AND batch.end_period_id

Line 2124: FROM cn_notify_log_all event, cn_process_batches_all batch

2120: AND event.action IN ('SOURCE_CLS', 'XROLL', 'ROLL_PULL', 'DELETE_ROLL_PULL')
2121: AND event.status = 'INCOMPLETE'
2122: UNION
2123: SELECT event.notify_log_id
2124: FROM cn_notify_log_all event, cn_process_batches_all batch
2125: WHERE batch.physical_batch_id = p_physical_batch_id
2126: AND batch.salesrep_id = event.salesrep_id
2127: AND event.org_id = batch.org_id
2128: AND event.period_id between batch.period_id and batch.end_period_id

Line 2137: and a.salesrep_id in (select salesrep_id from cn_process_batches_all

2133: -- reset process_all_flag = 'N' since calculation completed sucessfully
2134: update cn_srp_intel_periods_all a
2135: set a.process_all_flag = 'N'
2136: where a.org_id = l_org_id
2137: and a.salesrep_id in (select salesrep_id from cn_process_batches_all
2138: where physical_batch_id = p_physical_batch_id)
2139: and a.period_id >= (select min(period_id) from cn_process_batches_all
2140: where physical_batch_id = p_physical_batch_id
2141: and salesrep_id = a.salesrep_id)

Line 2139: and a.period_id >= (select min(period_id) from cn_process_batches_all

2135: set a.process_all_flag = 'N'
2136: where a.org_id = l_org_id
2137: and a.salesrep_id in (select salesrep_id from cn_process_batches_all
2138: where physical_batch_id = p_physical_batch_id)
2139: and a.period_id >= (select min(period_id) from cn_process_batches_all
2140: where physical_batch_id = p_physical_batch_id
2141: and salesrep_id = a.salesrep_id)
2142: and a.period_id <= (select max(end_period_id) from cn_process_batches_all
2143: where physical_batch_id = p_physical_batch_id

Line 2142: and a.period_id <= (select max(end_period_id) from cn_process_batches_all

2138: where physical_batch_id = p_physical_batch_id)
2139: and a.period_id >= (select min(period_id) from cn_process_batches_all
2140: where physical_batch_id = p_physical_batch_id
2141: and salesrep_id = a.salesrep_id)
2142: and a.period_id <= (select max(end_period_id) from cn_process_batches_all
2143: where physical_batch_id = p_physical_batch_id
2144: and salesrep_id = a.salesrep_id);
2145: commit;
2146: END IF;

Line 2448: Procedure revert_batch_intel_comm (p_physical_batch_id cn_process_batches.physical_batch_id%TYPE ) IS

2444: WHERE commission_header_id = p_commission_header_id;
2445: END IF;
2446: END revert_header_lines;
2447:
2448: Procedure revert_batch_intel_comm (p_physical_batch_id cn_process_batches.physical_batch_id%TYPE ) IS
2449: -- 'COL' event which need to reclassify, will be handled in CLASSIFICATION phase
2450: -- 'CLS' event which only happened when mangerial rollup flag is changed,
2451: -- will be handled here, set process_all_flag = 'Y'
2452: -- 'ROLL' event, handled here set process_all_flag = 'Y'

Line 2474: FROM cn_process_batches_all batch,

2470: Log.start_date, Log.end_date,
2471: Log.revert_state, Log.comp_group_id,
2472: Log.base_salesrep_id, Log.base_comp_group_id,
2473: Log.role_id, Log.action
2474: FROM cn_process_batches_all batch,
2475: cn_notify_log_all Log
2476: WHERE batch.physical_batch_id = p_physical_batch_id
2477: AND log.org_id = batch.org_id
2478: AND Log.period_id BETWEEN batch.period_id AND batch.end_period_id

Line 2491: FROM cn_process_batches_all batch,

2487: Log.start_date, Log.end_date,
2488: Log.revert_state, Log.comp_group_id,
2489: Log.base_salesrep_id, Log.base_comp_group_id,
2490: Log.quota_id
2491: FROM cn_process_batches_all batch,
2492: cn_notify_log_all Log
2493: WHERE batch.physical_batch_id = p_physical_batch_id
2494: AND log.org_id = batch.org_id
2495: AND Log.period_id BETWEEN batch.period_id AND batch.end_period_id

Line 2688: from cn_process_batches_all

2684: BEGIN
2685: cn_message_pkg.debug('Reversing transactions in physical batch (ID=' || p_physical_batch_id||')');
2686:
2687: select org_id into l_org_id
2688: from cn_process_batches_all
2689: where physical_batch_id = p_physical_batch_id
2690: and rownum = 1;
2691:
2692: -- mark proces_all_flag = 'Y', means that need to recalculate every transaction

Line 2703: FROM cn_process_batches_all batch,

2699: SET process_all_flag = 'Y'
2700: WHERE org_id = l_org_id
2701: AND ( salesrep_id, period_id ) IN
2702: ( SELECT DISTINCT batch.salesrep_id, Log.period_id
2703: FROM cn_process_batches_all batch,
2704: cn_notify_log_all Log
2705: WHERE batch.physical_batch_id = p_physical_batch_id
2706: AND log.org_id = batch.org_id
2707: AND Log.period_id BETWEEN batch.period_id AND batch.end_period_id

Line 3108: PROCEDURE Revert_Batch_nonintel(p_batch_id cn_process_batches.physical_batch_id%TYPE,

3104: END revert_batch_intel_comm;
3105:
3106: -- do non intelligent revert. revert every system generated trxs
3107: -- this procedure will handle both 'FORECAST' and 'COMMISSION' type calculation bonus trx type is handled in different procedure
3108: PROCEDURE Revert_Batch_nonintel(p_batch_id cn_process_batches.physical_batch_id%TYPE,
3109: p_calc_type cn_calc_submission_batches.calc_type%TYPE) IS
3110: CURSOR l_post_lines_csr IS
3111: SELECT line.commission_line_id
3112: FROM cn_commission_lines_all line,

Line 3113: cn_process_batches_all batch

3109: p_calc_type cn_calc_submission_batches.calc_type%TYPE) IS
3110: CURSOR l_post_lines_csr IS
3111: SELECT line.commission_line_id
3112: FROM cn_commission_lines_all line,
3113: cn_process_batches_all batch
3114: WHERE batch.physical_batch_id = p_batch_id
3115: AND line.org_id = batch.org_id
3116: AND line.credited_salesrep_id = batch.salesrep_id
3117: AND line.status = 'CALC'

Line 3126: FROM cn_process_batches_all

3122: OR (p_calc_type ='FORECAST' AND line.trx_type = 'FORECAST') );
3123:
3124: CURSOR check_unique_tuple IS
3125: SELECT DISTINCT period_id, end_period_id, start_date, end_date
3126: FROM cn_process_batches_all
3127: WHERE physical_batch_id = p_batch_id;
3128:
3129: l_period_id NUMBER;
3130: l_end_period_id NUMBER;

Line 3148: from cn_process_batches_all

3144: BEGIN
3145: cn_message_pkg.debug('Reversing transactions in physical batch (ID='||p_batch_id||')');
3146:
3147: select org_id into l_org_id
3148: from cn_process_batches_all
3149: where physical_batch_id = p_batch_id
3150: and rownum = 1;
3151:
3152: -- mark process_all_flag = 'Y'

Line 3156: and a.salesrep_id in (select salesrep_id from cn_process_batches_all

3152: -- mark process_all_flag = 'Y'
3153: update cn_srp_intel_periods_all a
3154: set a.process_all_flag = 'Y'
3155: where a.org_id = l_org_id
3156: and a.salesrep_id in (select salesrep_id from cn_process_batches_all
3157: where physical_batch_id = p_batch_id)
3158: and a.period_id >= (select min(period_id) from cn_process_batches_all
3159: where physical_batch_id = p_batch_id
3160: and salesrep_id = a.salesrep_id)

Line 3158: and a.period_id >= (select min(period_id) from cn_process_batches_all

3154: set a.process_all_flag = 'Y'
3155: where a.org_id = l_org_id
3156: and a.salesrep_id in (select salesrep_id from cn_process_batches_all
3157: where physical_batch_id = p_batch_id)
3158: and a.period_id >= (select min(period_id) from cn_process_batches_all
3159: where physical_batch_id = p_batch_id
3160: and salesrep_id = a.salesrep_id)
3161: and a.period_id <= (select max(end_period_id) from cn_process_batches_all
3162: where physical_batch_id = p_batch_id

Line 3161: and a.period_id <= (select max(end_period_id) from cn_process_batches_all

3157: where physical_batch_id = p_batch_id)
3158: and a.period_id >= (select min(period_id) from cn_process_batches_all
3159: where physical_batch_id = p_batch_id
3160: and salesrep_id = a.salesrep_id)
3161: and a.period_id <= (select max(end_period_id) from cn_process_batches_all
3162: where physical_batch_id = p_batch_id
3163: and salesrep_id = a.salesrep_id);
3164:
3165: -- create reversal of posting line

Line 3186: FROM cn_process_batches_all

3182:
3183: loop
3184: DELETE /*+ index(line cn_commission_lines_n7) */ cn_commission_lines_all line
3185: WHERE line.credited_salesrep_id IN (SELECT salesrep_id
3186: FROM cn_process_batches_all
3187: WHERE physical_batch_id = p_batch_id)
3188: AND line.processed_period_id BETWEEN l_period_id AND l_end_period_id
3189: AND line.processed_date BETWEEN l_start_date AND l_end_date
3190: AND line.status <> 'OBSOLETE'

Line 3206: cn_process_batches_all batch

3202: DELETE cn_commission_lines_all del_line
3203: WHERE del_line.commission_line_id IN
3204: (SELECT line.commission_line_id
3205: FROM cn_commission_lines_all line,
3206: cn_process_batches_all batch
3207: WHERE batch.physical_batch_id = p_batch_id
3208: AND line.org_id = batch.org_id
3209: AND line.credited_salesrep_id = batch.salesrep_id
3210: AND line.processed_period_id BETWEEN batch.period_id AND batch.end_period_id

Line 3230: from cn_process_batches_all

3226: -- bonus trx are all non accumulative, so 'ITD', 'GRP' doesn't apply.
3227: IF (l_unique_flag = 'Y') THEN
3228: delete cn_commission_headers_all ch
3229: where ch.direct_salesrep_id in (select salesrep_id
3230: from cn_process_batches_all
3231: where physical_batch_id = p_batch_id)
3232: and ch.processed_date between l_start_date and l_end_date
3233: AND (ch.trx_type IN ('GRP', 'ITD') OR ch.parent_header_id = -1)
3234: and ch.org_id = l_org_id;

Line 3240: cn_process_batches_all batch

3236: DELETE cn_commission_headers_all head
3237: WHERE head.commission_header_id IN
3238: ( SELECT dh.commission_header_id
3239: FROM cn_commission_headers_all dh,
3240: cn_process_batches_all batch
3241: WHERE batch.physical_batch_id = p_batch_id
3242: AND dh.org_id = batch.org_id
3243: AND batch.salesrep_id = dh.direct_salesrep_id
3244: AND dh.processed_date BETWEEN batch.start_date AND batch.end_date

Line 3260: cn_process_batches_all batch

3256: last_update_login = g_last_update_login
3257: WHERE up_header.commission_header_id IN
3258: ( SELECT header.commission_header_id
3259: FROM cn_commission_headers_all header,
3260: cn_process_batches_all batch
3261: WHERE batch.physical_batch_id = p_batch_id
3262: AND batch.salesrep_id = header.direct_salesrep_id
3263: AND header.org_id = batch.org_id
3264: AND header.status <> 'OBSOLETE'

Line 3278: FROM cn_process_batches_all

3274: last_updated_by = g_last_updated_by,
3275: last_update_login = g_last_update_login
3276: WHERE org_id = l_org_id
3277: AND direct_salesrep_id IN (SELECT salesrep_id
3278: FROM cn_process_batches_all
3279: WHERE physical_batch_id = p_batch_id)
3280: AND processed_date BETWEEN l_start_date AND l_end_date
3281: AND status <> 'OBSOLETE'
3282: AND ((p_calc_type ='FORECAST' AND trx_type = 'FORECAST')

Line 3288: PROCEDURE Revert_Batch_nonintel_bonus(p_batch_id cn_process_batches.physical_batch_id%TYPE) IS

3284: END IF;
3285: END Revert_Batch_nonintel;
3286:
3287: -- do non intelligent revert for bonus calc
3288: PROCEDURE Revert_Batch_nonintel_bonus(p_batch_id cn_process_batches.physical_batch_id%TYPE) IS
3289: l_interval_type_id NUMBER;
3290: l_calc_sub_batch_id NUMBER;
3291: l_counter NUMBER;
3292: l_org_id NUMBER;

Line 3298: FROM cn_process_batches_all

3294: CURSOR l_sub_batch_csr IS
3295: SELECT calc_sub_batch_id, interval_type_id, org_id
3296: FROM cn_calc_submission_batches_all
3297: WHERE logical_batch_id IN (SELECT logical_batch_id
3298: FROM cn_process_batches_all
3299: WHERE physical_batch_id = p_batch_id
3300: AND rownum = 1);
3301:
3302: CURSOR l_quota_count_csr IS

Line 3310: cn_process_batches_all batch

3306:
3307: CURSOR l_post_lines IS
3308: select cl.commission_line_id
3309: FROM cn_commission_lines_all cl,
3310: cn_process_batches_all batch
3311: WHERE batch.physical_batch_id = p_batch_id
3312: AND batch.salesrep_id = cl.credited_salesrep_id
3313: and cl.org_id = l_org_id
3314: --and cl.processed_period_id between batch.period_id and batch.end_period_id

Line 3351: cn_process_batches_all batch

3347: delete from cn_commission_headers_all
3348: where commission_header_id in (
3349: select cl.commission_header_id
3350: from cn_commission_lines_all cl,
3351: cn_process_batches_all batch
3352: where batch.physical_batch_id = p_batch_id
3353: and batch.salesrep_id = cl.credited_salesrep_id
3354: and cl.org_id = l_org_id
3355: --and cl.processed_period_id between batch.period_id and batch.end_period_id

Line 3370: cn_process_batches_all batch

3366: delete from cn_commission_lines_all
3367: where commission_line_id in (
3368: select cl.commission_line_id
3369: from cn_commission_lines_all cl,
3370: cn_process_batches_all batch
3371: where batch.physical_batch_id = p_batch_id
3372: and batch.salesrep_id = cl.credited_salesrep_id
3373: and cl.org_id =l_org_id
3374: --and cl.processed_period_id between batch.period_id and batch.end_period_id

Line 3386: Procedure revert_batch (p_batch_id cn_process_batches.physical_batch_id%TYPE) IS

3382: where calc_sub_batch_id = l_calc_sub_batch_id)));
3383: END Revert_Batch_nonintel_bonus;
3384:
3385:
3386: Procedure revert_batch (p_batch_id cn_process_batches.physical_batch_id%TYPE) IS
3387: l_intel_calc_flag VARCHAR2(30);
3388: l_calc_type VARCHAR2(30);
3389: BEGIN
3390:

Line 3711: FROM cn_process_batches_all

3707: end_period_id,
3708: start_date,
3709: end_date,
3710: org_id
3711: FROM cn_process_batches_all
3712: WHERE physical_batch_id = p_physical_batch_id;
3713:
3714: l_calc_type VARCHAR2(30);
3715: BEGIN