DBA Data[Home] [Help]

PACKAGE: APPS.AMS_REFRESHMETRIC_PVT

Source


1 PACKAGE Ams_Refreshmetric_Pvt AUTHID CURRENT_USER AS
2 /* $Header: amsvmrss.pls 115.25 2002/11/12 23:42:14 jieli ship $ */
3 
4 --
5 -- Start of comments.
6 --
7 -- NAME
8 --   Ams_RefreshMetric_Pvt
9 --
10 -- PURPOSE
11 --   This package is a private package used to refresh Metrics
12 --	 It will recalculate the value of the Metric and Update the Activity Metric as
13 --   well as corrosponding Usage tables with new metric values.
14 --   This Also contains code to create Seeded Metrics from Templates defined.
15 --   This Package also takes care of Apportioning .
16 --
17 --   Procedures:
18 --   Refresh_Metric
19 --   Update_ActMetric
20 --   Lock_ActMetric
21 --   Delete_ActMetric
22 --   Validate_ActMetric
23 --
24 -- NOTES
25 --
26 --
27 -- HISTORY
28 -- 10/20/1999   ptendulk	   Created
29 -- 10/11/2000	sveerave	   Commented convert_currency.
30 -- 08/21/2001  dmvincen    Added refresh_metric with object parameters.
31 -- 08/21/2001  dmvincen    Added check_object_status for canceled.
32 --
33 -- 15-Jan-2002   huili        Added the "p_update_history" to the
34 --                            "Refresh_Act_metrics" module.
35 -- End of comments.
36 --
37 
38 -- Start of comments
39 -- API Name       Refresh_Metric
40 -- Type           Private
41 -- Pre-reqs       None.
42 -- Function       Re-calculate the value for a given activity metric.
43 -- Parameters
44 --    IN          p_api_version               IN NUMBER     Required
45 --                p_init_msg_list             IN VARCHAR2   Optional
46 --                Default := FND_API.G_FALSE
47 --                p_commit                    IN VARCHAR2   Optional
48 --                 Default := FND_API.G_FALSE
49 --                p_activity_metric_id        IN NUMBER  Required
50 --				      p_refresh_type 			    IN VARCHAR2 Required
51 --		            p_refresh_function	       IN VARCHAR2 Optional
52 --    OUT         x_return_status             OUT VARCHAR2
53 --                x_msg_count                 OUT NUMBER
54 --                x_msg_data                  OUT VARCHAR2
55 -- Version        Current version: 1.0
56 --                Previous version: 1.0
57 --                Initial version: 1.0
58 -- End of comments
59 
60 PROCEDURE Refresh_Metric (
61    p_api_version                 IN    NUMBER,
62    p_init_msg_list               IN    VARCHAR2 := Fnd_Api.G_TRUE,
63    p_commit                      IN    VARCHAR2 := Fnd_Api.G_FALSE,
64    x_return_status               OUT NOCOPY   VARCHAR2,
65    x_msg_count                   OUT NOCOPY   NUMBER,
66    x_msg_data                    OUT NOCOPY   VARCHAR2,
67    p_activity_metric_id          IN    NUMBER,
68    p_refresh_type                IN    VARCHAR2,
69    p_refresh_function            IN   VARCHAR2 := Fnd_Api.G_TRUE
70 );
71 
72 -- Start of Comments
73 --
74 -- NAME
75 --   Refresh_Act_metrics
76 --
77 -- PURPOSE
78 --   This procedure wrapes around Refresh_Metric and is called
79 --   from concurrent program
80 --
81 -- NOTES
82 --
83 --
84 -- HISTORY
85 --   05/02/1999      bgeorge    created
86 -- End of Comments
87 
88 PROCEDURE Refresh_Act_metrics (
89      errbuf        OUT NOCOPY    VARCHAR2,
90      retcode       OUT NOCOPY    NUMBER,
91 	  p_update_history IN  VARCHAR2 := Fnd_Api.G_FALSE
92 );
93 
94 -- Start of comments
95 -- API Name       GetMetricCatVal
96 -- Type           Private
97 -- Pre-reqs       None.
98 -- Function       --   Returns the functional forecasted value, committed value, actual
99 --   value depending on Return type for a given metric.
100 --
101 -- Parameters
102 --    IN          p_arc_act_metric_used_by       IN VARCHAR2     Required
103 --                p_act_metric_used_by_id        IN NUMBER       Required
104 --                p_metric_category              IN VARCHAR2     Required
105 --                p_return_type    				 IN VARCHAR2     Required
106 --    OUT         x_return_status         OUT VARCHAR2
107 --                x_value                 OUT NUMBER
108 -- Version        Current version: 1.0
109 --                Previous version: 1.0
110 --                Initial version: 1.0
111 -- End of comments
112 
113 PROCEDURE GetMetCatVal (
114    x_return_status               OUT NOCOPY VARCHAR2,
115    p_arc_act_metric_used_by      IN  VARCHAR2,
116    p_act_metric_used_by_id       IN  NUMBER,
117    p_metric_category             IN  VARCHAR2,
118    p_return_type       		 IN  VARCHAR2,
119    x_value        		 OUT NOCOPY NUMBER
120  ) ;
121 
122 -- Start of comments
123 -- API Name       Copy_seeded_Metric
124 -- Type           Private
125 -- Pre-reqs       None.
126 -- Function       This Procedure is called when a new Usage(Campaign/Event/Del.)
127 -- 				  is Created. This will check the templates defined for the given
128 --				  usage ,usage type and will copy the metrics associated with
129 --				  this Template to the Activity Metric.
130 --    			  For e.g. when Campaign c1 is created with type type1 , this
131 --				  process will check the template defined for campaigns (or if
132 --				  avilable Template for this Campaign for this campaign type )  .
133 --				  If Metric M1,M2,M3 are attached to Campaigns then the rows are
134 --				  inserted into Activity Metric table for M1,M2,M3 attached to C1
135 -- Parameters
136 --    IN          p_api_version               IN NUMBER     Required
137 --                p_init_msg_list             IN VARCHAR2   Optional
138 --                       Default := FND_API.G_FALSE
139 --                p_commit                    IN VARCHAR2   Optional
140 --                       Default := FND_API.G_FALSE
141 --                p_act_arc_metric_used_by    IN VARCHAR2   Required
142 --				  p_act_metric_used_by_id 	  IN NUMBER		Required
143 --                p_act_metric_used_by_type   IN VARCHAR2   Required
144 --    OUT         x_return_status             OUT VARCHAR2
145 --                x_msg_count                 OUT NUMBER
146 --                x_msg_data                  OUT VARCHAR2
147 -- Version        Current version: 1.0
148 --                Previous version: 1.0
149 --                Initial version: 1.0
150 -- End of comments
151 
152 
153 PROCEDURE Copy_Seeded_Metric (
154    p_api_version           	 IN  NUMBER,
155    p_init_msg_list         	 IN  VARCHAR2 := Fnd_Api.G_FALSE,
156    p_commit                	 IN  VARCHAR2 := Fnd_Api.G_FALSE,
157    x_return_status         	 OUT NOCOPY VARCHAR2,
158    x_msg_count             	 OUT NOCOPY NUMBER,
159    x_msg_data              	 OUT NOCOPY VARCHAR2,
160    p_arc_act_metric_used_by	 IN  VARCHAR2 ,
161    p_act_metric_used_by_id 	 IN  NUMBER ,
162    p_act_metric_used_by_type IN  VARCHAR2
163 );
164 
165 -- Start of comments
166 -- API Name       Create_Apport_Metric
167 -- Type           Private
168 -- Pre-reqs       None.
169 -- Function       This Procedure is called when a new Object association
170 -- 				  is created.This will create Activity Metric in AMS_ACT_METRICS_ALL
171 --				  with the details of the association.
172 --
173 -- Parameters
174 --    IN          p_api_version           IN NUMBER     Required
175 --                p_init_msg_list         IN VARCHAR2   Optional
176 --                       Default := FND_API.G_FALSE
177 --                p_commit                IN VARCHAR2   Optional
178 --                       Default := FND_API.G_FALSE
179 --                p_obj_association_id    IN NUMBER  Required
180 --    OUT         x_return_status         OUT VARCHAR2
181 --                x_msg_count             OUT NUMBER
182 --                x_msg_data              OUT VARCHAR2
183 -- Version        Current version: 1.0
184 --                Previous version: 1.0
185 --                Initial version: 1.0
186 -- End of comments
187 
188 
189 PROCEDURE Create_Apport_Metric(
190    p_api_version           	 IN  NUMBER,
191    p_init_msg_list         	 IN  VARCHAR2 := Fnd_Api.G_FALSE,
192    p_commit                	 IN  VARCHAR2 := Fnd_Api.G_FALSE,
193    x_return_status         	 OUT NOCOPY VARCHAR2,
194    x_msg_count             	 OUT NOCOPY NUMBER,
195    x_msg_data              	 OUT NOCOPY VARCHAR2,
196    p_obj_association_id 	 IN  NUMBER
197 );
198 
199 
200 -- Start of comments
201 -- API Name       Convert_Uom
202 -- Type           Private
203 -- Pre-reqs       None.
204 -- Function       This Procedure will  call the Inventory API to convert Uom
205 --    			  It will return the calculated quantity (in UOM of to_uom_code )
206 --    			  All the Calculations to calculate Value of the metrics
207 --    			  are done in Base Uom defined for that Metric. So the First step
208 --    			  before calculation starts is to convert the UOM into Base UOM.
209 --    			  Once the Value is calculated it's converted back to the Original
210 --    			  UOM Activity Metric table will be updated with this UOM
211 --
212 -- Parameters
213 --    IN          p_from_uom_code       		 IN VARCHAR2     Required
214 --		  p_to_uom_code       		 	 IN VARCHAR2     Required
215 --		  p_from_quantity			 IN NUMBER       Required
216 --                p_precision        			 IN NUMBER       Optional
217 --                p_from_uom_name			 IN VARCHAR2     Optional
218 --                p_to_uom_name				 IN VARCHAR2     Optional
219 --    OUT         Converted UOM quanity 		 NUMBER
220 -- Version        Current version: 1.0
221 --                Previous version: 1.0
222 --                Initial version: 1.0
223 -- End of comments
224 
225 FUNCTION Convert_Uom(
226    p_from_uom_code    	 	 	 IN  VARCHAR2,
227    p_to_uom_code    	 	 	 IN  VARCHAR2,
228    p_from_quantity				 IN	 NUMBER,
229    p_precision					 IN	 NUMBER   DEFAULT NULL,
230    p_from_uom_name				 IN  VARCHAR2 DEFAULT NULL,
231    p_to_uom_name			 	 IN  VARCHAR2 DEFAULT NULL
232 ) RETURN NUMBER ;
233 
234 
235 -- API Name       Refresh_Metric
236 -- Type           Private
237 -- Pre-reqs       None.
238 -- Function       Re-calculate the value for a given activity metric.
239 -- Parameters
240 --    IN          p_api_version               IN NUMBER     Required
241 --                p_init_msg_list             IN VARCHAR2   Optional
242 --                Default := FND_API.G_FALSE
243 --                p_commit                    IN VARCHAR2   Optional
244 --                 Default := FND_API.G_FALSE
245 --                p_arc_act_metric_used_by    IN VARCHAR2  Required
246 --                p_act_metric_used_by_id     IN NUMBER  Required
247 --		            p_refresh_function	       IN VARCHAR2 Optional
248 --    OUT         x_return_status             OUT VARCHAR2
249 --                x_msg_count                 OUT NUMBER
250 --                x_msg_data                  OUT VARCHAR2
251 -- Version        Current version: 1.0
252 --                Previous version: 1.0
253 --                Initial version: 1.0
254 PROCEDURE Refresh_Metric (
255    p_api_version                 IN     NUMBER,
256    p_init_msg_list               IN     VARCHAR2 := Fnd_Api.G_TRUE,
257    p_commit                      IN     VARCHAR2 := Fnd_Api.G_FALSE,
258    x_return_status               OUT NOCOPY    VARCHAR2,
259    x_msg_count                   OUT NOCOPY    NUMBER,
260    x_msg_data                    OUT NOCOPY    VARCHAR2,
261    p_arc_act_metric_used_by      IN     VARCHAR2,
262 	p_act_metric_used_by_id       IN     NUMBER,
263    p_refresh_function            IN     VARCHAR2 := Fnd_Api.G_TRUE
264 );
265 
266 -- API Name       check_object_status
267 -- Type           Private
268 -- Pre-reqs       None.
269 -- Function       Check if the object has been canceled.
270 --
271 -- Parameters
272 --    IN          p_activity_metric_id    		 IN  NUMBER       Required
273 --	  	  p_conv_date       		 	 IN  DATE         Required
274 --		  p_func_amount				 IN  NUMBER       Required
275 --    OUT         x_return_status			 OUT VARCHAR2
276 --		  x_trans_amount			 OUT NUMBER
277 -- Version        Current version: 1.0
278 --                Previous version: 1.0
279 --                Initial version: 1.0
280 PROCEDURE check_object_status(
281    p_arc_act_metric_used_by IN VARCHAR2,
282 	p_act_metric_used_by_id IN NUMBER,
283 	x_is_canceled OUT NOCOPY VARCHAR2
284 );
285 
286 END Ams_Refreshmetric_Pvt;