DBA Data[Home] [Help]

PACKAGE BODY: APPS.AMS_UTILITY_PVT_W

Source


1 package body ams_utility_pvt_w as
2   /* $Header: amswutlb.pls 115.5 2003/01/20 19:18:40 yzhao ship $ */
3   rosetta_g_mistake_date date := to_date('01/01/+4713', 'MM/DD/SYYYY');
4   rosetta_g_miss_date date := to_date('01/01/-4712', 'MM/DD/SYYYY');
5 
6   -- this is to workaround the JDBC bug regarding IN DATE of value GMiss
7   function rosetta_g_miss_date_in_map(d date) return date as
8   begin
9     if d = rosetta_g_mistake_date then return fnd_api.g_miss_date; end if;
10     return d;
11   end;
12 
13   function rosetta_g_miss_num_map(n number) return number as
14     a number := fnd_api.g_miss_num;
15     b number := 0-1962.0724;
16   begin
17     if n=a then return b; end if;
18     if n=b then return a; end if;
19     return n;
20   end;
21 
22   procedure rosetta_table_copy_in_p45(t out nocopy ams_utility_pvt.dependent_objects_tbl_type, a0 JTF_VARCHAR2_TABLE_300
23     , a1 JTF_VARCHAR2_TABLE_100
24     , a2 JTF_VARCHAR2_TABLE_100
25     , a3 JTF_VARCHAR2_TABLE_300
26     , a4 JTF_VARCHAR2_TABLE_100
27     ) as
28     ddindx binary_integer; indx binary_integer;
29   begin
30   if a0 is not null and a0.count > 0 then
31       if a0.count > 0 then
32         indx := a0.first;
33         ddindx := 1;
34         while true loop
35           t(ddindx).name := a0(indx);
36           t(ddindx).type := a1(indx);
37           t(ddindx).status := a2(indx);
38           t(ddindx).owner := a3(indx);
39           t(ddindx).deletable_flag := a4(indx);
40           ddindx := ddindx+1;
41           if a0.last =indx
42             then exit;
43           end if;
44           indx := a0.next(indx);
45         end loop;
46       end if;
47    end if;
48   end rosetta_table_copy_in_p45;
49   procedure rosetta_table_copy_out_p45(t ams_utility_pvt.dependent_objects_tbl_type, a0 out nocopy JTF_VARCHAR2_TABLE_300
50     , a1 out nocopy JTF_VARCHAR2_TABLE_100
51     , a2 out nocopy JTF_VARCHAR2_TABLE_100
52     , a3 out nocopy JTF_VARCHAR2_TABLE_300
53     , a4 out nocopy JTF_VARCHAR2_TABLE_100
54     ) as
55     ddindx binary_integer; indx binary_integer;
56   begin
57   if t is null or t.count = 0 then
58     a0 := JTF_VARCHAR2_TABLE_300();
59     a1 := JTF_VARCHAR2_TABLE_100();
60     a2 := JTF_VARCHAR2_TABLE_100();
61     a3 := JTF_VARCHAR2_TABLE_300();
62     a4 := JTF_VARCHAR2_TABLE_100();
63   else
64       a0 := JTF_VARCHAR2_TABLE_300();
65       a1 := JTF_VARCHAR2_TABLE_100();
66       a2 := JTF_VARCHAR2_TABLE_100();
67       a3 := JTF_VARCHAR2_TABLE_300();
68       a4 := JTF_VARCHAR2_TABLE_100();
69       if t.count > 0 then
70         a0.extend(t.count);
71         a1.extend(t.count);
72         a2.extend(t.count);
73         a3.extend(t.count);
74         a4.extend(t.count);
75         ddindx := t.first;
76         indx := 1;
77         while true loop
78           a0(indx) := t(ddindx).name;
79           a1(indx) := t(ddindx).type;
80           a2(indx) := t(ddindx).status;
81           a3(indx) := t(ddindx).owner;
82           a4(indx) := t(ddindx).deletable_flag;
83           indx := indx+1;
84           if t.last =ddindx
85             then exit;
86           end if;
87           ddindx := t.next(ddindx);
88         end loop;
89       end if;
90    end if;
91   end rosetta_table_copy_out_p45;
92 
93   procedure create_log(x_return_status out nocopy  VARCHAR2
94     , p_arc_log_used_by  VARCHAR2
95     , p_log_used_by_id  VARCHAR2
96     , p_msg_data  VARCHAR2
97     , p_msg_level  NUMBER
98     , p_msg_type  VARCHAR2
99     , p_desc  VARCHAR2
100     , p_budget_id  NUMBER
101     , p_threshold_id  NUMBER
102     , p_transaction_id  NUMBER
103     , p_notification_creat_date  date
104     , p_activity_log_id  NUMBER
105   )
106 
107   as
108     ddp_notification_creat_date date;
109     ddindx binary_integer; indx binary_integer;
110   begin
111 
112     -- copy data to the local IN or IN-OUT args, if any
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123     ddp_notification_creat_date := rosetta_g_miss_date_in_map(p_notification_creat_date);
124 
125 
126     -- here's the delegated call to the old PL/SQL routine
127     ams_utility_pvt.create_log(x_return_status,
128       p_arc_log_used_by,
129       p_log_used_by_id,
130       p_msg_data,
131       p_msg_level,
132       p_msg_type,
133       p_desc,
134       p_budget_id,
135       p_threshold_id,
136       p_transaction_id,
137       ddp_notification_creat_date,
138       p_activity_log_id);
139 
140     -- copy data back from the local variables to OUT or IN-OUT args, if any
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152   end;
153 
154   procedure convert_currency(x_return_status out nocopy  VARCHAR2
155     , p_from_currency  VARCHAR2
156     , p_to_currency  VARCHAR2
157     , p_conv_date  date
158     , p_from_amount  NUMBER
159     , x_to_amount out nocopy  NUMBER
160   )
161 
162   as
163     ddp_conv_date date;
164     ddindx binary_integer; indx binary_integer;
165   begin
166 
167     -- copy data to the local IN or IN-OUT args, if any
168 
169 
170 
171     ddp_conv_date := rosetta_g_miss_date_in_map(p_conv_date);
172 
173 
174 
175     -- here's the delegated call to the old PL/SQL routine
176     ams_utility_pvt.convert_currency(x_return_status,
177       p_from_currency,
178       p_to_currency,
179       ddp_conv_date,
180       p_from_amount,
181       x_to_amount);
182 
183     -- copy data back from the local variables to OUT or IN-OUT args, if any
184 
185 
186 
187 
188 
189   end;
190 
191   procedure convert_timezone(p_init_msg_list  VARCHAR2
192     , x_return_status out nocopy  VARCHAR2
193     , x_msg_count out nocopy  NUMBER
194     , x_msg_data out nocopy  VARCHAR2
195     , p_user_tz_id  NUMBER
196     , p_in_time  date
197     , p_convert_type  VARCHAR2
198     , x_out_time out nocopy  DATE
199   )
200 
201   as
202     ddp_in_time date;
203     ddindx binary_integer; indx binary_integer;
204   begin
205 
206     -- copy data to the local IN or IN-OUT args, if any
207 
208 
209 
210 
211 
212     ddp_in_time := rosetta_g_miss_date_in_map(p_in_time);
213 
214 
215 
216     -- here's the delegated call to the old PL/SQL routine
217     ams_utility_pvt.convert_timezone(p_init_msg_list,
218       x_return_status,
219       x_msg_count,
220       x_msg_data,
221       p_user_tz_id,
222       ddp_in_time,
223       p_convert_type,
224       x_out_time);
225 
226     -- copy data back from the local variables to OUT or IN-OUT args, if any
227 
228 
229 
230 
231 
232 
233 
234   end;
235 
236   procedure convert_currency(p_set_of_books_id  NUMBER
237     , p_from_currency  VARCHAR2
238     , p_conversion_date  date
239     , p_conversion_type  VARCHAR2
240     , p_conversion_rate  NUMBER
241     , p_amount  NUMBER
242     , x_return_status out nocopy  VARCHAR2
243     , x_acc_amount out nocopy  NUMBER
244     , x_rate out nocopy  NUMBER
245   )
246 
247   as
248     ddp_conversion_date date;
249     ddindx binary_integer; indx binary_integer;
250   begin
251 
252     -- copy data to the local IN or IN-OUT args, if any
253 
254 
255     ddp_conversion_date := rosetta_g_miss_date_in_map(p_conversion_date);
256 
257 
258 
259 
260 
261 
262 
263     -- here's the delegated call to the old PL/SQL routine
264     ams_utility_pvt.convert_currency(p_set_of_books_id,
265       p_from_currency,
266       ddp_conversion_date,
267       p_conversion_type,
268       p_conversion_rate,
269       p_amount,
270       x_return_status,
271       x_acc_amount,
272       x_rate);
273 
274     -- copy data back from the local variables to OUT or IN-OUT args, if any
275 
276 
277 
278 
279 
280 
281 
282 
283   end;
284 
285   procedure calculate_functional_curr(p_from_amount  NUMBER
286     , p_conv_date  date
287     , p_tc_currency_code  VARCHAR2
288     , p_org_id  NUMBER
289     , x_to_amount out nocopy  NUMBER
290     , x_set_of_books_id out nocopy  NUMBER
291     , x_mrc_sob_type_code out nocopy  VARCHAR2
292     , x_fc_currency_code out nocopy  VARCHAR2
293     , x_exchange_rate_type in out nocopy  VARCHAR2
294     , x_exchange_rate in out nocopy  NUMBER
295     , x_return_status out nocopy  VARCHAR2
296   )
297 
298   as
299     ddp_conv_date date;
300     ddindx binary_integer; indx binary_integer;
301   begin
302 
303     -- copy data to the local IN or IN-OUT args, if any
304 
305     ddp_conv_date := rosetta_g_miss_date_in_map(p_conv_date);
306 
307 
308 
309 
310 
311 
312 
313 
314 
315 
316     -- here's the delegated call to the old PL/SQL routine
317     ams_utility_pvt.calculate_functional_curr(p_from_amount,
318       ddp_conv_date,
319       p_tc_currency_code,
320       p_org_id,
321       x_to_amount,
322       x_set_of_books_id,
323       x_mrc_sob_type_code,
324       x_fc_currency_code,
325       x_exchange_rate_type,
326       x_exchange_rate,
327       x_return_status);
328 
329     -- copy data back from the local variables to OUT or IN-OUT args, if any
330 
331 
332 
333 
334 
335 
336 
337 
338 
339 
340   end;
341 
342   procedure convert_currency(p_from_currency  VARCHAR2
343     , p_to_currency  VARCHAR2
344     , p_conv_type  VARCHAR2
345     , p_conv_rate  NUMBER
346     , p_conv_date  date
347     , p_from_amount  NUMBER
348     , x_return_status out nocopy  VARCHAR2
349     , x_to_amount out nocopy  NUMBER
350     , x_rate out nocopy  NUMBER
351   )
352 
353   as
354     ddp_conv_date date;
355     ddindx binary_integer; indx binary_integer;
356   begin
357 
358     -- copy data to the local IN or IN-OUT args, if any
359 
360 
361 
362 
363     ddp_conv_date := rosetta_g_miss_date_in_map(p_conv_date);
364 
365 
366 
367 
368 
369     -- here's the delegated call to the old PL/SQL routine
370     ams_utility_pvt.convert_currency(p_from_currency,
371       p_to_currency,
372       p_conv_type,
373       p_conv_rate,
374       ddp_conv_date,
375       p_from_amount,
376       x_return_status,
377       x_to_amount,
378       x_rate);
379 
380     -- copy data back from the local variables to OUT or IN-OUT args, if any
381 
382 
383 
384 
385 
386 
387 
388 
389   end;
390 
391 end ams_utility_pvt_w;