DBA Data[Home] [Help]

PACKAGE BODY: APPS.FA_FASRCOST_XMLP_PKG

Source


1 PACKAGE BODY FA_FASRCOST_XMLP_PKG AS
2 /* $Header: FASRCOSTB.pls 120.0.12010000.1 2008/07/28 13:17:21 appldev ship $ */
3 
4 function report_nameformula(Company_Name in varchar2) return varchar2 is
5 begin
6 
7 DECLARE
8   l_report_name VARCHAR2(80);
9   l_conc_program_id NUMBER;
10 BEGIN
11 --Added during DT Fix
12  P_CONC_REQUEST_ID := fnd_global.CONC_REQUEST_ID;
13 --End of DT Fix
14   RP_Company_Name := Company_Name;
15 
16   SELECT cr.concurrent_program_id
17   INTO l_conc_program_id
18   FROM FND_CONCURRENT_REQUESTS cr
19   WHERE cr.program_application_id = 140
20   AND   cr.request_id = P_CONC_REQUEST_ID;
21 
22   SELECT cp.user_concurrent_program_name
23   INTO   l_report_name
24   FROM    FND_CONCURRENT_PROGRAMS_VL cp
25   WHERE
26       cp.concurrent_program_id= l_conc_program_id
27   and cp.application_id = 140;
28 
29   l_report_name := substr(l_report_name,1,instr(l_report_name,' (XML)'));
30   RP_Report_Name := l_report_name;
31   RETURN(l_report_name);
32 
33 EXCEPTION
34   WHEN OTHERS THEN
35     RP_Report_Name := ':Recoverable Cost Report:';
36     RETURN(RP_REPORT_NAME);
37 END;
38 RETURN NULL; end;
39 
40 function BeforeReport return boolean is
41 begin
42 
43 /*SRW.USER_EXIT('FND SRWINIT');*/null;
44   return (TRUE);
45 end;
46 
47 function AfterReport return boolean is
48 begin
49 
50 /*SRW.USER_EXIT('FND SRWEXIT');*/null;
51   return (TRUE);
52 end;
53 
54 function Period1_PCFormula return Number is
55 begin
56 
57 DECLARE
58   l_period_POD  DATE;
59   l_period_PCD  DATE;
60   l_period_PC   NUMBER(15);
61   l_period_FY   NUMBER(15);
62 BEGIN
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 
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 
82 --function corp_period_pcformula(book_type_code in varchar2, distribution_source_book in varchar2) return number is
83 function corp_period_pcformula(chg_book_type_code in varchar2, chg_distribution_source_book in varchar2) return number is
84 begin
85 
86 DECLARE
87   l_period_POD  DATE;
88   l_period_PCD  DATE;
89   l_period_PC   NUMBER(15);
90 
91   tax_calendar  VARCHAR2(15);
92   corp_calendar VARCHAR2(15);
93 slask 	varchar2(30);
94 BEGIN
95 
96   Select deprn_calendar
97   into   tax_calendar
98   from fa_book_controls
99 --  where book_type_code = book_type_code;
100   where book_type_code = chg_book_type_code;
101 
102   select deprn_calendar
103   into corp_calendar
104   from fa_book_controls
105   --where book_type_code = distribution_source_book;
106   where book_type_code = chg_distribution_source_book;
107 
108 
109   if tax_calendar = corp_calendar then
110          SELECT period_counter,
111          period_open_date,
112          nvl(period_close_date, sysdate)
113      INTO   l_period_PC,
114          l_period_POD,
115          l_period_PCD
116      FROM   FA_DEPRN_PERIODS
117      --WHERE  book_type_code = Distribution_Source_Book
118      WHERE  book_type_code = chg_distribution_source_book
119      AND    period_name    = P_PERIOD1;
120 
121 
122   else
123 
124      SELECT period_counter,
125          period_open_date,
126          nvl(period_close_date, sysdate)
127      INTO   l_period_PC,
128          l_period_POD,
129          l_period_PCD
130      FROM   FA_DEPRN_PERIODS
131      --WHERE  book_type_code = Distribution_Source_Book
132      WHERE  book_type_code = chg_distribution_source_book
133      AND    Period1_PCD BETWEEN PERIOD_OPEN_DATE AND
134 	NVL(PERIOD_CLOSE_DATE, Period1_PCD);
135 
136   end if;
137 
138   Corp_Period_POD := l_period_POD;
139   Corp_Period_PCD := l_period_PCD;
140   return(l_period_PC);
141 END;
142 RETURN NULL; end;
143 
144 --Functions to refer Oracle report placeholders--
145 
146  Function ACCT_BAL_APROMPT_p return varchar2 is
147 	Begin
148 	 return ACCT_BAL_APROMPT;
149 	 END;
150  Function Period1_POD_p return date is
151 	Begin
152 	 return Period1_POD;
153 	 END;
154  Function Period1_PCD_p return date is
155 	Begin
156 	 return Period1_PCD;
157 	 END;
158  Function Period1_FY_p return number is
159 	Begin
160 	 return Period1_FY;
161 	 END;
162  Function Corp_Period_POD_p return date is
163 	Begin
164 	 return Corp_Period_POD;
165 	 END;
166  Function Corp_Period_PCD_p return date is
167 	Begin
168 	 return Corp_Period_PCD;
169 	 END;
170  Function RP_COMPANY_NAME_p return varchar2 is
171 	Begin
172 	 return RP_COMPANY_NAME;
173 	 END;
174  Function RP_REPORT_NAME_p return varchar2 is
175 	Begin
176 	 return RP_REPORT_NAME;
177 	 END;
178  Function RP_BAL_LPROMPT_p return varchar2 is
179 	Begin
180 	 return RP_BAL_LPROMPT;
181 	 END;
182 END FA_FASRCOST_XMLP_PKG ;
183