[Home] [Help]
1: PACKAGE BODY CSE_ASSET_UTIL_PKG AS
2: /* $Header: CSEFAUTB.pls 120.29.12010000.1 2008/07/30 05:17:36 appldev ship $ */
3:
4: l_debug varchar2(1) := NVL(fnd_profile.value('cse_debug_option'),'N');
5:
70: l_description VARCHAR2(80);
71: x_hook_used PLS_INTEGER;
72: i NUMBER := 0;
73: e_error EXCEPTION ;
74: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.asset_description';
75:
76: -- For Non Serialized items, Asset description is not based on item as we may
77: -- have asset for multiple items
78:
136: l_api_name VARCHAR2(100) ;
137:
138: BEGIN
139: x_return_status := fnd_api.G_RET_STS_SUCCESS ;
140: l_api_name := 'CSE_ASSET_UTIL_PKG.asset_category';
141: cse_asset_client_ext_stub.get_asset_category
142: (p_asset_attrib_rec, --modified the signature for R12
143: x_hook_used,
144: x_error_msg);
213: x_hook_used PLS_INTEGER;
214: l_txn_process_flag VARCHAR2(1);
215: l_asset_creation_code VARCHAR2(1);
216: e_error EXCEPTION;
217: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.Book_Type';
218: l_txn_ou_context NUMBER; -- Bug 6492235, added to support multiple FA book
219: BEGIN
220: x_return_status := fnd_api.G_RET_STS_SUCCESS ;
221: cse_asset_client_ext_stub.get_book_type(p_asset_attrib_rec, --modified the signature for R12
361: BEGIN
362:
363: x_return_status := fnd_api.g_ret_sts_success ;
364:
365: debug('inside cse_asset_util_pkg.date_place_in_service');
366:
367: cse_asset_client_ext_stub.get_date_place_in_service(
368: p_asset_attrib_rec,
369: x_date_place_in_service,
397: l_date_place_in_service := l_transaction_date;
398: ELSE
399:
400: IF nvl(p_asset_attrib_rec.book_type_code, fnd_api.g_miss_char) = fnd_api.g_miss_char THEN
401: l_book_type_code := cse_asset_util_pkg.book_type(p_asset_attrib_rec,
402: x_error_msg,
403: x_return_status);
404: IF x_return_status <> fnd_api.G_RET_STS_SUCCESS THEN
405: RAISE fnd_api.g_exc_error ;
441: x_return_status OUT NOCOPY VARCHAR2) RETURN NUMBER
442: IS
443: l_asset_key_ccid NUMBER;
444: l_hook_used PLS_INTEGER;
445: l_api_name VARCHAR2(100) := 'cse_asset_util_pkg.asset_key';
446: BEGIN
447: x_return_status := fnd_api.g_ret_sts_success;
448: cse_asset_client_ext_stub.get_asset_key(p_asset_attrib_rec,
449: l_asset_key_ccid,
506:
507: BEGIN
508:
509: x_return_status := fnd_api.G_RET_STS_SUCCESS ;
510: l_api_name := 'CSE_ASSET_UTIL_PKG.get_wip_assembly_cost';
511:
512: debug('Begining of Calculation of Wip cost ');
513:
514: OPEN wip_cost_cur(p_asset_attrib_rec.source_header_ref_id);
556: l_flex_code varchar2(4) := 'GL#' ;
557: l_hook_used pls_integer;
558: l_category_conc_seg varchar2(80);
559:
560: l_api_name varchar2(100) := 'cse_asset_util_pkg.deprn_expense_ccod';
561: l_return_status varchar2(1) := fnd_api.g_ret_sts_success;
562: l_error_message varchar2(2000);
563:
564: CURSOR fab_control_cur (c_book_type_code IN VARCHAR2) IS
604: IF nvl(p_asset_attrib_rec.book_type_code, fnd_api.g_miss_char) <> fnd_api.g_miss_char THEN
605: l_book_type_code := p_asset_attrib_rec.book_type_code;
606: ELSE
607:
608: l_book_type_code := cse_asset_util_pkg.book_type(
609: p_asset_attrib_rec => p_asset_attrib_rec,
610: x_error_msg => l_error_message,
611: x_return_status => l_return_status);
612:
628: IF nvl(p_asset_attrib_rec.asset_category_id, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
629: l_category_id := p_asset_attrib_rec.asset_category_id;
630: ELSE
631:
632: l_category_id := cse_asset_util_pkg.asset_category(
633: p_asset_attrib_rec => p_asset_attrib_rec,
634: x_error_msg => l_error_message,
635: x_return_status => l_return_status);
636:
727: l_search_method VARCHAR2(4);
728: x_search_method VARCHAR2(4);
729: x_hook_used PLS_INTEGER;
730: e_error EXCEPTION;
731: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.search_method';
732:
733:
734: BEGIN
735: x_return_status := fnd_api.G_RET_STS_SUCCESS ;
910: BEGIN
911:
912: x_return_status := fnd_api.g_ret_sts_success;
913:
914: debug('inside cse_asset_util_pkg.payables_ccid');
915:
916: cse_asset_client_ext_stub.get_payables_ccid(
917: p_asset_attrib_rec => p_asset_attrib_rec,
918: x_payables_ccid => l_asset_acct_ccid,
948: OPEN src_mv_txn_cur(p_asset_attrib_rec.transaction_id);
949: FETCH src_mv_txn_cur INTO l_src_txn_id ;
950: CLOSE src_mv_txn_cur;
951:
952: l_book_type_code := cse_asset_util_pkg.book_type(p_asset_attrib_rec,
953: l_error_message,
954: l_return_status);
955: IF l_return_status <> fnd_api.G_RET_STS_SUCCESS THEN
956: RAISE fnd_api.g_exc_error;
954: l_return_status);
955: IF l_return_status <> fnd_api.G_RET_STS_SUCCESS THEN
956: RAISE fnd_api.g_exc_error;
957: END IF ;
958: l_category_id := cse_asset_util_pkg.asset_category(p_asset_attrib_rec,
959: l_error_message,
960: l_return_status);
961: IF l_return_status <> fnd_api.G_RET_STS_SUCCESS THEN
962: RAISE fnd_api.g_exc_error;
1076: IS
1077: x_tag_number VARCHAR2(15);
1078: l_tag_number VARCHAR2(15);
1079: x_hook_used PLS_INTEGER;
1080: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.tag_number';
1081: BEGIN
1082: x_return_status := fnd_api.G_RET_STS_SUCCESS ;
1083: cse_asset_client_ext_stub.get_tag_number(p_asset_attrib_rec,
1084: x_tag_number,
1116: IS
1117: x_model_number VARCHAR2(40);
1118: l_model_number VARCHAR2(40);
1119: x_hook_used PLS_INTEGER;
1120: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.model_number';
1121: BEGIN
1122: x_return_status := fnd_api.G_RET_STS_SUCCESS ;
1123: cse_asset_client_ext_stub.get_model_number(p_asset_attrib_rec,
1124: x_model_number,
1155: IS
1156: x_manufacturer_name VARCHAR2(30);
1157: l_manufacturer_name VARCHAR2(30);
1158: x_hook_used PLS_INTEGER;
1159: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.manufacturer';
1160: BEGIN
1161: x_return_status := fnd_api.G_RET_STS_SUCCESS ;
1162: cse_asset_client_ext_stub.get_manufacturer(p_asset_attrib_rec,
1163: x_manufacturer_name,
1190: p_asset_attrib_rec IN OUT NOCOPY CSE_DATASTRUCTURES_PUB.asset_attrib_rec,
1191: x_error_msg OUT NOCOPY VARCHAR2,
1192: x_return_status OUT NOCOPY VARCHAR2) RETURN NUMBER
1193: IS
1194: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.employee';
1195: x_employee_id NUMBER;
1196: l_employee_id NUMBER;
1197: x_hook_used PLS_INTEGER;
1198: BEGIN
1220:
1221: FUNCTION inventory_item(
1222: p_asset_attrib_rec IN OUT NOCOPY CSE_DATASTRUCTURES_PUB.asset_attrib_rec)
1223: RETURN NUMBER IS
1224: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.inventory_item';
1225: l_inventory_item_id NUMBER;
1226: x_hook_used PLS_INTEGER;
1227: x_error_msg VARCHAR2(2000);
1228: BEGIN
1246: x_error_msg OUT NOCOPY VARCHAR2)
1247: IS
1248: l_cost NUMBER;
1249: l_units NUMBER;
1250: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.get_pending_retirements';
1251:
1252: CURSOR pending_rets_cur (c_distribution_id IN NUMBER)
1253: IS
1254: SELECT SUM(DECODE(fr.status,'PENDING', NVL(fr.cost_retired,0)*(-1),
1328: l_units NUMBER := 0;
1329: l_total_units NUMBER := 0;
1330: l_location_units NUMBER := 0;
1331: l_unit_ratio NUMBER := 1;
1332: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.get_pending_adjustments';
1333: l_mass_addition_id NUMBER;
1334: CURSOR pending_adj_cur
1335: IS
1336: SELECT SUM(NVL(fma.fixed_assets_cost,0)) cost ,
1410: x_error_msg OUT NOCOPY VARCHAR2)
1411: IS
1412: x_hook_used NUMBER := 0;
1413: l_catchup_flag VARCHAR2(1);
1414: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.get_catchup_dep_flag';
1415:
1416:
1417:
1418:
1505:
1506: l_change_owner_flag VARCHAR2(1);
1507:
1508: BEGIN
1509: l_api_name := 'CSE_ASSET_UTIL_PKG.check_txn_class';
1510:
1511: x_return_status := fnd_api.G_RET_STS_SUCCESS ;
1512:
1513: l_txn_type := p_asset_attrib_rec.source_transaction_type ;
1674: IS
1675: l_inv_subinventory_name VARCHAR2(10);
1676: l_inv_organization_id NUMBER ;
1677: l_instance_id NUMBER;
1678: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.validate_inst_asset' ;
1679: l_valid varchar(1);
1680:
1681:
1682:
1750: x_msg_count OUT NOCOPY NUMBER,
1751: x_msg_data OUT NOCOPY VARCHAR2 )
1752: IS
1753: x_error_msg VARCHAR2(2000);
1754: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.insert_mass_add' ;
1755:
1756: l_fixed_assets_cost NUMBER ;
1757: l_payables_cost NUMBER ;
1758: l_unrevalued_cost NUMBER ;
2113: -- 2. Location ID and Location Type
2114: -------------------------------------------------------------------------------
2115:
2116: PROCEDURE get_fa_location(
2117: p_inst_loc_rec IN cse_asset_util_pkg.inst_loc_rec,
2118: x_asset_location_id OUT NOCOPY NUMBER,
2119: x_return_status OUT NOCOPY VARCHAR2,
2120: x_error_msg OUT NOCOPY VARCHAR2 )
2121: IS
2178:
2179: BEGIN
2180:
2181: x_return_status := fnd_api.g_ret_sts_success ;
2182: debug('Inside cse_asset_util_pkg.get_fa_location');
2183:
2184: x_asset_location_id := NULL ;
2185:
2186: debug(' p_rec.transaction_id : '||p_inst_loc_rec.transaction_id);
2386: ,x_valid_to_retire_flag OUT NOCOPY VARCHAR2
2387: ,x_error_msg OUT NOCOPY VARCHAR2
2388: ,x_return_status OUT NOCOPY VARCHAR2)
2389: IS
2390: l_api_name VARCHAR2(100) := 'CSE_ASSET_UTIL_PKG.is_valid_to_retire';
2391:
2392: CURSOR check_current_period_add
2393: IS
2394: SELECT 'N'
2428: -------------------------------------------------------------------------------
2429: ---- Following process will identify the transaction action as
2430: ---- "Sale" or "Move" or "Rect" for Sales Order Transactions/RMA .
2431: -------------------------------------------------------------------------------
2432: PROCEDURE get_so_txn_action ( p_inst_txn_rec IN cse_asset_util_pkg.inst_txn_rec
2433: ,x_fa_action OUT NOCOPY VARCHAR2
2434: ,x_error_msg OUT NOCOPY VARCHAR2
2435: ,x_return_status OUT NOCOPY VARCHAR2
2436: )
2592:
2593: END validate_ccid_required;
2594:
2595:
2596: END cse_asset_util_pkg;