1 PACKAGE BODY PA_CLIENT_EXTN_RET_COST_TYPE AS
2 -- $Header: PACCXRCB.pls 120.0 2005/05/30 03:07:24 appldev noship $
3
4 FUNCTION RETIREMENT_COST_TYPE
5 (p_expenditure_item_id IN NUMBER,
6 p_cdl_line_number IN NUMBER,
7 p_expenditure_type IN VARCHAR2) RETURN VARCHAR2 IS
8
9
10 v_retirement_cost_type VARCHAR2(30) := 'COR';
11 v_count NUMBER := 0;
12
13 BEGIN
14 /* This is a client extension function called by the GENERATE_RET_ASSET_LINES procedure,
15 in order to determine the Retirement Cost Type of each expenditure item. Retirement
16 Cost Type can either be 'COR' for Costs of Removal or 'POS' for Proceeds of Sale. This
17 function must return one of those two values, or downstream processing errors will result.
18
19 The intended use of this extension is to provide clients with the ability to modify
20 or override the standard logic for determining Retirement Cost Type, based on their own
21 business rules. The standard application logic, located in this function, checks to see
22 if the expenditure type of the EI exists in the PROCEEDS_OF_SALE_EXP_TYPES
23 Lookup Set. If so, the function will return 'POS', otherwise it will return 'COR'.
24
25 One example of a customer business rule may be to derive the Retirement Cost Type based
26 on the Task Service Type, or some other task indicator. Customer logic may be inserted
27 into the function where indicated below.
28
29 */
30
31 --Determine if the current Expenditure Type occurs in the POS Exp Types Lookup Set
32 SELECT COUNT(*)
33 INTO v_count
34 FROM pa_lookups
35 WHERE lookup_type = 'PROCEEDS_OF_SALE_EXP_TYPES'
36 AND lookup_code = upper(p_expenditure_type); -- Adding upper() for Bug3290556
37 /* AND lookup_code = p_expenditure_type;*/ -- Commenting out for Bug3290556
38
39 IF v_count > 0 THEN
40 v_retirement_cost_type := 'POS';
41 ELSE
42 v_retirement_cost_type := 'COR';
43 END IF;
44
45 /* If customers wish to modify or override the determination of Retirement Cost Type, they may do so HERE */
46
47 RETURN(v_retirement_cost_type);
48
49 EXCEPTION
50 WHEN OTHERS THEN
51 RAISE;
52 END;
53
54 END;