1 PACKAGE EDW_CURRENCY as
2 /* $Header: FIICACRS.pls 120.1 2002/10/22 21:54:12 djanaswa ship $ */
3
4
5 -- ------------------------
6 -- Public Functions
7 -- ------------------------
8
9 -- --------------------------------------------------------------
10 -- Name: convert_global_amount
11 -- Desc: This function converts the given transaction amount
12 -- to the equivalent value in global warehouse currency.
13 -- It will skip the conversion if either base currency or
14 -- transaction currency is the same as the global warehouse
15 -- Currency. It's not required to pass in base amounts or
16 -- base currency code; however, it may improve performance
17 -- by allowing the function to skip conversions.
18 -- If exchange rate type is not specified, the api will use
19 -- the global rate type setup in the global warehouse admin.
20 -- Input : x_trx_amount - amount to be converted in trx currency
21 -- x_base_amount - amount to be converted in base currency
22 -- x_exchange_date - indicates which day's rates to use
23 -- x_exchange_rate_type - indicates what kind of rate type to use
24 -- Output: If rate not available, returns -1
25 -- If input currency invalid, returns -2
26 -- Error: global warehouse parameters such as global currency have not
27 -- been setup or if any sql errors occur during execution, an
28 -- exception is raised.
29 -- --------------------------------------------------------------
30 FUNCTION convert_global_amount (
31 x_trx_amount NUMBER,
32 x_base_amount NUMBER DEFAULT NULL,
33 x_trx_currency_code VARCHAR2,
34 x_base_currency_code VARCHAR2 DEFAULT NULL,
35 x_exchange_date DATE,
36 x_exchange_rate_type VARCHAR2 DEFAULT NULL
37 ) RETURN NUMBER;
38
39 PRAGMA RESTRICT_REFERENCES(convert_global_amount, WNDS,WNPS,RNPS);
40
41
42 -- --------------------------------------------------------------
43 -- Name: convert_global_amount
44 -- Desc: This function converts the given transaction amount
45 -- to the equivalent value in global warehouse currency.
46 -- It will skip the conversion if either base currency or
47 -- transaction currency is the same as the global warehouse
48 -- Currency. It is the same as the above function except
49 -- it derives the base currency from set of books id.
50 -- It's not required to pass in base amounts or
51 -- set of books id ; however, it may improve performance
52 -- by allowing the function to skip conversions.
53 -- If exchange rate type is not specified, the api will use
54 -- the global rate type setup in the global warehouse admin.
55 -- Input : x_trx_amount - amount to be converted in trx currency
56 -- x_base_amount - amount to be converted in base currency
57 -- x_set_of_books_id - sob used to derive the base currency
58 -- x_exchange_date - indicates which day's rates to use
59 -- x_exchange_rate_type - indicates what kind of rate type to use
60 -- Output: If rate not available, returns -1
61 -- If input currency invalid, returns -2
62 -- Error: global warehouse parameters such as global currency have not
63 -- been setup or if any sql errors occur during execution, an
64 -- exception is raised.
65 -- --------------------------------------------------------------
66 FUNCTION convert_global_amount (
67 x_trx_amount NUMBER,
68 x_base_amount NUMBER DEFAULT NULL,
69 x_trx_currency_code VARCHAR2,
70 x_set_of_books_id NUMBER,
71 x_exchange_date DATE,
72 x_exchange_rate_type VARCHAR2 DEFAULT NULL
73 ) RETURN NUMBER;
74
75 PRAGMA RESTRICT_REFERENCES(convert_global_amount, WNDS,WNPS,RNPS);
76
77
78 -- --------------------------------------------------------------
79 -- Name: get_rate
80 -- Desc: This function returns conversion rate between transaction
81 -- currency (parameter x_trx_currency_code) and global
82 -- warehouse currency.
83 -- If exchange rate type is not specified, the api will use
84 -- the global rate type setup in the global warehouse admin.
85 -- Input : x_trx_currency_code - source currency code
86 -- x_exchange_date - indicates which day's rates to use
87 -- x_exchange_rate_type - indicates what kind of rate type to use
88 -- Output: If rate not available, returns -1
89 -- If input currency invalid, returns -2
90 -- Any other exception - returns NULL
91 -- Error: global warehouse parameters such as global currency have not
92 -- been setup or if any sql errors occur during execution, an
93 -- exception is raised and null value is returned
94 -- --------------------------------------------------------------
95
96 FUNCTION get_rate (
97 x_trx_currency_code VARCHAR2,
98 x_exchange_date DATE,
99 x_exchange_rate_type VARCHAR2 DEFAULT NULL
100 ) RETURN NUMBER;
101
102 PRAGMA RESTRICT_REFERENCES(get_rate, WNDS,WNPS,RNPS);
103
104
105 -- --------------------------------------------------------------
106 -- Name: get_mau
107 -- Desc: This function returns minimum accountable unit of the
108 -- global warehouse currency. If a currency does not have
109 -- minimum accountable unit, function returns currency precision.
110 -- If there is no precision, function returns default value of 0.01;
111 -- Function result can never be 0.
112 -- This function should be used in combination with get_rate
113 -- function to convert transaction amounts to amounts in global
114 -- warehouse currency:
115 -- <trx amount> * get_rate()
116 -- <global amount> = round (-------------------------) * get_mau()
117 -- get_mau()
118 --
119 -- Input : none
120 -- Output: function returns NULL in case of any exceptions.
121 -- --------------------------------------------------------------
122
123 FUNCTION get_mau RETURN NUMBER;
124
125 PRAGMA RESTRICT_REFERENCES(get_mau, WNDS,WNPS,RNPS);
126
127
128 END EDW_CURRENCY;