DBA Data[Home] [Help]

PACKAGE: APPS.OPI_OPM_COMMON_PKG

Source


1 PACKAGE OPI_OPM_common_pkg AUTHID CURRENT_USER as
2 /* $Header: OPICOMMS.pls 115.4 2002/05/07 13:29:01 pkm ship    $ */
3 
4 /* ###########################################################################
5    Function OPMCO_GET_COST
6 
7    Wrapper Function   on GMF_COMMON.cmcommon_get_Cost
8    Input Parameters
9          Item_id    Item_id
10          Whse_code  Warehouse Code
11          Trans_date Transaction Date
12          Cost_mthd  Cost Method
13     Description:
14 
15     Return Value Accounting Cost from GL_ITEM_CST table
16 
17     Note : This function return cost only if the cost is posted against GL tables
18            i.e if Cost update is run after Cost Rollup for the periods
19            Refer GMF_COMMON.cmcommon_get_Cost package for further Details
20 
21 ***************************************************************************
22 */
23 
24  FUNCTION OPMCO_GET_COST(p_Item_id       IN ic_item_mst.item_id%TYPE,
25              p_Whse_code     IN ic_whse_mst.whse_code%TYPE,
26              p_Cost_mthd     IN cm_cmpt_dtl.cost_mthd_code%TYPE DEFAULT NULL,
27 	       p_Transaction_date    IN DATE)
28      RETURN NUMBER;
29 
30 /*
31   ###########################################################################
32    Function OPMCO_GET_MULCURR_AMT
33 
34    Wrapper Function   on GMF_GLCOMMON_DB.get_closest_rate
35    Input Parameters
36          From Currency
37          To Currency
38          Exchange Rate Date
39          Amount to be converted
40     Description:
41     Return The converted amount from-currency to-currency. If conversion fails
42     returns the 0
43     Note :
44 
45     #####################################################################
46 */
47 
48     /* Package Variables for the function to avoid repetative calculations */
49 
50        PV_OPMCO_GMA_F_CURR    gl_curr_mst.currency_code%TYPE;
51        PV_OPMCO_GMA_T_CURR    gl_curr_mst.currency_code%TYPE;
52        PV_OPMCO_GMA_RATE_DT   DATE;
53        PV_OPMCO_GMA_SIGN      NUMBER;
54        PV_OPMCO_GMA_XCNG_RATE NUMBER;
55 
56      FUNCTION OPMCO_GET_MULCURR_AMT(
57                   p_From_Curr             IN gl_curr_mst.currency_code%TYPE,
58                   p_To_Curr               IN gl_curr_mst.currency_code%TYPE,
59                   p_Rate_date             IN DATE,
60 		      p_amount                IN NUMBER)
61      RETURN NUMBER;
62 
63 /* #####################################################################
64    Function OPMCO_CURRCONV_ERROR
65 
66    Wrapper Function   on GMF_GLCOMMON_DB.get_closest_rate
67    Input Parameters
68          From Currency
69          To Currency
70          Exchange Rate Date
71 
72     Description:
73     This function checks the availability of Currency cinversion for the date given.
74     Return 1 If conversion Does not exist or returns 0 if conversion exist
75 
76     Note :
77 
78     ###################################################################### */
79 
80     /* Package Variables for the function to avoid repetative calculations */
81 
82        PV_OPMCO_CE_F_CURR    gl_curr_mst.currency_code%TYPE;
83        PV_OPMCO_CE_T_CURR    gl_curr_mst.currency_code%TYPE;
84        PV_OPMCO_CE_RATE_DT   DATE;
85        PV_OPMCO_CE_XCNG_ERROR     NUMBER;
86 
87      FUNCTION OPMCO_CURRCONV_ERROR (
88                p_From_Curr             IN gl_curr_mst.currency_code%TYPE,
89                p_To_Curr               IN gl_curr_mst.currency_code%TYPE,
90                p_Rate_date             IN DATE)
91      RETURN NUMBER;
92 /* #############################################################################
93    Function OPI_OPM_GET_CHARGE
94    This function is to get charges from given order line
95 
96    Inputs
97          ORDER_ID
98          EXTENDED_PRICE
99          BASE_CURRENCY
100          Exchange Rate
101          MUL_DIV_SIGN
102 
103     Description
104     The following assumptions are made to get the charges
105      1. We should consider only those Charges where CHARGE_TYPE = 20 or 30 ( 20= Discount, 30= Allowances )
106      2. We will exclude CHARGE_TYPE = 0 or 1 or 10 ( 0 = Miscellaneous, 1 = Freight, 10 = Tax ) from this calculation.
107      3. OP_ORDR_CHG.EXTENDED_AMOUNT is the Total Charge (in Base Currency) for the order Line or the whole
108         Order.
109      4. In the table OP_ORDR_CHG, if LINE_ID is NULL ( i.e. Charge specified for the whole Order ) then calculate the
110         charge for a particular order line using the formula (Extended Price of the order line / Total Order Value ) *
111         EXTENDED_AMOUNT
112      5. If No Charge is found the function returns 0
113 
114    ################################################################################# */
115 
116 
117 FUNCTION OPI_OPM_GET_CHARGE  (p_Order_id        IN op_ordr_dtl.order_id%TYPE,
118                              p_charge_amount   IN NUMBER,
119                              p_extended_price   IN op_ordr_dtl.extended_price%TYPE,
120                              p_Billing_Currency IN op_ordr_dtl.billing_currency%TYPE,
121 		                 p_Base_Currency    IN op_ordr_dtl.BASE_CURRENCY%TYPE,
122                              p_exchange_Rate    IN op_ordr_dtl.EXCHANGE_RATE%TYPE,
123                              p_mul_div_sign     IN op_ordr_dtl.mul_div_sign%TYPE
124                             )
125           RETURN NUMBER;
126 
127 /* ###########################################################################
128    Function OPMCO_GET_RSRC_COST
129 
130    Input Parameters
131          ORGN_CODE  Organization Code
132          RESOURCE   Resource
133          Trans_date Transaction Date
134          Cost_mthd  Cost Method
135     Description:
136 
137     Return Value NOMINAL_COST from CM_RSRC_DTL
138     Note : This funciton returns a 0 cost if cost is not found
139 ***************************************************************************
140 */
141 
142  FUNCTION OPMCO_GET_RSRC_COST(p_ORGN_CODE IN SY_ORGN_MST.ORGN_CODE%TYPE,
143              p_RESOURCE     IN CR_RSRC_MST.RESOURCES%TYPE,
144              p_Cost_mthd    IN cm_rsrc_dtl.cost_mthd_code%TYPE DEFAULT NULL,
145              p_usage_uom    IN cm_rsrc_dtl.USAGE_UM%TYPE,
146 	       p_Transaction_date    IN DATE)
147      RETURN NUMBER;
148 
149 
150 END opi_opm_common_pkg;