DBA Data[Home] [Help]

PACKAGE: APPS.INV_MGD_MVT_UTILS_PKG

Source


1 PACKAGE INV_MGD_MVT_UTILS_PKG AUTHID CURRENT_USER AS
2 /* $Header: INVUINTS.pls 120.5 2011/08/10 12:46:41 abhissri ship $ */
3 --+=======================================================================+
4 --|               Copyright (c) 1998 Oracle Corporation                   |
5 --|                       Redwood Shores, CA, USA                         |
6 --|                         All rights reserved.                          |
7 --+=======================================================================+
8 --| FILENAME                                                              |
9 --|     INVUINTS.pls                                                      |
10 --|                                                                       |
11 --| DESCRIPTION                                                           |
12 --|    Spec of INV_MGD_MVT_UTILS_PKG                                      |
13 --|                                                                       |
14 --| Mvt_Stats_Util_Info                                                   |
15 --| Calc_Unit_Weight                                                      |
16 --| Calc_Total_weight                                                     |
17 --| Get_Alternate_UOM                                                     |
18 --| Convert_alternate_Quantity                                            |
19 --| Convert_Territory_Code                                                |
20 --| Get_Commodity_Info                                                    |
21 --| Get_Category_Id                                                       |
22 --| Get_Site_Location                                                     |
23 --| Get_Org_Location                                                      |
24 --| Get_Vendor_Info                                                       |
25 --| Get_Cust_VAT_Number                                                   |
26 --| Get_Org_VAT_Number                                                    |
27 --| Get_Zone_Code                                                         |
28 --| Get_Subinv_Location                                                   |
29 --| Get_SO_Legal_Entity                                                   |
30 --| Get_Shipping_Legal_Entity                                             |
31 --| Get_LE_Currency                                                       |
32 --| Get_LE_Location                                                       |
33 --| Get_Weight_Precision                                                  |
34 --| Get_org_from_le                                                       |
35 --| HISTORY                                                               |
36 --|     04/11/2000 pseshadr        Created                                |
37 --|     05/26/2005 yawang        Added Get_LE_Currency for R12            |
38 --|                              Added Get_LE_Location for R12            |
39 --+======================================================================*/
40 
41 
42 --g_OPM_static_data INV_MGD_MVT_DATA_STR.array_OPM_stat_typ_transaction;
43 
44 --===================
45 -- CONSTANTS
46 --===================
47 
48 G_LOG_ERROR                   CONSTANT NUMBER := 5;
49 G_LOG_EXCEPTION               CONSTANT NUMBER := 4;
50 G_LOG_EVENT                   CONSTANT NUMBER := 3;
51 G_LOG_PROCEDURE               CONSTANT NUMBER := 2;
52 G_LOG_STATEMENT               CONSTANT NUMBER := 1;
53 
54 --===================
55 -- PROCEDURES AND FUNCTIONS
56 --===================
57 
58 --========================================================================
59 -- PROCEDURE : Mvt_Stats_Util_Info  PUBLIC
60 -- PARAMETERS: p_api_version_number    known api version
61 --             p_init_msg_list         FND_API.G_TRUE to reset list
62 --             x_return_status         return status
63 --             x_msg_count             number of messages in the list
64 --             x_msg_data              message text
65 --             p_stat_typ_transaction  IN  Stat type Usages record
66 --             x_movement_transaction  IN OUT  Movement Statistics Record
67 -- VERSION   : current version         1.0
68 --             initial version         1.0
69 -- COMMENT   : Utility procedure that calculates invoice info,
70 --             weight info, this procedure inturns calls the
71 --             functions and procedures described above.
72 --=========================================================================
73 PROCEDURE Mvt_Stats_Util_Info
74 ( p_stat_typ_transaction IN
75    INV_MGD_MVT_DATA_STR.Movement_Stat_Usages_Rec_Type
76 , x_movement_transaction IN OUT NOCOPY
77     INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
78 , x_return_status        OUT NOCOPY VARCHAR2
79 );
80 
81 --========================================================================
82 -- FUNCTION  : Get_Rate_Two_Uom Public
83 -- PARAMETERS:
84 --             p_item_id     Inventory Item
85 --             p_uom1        UOM1
86 --             p_uom2        UOM2
87 -- COMMENT   : Returns the conversion rate between the two passing in uoms
88 --=======================================================================
89 FUNCTION Get_Rate_Two_Uom
90 ( p_item_id    NUMBER
91 , p_uom1       VARCHAR2
92 , p_uom2       VARCHAR2
93 )
94 RETURN NUMBER;
95 
96 --========================================================================
97 -- FUNCTION : Calc_Unit_Weight PUBLIC
98 -- PARAMETERS:
99 --             p_inventory_item_id     Inventory Item
100 --             p_organization_id       Organization_id
101 --             p_stat_typ_uom_code     UOM defined in stat type usages
102 -- VERSION   : current version         1.0
103 --             initial version         1.0
104 -- COMMENT   : Returns the unit weight of an item
105 --
106 -- History   : yawang 23-APR-2002      add new parameter p_tranx_uom_code
107 --=======================================================================
108 
109 FUNCTION Calc_Unit_Weight
110 ( p_inventory_item_id	     NUMBER
111 , p_organization_id	     NUMBER
112 , p_stat_typ_uom_code        VARCHAR2
113 , p_tranx_uom_code           VARCHAR2
114 )
115 RETURN NUMBER;
116 
117 
118 /*
119 --========================================================================
120 -- FUNCTION : Calc_Total_weight PUBLIC
121 -- PARAMETERS:
122 --             p_inventory_item_id     Inventory Item
123 --             p_organization_id       Organization_id
124 --             p_weight_uom_code       UOM
125 --             p_weight_precision      rounding decimal digits
126 --             p_transaction_quantity  Quantity
127 --             p_transaction_uom_code  Transaction UOM
128 -- VERSION   : current version         1.0
129 --             initial version         1.0
130 -- COMMENT   : Total weight in the UOM that is defined in
131 --             the set-up form in mtl stat type usages.
132 --             The weight is defined in the UOm that is defined
133 --             by the authorities for reporting.
134 --=======================================================================
135 
136 FUNCTION Calc_Total_weight
137 ( p_inventory_item_id	     NUMBER
138 , p_organization_id	     NUMBER
139 , p_weight_uom_code	     VARCHAR2
140 , p_weight_precision	     NUMBER
141 , p_transaction_quantity     NUMBER
142 , p_transaction_uom_code     VARCHAR2
143 , p_unit_weight              NUMBER
144 )
145 RETURN NUMBER;
146 */
147 
148 --========================================================================
149 -- FUNCTION : Get_Alternate_UOM PUBLIC
150 -- VERSION   : current version         1.0
151 --             initial version         1.0
152 --========================================================================
153 
154 FUNCTION Get_Alternate_UOM
155 ( p_category_set_id    	   NUMBER
156 , p_alt_uom_rule_set_code  VARCHAR2
157 , p_commodity_code         VARCHAR2
158 )
159 RETURN VARCHAR2;
160 
161 --========================================================================
162 -- FUNCTION : Convert_Alternate_Quantity PUBLIC
163 -- VERSION   : current version         1.0
164 --             initial version         1.0
165 --========================================================================
166 
167 FUNCTION Convert_alternate_Quantity
168 ( p_transaction_quantity   NUMBER
169 , p_alternate_uom_code     VARCHAR2
170 , p_inventory_item_id	   NUMBER
171 , p_transaction_uom_code   VARCHAR2
172 )
173 RETURN NUMBER;
174 
175 --========================================================================
176 -- FUNCTION : Convert_Territory_Code PUBLIC
177 -- PARAMETERS:
178 --             l_iso_code              varchar2
179 -- VERSION   : current version         1.0
180 --             initial version         1.0
181 -- COMMENT   : Calculates and returns the ISO code given the territory code
182 --=======================================================================
183 
184 FUNCTION Convert_Territory_Code (l_iso_code VARCHAR2)
185 RETURN VARCHAR2;
186 
187 
188 --========================================================================
189 -- PROCEDURE : Get_Commodity_Info  PUBLIC
190 -- PARAMETERS: x_movement_transaction  IN OUT  Movement Statistics Record
191 -- VERSION   : current version         1.0
192 --             initial version         1.0
193 -- COMMENT   : Procedure to populate the commoddity information for the item
194 --=======================================================================--
195 
196 PROCEDURE Get_Commodity_Info
197 ( x_movement_transaction IN OUT NOCOPY
198     INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
199 );
200 
201 --========================================================================
202 -- PROCEDURE : Get_Order_Number  PUBLIC
203 -- PARAMETERS: p_movement_transaction  IN  Movement Statistics Record
204 --             x_movement_transaction  OUT Movement Statistics Record
205 -- VERSION   : current version         1.0
206 --             initial version         1.0
207 -- COMMENT   : Procedure to populate the Order Number
208 --=======================================================================--
209 
210 PROCEDURE Get_Order_Number
211 ( x_movement_transaction IN OUT NOCOPY
212     INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
213 );
214 
215 --========================================================================
216 -- FUNCTION : Get_Category_Id  PUBLIC
217 -- PARAMETERS: p_movement_transaction  IN  Movement Statistics Record
218 --             p_stat_typ_transaction  IN  Stat type Usages record
219 -- VERSION   : current version         1.0
220 --             initial version         1.0
221 -- COMMENT   : Function that returns the category id for an item
222 --=======================================================================--
223 
224 FUNCTION Get_Category_Id
225 ( p_movement_transaction IN
226     INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
227 , p_stat_typ_transaction IN
228     INV_MGD_MVT_DATA_STR.Movement_Stat_Usages_Rec_Type
229 )
230 RETURN NUMBER;
231 
232 --========================================================================
233 -- FUNCTION : Get_Site_Location        PUBLIC
234 -- PARAMETERS: p_site_use_id           Site id
235 -- VERSION   : current version         1.0
236 --             initial version         1.0
237 -- COMMENT   : Function that returns the territory code where the site
238 --             is located.
239 --=======================================================================--
240 
241 FUNCTION Get_Site_Location
242 ( p_site_use_id  IN NUMBER
243 )
244 RETURN VARCHAR2;
245 
246 
247 --========================================================================
248 -- FUNCTION : Get_Org_Location         PUBLIC
249 -- PARAMETERS: p_warehouse_id          warehouse id
250 -- VERSION   : current version         1.0
251 --             initial version         1.0
252 -- COMMENT   : Function that returns the territory code where the warehouse
253 --             is located.
254 --=======================================================================--
255 
256 FUNCTION Get_Org_Location
257 ( p_warehouse_id  IN NUMBER
258 )
259 RETURN VARCHAR2;
260 
261 --========================================================================
262 -- FUNCTION : Get_Vendor_Location      PUBLIC
263 -- PARAMETERS: p_vendor_site_id        Vendor Site
264 -- VERSION   : current version         1.0
265 --             initial version         1.0
266 -- COMMENT   : Function that returns the territory code where the vendor site
267 --             is located.
268 --=======================================================================--
269 
270 FUNCTION Get_vendor_Location
271 ( p_vendor_site_id  IN NUMBER
272 )
273 RETURN VARCHAR2;
274 
275 --========================================================================
276 -- FUNCTION : Get_Zone_Code            PUBLIC
277 -- PARAMETERS: p_territory_code        territory code
278 --             p_zone_code             zone code
279 -- VERSION   : current version         1.0
280 --             initial version         1.0
281 -- COMMENT   : Function that returns the zone code if the zone code
282 --             and territory code matches and entry in country assignments
283 --=======================================================================--
284 
285 FUNCTION Get_Zone_Code
286 ( p_territory_code IN VARCHAR2
287 , p_zone_code      IN VARCHAR2
288 , p_trans_date     IN VARCHAR2
289 )
290 RETURN VARCHAR2;
291 
292 
293 --========================================================================
294 -- PROCEDURE : Get_Vendor_Info  PUBLIC
295 -- PARAMETERS: x_movement_transaction  IN OUT  Movement Statistics Record
296 --
297 -- VERSION   : current version         1.0
298 --             initial version         1.0
299 -- COMMENT   : Procedure to populate the  vendor info
300 --=========================================================================
301 
302 PROCEDURE Get_Vendor_Info
303 ( x_movement_transaction IN OUT NOCOPY
304     INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
305 );
306 
307 --========================================================================
308 -- FUNCTION : Get_Cust_VAT_Number
309 -- PARAMETERS: p_site_use_id      IN  NUMBER site use id
310 --========================================================================
311 FUNCTION Get_Cust_VAT_Number
312 ( p_site_use_id  NUMBER)
313 RETURN VARCHAR2;
314 
315 --========================================================================
316 -- FUNCTION : Get_Org_VAT_Number
317 -- PARAMETERS: p_entity_org_id      IN  NUMBER legal entity id
318 --========================================================================
319 FUNCTION Get_Org_VAT_Number
320 ( p_entity_org_id IN NUMBER
321 , p_date          IN DATE)
322 RETURN VARCHAR2;
323 
324 --========================================================================
325 -- PROCEDURE : Log_Initialize             PUBLIC
326 -- COMMENT   : Initializes the log facility. It should be called from
327 --             the top level procedure of each concurrent program
328 --=======================================================================--
329 PROCEDURE Log_Initialize;
330 
331 --========================================================================
332 -- PROCEDURE : Log                        PUBLIC
333 -- PARAMETERS: p_level                IN  priority of the message - from
334 --                                        highest to lowest:
335 --                                          -- G_LOG_ERROR
336 --                                          -- G_LOG_EXCEPTION
337 --                                          -- G_LOG_EVENT
338 --                                          -- G_LOG_PROCEDURE
339 --                                          -- G_LOG_STATEMENT
340 --             p_msg                  IN  message to be print on the log
341 --                                        file
342 -- COMMENT   : Add an entry to the log
343 --=======================================================================--
344 PROCEDURE Log
345 ( p_priority                    IN  NUMBER
346 , p_msg                         IN  VARCHAR2
347 );
348 
349 --========================================================================
350 -- FUNCTION : Get_Subinv_Location      PUBLIC
351 -- PARAMETERS: p_warehouse_id          warehouse id
352 --             p_subinv_code           subinventory code
353 -- VERSION   : current version         1.0
354 --             initial version         1.0
355 -- COMMENT   : Function that returns the territory code where the subinventory
356 --             is located.
357 --=======================================================================--
358 
359 FUNCTION Get_Subinv_Location
360 ( p_warehouse_id  IN NUMBER
361 , p_subinv_code   IN VARCHAR2
362 )
363 RETURN VARCHAR2;
364 
365 --========================================================================
366 -- FUNCTION  : Get_SO_Legal_Entity      PUBLIC
367 -- PARAMETERS: p_order_line_id          order line id
368 --
369 -- VERSION   : current version          1.0
370 --             initial version          1.0
371 -- COMMENT   : Function that returns the legal entity where this sales order
372 --             is created.
373 --=======================================================================--
374 
375 FUNCTION Get_SO_Legal_Entity
376 ( p_order_line_id  IN NUMBER
377 )
378 RETURN NUMBER;
379 
380 --========================================================================
381 -- FUNCTION  : Get_Shipping_Legal_Entity  PUBLIC
382 -- PARAMETERS: p_warehouse_id             warehouse id
383 --
384 -- VERSION   : current version            1.0
385 --             initial version            1.0
386 -- COMMENT   : Function that returns the legal entity where this sales order
387 --             is ship released.
388 --=======================================================================--
389 
390 FUNCTION Get_Shipping_Legal_Entity
391 ( p_warehouse_id  IN NUMBER
392 )
393 RETURN NUMBER;
394 
395 --========================================================================
396 -- FUNCTION  : Get_LE_Currency  PUBLIC
397 -- PARAMETERS: p_le_id          legal entity id
398 --
399 -- VERSION   : current version            1.0
400 --             initial version            1.0
401 -- COMMENT   : Function that returns the functional currency of a given
402 --             legal entity.
403 --=======================================================================--
404 
405 FUNCTION Get_LE_Currency
406 ( p_le_id  IN NUMBER
407 )
408 RETURN VARCHAR2;
409 
410 --========================================================================
411 -- FUNCTION  : Get_LE_Location     PUBLIC
412 -- PARAMETERS: p_le_id             legal entity id
413 --
414 -- VERSION   : current version            1.0
415 --             initial version            1.0
416 -- COMMENT   : Function that returns the country location of a given
417 --             legal entity.
418 --=======================================================================--
419 
420 FUNCTION Get_LE_Location
421 ( p_le_id  IN NUMBER
422 )
423 RETURN VARCHAR2;
424 
425 --========================================================================
426 -- PROCEDURE  : Get_Weight_Precision       PUBLIC
427 -- PARAMETERS: p_legal_entity_id       IN   legal entity  id
428 --             p_zone_code             IN   zone code
429 --             p_usage_type            IN   usage type
430 --             p_stat_type             IN   stat type
431 --             x_weight_precision      OUT  weight precision
432 --             x_rep_rounding          OUT  reporting rounding method
433 --
434 -- VERSION   : current version            1.0
435 --             initial version            1.0
436 -- COMMENT   : Function that returns the weight precision defined on
437 --             parameter form
438 --=======================================================================--
439 
440 PROCEDURE Get_Weight_Precision
441 ( p_legal_entity_id  IN NUMBER
442 , p_zone_code        IN VARCHAR2
443 , p_usage_type       IN VARCHAR2
444 , p_stat_type        IN VARCHAR2
445 , x_weight_precision OUT NOCOPY NUMBER
446 , x_rep_rounding     OUT NOCOPY VARCHAR2
447 )
448 ;
449 
450 
451 --========================================================================
452 -- FUNCTION  : Round_Number  PUBLIC
453 -- PARAMETERS: p_number                   number to be rounded
454 --             p_precision                the precision to be rounded to
455 --             p_rounding_method          rounding method
456 --
457 -- VERSION   : current version            1.0
458 --             initial version            1.0
459 -- COMMENT   : Function that returns a rounded number
460 --=======================================================================--
461 FUNCTION Round_Number
462 ( p_number          IN NUMBER
463 , p_precision       IN NUMBER
464 , p_rounding_method IN VARCHAR2
465 )
466 RETURN NUMBER;
467 
468 --========================================================================
469 -- FUNCTION  : Get_Org_From_Le            PUBLIC
470 -- PARAMETERS: p_le_id                    legal entity id
471 --
472 -- VERSION   : current version            1.0
473 --             initial version            1.0
474 -- COMMENT   : Function that returns a rounded number
475 --=======================================================================--
476 FUNCTION Get_Org_From_Le
477 ( p_le_id          IN NUMBER
478 )
479 RETURN NUMBER;
480 
481 --
482 -- bug 12844667
483 --
484 --========================================================================
485 -- FUNCTION  : Is_Process_Org             PUBLIC
486 -- PARAMETERS: p_org_id                   Organization Id
487 --
488 -- VERSION   : current version            1.0
489 --             initial version            1.0
490 -- COMMENT   : Function that checks if the org thats passed is a process org
491 --=======================================================================--
492 FUNCTION Is_Process_Org
493 ( p_org_id          IN NUMBER
494 )
495 RETURN BOOLEAN;
496 
497 --
498 -- bug 12844667
499 --
500 --========================================================================
501 -- FUNCTION  : Get_Process_Item_Cost      PUBLIC
502 -- PARAMETERS: p_org_id                   Organization Id
503 --             p_item_id                  Inventory Item Id
504 --             p_transaction_date         Transaction Date
505 --
506 -- VERSION   : current version            1.0
507 --             initial version            1.0
508 -- COMMENT   : Function that computes the cost of a Process Item
509 --=======================================================================--
510 FUNCTION Get_Process_Item_Cost
511 ( p_org_id            IN NUMBER,
512   p_item_id           IN NUMBER,
513   p_transaction_date  IN DATE
514 )
515 RETURN NUMBER;
516 
517 
518 END INV_MGD_MVT_UTILS_PKG;