71: SELECT split_from_line_id
72: FROM OE_ORDER_LINES_ALL
73: WHERE line_id = p_order_line_id; --AMITAMKU fixed Bug 14262288
74:
75: l_precedence NUMBER := fnd_api.g_miss_num;
76: l_dummy1 NUMBER;
77: l_dummy2 NUMBER;
78: l_offer_market_option_id NUMBER;
79: l_vol_track_type VARCHAR2(30);
262: l_api_name CONSTANT VARCHAR2(30) := 'insert_volume';
263: l_currency_code VARCHAR2(15);
264: l_convert_amt NUMBER;
265: l_return_status VARCHAR2(1);
266: l_exchange_rate_type VARCHAR2(30) := FND_API.G_MISS_CHAR;
267: l_rate NUMBER;
268: BEGIN
269: SAVEPOINT create_volume;
270: x_return_status := Fnd_Api.g_ret_sts_success;
266: l_exchange_rate_type VARCHAR2(30) := FND_API.G_MISS_CHAR;
267: l_rate NUMBER;
268: BEGIN
269: SAVEPOINT create_volume;
270: x_return_status := Fnd_Api.g_ret_sts_success;
271: ozf_utility_pvt.write_conc_log('========================= Insert Volume =========================');
272: ozf_utility_pvt.write_conc_log('offer_id: ' || p_offer_id);
273:
274: IF p_offer_id IS NOT NULL THEN
392: ,p_from_amount => p_volume_detail_rec.amount
393: ,x_to_amount => l_convert_amt
394: ,x_rate => l_rate); --7030415
395:
396: IF l_return_status <> fnd_api.g_ret_sts_success THEN
397: ozf_utility_pvt.write_conc_log('Convert Currency failed');
398: RAISE Fnd_Api.g_exc_unexpected_error;
399: END IF;
400:
394: ,x_rate => l_rate); --7030415
395:
396: IF l_return_status <> fnd_api.g_ret_sts_success THEN
397: ozf_utility_pvt.write_conc_log('Convert Currency failed');
398: RAISE Fnd_Api.g_exc_unexpected_error;
399: END IF;
400:
401: IF p_volume_detail_rec.source_code = 'OM' THEN
402: l_current_volume := l_convert_amt; -- for OM return order, amount is already negative
548: END IF; --end l_volume_track_type = 'GROUP'
549:
550:
551: -- 2. distributor's volume
552: --IF p_volume_detail_rec.sold_from_cust_account_id IS NOT NULL AND p_volume_detail_rec.sold_from_cust_account_id <> fnd_api.g_miss_num THEN
553: IF p_indirect_flag = 'R' THEN -- indirect sales
554: ozf_utility_pvt.write_conc_log('distributor ' || l_volume_exists);
555: --insert distributor's volume in to volume summary int table
556: INSERT INTO ozf_volume_summary_int
792: END IF; -- end l_volume_exists
793: END IF; -- end l_volume_track_type = 'GROUP'
794:
795: -- 2. distributor's volume
796: --IF p_volume_detail_rec.sold_from_cust_account_id IS NOT NULL AND p_volume_detail_rec.sold_from_cust_account_id <> fnd_api.g_miss_num THEN
797: IF p_indirect_flag = 'R' THEN -- indirect sales
798: l_volume_exists := 'N';
799: IF p_volume_detail_rec.sold_from_cust_account_id IS NOT NULL THEN
800: OPEN c_individual_volume_exists(p_offer_id, 'DISTRIBUTOR', p_volume_detail_rec.sold_from_cust_account_id, l_pbh_line_id);
1023:
1024:
1025: EXCEPTION
1026: WHEN OTHERS THEN
1027: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
1028: ROLLBACK TO insert_volume;
1029: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR )
1030: THEN
1031: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1032: END IF;
1033: Fnd_Msg_Pub.Count_AND_Get
1034: ( p_count => x_msg_count,
1035: p_data => x_msg_data,
1036: p_encoded => Fnd_Api.G_FALSE
1037: );
1038: END insert_volume;
1039:
1040:
1105: l_api_name CONSTANT VARCHAR2(30) := 'create_volume';
1106:
1107: BEGIN
1108: SAVEPOINT create_volume;
1109: x_return_status := Fnd_Api.g_ret_sts_success;
1110: ozf_utility_pvt.write_conc_log('========================= Create Volume =========================');
1111: ozf_utility_pvt.write_conc_log('enter creat_volume : ' || p_volume_detail_rec.line_id);
1112: ozf_utility_pvt.write_conc_log('source_code ' || p_volume_detail_rec.source_code);
1113: ozf_utility_pvt.write_conc_log('transfer_type ' || p_volume_detail_rec.transfer_type);
1131: ELSIF p_volume_detail_rec.transfer_type = 'OUT' THEN
1132: l_sign := -1;
1133: END IF;
1134:
1135: IF p_qp_list_header_id IS NULL OR p_qp_list_header_id = fnd_api.g_miss_num THEN
1136: FOR l_offer_id_om IN c_offer_id_om(p_volume_detail_rec.line_id, l_object_type) loop
1137: ozf_utility_pvt.write_conc_log('OM offer_id 1: ' || l_offer_id_om.offer_id);
1138:
1139: -- Catch Weight - start
1233: ELSIF p_volume_detail_rec.transfer_type = 'OUT' THEN
1234: l_sign := 1;
1235: END IF;
1236:
1237: IF p_qp_list_header_id IS NULL OR p_qp_list_header_id = fnd_api.g_miss_num THEN
1238: FOR l_offer_id_is IN c_offer_id_is(p_volume_detail_rec.line_id, l_object_type) LOOP
1239:
1240: ozf_utility_pvt.write_conc_log('IS offer_id 1: ' || l_offer_id_is.offer_id);
1241: ozf_utility_pvt.write_conc_log('IS p_use_vol_smry_stg_tbl ' || p_use_vol_smry_stg_tbl);
1333: ozf_utility_pvt.write_conc_log('indirect_flag ' || l_indirect_flag);
1334:
1335: EXCEPTION
1336: WHEN OTHERS THEN
1337: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
1338: ROLLBACK TO create_volume;
1339: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR )
1340: THEN
1341: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1342: END IF;
1343: Fnd_Msg_Pub.Count_AND_Get
1344: ( p_count => x_msg_count,
1345: p_data => x_msg_data,
1346: p_encoded => Fnd_Api.G_FALSE
1347: );
1348: END create_volume;
1349:
1350:
1838: l_trx_date DATE;
1839: l_api_name CONSTANT VARCHAR2(30) := 'get_volume_2';
1840: BEGIN
1841: SAVEPOINT get_volume_2;
1842: x_return_status := Fnd_Api.g_ret_sts_success;
1843:
1844: OPEN c_volume_detail;
1845: FETCH c_volume_detail INTO l_cust_account_id, l_bill_to, l_ship_to;
1846: CLOSE c_volume_detail;
1919: END IF;
1920:
1921: EXCEPTION
1922: WHEN OTHERS THEN
1923: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
1924: ROLLBACK TO get_volume_2;
1925: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR )
1926: THEN
1927: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1928: END IF;
1929: Fnd_Msg_Pub.Count_AND_Get
1930: ( p_count => x_msg_count,
1931: p_data => x_msg_data,
1932: p_encoded => Fnd_Api.G_FALSE
1933: );
1934: END get_volume;
1935:
1936:
2385: l_api_name CONSTANT VARCHAR2(30) := 'update_tracking_line';
2386: BEGIN
2387: SAVEPOINT update_tracking_line;
2388:
2389: x_return_status := Fnd_Api.g_ret_sts_success;
2390:
2391: UPDATE ozf_order_group_prod
2392: SET order_line_id = p_resale_line_id,
2393: indirect_flag = 'R'
2396: AND indirect_flag = 'I';
2397:
2398: EXCEPTION
2399: WHEN OTHERS THEN
2400: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
2401: ROLLBACK TO update_tracking_line;
2402: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR )
2403: THEN
2404: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
2405: END IF;
2406: Fnd_Msg_Pub.Count_AND_Get
2407: ( p_count => x_msg_count,
2408: p_data => x_msg_data,
2409: p_encoded => Fnd_Api.G_FALSE
2410: );
2411: END update_tracking_line;
2412:
2413:
2678: FOR adjustment_line_rec IN c_existing_lines LOOP
2679: OPEN c_list_line_id(adjustment_line_rec.qp_list_header_id);
2680: FETCH c_list_line_id INTO l_list_line_id;
2681: CLOSE c_list_line_id;
2682: IF adjustment_line_rec.prod_attribute IS NOT NULL AND adjustment_line_rec.prod_attribute <> FND_API.G_MISS_CHAR THEN
2683: l_req_line_attrs_tbl(i).attribute_type := 'PRODUCT';
2684: l_req_line_attrs_tbl(i).attribute := adjustment_line_rec.prod_attribute;
2685: l_req_line_attrs_tbl(i).value := adjustment_line_rec.prod_attr_value;
2686: END IF;