1 package EAM_METER_READINGS_JSP AUTHID CURRENT_USER AS
2 /* $Header: EAMMRRJS.pls 115.5 2002/11/19 23:53:13 aan ship $
3 $Author: aan $ */
4 -- Author : YULIN
5 -- Created : 6/1/01 1:18:57 PM
6 -- Purpose : API for JSP pages to call to add meter reading
7
8 -- Public type declarations
9 -- Standard who
10 g_last_updated_by NUMBER(15) := FND_GLOBAL.USER_ID;
11 g_created_by NUMBER(15) := FND_GLOBAL.USER_ID;
12 g_last_update_login NUMBER(15) := FND_GLOBAL.LOGIN_ID;
13 g_request_id NUMBER(15) := FND_GLOBAL.CONC_REQUEST_ID;
14 g_program_application_id NUMBER(15) := FND_GLOBAL.PROG_APPL_ID;
15 g_program_id NUMBER(15) := FND_GLOBAL.CONC_PROGRAM_ID;
16
17 /**
18 * Wrapper function. Retrun 'Yes'/'No' for if a job has
19 * has mandatory meter readings or not.
20 */
21 -------------------------------------------------------------------------------
22 -- check if work order has mandatory meter reading
23 function has_mandatory_meter_reading(p_wip_entity_id in number) return varchar2;
24
25 -------------------------------------------------------------------------------
26 -- check if meter is mandatory
27 function is_meter_reading_mandatory( p_wip_entity_id in number, p_meter_id in number) RETURN VARCHAR2;
28
29 -------------------------------------------------------------------------------
30 -- get the last reading's meter reading id of a meter
31 function get_latest_meter_reading_id( p_meter_id in number) RETURN NUMBER;
32
33 -------------------------------------------------------------------------
34 --- insert a meter reading row into eam_meter_readings table
35 -------------------------------------------------------------------------
36 procedure insert_row
37 (
38 p_meter_id IN NUMBER
39 ,p_current_reading IN NUMBER
40 ,p_current_reading_date IN DATE
41 ,p_reset_flag IN VARCHAR2
42 ,p_life_to_date_reading IN NUMBER
43 ,p_wip_entity_id IN NUMBER
44 ,p_description IN VARCHAR2
45 );
46
47 -------------------------------------------------------------------------
48 -- caculate current reading and current life to date reading
49 -------------------------------------------------------------------------
50 procedure get_current_reading_data
51 (
52 p_reading IN NUMBER
53 ,p_reading_change IN NUMBER
54 ,p_reset_flag IN VARCHAR2
55 ,p_meter_direction IN NUMBER
56 ,p_before_reading IN NUMBER
57 ,p_before_ltd_reading IN NUMBER
58 ,p_after_reading IN NUMBER
59 ,p_after_ltd_reading IN NUMBER
60 ,p_reading_date IN DATE
61 ,p_meter_name IN VARCHAR2
62 ,x_current_reading OUT NOCOPY NUMBER
63 ,x_current_ltd_reading OUT NOCOPY NUMBER
64 ,p_mtr_warning_shown IN OUT NOCOPY VARCHAR2
65 -- ,x_return_status OUT VARCHAR2
66 -- ,x_msg_count OUT NUMBER
67 -- ,x_msg_data OUT VARCHAR2
68 );
69
70 -------------------------------------------------------------------------
71 -- check asset and meter associating
72 -------------------------------------------------------------------------
73 procedure check_asset_meter_association
74 (
75 p_meter_id IN NUMBER
76 ,p_wip_entity_id IN NUMBER
77 ,p_org_id IN NUMBER := NULL
78 ,p_asset_number IN VARCHAR2 := NULL
79 ,p_asset_group_id IN NUMBER := NULL
80 ,x_return_status OUT NOCOPY VARCHAR2
81 ,x_msg_count OUT NOCOPY NUMBER
82 ,x_msg_data OUT NOCOPY VARCHAR2
83 );
84
85 --------------------------------------------------------------------------------------
86 -- get the reading that is just before/after the current reading date
87 -- we need to know the previous reading data and next reading data to do validation
88 --------------------------------------------------------------------------------------
89 procedure get_adjacent_reading
90 (
91 p_before IN VARCHAR2 := FND_API.G_TRUE
92 ,p_meter_id IN NUMBER
93 ,p_reading_date IN DATE
94 ,x_reading_id OUT NOCOPY NUMBER
95 ,x_reading_date OUT NOCOPY DATE
96 ,x_reading OUT NOCOPY NUMBER
97 ,x_ltd_reading OUT NOCOPY NUMBER
98 );
99
100 ------------------------------------------------------------------------------------
101 -- record a meter reading data
102 ------------------------------------------------------------------------------------
103 procedure add_meter_reading
104 ( p_api_version IN NUMBER := 1.0
105 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
106 ,p_commit IN VARCHAR2 := FND_API.G_FALSE
107 ,p_validate_only IN VARCHAR2 := FND_API.G_TRUE
108 ,p_record_version_number IN NUMBER := NULL
109 ,x_return_status OUT NOCOPY VARCHAR2
110 ,x_msg_count OUT NOCOPY NUMBER
111 ,x_msg_data OUT NOCOPY VARCHAR2
112 ,p_wip_entity_id IN NUMBER -- data
113 ,p_meter_id IN NUMBER
114 ,p_reading_date IN DATE
115 ,p_reading IN NUMBER
116 ,p_reading_change IN NUMBER
117 ,p_reset_flag IN VARCHAR2
118 ,p_mtr_warning_shown IN OUT NOCOPY VARCHAR2
119 );
120
121 end EAM_METER_READINGS_JSP;