232: FND_LOG.STRING(FND_LOG.LEVEL_UNEXPECTED,
233: 'cn.plsql.cn_formula_common_pkg.revert_posting_line.exception',
234: sqlerrm);
235: end if;
236: cn_message_pkg.debug('Exception occurs in reversing posted line (ID='|| p_commission_line_id||')');
237: cn_message_pkg.debug(sqlerrm);
238: RAISE;
239: END revert_posting_line;
240:
233: 'cn.plsql.cn_formula_common_pkg.revert_posting_line.exception',
234: sqlerrm);
235: end if;
236: cn_message_pkg.debug('Exception occurs in reversing posted line (ID='|| p_commission_line_id||')');
237: cn_message_pkg.debug(sqlerrm);
238: RAISE;
239: END revert_posting_line;
240:
241: PROCEDURE Select_Tier( p_rate_dim_sequence NUMBER,
296: FND_LOG.STRING(FND_LOG.LEVEL_UNEXPECTED,
297: 'cn.plsql.cn_formula_common_pkg.select_tier.exception',
298: sqlerrm);
299: end if;
300: cn_message_pkg.debug('Exception occurs in identifying rate tier:');
301: cn_message_pkg.debug('p_direction=' || p_direction);
302: cn_message_pkg.debug('p_quota_achieved='|| p_quota_achieved);
303: cn_message_pkg.debug(sqlerrm);
304: RAISE;
297: 'cn.plsql.cn_formula_common_pkg.select_tier.exception',
298: sqlerrm);
299: end if;
300: cn_message_pkg.debug('Exception occurs in identifying rate tier:');
301: cn_message_pkg.debug('p_direction=' || p_direction);
302: cn_message_pkg.debug('p_quota_achieved='|| p_quota_achieved);
303: cn_message_pkg.debug(sqlerrm);
304: RAISE;
305: END Select_Tier;
298: sqlerrm);
299: end if;
300: cn_message_pkg.debug('Exception occurs in identifying rate tier:');
301: cn_message_pkg.debug('p_direction=' || p_direction);
302: cn_message_pkg.debug('p_quota_achieved='|| p_quota_achieved);
303: cn_message_pkg.debug(sqlerrm);
304: RAISE;
305: END Select_Tier;
306:
299: end if;
300: cn_message_pkg.debug('Exception occurs in identifying rate tier:');
301: cn_message_pkg.debug('p_direction=' || p_direction);
302: cn_message_pkg.debug('p_quota_achieved='|| p_quota_achieved);
303: cn_message_pkg.debug(sqlerrm);
304: RAISE;
305: END Select_Tier;
306:
307: PROCEDURE get_rate_sequence(p_number_dim NUMBER ,
329: 'cn.plsql.cn_formula_common_pkg.get_rate_sequence.exception',
330: sqlerrm);
331: end if;
332:
333: cn_message_pkg.debug('Exception occurs in getting rate sequence: ');
334: cn_message_pkg.debug(sqlerrm);
335: RAISE;
336: END get_rate_sequence;
337:
330: sqlerrm);
331: end if;
332:
333: cn_message_pkg.debug('Exception occurs in getting rate sequence: ');
334: cn_message_pkg.debug(sqlerrm);
335: RAISE;
336: END get_rate_sequence;
337:
338:
796: 'cn.plsql.cn_formula_common_pkg.get_rates.exception',
797: sqlerrm);
798: end if;
799:
800: cn_message_pkg.debug('Exception occurs in getting commission rate: ');
801: cn_message_pkg.debug(sqlerrm);
802: RAISE;
803: END get_rates;
804:
797: sqlerrm);
798: end if;
799:
800: cn_message_pkg.debug('Exception occurs in getting commission rate: ');
801: cn_message_pkg.debug(sqlerrm);
802: RAISE;
803: END get_rates;
804:
805: PROCEDURE delete_itd_trx( p_salesrep_id NUMBER ,
1132: setting can be calculated incrementally.
1133: ******************************************************************************/
1134: IF (nvl(cn_system_parameters.value('CN_PRIOR_ADJUSTMENT', l_org_id), 'N') = 'N' ) THEN
1135: l_incremental_flag := 'Y';
1136: cn_message_pkg.debug('Profile CN_PRIOR_ADJUSTMENT has value: No ');
1137: END IF;
1138:
1139: /******************************************************************************
1140: 1). when process_all_flag = 'Y', do non incremental calc.
1151: ELSE
1152: x_select_status_flag := 'P';
1153: END IF;
1154:
1155: cn_message_pkg.debug('Parameters that control the calculation initialization');
1156: cn_message_pkg.debug('--p_process_all_flag: ' || p_process_all_flag);
1157: cn_message_pkg.debug('--l_incremental_flag: ' || l_incremental_flag);
1158: cn_message_pkg.debug('--p_select_status_flag: ' || x_select_status_flag);
1159: cn_message_pkg.debug('--p_trx_group_code: ' || p_trx_group_code);
1152: x_select_status_flag := 'P';
1153: END IF;
1154:
1155: cn_message_pkg.debug('Parameters that control the calculation initialization');
1156: cn_message_pkg.debug('--p_process_all_flag: ' || p_process_all_flag);
1157: cn_message_pkg.debug('--l_incremental_flag: ' || l_incremental_flag);
1158: cn_message_pkg.debug('--p_select_status_flag: ' || x_select_status_flag);
1159: cn_message_pkg.debug('--p_trx_group_code: ' || p_trx_group_code);
1160:
1153: END IF;
1154:
1155: cn_message_pkg.debug('Parameters that control the calculation initialization');
1156: cn_message_pkg.debug('--p_process_all_flag: ' || p_process_all_flag);
1157: cn_message_pkg.debug('--l_incremental_flag: ' || l_incremental_flag);
1158: cn_message_pkg.debug('--p_select_status_flag: ' || x_select_status_flag);
1159: cn_message_pkg.debug('--p_trx_group_code: ' || p_trx_group_code);
1160:
1161: -- initialize ptd value to be 0, ptd = 0;
1154:
1155: cn_message_pkg.debug('Parameters that control the calculation initialization');
1156: cn_message_pkg.debug('--p_process_all_flag: ' || p_process_all_flag);
1157: cn_message_pkg.debug('--l_incremental_flag: ' || l_incremental_flag);
1158: cn_message_pkg.debug('--p_select_status_flag: ' || x_select_status_flag);
1159: cn_message_pkg.debug('--p_trx_group_code: ' || p_trx_group_code);
1160:
1161: -- initialize ptd value to be 0, ptd = 0;
1162: x_input_achieved_ptd(1) := 0;
1155: cn_message_pkg.debug('Parameters that control the calculation initialization');
1156: cn_message_pkg.debug('--p_process_all_flag: ' || p_process_all_flag);
1157: cn_message_pkg.debug('--l_incremental_flag: ' || l_incremental_flag);
1158: cn_message_pkg.debug('--p_select_status_flag: ' || x_select_status_flag);
1159: cn_message_pkg.debug('--p_trx_group_code: ' || p_trx_group_code);
1160:
1161: -- initialize ptd value to be 0, ptd = 0;
1162: x_input_achieved_ptd(1) := 0;
1163: x_output_achieved_ptd := 0;
1248:
1249: -- case3 : IF l_incremental_flag = 'Y' and trx_group_code = 'INDIVIDUAL'
1250: -- itd = itd, ptd = ptd
1251: IF l_incremental_flag = 'Y' AND p_trx_group_code = 'INDIVIDUAL' THEN
1252: cn_message_pkg.debug('p_trx_group_code: ' || p_trx_group_code );
1253:
1254: SELECT nvl(quota.input_achieved_itd,0), Nvl( quota.input_achieved_ptd, 0),
1255: nvl(quota.output_achieved_itd,0), Nvl(quota.output_achieved_ptd, 0),
1256: nvl(quota.perf_achieved_itd, 0), Nvl(quota.perf_achieved_ptd, 0),
1283:
1284: END IF;
1285: END IF; -- end of p_process_all_flag check
1286:
1287: cn_message_pkg.debug('Initialized values');
1288: FOR i IN 1..x_input_achieved_itd.COUNT LOOP
1289: cn_message_pkg.debug('--x_input_achieved_itd: ' || x_input_achieved_itd(i));
1290: END LOOP;
1291:
1285: END IF; -- end of p_process_all_flag check
1286:
1287: cn_message_pkg.debug('Initialized values');
1288: FOR i IN 1..x_input_achieved_itd.COUNT LOOP
1289: cn_message_pkg.debug('--x_input_achieved_itd: ' || x_input_achieved_itd(i));
1290: END LOOP;
1291:
1292: cn_message_pkg.debug('--x_output_achieved_itd: ' || x_output_achieved_itd);
1293: cn_message_pkg.debug('--x_perf_achieved_itd: ' || x_perf_achieved_itd);
1288: FOR i IN 1..x_input_achieved_itd.COUNT LOOP
1289: cn_message_pkg.debug('--x_input_achieved_itd: ' || x_input_achieved_itd(i));
1290: END LOOP;
1291:
1292: cn_message_pkg.debug('--x_output_achieved_itd: ' || x_output_achieved_itd);
1293: cn_message_pkg.debug('--x_perf_achieved_itd: ' || x_perf_achieved_itd);
1294: cn_message_pkg.debug('--x_commission_payed_itd: ' || x_commission_payed_itd );
1295:
1296: FOR i IN 1..x_input_achieved_ptd.COUNT LOOP
1289: cn_message_pkg.debug('--x_input_achieved_itd: ' || x_input_achieved_itd(i));
1290: END LOOP;
1291:
1292: cn_message_pkg.debug('--x_output_achieved_itd: ' || x_output_achieved_itd);
1293: cn_message_pkg.debug('--x_perf_achieved_itd: ' || x_perf_achieved_itd);
1294: cn_message_pkg.debug('--x_commission_payed_itd: ' || x_commission_payed_itd );
1295:
1296: FOR i IN 1..x_input_achieved_ptd.COUNT LOOP
1297: cn_message_pkg.debug('--x_input_achieved_ptd: ' || x_input_achieved_ptd(i));
1290: END LOOP;
1291:
1292: cn_message_pkg.debug('--x_output_achieved_itd: ' || x_output_achieved_itd);
1293: cn_message_pkg.debug('--x_perf_achieved_itd: ' || x_perf_achieved_itd);
1294: cn_message_pkg.debug('--x_commission_payed_itd: ' || x_commission_payed_itd );
1295:
1296: FOR i IN 1..x_input_achieved_ptd.COUNT LOOP
1297: cn_message_pkg.debug('--x_input_achieved_ptd: ' || x_input_achieved_ptd(i));
1298: END LOOP;
1293: cn_message_pkg.debug('--x_perf_achieved_itd: ' || x_perf_achieved_itd);
1294: cn_message_pkg.debug('--x_commission_payed_itd: ' || x_commission_payed_itd );
1295:
1296: FOR i IN 1..x_input_achieved_ptd.COUNT LOOP
1297: cn_message_pkg.debug('--x_input_achieved_ptd: ' || x_input_achieved_ptd(i));
1298: END LOOP;
1299: cn_message_pkg.debug('--x_output_achieved_ptd: ' || x_output_achieved_ptd);
1300: cn_message_pkg.debug('--x_perf_achieved_ptd: ' || x_perf_achieved_ptd);
1301: cn_message_pkg.debug('--x_commission_payed_ptd: ' || x_commission_payed_ptd );
1295:
1296: FOR i IN 1..x_input_achieved_ptd.COUNT LOOP
1297: cn_message_pkg.debug('--x_input_achieved_ptd: ' || x_input_achieved_ptd(i));
1298: END LOOP;
1299: cn_message_pkg.debug('--x_output_achieved_ptd: ' || x_output_achieved_ptd);
1300: cn_message_pkg.debug('--x_perf_achieved_ptd: ' || x_perf_achieved_ptd);
1301: cn_message_pkg.debug('--x_commission_payed_ptd: ' || x_commission_payed_ptd );
1302:
1303: ELSIF p_calc_type = 'BONUS' THEN
1296: FOR i IN 1..x_input_achieved_ptd.COUNT LOOP
1297: cn_message_pkg.debug('--x_input_achieved_ptd: ' || x_input_achieved_ptd(i));
1298: END LOOP;
1299: cn_message_pkg.debug('--x_output_achieved_ptd: ' || x_output_achieved_ptd);
1300: cn_message_pkg.debug('--x_perf_achieved_ptd: ' || x_perf_achieved_ptd);
1301: cn_message_pkg.debug('--x_commission_payed_ptd: ' || x_commission_payed_ptd );
1302:
1303: ELSIF p_calc_type = 'BONUS' THEN
1304: -- do nothing since we already initialize ptd =0 and itd = itd - ptd
1297: cn_message_pkg.debug('--x_input_achieved_ptd: ' || x_input_achieved_ptd(i));
1298: END LOOP;
1299: cn_message_pkg.debug('--x_output_achieved_ptd: ' || x_output_achieved_ptd);
1300: cn_message_pkg.debug('--x_perf_achieved_ptd: ' || x_perf_achieved_ptd);
1301: cn_message_pkg.debug('--x_commission_payed_ptd: ' || x_commission_payed_ptd );
1302:
1303: ELSIF p_calc_type = 'BONUS' THEN
1304: -- do nothing since we already initialize ptd =0 and itd = itd - ptd
1305: -- because bonus type formula are guaranteed to be NON-cumulative, INDIVIDUAL, NON-itd
1539: p_srp_pe_subledger => l_srp_pe_subledger);
1540:
1541:
1542: FOR l_counter IN 1..l_msg_count LOOP
1543: cn_message_pkg.debug( substr(FND_MSG_PUB.get(p_msg_index => l_counter,
1544: p_encoded => FND_API.G_FALSE), 1, 249 ));
1545: END LOOP;
1546: EXCEPTION
1547: WHEN OTHERS THEN
1550: 'cn.plsql.cn_formula_common_pkg.calculate_roll.exception',
1551: sqlerrm);
1552: end if;
1553:
1554: cn_message_pkg.debug('Exception occurs in calculate_roll ');
1555: cn_message_pkg.debug(sqlerrm);
1556: RAISE;
1557: END calculate_roll;
1558:
1551: sqlerrm);
1552: end if;
1553:
1554: cn_message_pkg.debug('Exception occurs in calculate_roll ');
1555: cn_message_pkg.debug(sqlerrm);
1556: RAISE;
1557: END calculate_roll;
1558:
1559: -- Work as a dispatcher to invoke the corresponding cn_formula_id_pkg.calculate_quota
1614: AND q.org_id = f.org_id(+);
1615:
1616: if (l_debug_flag = 'Y') then
1617: select name into l_statement from cn_salesreps where salesrep_id = p_salesrep_id and org_id = l_org_id;
1618: cn_message_pkg.debug('Resource: '||l_statement);
1619: cn_message_pkg.debug('Plan element: '||l_pe_name);
1620: cn_message_pkg.debug('Formula: '||l_formula_name);
1621: cn_message_pkg.debug('Calculation parameters:');
1622: cn_message_pkg.debug('--p_srp_plan_assign_id: ' || p_srp_plan_assign_id);
1615:
1616: if (l_debug_flag = 'Y') then
1617: select name into l_statement from cn_salesreps where salesrep_id = p_salesrep_id and org_id = l_org_id;
1618: cn_message_pkg.debug('Resource: '||l_statement);
1619: cn_message_pkg.debug('Plan element: '||l_pe_name);
1620: cn_message_pkg.debug('Formula: '||l_formula_name);
1621: cn_message_pkg.debug('Calculation parameters:');
1622: cn_message_pkg.debug('--p_srp_plan_assign_id: ' || p_srp_plan_assign_id);
1623: cn_message_pkg.debug('--p_salesrep_id: ' || p_salesrep_id);
1616: if (l_debug_flag = 'Y') then
1617: select name into l_statement from cn_salesreps where salesrep_id = p_salesrep_id and org_id = l_org_id;
1618: cn_message_pkg.debug('Resource: '||l_statement);
1619: cn_message_pkg.debug('Plan element: '||l_pe_name);
1620: cn_message_pkg.debug('Formula: '||l_formula_name);
1621: cn_message_pkg.debug('Calculation parameters:');
1622: cn_message_pkg.debug('--p_srp_plan_assign_id: ' || p_srp_plan_assign_id);
1623: cn_message_pkg.debug('--p_salesrep_id: ' || p_salesrep_id);
1624: cn_message_pkg.debug('--p_period_id: ' || p_period_id);
1617: select name into l_statement from cn_salesreps where salesrep_id = p_salesrep_id and org_id = l_org_id;
1618: cn_message_pkg.debug('Resource: '||l_statement);
1619: cn_message_pkg.debug('Plan element: '||l_pe_name);
1620: cn_message_pkg.debug('Formula: '||l_formula_name);
1621: cn_message_pkg.debug('Calculation parameters:');
1622: cn_message_pkg.debug('--p_srp_plan_assign_id: ' || p_srp_plan_assign_id);
1623: cn_message_pkg.debug('--p_salesrep_id: ' || p_salesrep_id);
1624: cn_message_pkg.debug('--p_period_id: ' || p_period_id);
1625: cn_message_pkg.debug('--p_start_date: ' || p_start_date);
1618: cn_message_pkg.debug('Resource: '||l_statement);
1619: cn_message_pkg.debug('Plan element: '||l_pe_name);
1620: cn_message_pkg.debug('Formula: '||l_formula_name);
1621: cn_message_pkg.debug('Calculation parameters:');
1622: cn_message_pkg.debug('--p_srp_plan_assign_id: ' || p_srp_plan_assign_id);
1623: cn_message_pkg.debug('--p_salesrep_id: ' || p_salesrep_id);
1624: cn_message_pkg.debug('--p_period_id: ' || p_period_id);
1625: cn_message_pkg.debug('--p_start_date: ' || p_start_date);
1626: cn_message_pkg.debug('--p_quota_id: ' || p_quota_id);
1619: cn_message_pkg.debug('Plan element: '||l_pe_name);
1620: cn_message_pkg.debug('Formula: '||l_formula_name);
1621: cn_message_pkg.debug('Calculation parameters:');
1622: cn_message_pkg.debug('--p_srp_plan_assign_id: ' || p_srp_plan_assign_id);
1623: cn_message_pkg.debug('--p_salesrep_id: ' || p_salesrep_id);
1624: cn_message_pkg.debug('--p_period_id: ' || p_period_id);
1625: cn_message_pkg.debug('--p_start_date: ' || p_start_date);
1626: cn_message_pkg.debug('--p_quota_id: ' || p_quota_id);
1627: cn_message_pkg.debug('--p_intel_calc_flag: ' || p_intel_calc_flag);
1620: cn_message_pkg.debug('Formula: '||l_formula_name);
1621: cn_message_pkg.debug('Calculation parameters:');
1622: cn_message_pkg.debug('--p_srp_plan_assign_id: ' || p_srp_plan_assign_id);
1623: cn_message_pkg.debug('--p_salesrep_id: ' || p_salesrep_id);
1624: cn_message_pkg.debug('--p_period_id: ' || p_period_id);
1625: cn_message_pkg.debug('--p_start_date: ' || p_start_date);
1626: cn_message_pkg.debug('--p_quota_id: ' || p_quota_id);
1627: cn_message_pkg.debug('--p_intel_calc_flag: ' || p_intel_calc_flag);
1628: cn_message_pkg.debug('--p_calc_type: ' || p_calc_type);
1621: cn_message_pkg.debug('Calculation parameters:');
1622: cn_message_pkg.debug('--p_srp_plan_assign_id: ' || p_srp_plan_assign_id);
1623: cn_message_pkg.debug('--p_salesrep_id: ' || p_salesrep_id);
1624: cn_message_pkg.debug('--p_period_id: ' || p_period_id);
1625: cn_message_pkg.debug('--p_start_date: ' || p_start_date);
1626: cn_message_pkg.debug('--p_quota_id: ' || p_quota_id);
1627: cn_message_pkg.debug('--p_intel_calc_flag: ' || p_intel_calc_flag);
1628: cn_message_pkg.debug('--p_calc_type: ' || p_calc_type);
1629: end if;
1622: cn_message_pkg.debug('--p_srp_plan_assign_id: ' || p_srp_plan_assign_id);
1623: cn_message_pkg.debug('--p_salesrep_id: ' || p_salesrep_id);
1624: cn_message_pkg.debug('--p_period_id: ' || p_period_id);
1625: cn_message_pkg.debug('--p_start_date: ' || p_start_date);
1626: cn_message_pkg.debug('--p_quota_id: ' || p_quota_id);
1627: cn_message_pkg.debug('--p_intel_calc_flag: ' || p_intel_calc_flag);
1628: cn_message_pkg.debug('--p_calc_type: ' || p_calc_type);
1629: end if;
1630:
1623: cn_message_pkg.debug('--p_salesrep_id: ' || p_salesrep_id);
1624: cn_message_pkg.debug('--p_period_id: ' || p_period_id);
1625: cn_message_pkg.debug('--p_start_date: ' || p_start_date);
1626: cn_message_pkg.debug('--p_quota_id: ' || p_quota_id);
1627: cn_message_pkg.debug('--p_intel_calc_flag: ' || p_intel_calc_flag);
1628: cn_message_pkg.debug('--p_calc_type: ' || p_calc_type);
1629: end if;
1630:
1631: IF l_quota_type = 'FORMULA' THEN
1624: cn_message_pkg.debug('--p_period_id: ' || p_period_id);
1625: cn_message_pkg.debug('--p_start_date: ' || p_start_date);
1626: cn_message_pkg.debug('--p_quota_id: ' || p_quota_id);
1627: cn_message_pkg.debug('--p_intel_calc_flag: ' || p_intel_calc_flag);
1628: cn_message_pkg.debug('--p_calc_type: ' || p_calc_type);
1629: end if;
1630:
1631: IF l_quota_type = 'FORMULA' THEN
1632: l_statement := 'begin cn_formula_' || abs(l_formula_id) || '_' || abs(l_org_id) || '_pkg';
1665: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
1666: 'cn.plsql.cn_formula_common_pkg.calculate_quota.end',
1667: 'End of Calculate_Quota.');
1668: end if;
1669: cn_message_pkg.debug('Finish caculating plan element: '||l_pe_name);
1670: cn_message_pkg.debug(' ');
1671: EXCEPTION
1672: WHEN OTHERS THEN
1673: if (FND_LOG.LEVEL_UNEXPECTED >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
1666: 'cn.plsql.cn_formula_common_pkg.calculate_quota.end',
1667: 'End of Calculate_Quota.');
1668: end if;
1669: cn_message_pkg.debug('Finish caculating plan element: '||l_pe_name);
1670: cn_message_pkg.debug(' ');
1671: EXCEPTION
1672: WHEN OTHERS THEN
1673: if (FND_LOG.LEVEL_UNEXPECTED >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
1674: FND_LOG.STRING(FND_LOG.LEVEL_UNEXPECTED,
1674: FND_LOG.STRING(FND_LOG.LEVEL_UNEXPECTED,
1675: 'cn.plsql.cn_formula_common_pkg.calculate_quota.exception',
1676: sqlerrm);
1677: end if;
1678: cn_message_pkg.debug('Excpetion occurs in calculate_quota dispatcher: ');
1679: cn_message_pkg.debug(sqlerrm);
1680: RAISE;
1681: END calculate_quota;
1682:
1675: 'cn.plsql.cn_formula_common_pkg.calculate_quota.exception',
1676: sqlerrm);
1677: end if;
1678: cn_message_pkg.debug('Excpetion occurs in calculate_quota dispatcher: ');
1679: cn_message_pkg.debug(sqlerrm);
1680: RAISE;
1681: END calculate_quota;
1682:
1683:
1976: OPEN l_check_calc_entry_csr(spp.salesrep_id, spp.period_id);
1977: FETCH l_check_calc_entry_csr INTO l_counter;
1978:
1979: IF l_check_calc_entry_csr%found THEN
1980: cn_message_pkg.debug('Process plan elements in notify log only (try incremental calc)');
1981: FOR l_pe IN l_srp_quotas_csr(spp.srp_plan_assign_id, spp.salesrep_id, spp.period_id) LOOP
1982: if (l_quota_sequence > l_pe.quota_sequence) then
1983: l_quota_sequence := l_pe.quota_sequence;
1984: end if;
2005: swap_dates ( l_current_processed_date, l_next_processed_date);
2006:
2007: END LOOP;
2008: ELSE
2009: cn_message_pkg.debug('Process plan elements in notify log only (Non incremental calc)');
2010: FOR l_pe IN l_srp_quotas_csr(spp.srp_plan_assign_id, spp.salesrep_id, spp.period_id) LOOP
2011: open l_notify_log_csr(spp.salesrep_id, spp.period_id, l_pe.quota_id);
2012: fetch l_notify_log_csr into l_counter;
2013: if (l_notify_log_csr%found or l_pe.quota_sequence > l_quota_sequence) then
2164: x_msg_data => l_msg_data,
2165: p_srp_subledger => l_srp_subledger);
2166:
2167: IF l_return_status <> FND_API.g_ret_sts_success THEN
2168: cn_message_pkg.debug('Exception occurs in updating subledgers:');
2169: FOR l_counter IN 1..l_msg_count LOOP
2170: cn_message_pkg.debug(FND_MSG_PUB.get(p_msg_index => l_counter,
2171: p_encoded => FND_API.G_FALSE));
2172: fnd_file.put_line(fnd_file.Log, fnd_msg_pub.get(p_msg_index => l_counter,
2166:
2167: IF l_return_status <> FND_API.g_ret_sts_success THEN
2168: cn_message_pkg.debug('Exception occurs in updating subledgers:');
2169: FOR l_counter IN 1..l_msg_count LOOP
2170: cn_message_pkg.debug(FND_MSG_PUB.get(p_msg_index => l_counter,
2171: p_encoded => FND_API.G_FALSE));
2172: fnd_file.put_line(fnd_file.Log, fnd_msg_pub.get(p_msg_index => l_counter,
2173: p_encoded => FND_API.G_FALSE));
2174: END LOOP;
2188: 'cn.plsql.cn_formula_common_pkg.calculate_batch.exception',
2189: sqlerrm);
2190: end if;
2191:
2192: cn_message_pkg.debug('Exception occurs in calculate_batch: ');
2193: cn_message_pkg.rollback_errormsg_commit(sqlerrm);
2194: raise;
2195: END calculate_batch;
2196:
2189: sqlerrm);
2190: end if;
2191:
2192: cn_message_pkg.debug('Exception occurs in calculate_batch: ');
2193: cn_message_pkg.rollback_errormsg_commit(sqlerrm);
2194: raise;
2195: END calculate_batch;
2196:
2197: -- p_commission_header_id will be the commisson_header_id of the reversal trx created
2681: AND cl.org_id = l_org_id
2682: AND cl.processed_date BETWEEN p_start_date AND p_end_date);
2683:
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
3097: FND_LOG.STRING(FND_LOG.LEVEL_UNEXPECTED,
3098: 'cn.plsql.cn_formula_common_pkg.revert_batch_intel_comm.exception',
3099: sqlerrm);
3100: end if;
3101: cn_message_pkg.debug('Exception occurs in reversing transactions: ');
3102: cn_message_pkg.debug(sqlerrm );
3103: RAISE;
3104: END revert_batch_intel_comm;
3105:
3098: 'cn.plsql.cn_formula_common_pkg.revert_batch_intel_comm.exception',
3099: sqlerrm);
3100: end if;
3101: cn_message_pkg.debug('Exception occurs in reversing transactions: ');
3102: cn_message_pkg.debug(sqlerrm );
3103: RAISE;
3104: END revert_batch_intel_comm;
3105:
3106: -- do non intelligent revert. revert every system generated trxs
3141: l_conc_request_id NUMBER(15) := fnd_global.conc_request_id;
3142: l_prog_appl_id NUMBER(15) := fnd_global.prog_appl_id ;
3143:
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
3323: cl.quota_id in (select quota_id from cn_calc_sub_quotas_all
3324: where calc_sub_batch_id = l_calc_sub_batch_id));
3325:
3326: BEGIN
3327: cn_message_pkg.debug('Reversing transactions in physical batch (ID='||p_batch_id||')');
3328:
3329: OPEN l_sub_batch_csr;
3330: FETCH l_sub_batch_csr INTO l_calc_sub_batch_id, l_interval_type_id, l_org_id;
3331: CLOSE l_sub_batch_csr;
3413: 'cn.plsql.cn_formula_common_pkg.revert_batch.exception',
3414: sqlerrm);
3415: end if;
3416:
3417: cn_message_pkg.debug('Exception occurs in reversing transactions: ');
3418: cn_message_pkg.rollback_errormsg_commit(sqlerrm);
3419: raise;
3420: END revert_batch;
3421:
3414: sqlerrm);
3415: end if;
3416:
3417: cn_message_pkg.debug('Exception occurs in reversing transactions: ');
3418: cn_message_pkg.rollback_errormsg_commit(sqlerrm);
3419: raise;
3420: END revert_batch;
3421:
3422: -- create a new group by trx if not existed update the existing group by trx if already existed
3641: 'cn.plsql.cn_formula_common_pkg.create_trx.begin',
3642: 'Within create_trx.');
3643: end if;
3644:
3645: cn_message_pkg.debug('Creating or updating system-generated transaction ');
3646:
3647: IF p_trx_rec.trx_type = 'GRP' THEN
3648: create_update_grp_trx(p_trx_rec);
3649: ELSIF p_trx_rec.trx_type = 'ITD' THEN
3693: 'cn.plsql.cn_formula_common_pkg.create_trx.exception',
3694: sqlerrm);
3695: end if;
3696:
3697: cn_message_pkg.debug('Exception occurs in creating or updating system-generated transaction: ');
3698: cn_message_pkg.debug(sqlerrm);
3699: RAISE;
3700: END create_trx ;
3701:
3694: sqlerrm);
3695: end if;
3696:
3697: cn_message_pkg.debug('Exception occurs in creating or updating system-generated transaction: ');
3698: cn_message_pkg.debug(sqlerrm);
3699: RAISE;
3700: END create_trx ;
3701:
3702: -- populate the event_factor, payment_factor, quota_factor and payees