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