DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_PACRCBDT_XMLP_PKG

Source


1 PACKAGE BODY PA_PACRCBDT_XMLP_PKG AS
2 /* $Header: PACRCBDTB.pls 120.0 2008/01/02 10:57:25 krreddy noship $ */
3 function cf_total_costformula(p_project_id in number, capital_event_id in number) return number is
4 l_total_cost NUMBER :=0;
5 begin
6   begin
7     select SUM(decode(cp_capital_cost_type_flag,'R',
8                                             amount,
9                                             decode(cdl.line_type,'D',cdl.amount,
10                                                                      cdl.burdened_cost)))
11     into  l_total_cost
12     from  pa_cost_distribution_lines_all cdl,
13            pa_expenditure_items_all ei
14    where  ei.expenditure_item_id = cdl.expenditure_item_id
15      and  cdl.project_id = cf_total_costformula.p_project_id
16      and  ei.capital_event_id = cf_total_costformula.capital_event_id
17      and  (cdl.line_type =  decode(cp_line_type, 'D', 'D', 'R', 'R')  OR
18            cdl.line_type = decode(cp_line_type, 'D', 'D', 'R', 'I')
19           );
20   exception
21     when no_data_found then
22     l_total_Cost:=0;
23    end;
24 return(l_total_cost);
25 end;
26 function cf_project_setupformula(project_id in number) return char is
27 CURSOR C_project_setup IS (SELECT PPT.capital_cost_type_code ,PPT.total_burden_flag,PPT.burden_amt_display_method
28 	 			 FROM PA_PROJECT_TYPES PPT,
29            			      PA_PROJECTS_ALL PP
30     				WHERE PP.project_type = PPT.project_type
31 	 			  AND PP.project_id=cf_project_setupformula.project_id);
32 r_project_setup c_project_setup%ROWTYPE;
33 begin
34 OPEN C_project_setup;
35 FETCH C_project_setup INTO r_project_setup;
36 cp_capital_cost_type_flag:=r_project_setup.capital_cost_type_code;
37 if (cp_capital_cost_type_flag = 'B' and
38       nvl(r_project_setup.total_burden_flag,'N') = 'Y') then
39         cp_line_type := 'D' ;
40   else
41         cp_line_type := 'R' ;
42 end if ;
43 CLOSE C_project_setup;
44 return('X');
45 end;
46 function cf_locationformula(location_id in number) return char is
47 BEGIN
48 RETURN (fnd_flex_ext.get_segs('OFA', 'LOC#',101, location_id));
49 end;
50 function cf_categoryformula(asset_category_id in number) return char is
51 BEGIN
52 RETURN (fnd_flex_ext.get_segs('OFA', 'CAT#',101, asset_category_id));
53 end;
54 FUNCTION  get_company_name    RETURN BOOLEAN IS
55   l_name                  gl_sets_of_books.name%TYPE;
56 BEGIN
57   SELECT  gl.name
58   INTO    l_name
59   FROM    gl_sets_of_books gl,pa_implementations pi
60   WHERE   gl.set_of_books_id = pi.set_of_books_id;
61   cp_company_name     := l_name;
62   RETURN (TRUE);
63 EXCEPTION
64   WHEN   OTHERS  THEN
65     RETURN (FALSE);
66 END;
67 function BeforeReport return boolean is
68 l_purgeable         varchar2(20);
69 l_retcode           NUMBER:=0;
70 l_errbuf            VARCHAR2(2000):=Null;
71 number_of_messages  NUMBER;
72 message_buf         VARCHAR2(2000);
73 init_failure        EXCEPTION;
74 BEGIN
75 
76      P_DEBUG_MODE:='G';
77         /*SRW.MESSAGE('100','BEFORE CALLING INIT USEREXIT');*/null;
78     /*srw.user_exit('FND SRWINIT');*/null;
79         IF P_CONC_REQUEST_ID IS NULL THEN
80         P_CONC_REQUEST_ID:=-1;
81 	/*SRW.MESSAGE('100','P_CONC_ID IS NULL');*/null;
82     END IF;
83 IF p_project_id IS NOT NULL THEN
84   Begin
85     select segment1
86     into p_project_number
87     from pa_projects_all
88    where project_id=p_project_id;
89   EXCEPTION
90    when no_data_found then null;
91   END;
92 END IF;
93 p_project_number_parameter :=p_project_number;
94 IF p_org_id IS NOT NULL THEN
95    BEGIN
96     select name
97     INTO p_org_name
98     from pa_organizations_proj_all_bg_v
99     where organization_id=p_org_id;
100   EXCEPTION
101     when no_data_found then null;
102   END;
103 END IF;
104 
105     /*SRW.MESSAGE('100','BEFORE GETTTING THE DEBUG MODE PROFILE VALUE');*/null;
106         /*srw.user_exit('FND GETPROFILE
107                    NAME="PA_DEBUG_MODE"
108 	           FIELD=":p_debug_mode"
109 		   PRINT_ERROR="N"');*/null;
110     /*SRW.MESSAGE('100','BEFORE SETTING ALTER SEESION');*/null;
111     If p_debug_mode = 'Y' then
112        /*srw.do_sql('ALTER SESSION SET SQL_TRACE TRUE');*/null;
113     End If;
114     /*SRW.MESSAGE('100','BEFORE GETTTING THE COMP NAME');*/null;
115         IF (get_company_name <> TRUE) THEN          RAISE init_failure;
116     END IF;
117     /*SRW.MESSAGE('100','BEFORE CALLING THE GET CAP');*/null;
118     /*SRW.MESSAGE('100','BEFORE CALLING THE GET CAP P1'||p_project_type);*/null;
119     /*SRW.MESSAGE('100','BEFORE CALLING THE GET CAP P2'||p_project_id);*/null;
120     /*SRW.MESSAGE('100','BEFORE CALLING THE GET CAP P3'||p_event_period);*/null;
121     /*SRW.MESSAGE('100','BEFORE CALLING THE GET CAP P4'||p_class_category);*/null;
122     /*SRW.MESSAGE('100','BEFORE CALLING THE GET CAP P5'||p_class_code);*/null;
123     /*SRW.MESSAGE('100','BEFORE CALLING THE GET CAP P6'||p_show_detail);*/null;
124     return (TRUE);
125 EXCEPTION
126     WHEN init_failure then
127         /*srw.message('102','Unable to get the Title');*/null;
128         return (TRUE);
129     WHEN   OTHERS  THEN
130         l_retcode := SQLCODE;
131         l_errbuf := SQLERRM;
132         /*srw.message('101','Unexpected Error'||substr(l_errbuf,1,100));*/null;
133         RAISE_application_error(-20101,null);/*SRW.PROGRAM_ABORT;*/null;
134         return (TRUE);
135 end ;
136 function CF_currency_CodeFormula return Char is
137 begin
138  return(pa_multi_currency.get_acct_currency_code);
139 end;
140 function AfterReport return boolean is
141 begin
142   /*srw.user_exit('FND SRWEXIT');*/null;
143   return (TRUE);
144 end;
145 function project_asset_type_dispformula(project_asset_type in varchar2) return char is
146 l_meaning pa_lookups.meaning%TYPE:=NULL;
147 begin
148   BEGIN
149     select meaning
150       into l_meaning
151       from pa_lookups
152      where lookup_type ='PROJECT_ASSET_TYPES'
153        and lookup_code=project_asset_type;
154   EXCEPTION
155     WHEN NO_DATA_FOUND THEN
156       NULL;
157   END;
158 return(l_meaning);
159 end;
160 function event_type_dspformula(event_type in varchar2) return char is
161 l_meaning pa_lookups.meaning%type;
162 begin
163   BEGIN
164    select meaning
165      into l_meaning
166      from pa_lookups
167    where lookup_type ='CAPITAL_TYPE'
168      and lookup_code=event_type;
169    EXCEPTION
170    WHEN NO_DATA_FOUND THEN
171      l_meaning :=NULL;
172    END;
173 return(l_meaning);
174 end;
175 function organization_dspformula(CARRYING_OUT_ORGANIZATION_ID in number) return char is
176 l_name HR_ORGANIZATION_UNITS .name%TYPE;
177 begin
178   BEGIN
179   select  ORG.name
180    INTO l_name
181    from HR_ORGANIZATION_UNITS  ORG
182    where  ORG.ORGANIZATION_ID = CARRYING_OUT_ORGANIZATION_ID;
183   EXCEPTION
184   WHEN NO_DATA_FOUND THEN
185   l_name :=NULL;
186   END;
187 return(l_name);
188 end;
189 function b_capital_event_number1formatt(capital_event_id in number) return boolean is
190 begin
191 
192     if ((capital_event_id = '-1') )
193   then
194     return (FALSE);
195   end if;
196 
197   return (TRUE);
198 end;
199 
200 function b_project_type3formattrigger(no_rec in number) return boolean is
201 begin
202   if (no_rec <>0)
203   then
204     return (FALSE);
205   end if;
206   return (TRUE);
207 end;
208 function b_sumcurrent_asset_costpercap2(sumcurrent_asset_costperasset in number) return boolean is
209 begin
210     if (P_SHOW_DETAIL <> 'Y')
211   then
212        return (FALSE);
213      end if;
214 if (sumcurrent_asset_costperasset IS NULL)
215     then
216   return (TRUE);
217 else
218 return(false);
219 end if;
220 end;
221 function b_8formattrigger(capital_event_id in number) return boolean is
222 begin
223     if ((capital_event_id = '-1') )
224   then
225     return (FALSE);
226   end if;
227   return (TRUE);
228 end;
229 function b_9formattrigger(capital_event_id in number) return boolean is
230 begin
231     if ((capital_event_id = '-1') )
232   then
233     return (FALSE);
234   end if;
235   return (TRUE);
236 end;
237 --Functions to refer Oracle report placeholders--
238  Function CP_line_type_p return varchar2 is
239 	Begin
240 	 return CP_line_type;
241 	 END;
242  Function CP_capital_cost_type_flag_p return varchar2 is
243 	Begin
244 	 return CP_capital_cost_type_flag;
245 	 END;
246  Function cp_company_name_p return varchar2 is
247 	Begin
248 	 return cp_company_name;
249 	 END;
250 Function p_project_number_parameter_p return varchar2 is
251 Begin
252 	 return p_project_number_parameter;
253 END;
254 
255 END PA_PACRCBDT_XMLP_PKG ;
256