DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_PQUBGTEN_XMLP_PKG

Source


1 PACKAGE BODY PQH_PQUBGTEN_XMLP_PKG AS
2 /* $Header: PQUBGTENB.pls 120.3 2008/02/28 12:17:54 srikrish noship $ */
3 
4 function BeforeReport return boolean is
5 errbuf varchar2(1000);
6 retcode varchar2(100);
7 pqh_pack_err exception;
8 l_batch varchar2(1);
9 cursor c_process_log is
10 select  '1'
11   from pqh_process_log
12  where module_cd = 'POSITION_BUDGET_ANALYSIS'
13    and information12 = 'REPORT'
14    and information11 like P_BATCH_NAME||'%';
15 
16 Cursor c_curr_date is
17 Select trunc(sysdate)
18   From dual;
19 cursor csr_org_struct_name IS
20    SELECT name
21    FROM   per_organization_structures
22    WHERE  organization_structure_id = p_org_structure_id;
23 l_org_struct_name per_organization_structures.name%TYPE;
24 Cursor Csr_entity_name IS
25     SELECT meaning
26     FROM   hr_lookups
27     WHERE  lookup_type IN ('PQH_BUDGET_ENTITY','UNDER_BDGT_EXTRA_TYPES')
28     AND    lookup_code = p_entity_code;
29   l_entity_name  varchar2(80);
30 begin
31 P_EFFECTIVE_DATE_T := to_char(P_EFFECTIVE_DATE,'DD-MON-YYYY');
32 --hr_standard.event('BEFORE REPORT');
33 
34 cp_bg_name := hr_general.decode_organization(p_business_group_id);
35 CP_REPORT_TITLE:= hr_general.decode_lookup('PQH_REPORT_TITLES','PQHWSUBE');
36 If p_org_structure_id IS NOT NULL THEN
37   OPEN csr_org_struct_name;
38   FETCH csr_org_struct_name INTO l_org_struct_name;
39   CLOSE csr_org_struct_name;
40   cp_org_structure_name := l_org_struct_name;
41 End If;
42 If p_start_org_id IS NOT NULL THEN
43   cp_start_org_name := hr_general.decode_organization(p_start_org_id);
44 End If;
45 OPEN csr_entity_name;
46 FETCH csr_entity_name INTO l_entity_name;
47 CLOSE csr_entity_name;
48 cp_entity_name := l_entity_name;
49 cp_uom := hr_general.decode_lookup('BUDGET_MEASUREMENT_TYPE',P_UNIT_OF_MEASURE);
50 pqh_budget_analysis_pkg.get_entity(
51 errbuf,
52 retcode,
53 p_batch_name,
54 to_char(p_effective_date, 'YYYY/MM/DD HH24:MI:SS'),
55 to_char(p_start_date, 'YYYY/MM/DD HH24:MI:SS'),
56 to_char(p_end_date, 'YYYY/MM/DD HH24:MI:SS'),
57 p_entity_code,
58 p_unit_of_measure,
59 p_business_group_id,
60 p_start_org_id,
61 p_org_structure_id);
62 commit;
63 
64 OPEN c_process_log;
65 FETCH c_process_log INTO l_batch;
66 If c_process_log%notfound Then
67   cp_no_data := null;
68 Else
69   cp_no_data := '1';
70 End If;
71 CLOSE c_process_log;
72 
73 OPEN c_curr_date;
74 FETCH c_curr_date Into cp_sysdate;
75 CLOSE c_curr_date;
76 
77 
78 if errbuf is not null then
79 raise pqh_pack_err;
80 return (FALSE);
81 else
82   return (TRUE);
83 end if;
84 
85 
86 
87 exception
88 when pqh_pack_err then
89 /*srw.message(100, errbuf);*/null;
90 
91 --return (FALSE);
92 RETURN (TRUE);
93 when others then
94 /*srw.message(100, 'Unexpected error occured in the Before Report trigger for PQH_PQUBGTEN_XMLP_PKG report');*/null;
95 
96 --return (FALSE);
97 RETURN (TRUE);
98 end;
99 
100 function CP_sysdateFormula return Date is
101 begin
102 null;
103 end;
104 
105 function AfterReport return boolean is
106 begin
107   /*srw.user_exit('FND SRWEXIT');*/null;
108 
109   return (TRUE);
110 end;
111 
112 function cf_amount_format_maskformula(uom in varchar2) return char is
113 l_format_mask  varchar2(40);
114 l_currency_code varchar2(10);
115 l_leg_code   varchar2(10);
116 cursor csr_leg_code IS
117     SELECT  bg.legislation_code
118     FROM    per_business_groups_perf bg
119     WHERE   bg.business_group_id = p_business_group_id;
120 begin
121   l_currency_code := hr_general.default_currency_code(p_business_group_id => p_business_group_id);
122   IF l_currency_code IS NULL THEN
123     OPEN csr_leg_code;
124     FETCH csr_leg_code INTO l_leg_code;
125     CLOSE csr_leg_code;
126     l_currency_code := hr_general.default_currency_code(p_legislation_code => l_leg_code);
127   END IF;
128   IF uom = 'MONEY' and l_currency_code IS NOT NULL THEN
129       l_format_mask := fnd_currency.get_format_mask(l_currency_code,22);
130   ELSE
131     fnd_currency.build_format_mask(l_format_mask,22,2,null,null,null,null);
132    END IF;
133 RETURN l_format_mask;
134 
135 end;
136 
137 function BeforePForm return boolean is
138 begin
139   insert into fnd_sessions (session_id, effective_date)
140  values(userenv('sessionid'),p_effective_date);
141   return (TRUE);
142 end;
143 
144 --Functions to refer Oracle report placeholders--
145 
146  Function CP_No_Data_p return varchar2 is
147 	Begin
148 	 return CP_No_Data;
149 	 END;
150  Function CP_sysdate_p return date is
151 	Begin
152 	 return CP_sysdate;
153 	 END;
154  Function CP_BG_NAME_p return varchar2 is
155 	Begin
156 	 return CP_BG_NAME;
157 	 END;
158  Function CP_UOM_p return varchar2 is
159 	Begin
160 	 return CP_UOM;
161 	 END;
162  Function CP_ENTITY_NAME_p return varchar2 is
163 	Begin
164 	 return CP_ENTITY_NAME;
165 	 END;
166  Function CP_ORG_STRUCTURE_NAME_p return varchar2 is
167 	Begin
168 	 return CP_ORG_STRUCTURE_NAME;
169 	 END;
170  Function CP_START_ORG_NAME_p return varchar2 is
171 	Begin
172 	 return CP_START_ORG_NAME;
173 	 END;
174  Function CP_REPORT_TITLE_p return varchar2 is
175 	Begin
176 	 return CP_REPORT_TITLE;
177 	 END;
178 END PQH_PQUBGTEN_XMLP_PKG ;