[Home] [Help]
PACKAGE BODY: APPS.FA_FAS402_XMLP_PKG
Source
1 PACKAGE BODY FA_FAS402_XMLP_PKG AS
2 /* $Header: FAS402B.pls 120.0.12010000.1 2008/07/28 13:14:13 appldev ship $ */
3 function BookFormula return VARCHAR2 is
4 begin
5 DECLARE
6 l_book VARCHAR2(15);
7 l_accounting_flex_structure NUMBER(15);
8 l_currency_code VARCHAR2(15);
9 l_precision NUMBER(15);
10 BEGIN
11 IF upper(p_mrcsobtype) = 'R'
12 THEN
13 SELECT bc.book_type_code,
14 bc.accounting_flex_structure,
15 sob.currency_code,
16 cur.precision
17 INTO l_book,
18 l_accounting_flex_Structure,
19 l_currency_code,
20 l_precision
21 FROM FA_BOOK_CONTROLS_MRC_V bc,
22 GL_SETS_OF_BOOKS sob,
23 FND_CURRENCIES cur
24 WHERE bc.book_type_code = P_BOOK
25 AND sob.set_of_books_id = bc.set_of_books_id
26 AND sob.currency_code = cur.currency_code;
27 ELSE
28 SELECT bc.book_type_code,
29 bc.accounting_flex_structure,
30 sob.currency_code,
31 cur.precision
32 INTO l_book,
33 l_accounting_flex_Structure,
34 l_currency_code,
35 l_precision
36 FROM FA_BOOK_CONTROLS bc,
37 GL_SETS_OF_BOOKS sob,
38 FND_CURRENCIES cur
39 WHERE bc.book_type_code = P_BOOK
40 AND sob.set_of_books_id = bc.set_of_books_id
41 AND sob.currency_code = cur.currency_code;
42 END IF;
43 Accounting_Flex_Structure:=l_accounting_flex_structure;
44 Currency_Code := l_currency_code;
45 P_Min_Precision := l_precision;
46 return(l_book);
47 END;
48 RETURN NULL; end;
49 function Period1Formula return VARCHAR2 is
50 begin
51 DECLARE
52 l_period_name VARCHAR2(15);
53 l_period_PC NUMBER(15);
54 BEGIN
55 IF upper(p_mrcsobtype) = 'R'
56 THEN
57 SELECT period_name,
58 period_counter
59 INTO l_period_name,
60 l_period_PC
61 FROM FA_DEPRN_PERIODS_MRC_V
62 WHERE book_type_code = P_BOOK
63 AND period_name = P_PERIOD1;
64 ELSE
65 SELECT period_name,
66 period_counter
67 INTO l_period_name,
68 l_period_PC
69 FROM FA_DEPRN_PERIODS
70 WHERE book_type_code = P_BOOK
71 AND period_name = P_PERIOD1;
72 END IF;
73 Period1_PC := l_period_PC;
74 return(l_period_name);
75 END;
76 RETURN NULL; end;
77 function report_nameformula(Company_Name in varchar2) return varchar2 is
78 begin
79 DECLARE
80 l_report_name VARCHAR2(80);
81 l_conc_program_id NUMBER;
82 BEGIN
83 --Added during DT Fixes
84 P_CONC_REQUEST_ID := fnd_global.CONC_REQUEST_ID;
85 --End of DT Fixes
86 RP_Company_Name := Company_Name;
87 SELECT cr.concurrent_program_id
88 INTO l_conc_program_id
89 FROM FND_CONCURRENT_REQUESTS cr
90 WHERE cr.program_application_id = 140
91 AND cr.request_id = P_CONC_REQUEST_ID;
92 SELECT cp.user_concurrent_program_name
93 INTO l_report_name
94 FROM FND_CONCURRENT_PROGRAMS_VL cp
95 WHERE
96 cp.concurrent_program_id= l_conc_program_id
97 and cp.application_id = 140;
98 l_report_name := substr(l_report_name,1,instr(l_report_name,' (XML)'));
99 RP_Report_Name := l_report_name;
100 RETURN(l_report_name);
101 EXCEPTION
102 WHEN OTHERS THEN
103 RP_Report_Name := ':Fully Reserved Assets Report:';
104 RETURN(RP_Report_Name);
105 END;
106 RETURN NULL; end;
107 function Period2Formula return VARCHAR2 is
108 begin
109 DECLARE
110 l_period_name VARCHAR2(15);
111 l_period_PC NUMBER(15);
112 BEGIN
113 /*SRW.REFERENCE(PERIOD1_PC);*/null;
114 IF upper(p_mrcsobtype) = 'R'
115 THEN
116 SELECT period_name,
117 period_counter
118 INTO l_period_name,
119 l_period_PC
120 FROM FA_DEPRN_PERIODS_MRC_V
121 WHERE book_type_code = P_BOOK
122 AND period_name = P_PERIOD2;
123 ELSE
124 SELECT period_name,
125 period_counter
126 INTO l_period_name,
127 l_period_PC
128 FROM FA_DEPRN_PERIODS
129 WHERE book_type_code = P_BOOK
130 AND period_name = P_PERIOD2;
131 END IF;
132 Period2_PC := l_period_PC;
133 return(l_period_name);
134 EXCEPTION
135 WHEN NO_DATA_FOUND
136 THEN
137 PERIOD2_PC := PERIOD1_PC;
138 RETURN(P_PERIOD2);
139 END;
140 RETURN NULL; end;
141 function BeforeReport return boolean is
142 begin
143 /*SRW.USER_EXIT('FND SRWINIT');*/null;
144 IF upper(p_mrcsobtype) = 'R'
145 THEN
146 fnd_client_info.set_currency_context(p_ca_set_of_books_id);
147 END IF;
148 return (TRUE);
149 end;
150 function AfterReport return boolean is
151 begin
152 /*SRW.USER_EXIT('FND SRWEXIT');*/null;
153 return (TRUE);
154 end;
155 function d_lifeformula(LIFE in number, ADJ_RATE in number, BONUS_RATE in number, PROD in number) return varchar2 is
156 begin
157 RETURN(FADOLIF(LIFE, ADJ_RATE, BONUS_RATE, PROD));
158 end;
159 function AfterPForm return boolean is
160 begin
161 IF p_ca_set_of_books_id <> -1999
162 THEN
163 BEGIN
164 select mrc_sob_type_code, currency_code
165 into p_mrcsobtype, lp_currency_code
166 from gl_sets_of_books
167 where set_of_books_id = p_ca_set_of_books_id;
168 EXCEPTION
169 WHEN OTHERS THEN
170 p_mrcsobtype := 'P';
171 END;
172 ELSE
173 p_mrcsobtype := 'P';
174 END IF;
175 IF upper(p_mrcsobtype) = 'R'
176 THEN
177 lp_fa_deprn_summary := 'FA_DEPRN_SUMMARY_MRC_V';
178 lp_fa_deprn_detail := 'FA_DEPRN_DETAIL_MRC_V';
179 lp_fa_books := 'FA_BOOKS_MRC_V';
180 lp_fa_book_controls := 'FA_BOOK_CONTROLS_MRC_V';
181 lp_fa_deprn_periods := 'FA_DEPRN_PERIODS_MRC_V';
182 ELSE
183 lp_fa_deprn_summary := 'FA_DEPRN_SUMMARY';
184 lp_fa_deprn_detail := 'FA_DEPRN_DETAIL';
185 lp_fa_books := 'FA_BOOKS';
186 lp_fa_book_controls := 'FA_BOOK_CONTROLS';
187 lp_fa_deprn_periods := 'FA_DEPRN_PERIODS';
188 END IF;
189 return (TRUE);
190 end;
191 --Functions to refer Oracle report placeholders--
192 Function Accounting_Flex_Structure_p return number is
193 Begin
194 return Accounting_Flex_Structure;
195 END;
196 Function Currency_Code_p return varchar2 is
197 Begin
198 return Currency_Code;
199 END;
200 Function Period1_PC_p return number is
201 Begin
202 return Period1_PC;
203 END;
204 Function Period2_PC_p return number is
205 Begin
206 return Period2_PC;
207 END;
208 Function RP_COMPANY_NAME_p return varchar2 is
209 Begin
210 return RP_COMPANY_NAME;
211 END;
212 Function RP_REPORT_NAME_p return varchar2 is
213 Begin
214 return RP_REPORT_NAME;
215 END;
216 Function RP_BAL_LPROMPT_p return varchar2 is
217 Begin
218 return RP_BAL_LPROMPT;
219 END;
220 FUNCTION fadolif(life NUMBER,
221 adj_rate NUMBER,
222 bonus_rate NUMBER,
223 prod NUMBER)
224 RETURN CHAR IS
225 retval CHAR(7);
226 num_chars NUMBER;
227 temp_retval number;
228 BEGIN
229 IF life IS NOT NULL
230 THEN
231 -- Fix for bug 601202 -- added substrb after lpad. changed '90' to '999'
232 temp_retval := fnd_number.canonical_to_number((LPAD(SUBSTR(TO_CHAR(TRUNC(life/12, 0), '999'), 2, 3),3,' ') || '.' ||
233 SUBSTR(TO_CHAR(MOD(life, 12), '00'), 2, 2)) );
234 retval := to_char(temp_retval,'999D99');
235 ELSIF adj_rate IS NOT NULL
236 THEN
237 /* Bug 1744591
238 Changed 90D99 to 990D99 */
239 retval := SUBSTR(TO_CHAR(ROUND((adj_rate + NVL(bonus_rate, 0))*100, 2), '990.99'),2,6) || '%';
240 ELSIF prod IS NOT NULL
241 THEN
242 --test for length of production_capacity; if it's longer
243 --than 7 characters, then display in exponential notation
244 --IF prod <= 9999999
245 --THEN
246 -- retval := TO_CHAR(prod);
247 --ELSE
248 -- retval := SUBSTR(LTRIM(TO_CHAR(prod, '9.9EEEE')), 1, 7);
249 --END IF;
250 --display nothing for UOP assets
251 retval := '';
252 ELSE
253 --should not occur
254 retval := ' ';
255 END IF;
256 return(retval);
257 END;
258 END FA_FAS402_XMLP_PKG ;
259