DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_MULTI_GAAP_PVT_W

Source


1 package body okl_multi_gaap_pvt_w as
2   /* $Header: OKLEGAPB.pls 115.2 2004/02/06 22:36:02 sgiyer noship $ */
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_p3(t out nocopy okl_multi_gaap_pvt.asset_deprn_tbl_type, a0 JTF_VARCHAR2_TABLE_2000
23     , a1 JTF_VARCHAR2_TABLE_100
24     , a2 JTF_NUMBER_TABLE
25     ) as
26     ddindx binary_integer; indx binary_integer;
27   begin
28   if a0 is not null and a0.count > 0 then
29       if a0.count > 0 then
30         indx := a0.first;
31         ddindx := 1;
32         while true loop
33           t(ddindx).category_name := a0(indx);
34           t(ddindx).accrual_activity := a1(indx);
35           t(ddindx).deprn_amount := rosetta_g_miss_num_map(a2(indx));
36           ddindx := ddindx+1;
37           if a0.last =indx
38             then exit;
39           end if;
40           indx := a0.next(indx);
41         end loop;
42       end if;
43    end if;
44   end rosetta_table_copy_in_p3;
45   procedure rosetta_table_copy_out_p3(t okl_multi_gaap_pvt.asset_deprn_tbl_type, a0 out nocopy JTF_VARCHAR2_TABLE_2000
46     , a1 out nocopy JTF_VARCHAR2_TABLE_100
47     , a2 out nocopy JTF_NUMBER_TABLE
48     ) as
49     ddindx binary_integer; indx binary_integer;
50   begin
51   if t is null or t.count = 0 then
52     a0 := JTF_VARCHAR2_TABLE_2000();
53     a1 := JTF_VARCHAR2_TABLE_100();
54     a2 := JTF_NUMBER_TABLE();
55   else
56       a0 := JTF_VARCHAR2_TABLE_2000();
57       a1 := JTF_VARCHAR2_TABLE_100();
58       a2 := JTF_NUMBER_TABLE();
59       if t.count > 0 then
60         a0.extend(t.count);
61         a1.extend(t.count);
62         a2.extend(t.count);
63         ddindx := t.first;
64         indx := 1;
65         while true loop
66           a0(indx) := t(ddindx).category_name;
67           a1(indx) := t(ddindx).accrual_activity;
68           a2(indx) := rosetta_g_miss_num_map(t(ddindx).deprn_amount);
69           indx := indx+1;
70           if t.last =ddindx
71             then exit;
72           end if;
73           ddindx := t.next(ddindx);
74         end loop;
75       end if;
76    end if;
77   end rosetta_table_copy_out_p3;
78 
79   procedure rosetta_table_copy_in_p4(t out nocopy okl_multi_gaap_pvt.ae_lines_tbl_type, a0 JTF_NUMBER_TABLE
80     , a1 JTF_VARCHAR2_TABLE_100
81     , a2 JTF_VARCHAR2_TABLE_100
82     ) as
83     ddindx binary_integer; indx binary_integer;
84   begin
85   if a0 is not null and a0.count > 0 then
86       if a0.count > 0 then
87         indx := a0.first;
88         ddindx := 1;
89         while true loop
90           t(ddindx).ccid := rosetta_g_miss_num_map(a0(indx));
91           t(ddindx).line_type := a1(indx);
92           t(ddindx).crd_code := a2(indx);
93           ddindx := ddindx+1;
94           if a0.last =indx
95             then exit;
96           end if;
97           indx := a0.next(indx);
98         end loop;
99       end if;
100    end if;
101   end rosetta_table_copy_in_p4;
102   procedure rosetta_table_copy_out_p4(t okl_multi_gaap_pvt.ae_lines_tbl_type, a0 out nocopy JTF_NUMBER_TABLE
103     , a1 out nocopy JTF_VARCHAR2_TABLE_100
104     , a2 out nocopy JTF_VARCHAR2_TABLE_100
105     ) as
106     ddindx binary_integer; indx binary_integer;
107   begin
108   if t is null or t.count = 0 then
109     a0 := JTF_NUMBER_TABLE();
110     a1 := JTF_VARCHAR2_TABLE_100();
111     a2 := JTF_VARCHAR2_TABLE_100();
112   else
113       a0 := JTF_NUMBER_TABLE();
114       a1 := JTF_VARCHAR2_TABLE_100();
115       a2 := JTF_VARCHAR2_TABLE_100();
116       if t.count > 0 then
117         a0.extend(t.count);
118         a1.extend(t.count);
119         a2.extend(t.count);
120         ddindx := t.first;
121         indx := 1;
122         while true loop
123           a0(indx) := rosetta_g_miss_num_map(t(ddindx).ccid);
124           a1(indx) := t(ddindx).line_type;
125           a2(indx) := t(ddindx).crd_code;
126           indx := indx+1;
127           if t.last =ddindx
128             then exit;
129           end if;
130           ddindx := t.next(ddindx);
131         end loop;
132       end if;
133    end if;
134   end rosetta_table_copy_out_p4;
135 
136   procedure rosetta_table_copy_in_p5(t out nocopy okl_multi_gaap_pvt.rep_prd_summary_tbl_type, a0 JTF_VARCHAR2_TABLE_200
137     , a1 JTF_VARCHAR2_TABLE_200
138     , a2 JTF_VARCHAR2_TABLE_100
139     , a3 JTF_VARCHAR2_TABLE_100
140     , a4 JTF_NUMBER_TABLE
141     ) as
142     ddindx binary_integer; indx binary_integer;
143   begin
144   if a0 is not null and a0.count > 0 then
145       if a0.count > 0 then
146         indx := a0.first;
147         ddindx := 1;
148         while true loop
149           t(ddindx).product_name := a0(indx);
150           t(ddindx).stream_type := a1(indx);
151           t(ddindx).currency_code := a2(indx);
152           t(ddindx).accrual_activity := a3(indx);
153           t(ddindx).total_amount := rosetta_g_miss_num_map(a4(indx));
154           ddindx := ddindx+1;
155           if a0.last =indx
156             then exit;
157           end if;
158           indx := a0.next(indx);
159         end loop;
160       end if;
161    end if;
162   end rosetta_table_copy_in_p5;
163   procedure rosetta_table_copy_out_p5(t okl_multi_gaap_pvt.rep_prd_summary_tbl_type, a0 out nocopy JTF_VARCHAR2_TABLE_200
164     , a1 out nocopy JTF_VARCHAR2_TABLE_200
165     , a2 out nocopy JTF_VARCHAR2_TABLE_100
166     , a3 out nocopy JTF_VARCHAR2_TABLE_100
167     , a4 out nocopy JTF_NUMBER_TABLE
168     ) as
169     ddindx binary_integer; indx binary_integer;
170   begin
171   if t is null or t.count = 0 then
172     a0 := JTF_VARCHAR2_TABLE_200();
173     a1 := JTF_VARCHAR2_TABLE_200();
174     a2 := JTF_VARCHAR2_TABLE_100();
175     a3 := JTF_VARCHAR2_TABLE_100();
176     a4 := JTF_NUMBER_TABLE();
177   else
178       a0 := JTF_VARCHAR2_TABLE_200();
179       a1 := JTF_VARCHAR2_TABLE_200();
180       a2 := JTF_VARCHAR2_TABLE_100();
181       a3 := JTF_VARCHAR2_TABLE_100();
182       a4 := JTF_NUMBER_TABLE();
183       if t.count > 0 then
184         a0.extend(t.count);
185         a1.extend(t.count);
186         a2.extend(t.count);
187         a3.extend(t.count);
188         a4.extend(t.count);
189         ddindx := t.first;
190         indx := 1;
191         while true loop
192           a0(indx) := t(ddindx).product_name;
193           a1(indx) := t(ddindx).stream_type;
194           a2(indx) := t(ddindx).currency_code;
195           a3(indx) := t(ddindx).accrual_activity;
196           a4(indx) := rosetta_g_miss_num_map(t(ddindx).total_amount);
197           indx := indx+1;
198           if t.last =ddindx
199             then exit;
200           end if;
201           ddindx := t.next(ddindx);
202         end loop;
203       end if;
204    end if;
205   end rosetta_table_copy_out_p5;
206 
207   function submit_multi_gaap(x_return_status out nocopy  VARCHAR2
208     , x_msg_count out nocopy  NUMBER
209     , x_msg_data out nocopy  VARCHAR2
210     , p_api_version  NUMBER
211     , p_date_from  date
212     , p_date_to  date
213     , p_batch_name  VARCHAR2
214   ) return number
215 
216   as
217     ddp_date_from date;
218     ddp_date_to date;
219     ddindx binary_integer; indx binary_integer;
220     ddrosetta_retval number;
221   begin
222 
223     -- copy data to the local IN or IN-OUT args, if any
224 
225 
226 
227 
228     ddp_date_from := rosetta_g_miss_date_in_map(p_date_from);
229 
230     ddp_date_to := rosetta_g_miss_date_in_map(p_date_to);
231 
232 
233     -- here's the delegated call to the old PL/SQL routine
234     ddrosetta_retval := okl_multi_gaap_pvt.submit_multi_gaap(x_return_status,
235       x_msg_count,
236       x_msg_data,
237       p_api_version,
238       ddp_date_from,
239       ddp_date_to,
240       p_batch_name);
241 
242     -- copy data back from the local variables to OUT or IN-OUT args, if any
243 
244 
245 
246 
247 
248 
249 
250     return ddrosetta_retval;
251   end;
252 
253 end okl_multi_gaap_pvt_w;