DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_PAXAUMTC_XMLP_PKG

Source


1 PACKAGE BODY PA_PAXAUMTC_XMLP_PKG AS
2 /* $Header: PAXAUMTCB.pls 120.0.12020000.3 2013/03/06 09:52:53 admarath ship $ */
3 FUNCTION  get_cover_page_values   RETURN BOOLEAN IS
4 
5 BEGIN
6 
7 RETURN(TRUE);
8 
9 EXCEPTION
10 WHEN OTHERS THEN
11   RETURN(FALSE);
12 
13 END;
14 
15 function BeforeReport return boolean is
16 begin
17 
18 Declare
19  msg varchar2(2000);
20  init_failure exception;
21  hold_employee_name  VARCHAR2(40);
22  p_date_lo date;
23  p_date_hi date;
24  code VARCHAR2(80);
25  org_name hr_organization_units.name%TYPE;
26  person_name VARCHAR2(30);
27  start_day NUMBER;
28 
29  BEGIN
30 
31 
32 
33 /*srw.user_exit('FND SRWINIT');*/null;
34 
35 
36 
37 /*srw.user_exit('FND GETPROFILE
38 NAME="PA_RULE_BASED_OPTIMIZER"
39 FIELD=":p_rule_optimizer"
40 PRINT_ERROR="N"');*/null;
41 
42 
43 
44 
45 
46 
47 
48 /*srw.user_exit('FND GETPROFILE
49 NAME="PA_DEBUG_MODE"
50 FIELD=":p_debug_mode"
51 PRINT_ERROR="N"');*/null;
52 
53 
54 
55 
56 
57 --bug 14255823
58 If employee_id is not null
59   then
60 begin
61     select substr(full_name,1,40)
62     into   hold_employee_name
63     from   per_people_f
64     where  person_id = employee_id
65     and   ((sysdate between effective_start_date
66 		      and nvl(effective_end_date,sysdate + 1))
67           or (effective_start_date > sysdate))
68     and   ((employee_number IS NOT NULL and
69 nvl(current_employee_flag,'N')='Y')
70         or (npw_number IS NOT NULL and nvl(current_npw_flag,'N') ='Y'));
71 	Exception
72 	when others then
73 	NULL;
74 	end;
75 end if;
76 c_employee_name := hold_employee_name;
77 IF incurred_org is not null then
78    select substr(name,1,30)
79    into org_name from
80    hr_organization_units
81    where organization_id = incurred_org;
82 END IF;
83 c_incurred_org := org_name;
84 
85 --bug 14255823
86 IF supervisor is not null then
87 begin
88   select substr(full_name,1,30)
89   into person_name
90   from per_people_f
91   where person_id = supervisor
92   and   ((sysdate between effective_start_date
93 		    and nvl(effective_end_date,sysdate + 1))
94         or (effective_start_date > sysdate))
95   and   ((employee_number IS NOT NULL and
96 nvl(current_employee_flag,'N')='Y')
97         or (npw_number IS NOT NULL and nvl(current_npw_flag,'N') ='Y'));
98 Exception
99 when others then
100 NULL;
101 end;
102 
103 ELSE
104  select '' into person_name from dual;
105 END IF;
106 c_supervisor := person_name;
107 
108 
109 
110  c_date_lo := date_lo;
111  c_date_hi := date_hi;
112 
113 
114   IF (get_company_name <> TRUE) THEN       RAISE init_failure;
115   END IF;
116 EXCEPTION
117   WHEN   OTHERS  THEN
118     RAISE_application_error(-20101,null);/*SRW.PROGRAM_ABORT;*/null;
119 
120 END;
121   return (TRUE);
122 end;
123 
124 FUNCTION  get_company_name    RETURN BOOLEAN IS
125   l_name                  gl_sets_of_books.name%TYPE;
126 BEGIN
127   SELECT  gl.name
128   INTO    l_name
129   FROM    gl_sets_of_books gl,pa_implementations pi
130   WHERE   gl.set_of_books_id = pi.set_of_books_id;
131 
132   c_company_name_header     := l_name;
133 
134   RETURN (TRUE);
135 
136  EXCEPTION
137 
138   WHEN   OTHERS  THEN
139     RETURN (FALSE);
140 
141 END;
142 
143 function AfterReport return boolean is
144 begin
145 
146 BEGIN
147  /*srw.user_exit('FND SRWEXIT');*/null;
148 
149 END;  return (TRUE);
150 end;
151 
152 function AfterPForm return boolean is
153 
154 l_start_date varchar2(11);
155 l_end_date  varchar2(11) ;
156 l_dummy_date  varchar2(11);
157 l_dt_format varchar2(40) := 'dd-mon-rrrr';
158 begin
159 	/*srw.user_exit('FND SRWINIT');*/null;
160 
161 	l_start_date := to_char(pa_utils.getweekending(date_lo),l_dt_format);   --bug 14255823
162   l_end_date   := to_char(pa_utils.getweekending(date_hi),l_dt_format);  --bug 14255823
163   l_dummy_date := l_start_date;
164   if to_date(l_end_date, l_dt_format) > to_date(date_hi, l_dt_format)  then
165   	l_end_date := to_char(to_date(l_end_date, l_dt_format) - 7,l_dt_format);  --bug 14255823
166   end if ;
167 	while to_date(l_dummy_date, l_dt_format) <= to_date(l_end_date, l_dt_format)
168 	 loop
169     where_stmt := where_stmt||' union select to_date('||''''||l_dummy_date||''''|| ','||''''||l_dt_format||''''|| ') from dual';
170     l_dummy_date  := to_char(to_date(l_dummy_date,l_dt_format) + 7,l_dt_format);   --bug 14255823
171 	 end loop;
172 	 where_stmt := where_stmt || ' minus select distinct to_date(expenditure_ending_date,'||''''||l_dt_format||''''||') from pa_expenditures where expenditure_ending_date between :date_lo and :date_hi  and expenditure_class_code in (' || ''''
173                         || 'PT' || '''' || ',' || '''' || 'OT' || '''' || ') order by 1' ;
174 	   return (TRUE);
175 end;
176 
177 --Functions to refer Oracle report placeholders--
178 
179  Function C_COMPANY_NAME_HEADER_p return varchar2 is
180 	Begin
181 	 return C_COMPANY_NAME_HEADER;
182 	 END;
183  Function C_employee_name_p return varchar2 is
184 	Begin
185 	 return C_employee_name;
186 	 END;
187  Function C_date_lo_p return date is
188 	Begin
189 	 return C_date_lo;
190 	 END;
191  Function C_date_hi_p return date is
192 	Begin
193 	 return C_date_hi;
194 	 END;
195  Function C_incurred_org_p return varchar2 is
196 	Begin
197 	 return C_incurred_org;
198 	 END;
199  Function C_supervisor_p return varchar2 is
200 	Begin
201 	 return C_supervisor;
202 	 END;
203 END PA_PAXAUMTC_XMLP_PKG ;