1 package GMD_LABUOM_CALCULATE_PKG as
2 /* $Header: GMDSUOMS.pls 120.0 2005/07/13 07:32 rajreddy noship $ */
3
4 /* Constants
5 =========*/
6 cur_factor_default CONSTANT INTEGER := 1;
7 new_factor_default CONSTANT INTEGER := 1;
8
9 /* RETURN Error Code Constants:
10 ============================*/
11 UOM_LAB_TYPE_ERR CONSTANT INTEGER := -2;
12 UOM_CUR_UOMTYPE_ERR CONSTANT INTEGER := -3;
13 UOM_NEW_UOMTYPE_ERR CONSTANT INTEGER := -4;
14 UOM_INVUOM_ERR CONSTANT INTEGER := -5;
15 UOM_INV_UOMTYPE_ERR CONSTANT INTEGER := -6;
16 UOM_CUR_CONV_ERR CONSTANT INTEGER := -7;
17 UOM_LAB_CONST_ERR CONSTANT INTEGER := -8;
18 UOM_LAB_CONV_ERR CONSTANT INTEGER := -9;
19 UOM_NEW_CONV_ERR CONSTANT INTEGER := -10;
20 UOM_NOITEM_ERR CONSTANT INTEGER := -11;
21
22 /* =============================================
23 FUNCTION:
24 uom_conversion OVERLOADED FUNCTION
25 LAB ONLY!
26
27 DESCRIPTION:
28 This PL/SQL function is responsible for
29 calculating and returning the converted
30 quantity of an item in the unit of measure
31 specified.
32
33 The uom_conversion function ASSUMES POSITIVE NUMBERS ONLY!
34 ALL CALLERS MUST DEAL WITH NEGATIVE NUMBERS PRIOR TO
35 CALLING THIS FUNCTION!
36
37 PARAMETERS:
38 pitem_id The surrogate key of the item number
39
40 pformula_id The surrogate key for the formula/version
41 being converted. ALLOWS ZERO if performing
42 a regular conversion. FOR LAB MGT ONLY!
43
44 pcur_qty The current quantity to convert.
45
46 pcur_uom The current unit of measure to convert from.
47
48 pnew_uom The unit of measure to convert to.
49
50 patomic Flag to determine if decimal percision is
51 required as part of the conversion.
52 0 = No, provide full precision.
53 1 = Yes, provide integer ONLY!
54
55 plab_id Organization_id
56
57 pcnv_factor Conversion factor for density passed
58 by the user. NOT REQUIRED!
59 RETURNS:
60 >=0 - SUCCESS
61 -1 - Package problem.
62 -2 - Lab Type not passed for LAB conversion.
63 -3 - UOM_CLASS and conversion factor for current UOM not found.
64 -4 - UOM_CLASS and conversion factor for NEW UOM not found.
65 -5 - Cannot determine INVENTORY UOM for item.
66 -6 - UOM_CLASS and conversion factor for INV UOM not found.
67 -7 - Cannot find conversion factor for CURRENT UOM.
68 -8 - LAB CONVERSION - LM$DENSITY variable not found.
69 -9 - LAB CONVERSION - conversion factor not found.
70 -10 - Cannot find conversion factor for NEW UOM.
71 -11 - Item_id not passed as a parameter.
72 ============================================================== */
73
74 FUNCTION uom_conversion(pitem_id NUMBER,
75 pformula_id NUMBER,
76 plot_number VARCHAR2,
77 pcur_qty NUMBER,
78 pcur_uom VARCHAR2,
79 pnew_uom VARCHAR2,
80 patomic NUMBER,
81 plab_id NUMBER,
82 pcnv_factor NUMBER DEFAULT 0) RETURN NUMBER;
83
84 end GMD_LABUOM_CALCULATE_PKG;