DBA Data[Home] [Help]

PACKAGE BODY: APPS.ICX_ON_CABO

Source


1 package body icx_on_cabo as
2 /* $Header: ICXONCB.pls 120.0 2005/10/07 12:15:54 gjimenez noship $ */
3 
4 procedure toolbar(p_title varchar2,
5                   p_export boolean) is
6 
7 l_title   varchar2(80);
8 l_prompts icx_util.g_prompts_table;
9 
10 l_toolbar icx_cabo.toolbar;
11 
12 begin
13 
14 icx_util.getprompts(601, 'ICX_OBIS_TOOLBAR', l_title, l_prompts);
15 
16 l_toolbar.title := p_title;
17 if icx_sec.g_function_type = 'WWK'
18 then
19   l_toolbar.menu_url := 'javascript:window.close();';
20 else
21   l_toolbar.menu_url := owa_util.get_cgi_env('SCRIPT_NAME')||'/OracleNavigate.Responsibility';
22 end if;
23 l_toolbar.menu_mouseover := l_prompts(7);
24 l_toolbar.print_frame := 'main';
25 l_toolbar.print_mouseover := '';
26 l_toolbar.help_url := 'javascript:top.main.help_window()';
27 l_toolbar.help_mouseover := l_prompts(5);
28 if p_export
29 then
30   l_toolbar.custom_option1_url := 'javascript:top.main.document.exportON.submit()';
31   l_toolbar.custom_option1_mouseover := l_prompts(6);
32   l_toolbar.custom_option1_gif := 'OA_MEDIA/FNDEXP.gif';
33   l_toolbar.custom_option1_mouseover_gif := 'OA_MEDIA/FNDEXP.gif';
34   l_toolbar.custom_option1_disabled_gif := 'OA_MEDIA/FNDEXP.gif';
35 end if;
36 --add return to home icon
37 --mputman 1625243
38   l_toolbar.custom_option2_url := icx_plug_utilities.getPLSQLagent||'OracleMyPage.Home';
39   l_toolbar.custom_option2_mouseover := wf_core.translate('RETURN_TO_HOME');
40   l_toolbar.custom_option2_gif := '/OA_MEDIA/FNDHOME.gif';
41   l_toolbar.custom_option2_mouseover_gif := '/OA_MEDIA/FNDHOME.gif';
42 
43 icx_cabo.displaytoolbar(l_toolbar);
44 
45 end;
46 
47 procedure findPage(p_flow_appl_id in number,
48                    p_flow_code in varchar2,
49                    p_page_appl_id in number,
50                    p_page_code in varchar2,
51                    p_region_appl_id in number,
52                    p_region_code in varchar2,
53                    p_lines_now in number,
54                    p_lines_next in number,
55                    p_hidden_name in varchar2,
56                    p_hidden_value in varchar2,
57                    p_help_url in varchar2) is
58 
59 l_region_appl_id number;
60 l_region_code   varchar2(30);
61 
62 l_search_page_title  varchar2(240);
63 l_page_title  varchar2(240);
64 l_page_description varchar2(2000);
65 
66 l_X varchar2(2000);
67 l_helpmsg varchar2(240);
68 l_helptitle varchar2(240);
69 l_tabs icx_cabo.tabTable;
70 l_toolbar icx_cabo.toolbar;
71 
72 begin
73 
74 icx_cabo.g_base_href := FND_WEB_CONFIG.WEB_SERVER;
75 icx_cabo.g_plsql_agent := icx_cabo.plsqlagent;
76 
77 if p_page_code is not null
78 then
79   select  PRIMARY_REGION_APPL_ID,PRIMARY_REGION_CODE,
80           NAME,DESCRIPTION
81   into    l_region_appl_id,l_region_code,
82           l_page_title,l_page_description
83   from    AK_FLOW_PAGES_VL
84   where   PAGE_CODE = p_page_code
85   and     PAGE_APPLICATION_ID = p_page_appl_id
86   and     FLOW_CODE = p_flow_code
87   and     FLOW_APPLICATION_ID = p_flow_appl_id;
88 else
89   select  REGION_APPLICATION_ID,REGION_CODE,
90           NAME,DESCRIPTION
91   into    l_region_appl_id,l_region_code,
92           l_page_title,l_page_description
93   from    AK_REGIONS_VL
94   where   REGION_CODE = p_region_code
95   and     REGION_APPLICATION_ID = p_region_appl_id;
96 end if;
97 
98 l_search_page_title := icx_util.getPrompt(601,'ICX_WEB_ON_QUERY',178,'ICX_SEARCH')||'- '||l_page_title;
99 
100 l_toolbar.title := l_search_page_title;
101 l_toolbar.menu_url := 'insert_help_url_here';
102 l_toolbar.menu_mouseover := '';
103 l_toolbar.print_frame := 'main';
104 l_toolbar.print_mouseover := '';
105 l_toolbar.help_url := 'insert_help_url_here';
106 l_toolbar.help_mouseover := '';
107 
108 l_helptitle := '';
109 l_helpmsg := l_page_description;
110 
111 l_X := icx_call.encrypt2(p_flow_appl_id||'*'||p_flow_code||'*'||p_page_appl_id||'*'||p_page_code||'*'||l_region_appl_id||'*'||l_region_code||'*'||
112        p_lines_now||'*'||p_lines_next||'*'||p_hidden_name||'*'||p_hidden_value||'*'||p_help_url||'****]');
113 
114 l_tabs(0).name := 'search';
115 l_tabs(0).text := l_search_page_title;
116 l_tabs(0).hint := l_page_title;
117 l_tabs(0).visible := 'true';
118 l_tabs(0).enabled := 'true';
119 l_tabs(0).url := icx_cabo.g_base_href||icx_cabo.g_plsql_agent||'OracleON.FindForm?X='||l_X;
120 
121 l_tabs(1).name := 'results';
122 l_tabs(1).text := l_page_title;
123 l_tabs(1).hint := l_page_title;
124 l_tabs(1).visible := 'true';
125 l_tabs(1).enabled := 'true';
126 l_tabs(1).url := 'javascript:top.main.submitFunction();';
127 
128 icx_cabo.container(p_toolbar => l_toolbar,
129                p_helpmsg => l_helpmsg,
130                p_helptitle => l_helptitle,
131                p_tabs => l_tabs,
132                p_action => TRUE);
133 
134 end;
135 
136 procedure findForm(p_flow_appl_id in number,
137                    p_flow_code in varchar2,
138                    p_page_appl_id in number,
139                    p_page_code in varchar2,
140                    p_region_appl_id in number,
141                    p_region_code in varchar2,
142                    p_lines_now in number,
143                    p_lines_next in number,
144                    p_hidden_name in varchar2,
145                    p_hidden_value in varchar2,
146                    p_help_url in varchar2) is
147 
148 l_language_code	varchar2(30)	:= icx_sec.getID(icx_sec.pv_language_code);
149 l_responsibility_id number	:= icx_sec.getID(icx_sec.pv_responsibility_id);
150 
151 l_message	varchar2(2000);
152 l_search_page_title    varchar2(240);
153 l_page_title    varchar2(240);
154 l_page_description varchar2(2000);
155 l_region_title  varchar2(80);
156 l_region_description varchar2(2000);
157 
158 c_title         varchar2(80);
159 c_prompts       icx_util.g_prompts_table;
160 l_lookup_codes	icx_util.g_lookup_code_table;
161 l_lookup_meanings icx_util.g_lookup_meaning_table;
162 
163 c_count         number;
164 l_data_type	varchar2(1);
165 l_data_type1	varchar2(1);
166 l_column_name	varchar2(30);
167 l_flex_definition icx_on_utilities.v80_table;
168 l_segment_column varchar2(30);
169 c_attributes    v2000_table;
170 c_condition     v2000_table;
171 c_url           varchar2(2000);
172 
173 l_actions icx_cabo.actionTable;
174 l_toolbar icx_cabo.toolbar;
175 l_matchcase_view  varchar2(10); --1550760
176 l_flow_default_operand     varchar2(10); --1613153
177 l_icx_custom_call varchar2(80); --1570530 mputman
178 l_submit VARCHAR2(240);
179 
180 --begin additions for bulk fetch change from 1574527 mputman
181       --collections for bulk fetch
182 TYPE T_COLUMN_NAME IS TABLE OF AK_OBJECT_ATTRIBUTES.COLUMN_NAME%TYPE;
183 TYPE T_DATA_TYPE IS TABLE OF AK_ATTRIBUTES.DATA_TYPE%TYPE;
184 TYPE T_ATTRIBUTE_LABEL_LONG IS TABLE OF AK_REGION_ITEMS_VL.ATTRIBUTE_LABEL_LONG%TYPE;
185 TYPE T_ICX_CUSTOM_CALL IS TABLE OF AK_REGION_ITEMS.ICX_CUSTOM_CALL%TYPE;
186 
187       --record defining plsql table to replace cursor in loop
188 TYPE t_attr_rec IS RECORD
189   (
190     COLUMN_NAME           	AK_OBJECT_ATTRIBUTES.COLUMN_NAME%TYPE,
191     DATA_TYPE              AK_ATTRIBUTES.DATA_TYPE%TYPE,
192     ATTRIBUTE_LABEL_LONG   AK_REGION_ITEMS_VL.ATTRIBUTE_LABEL_LONG%TYPE,
193     ICX_CUSTOM_CALL        AK_REGION_ITEMS.ICX_CUSTOM_CALL%TYPE
194   );
195       --definition of table replacing cursor in loop
196   TYPE t_attr_tab is table of t_attr_rec
197      index by binary_integer;
198     --actual vars to use in logic
199 P_COLUMN_NAME T_COLUMN_NAME;
200 P_DATA_TYPE T_DATA_TYPE;
201 P_ATTRIBUTE_LABEL_LONG T_ATTRIBUTE_LABEL_LONG;
202 P_ICX_CUSTOM_CALL T_ICX_CUSTOM_CALL;
203 P_ATTR_TAB t_attr_tab;
204 -- end additions from bulk fetch 1574527 mputman
205 
206 cursor FindAttributes is
207         select  d.COLUMN_NAME,b.DATA_TYPE,a.ATTRIBUTE_LABEL_LONG,e.ICX_CUSTOM_CALL
208         from    AK_ATTRIBUTES b,
209                 AK_REGIONS c,
210                 AK_OBJECT_ATTRIBUTES d,
211 		AK_REGION_ITEMS e,
212 		AK_REGION_ITEMS_VL a
213         where   a.REGION_APPLICATION_ID = p_region_appl_id
214         and     a.REGION_CODE = p_region_code
215         and     a.NODE_QUERY_FLAG = 'Y'
216         and     a.REGION_APPLICATION_ID = c.REGION_APPLICATION_ID
217         and     a.REGION_CODE = c.REGION_CODE
218         and     c.DATABASE_OBJECT_NAME = d.DATABASE_OBJECT_NAME
219         and     a.ATTRIBUTE_APPLICATION_ID = d.ATTRIBUTE_APPLICATION_ID
220         and     a.ATTRIBUTE_CODE = d.ATTRIBUTE_CODE
221 	and	a.ATTRIBUTE_APPLICATION_ID = b.ATTRIBUTE_APPLICATION_ID
222 	and	a.ATTRIBUTE_CODE = b.ATTRIBUTE_CODE
223 	and	a.REGION_APPLICATION_ID = e.REGION_APPLICATION_ID
224 	and	a.REGION_CODE = e.REGION_CODE
225 	and     a.ATTRIBUTE_APPLICATION_ID = e.ATTRIBUTE_APPLICATION_ID
226 	and     a.ATTRIBUTE_CODE = e.ATTRIBUTE_CODE
227 	and	not exists     (select  'X'
228 				from 	AK_EXCLUDED_ITEMS
229 				where	RESPONSIBILITY_ID = l_responsibility_id
230 				and	ATTRIBUTE_CODE = a.ATTRIBUTE_CODE
231 				and	ATTRIBUTE_APPLICATION_ID = a.ATTRIBUTE_APPLICATION_ID)
232         order by a.DISPLAY_SEQUENCE;
233 
234 begin
235 
236 
237 l_matchcase_view := fnd_profile.value('ICX_MATCHCASE_VIEW');
238 
239 if l_matchcase_view is null
240 then
241 l_matchcase_view := 'Unchecked';
242 end if;
243 
244 icx_cabo.g_base_href := FND_WEB_CONFIG.WEB_SERVER;
245 icx_cabo.g_plsql_agent := icx_cabo.plsqlagent;
246 
247 /* Get condition title, prompts and conditions */
248 
249 icx_util.getPrompts(601,'ICX_WEB_ON_QUERY',c_title,c_prompts);
250 
251 
252 c_url := 'OracleON.FindForm?X='||icx_call.encrypt2(p_flow_appl_id||'*'||p_flow_code||'*'||p_page_appl_id||'*'||p_page_code||'*'||p_region_appl_id||'*'||p_region_code||'*'||
253          p_lines_next||'*'||p_lines_now||'*'||p_hidden_name||'*'||p_hidden_value||'*'||p_help_url||'****]');
254 
255 -- Create queryable attribute select list for standard Flows
256 
257 icx_util.getLookups('ICX_CONDITIONS',l_lookup_codes,l_lookup_meanings);
258 
259 c_count := 0;
260 c_attributes(0) := htf.formSelectOption(' ');
261 c_attributes(1) := '';
262 for i in 0..1 loop
263    --begin bulk fetch changes 1574527 mputman
264    OPEN FindAttributes;
265    FETCH FindAttributes BULK COLLECT INTO
266       P_COLUMN_NAME,
267       P_DATA_TYPE,
268       P_ATTRIBUTE_LABEL_LONG,
269       P_ICX_CUSTOM_CALL;
270    CLOSE FindAttributes;
271 
272    -- assemble the individual collectors into a collection of collectors
273    FOR q IN 1..P_COLUMN_NAME.LAST LOOP
274       P_ATTR_TAB(q).COLUMN_NAME:=P_COLUMN_NAME(q);
275       P_ATTR_TAB(q).DATA_TYPE:=P_DATA_TYPE(q);
276       P_ATTR_TAB(q).ATTRIBUTE_LABEL_LONG:=P_ATTRIBUTE_LABEL_LONG(q);
277       P_ATTR_TAB(q).ICX_CUSTOM_CALL:=P_ICX_CUSTOM_CALL(q);
278    END LOOP;
279   --end block of changes for bulk fetch 1574527 mputman.
280 
281    --replaced f.'s with P_ATTR_TAB(f)'s and modified
282    --for to use the plsql table instead of cursor
283    --to take advantage of bulk fetch (1574527) mputman.
284 
285 for f in 1..P_ATTR_TAB.LAST loop
286     c_count := c_count + 1;
287     if P_ATTR_TAB(f).DATA_TYPE = 'DATETIME'
288     then
289 	l_data_type := 'T';
290     else
291 	l_data_type := substr(P_ATTR_TAB(f).DATA_TYPE,1,1);
292     end if;
293     if c_count = 1
294     then
295 	l_data_type1 := l_data_type;
296     end if;
297     if substr(nvl(P_ATTR_TAB(f).icx_custom_call,'XXXX'),1,4) = 'FLEX'
298     then
299 	icx_on_utilities.unpack_parameters(P_ATTR_TAB(f).icx_custom_call,l_flex_definition);
300 	if fnd_flex_apis.get_segment_column
301                 (x_application_id => l_flex_definition(2),
302                  x_id_flex_code => l_flex_definition(3),
303                  x_id_flex_num => l_flex_definition(4),
304                  x_seg_attr_type => l_flex_definition(5),
305                  x_app_column_name => l_segment_column)
306         then
307                 l_column_name := l_segment_column;
308         else
309                 l_column_name := P_ATTR_TAB(f).COLUMN_NAME;
310         end if;
311     else
312 	l_column_name := P_ATTR_TAB(f).COLUMN_NAME;
313     end if;
314     if i = c_count
315     then
316         c_attributes(i) := '<OPTION VALUE='||l_data_type||l_column_name||' SELECTED>'||P_ATTR_TAB(f).ATTRIBUTE_LABEL_LONG;
317     else
318         c_attributes(i) := c_attributes(i)||'<OPTION VALUE='||l_data_type||l_column_name||'>'||P_ATTR_TAB(f).ATTRIBUTE_LABEL_LONG;
319     end if;
320 end loop;
321 c_attributes(i) := c_attributes(i)||htf.formSelectClose;
322 end loop;
323 
324 c_condition(0) := htf.formSelectOption(' ');
325 c_condition(1) := '';
326 
327 l_flow_default_operand := fnd_profile.value('ICX_FLOW_OPERANDS');
328 if l_flow_default_operand is null
329 then
330 l_flow_default_operand := 'CCONTAIN';
331 end if;
332 
333 for x in 0..1 loop
334 for i in 1..to_number(l_lookup_codes(0)) loop
335     if x = 1 and l_data_type1 = 'V' and l_lookup_codes(i) = l_flow_default_operand
336     then
337 	c_condition(x) := c_condition(x)||'<OPTION SELECTED VALUE='||l_lookup_codes(i)||'>'||l_lookup_meanings(i);
338     elsif x = 1 and l_data_type1 <> 'V' and l_lookup_codes(i) = 'AIS'
339     then
340 	c_condition(x) := c_condition(x)||'<OPTION SELECTED VALUE='||l_lookup_codes(i)||'>'||l_lookup_meanings(i);
341     else
342 	c_condition(x) := c_condition(x)||'<OPTION VALUE='||l_lookup_codes(i)||'>'||l_lookup_meanings(i);
343     end if;
344 end loop;
345 c_condition(x) := c_condition(x)||htf.formSelectClose;
346 end loop;
347 
348 htp.p('<html>
349 <BASE HREF="'||icx_cabo.g_base_href||'">
350 <link rel=stylesheet type="text/css" href="OA_HTML/webtools/images/cabo_styles.css">
351 <header>');
352 
353 htp.p('<SCRIPT LANGUAGE="JavaScript">');
354 
355 htp.p('function help_window(){
356              help_win = window.open("'||icx_cabo.g_base_href||icx_cabo.g_plsql_agent||'OracleON.IC?X='||icx_call.encrypt2(p_flow_appl_id||'*'||p_flow_code||'*'||p_page_appl_id||'*'||p_page_code||'*'||'ICX_HLP_INQUIRIES'||'**]')||'",
357              "help_win","resizable=yes,scrollbars=yes,toolbar=yes,width=600,height=500")};');
358 --add section to block blind queries --mputman
359 --mputman changed block blind code 1747066
360 select  icx_custom_call
361 into    l_icx_custom_call
362 from    ak_regions
363 where   REGION_APPLICATION_ID = p_region_appl_id
364 and     REGION_CODE = p_region_code;
365 
366 l_submit:=icx_cabo.g_plsql_agent||'OracleON.IC'; --mputman added 1747066
367 
368         if instr(l_icx_custom_call,'LONG') > 0
369            then
370   fnd_message.set_name('ICX','ICX_OPEN_QUERY2');
371   l_message := icx_util.replace_quotes(fnd_message.get);
372 
373 if p_lines_now = 1
374 then
375     htp.p('function submitFunction() {
376 		if (document.findForm.i_1.value == "") {
377 		    alert("'||l_message||'");
378 		    } else {
379           document.findForm.action="'||l_submit||'";
380           document.findForm.submit();
381 		    }
382                 };');
383 else
384 
385     htp.p('function submitFunction() {
386                 if (document.findForm.i_1.value == ""
387                     '||'&'||'&'||' document.findForm.i_2.value == ""
388                     '||'&'||'&'||' document.findForm.i_3.value == ""
389                     '||'&'||'&'||' document.findForm.i_4.value == ""
390                     '||'&'||'&'||' document.findForm.i_5.value == "") {
391                     alert("'||l_message||'");
392                     } else {
393                    document.findForm.action="'||l_submit||'";
394                    document.findForm.submit();
395                     }
396                 };');
397 end if;
398 
399 if p_lines_now = 1
400 then
401     htp.p('function resetFunction() {
402 		document.findForm.reset();
403 		document.findForm.i_1.value = "";
404 		};');
405 
406     htp.p('function advancedSearch() {
407                 top.main.location = "'||icx_cabo.g_base_href||icx_cabo.g_plsql_agent||c_url||'";
408                 };');
409 
410 else
411     htp.p('function resetFunction() {
412 		document.findForm.reset();
413                 document.findForm.i_1.value = "";
414                 document.findForm.i_2.value = "";
415                 document.findForm.i_3.value = "";
416                 document.findForm.i_4.value = "";
417                 document.findForm.i_5.value = "";
418                 };');
419 
420     htp.p('function simpleSearch() {
421                 top.main.location = "'||icx_cabo.g_base_href||icx_cabo.g_plsql_agent||c_url||'";
422                 };');
423 
424 end if;
425 
426 
427         ELSE -- end block blind
428 fnd_message.set_name('ICX','ICX_OPEN_QUERY');
429 l_message := icx_util.replace_quotes(fnd_message.get);
430 
431 if p_lines_now = 1
432 then
433     htp.p('function submitFunction() {
434 		if (document.findForm.i_1.value == "") {
435 		    if (confirm("'||l_message||'")) {
436           document.findForm.action="'||l_submit||'";
437 			document.findForm.submit();
438                         } else {
439                             top.tc.currentTab = 1;
440                             top.tabs.location.reload();
441                         };
442 		    } else {
443                    document.findForm.action="'||l_submit||'";
444                    document.findForm.submit();
445 		    }
446                 };'); --1876708 mputman added to confirm: document.findForm.action="'||l_submit||'";
447 
448 else
449     htp.p('function submitFunction() {
450                 if (document.findForm.i_1.value == ""
451                     '||'&'||'&'||' document.findForm.i_2.value == ""
452                     '||'&'||'&'||' document.findForm.i_3.value == ""
453                     '||'&'||'&'||' document.findForm.i_4.value == ""
454                     '||'&'||'&'||' document.findForm.i_5.value == "") {
455                     if (confirm("'||l_message||'")) {
456                    document.findForm.action="'||l_submit||'";
457                    document.findForm.submit();
458                         }
459                     } else {
460                    document.findForm.action="'||l_submit||'";
461                    document.findForm.submit();
462                     }
463                 };');
464 end if;
465 
466 if p_lines_now = 1
467 then
468     htp.p('function resetFunction() {
469 		document.findForm.reset();
470 		document.findForm.i_1.value = "";
471 		};');
472 
473     htp.p('function advancedSearch() {
474                 top.main.location = "'||icx_cabo.g_base_href||icx_cabo.g_plsql_agent||c_url||'";
475                 };');
476 else
477     htp.p('function resetFunction() {
478 		document.findForm.reset();
479                 document.findForm.i_1.value = "";
480                 document.findForm.i_2.value = "";
481                 document.findForm.i_3.value = "";
482                 document.findForm.i_4.value = "";
483                 document.findForm.i_5.value = "";
484                 };');
485 
486    htp.p('function simpleSearch() {
487                 top.main.location = "'||icx_cabo.g_base_href||icx_cabo.g_plsql_agent||c_url||'";
488                 };');
489 end if;
490         END IF;-- block blinds
491 
492 htp.p('</SCRIPT>');
493 htp.p('</header>');
494 htp.p('<body class=panel>');
495 
496 icx_plug_utilities.sessionjavascript;
497 
498 htp.formOpen('javascript:submitFunction()','POST','','','NAME="findForm"');
499 
500 select  NAME,DESCRIPTION
501 into    l_page_title,l_page_description
502 from    AK_FLOW_PAGES_VL
503 where   PAGE_CODE = p_page_code
504 and     PAGE_APPLICATION_ID = p_page_appl_id
505 and     FLOW_CODE = p_flow_code
506 and     FLOW_APPLICATION_ID = p_flow_appl_id;
507 
508 l_search_page_title := icx_util.getPrompt(601,'ICX_WEB_ON_QUERY',178,'ICX_SEARCH')||'- '||l_page_title;
509 
510 /*
511 select  NAME,DESCRIPTION
512 into    l_region_title,l_region_description
513 from    AK_REGIONS_VL
514 where   REGION_CODE = p_region_code
515 and     REGION_APPLICATION_ID = p_region_appl_id;
516 */
517 
518 if l_data_type1 = 'V'
519 then
520     fnd_message.set_name('ICX','ICX_FIND_VARCHAR2');
521     l_message := fnd_message.get;
522 else
523     fnd_message.set_name('ICX','ICX_FIND_NUMBER');
524     l_message := fnd_message.get;
525 end if;
526 
527 /*
528 htp.tableOpen('BORDER=0');
529 htp.tableRowOpen;
530 htp.tableData(cvalue => htf.img(curl => '/OA_MEDIA/FNDIFIND.gif', calt => c_prompts(1)));
531 
532 if p_page_code is not null
533 then
534     htp.tableData(cvalue => '<B><FONT SIZE=+2>'||c_prompts(1)||': '||l_page_title||' </FONT></B>'||l_page_description, cattributes => 'VALIGN="MIDDLE"');
535 else
536     htp.tableData(cvalue => '<B><FONT SIZE=+2>'||c_prompts(1)||': '||l_region_title||'</FONT></B>', cattributes => 'VALIGN="MIDDLE"');
537 end if;
538 
539 htp.tableRowClose;
540 if p_page_code is not null and l_region_description is not null
541 then
542     htp.tableRowOpen;
543     htp.tableData('<BR>');
544     htp.tableData(l_region_description);
545     htp.tableRowClose;
546 end if;
547 htp.tableClose;
548 */
549 
550 toolbar(p_title => l_search_page_title,
551         p_export => FALSE);
552 
553 
554 -- htp.nl;
555 htp.p(l_message);
556 htp.nl;
557 htp.nl;
558 
559 if p_lines_now > 1
560 then
561     fnd_message.set_name('ICX','ICX_FIND_AND_OR_TEXT');
562     htp.p(fnd_message.get);htp.nl;
563 
564     fnd_message.set_name('ICX','ICX_FIND_AND');
565     htp.p(htf.formRadio('o','AND','CHECKED')||fnd_message.get);htp.nl;
566 
567     fnd_message.set_name('ICX','ICX_FIND_OR');
568     htp.p(htf.formRadio('o','OR')||fnd_message.get);htp.nl;
569 end if;
570 
571 htp.p('<!-- Application ID '||p_region_appl_id||' Region '||p_region_code||' -->');
572 
573 for i in 1..p_lines_now loop
574 
575 htp.tableOpen('BORDER=0');
576     htp.tableRowOpen;
577         if i = 1
578         then
579                 htp.tableData(htf.formSelectOpen('a_'||i)||c_attributes(1));
580         	htp.tableData(htf.formSelectOpen('c_'||i)||c_condition(1));
581         else
582                 htp.tableData(htf.formSelectOpen('a_'||i)||c_attributes(0));
583         	htp.tableData(htf.formSelectOpen('c_'||i)||c_condition(0));
584         end if;
585         htp.tableData(htf.formText('i_'||i,20));
586     htp.tableRowClose;
587 htp.tableClose;
588 
589 end loop;
590 
591 htp.nl;
592 if l_matchcase_view = 'Unchecked'
593 then
594 	htp.p(htf.formCheckbox('m')||c_prompts(6));
595 	htp.nl;
596 end if;
597 
598 if l_matchcase_view = 'Checked'
599 then
600 	htp.p(htf.formCheckbox('m','','CHECKED')||c_prompts(6));
601 	htp.nl;
602 end if;
603 
604 if l_matchcase_view = 'Hidden'
605 then
606 	fnd_message.set_name('ICX','ICX_MATCHCASE_VIEW');
607 	l_message := fnd_message.get;
608         htp.p(l_message);
609  	htp.p(htf.formHidden('m','CHECKED'));
610  htp.nl;
611 end if;
612 
613 if p_hidden_name is not null
614 then
615         htp.formHidden(p_hidden_name,p_hidden_value);
616 end if;
617 
618 htp.p('<SCRIPT LANGUAGE="JavaScript">');
619 htp.p('top.tc.modifytab(2,"text:'||l_page_title||'")
620        top.tabs.location.reload();');
621 htp.p('</SCRIPT>');
622 
623 l_actions(0).name := 'Submit';
624 l_actions(0).text := c_prompts(1);
625 l_actions(0).actiontype := 'function';
626 l_actions(0).action := 'top.main.submitFunction()';  -- put your own commands here
627 l_actions(0).targetframe := 'main';
628 l_actions(0).enabled := 'b_enabled';
629 l_actions(0).gap := 'b_narrow_gap';
630 
631 l_actions(1).name := 'Reset';
632 l_actions(1).text := c_prompts(2);
633 l_actions(1).actiontype := 'function';
634 l_actions(1).action := 'top.main.resetFunction()';  -- put your own commands here
635 l_actions(1).targetframe := 'main';
636 l_actions(1).enabled := 'b_enabled';
637 l_actions(1).gap := 'b_narrow_gap';
638 
639 l_actions(2).name := 'Nav';
640 l_actions(2).actiontype := 'function';
641 if p_lines_now = 5
642 then
643   l_actions(2).text := c_prompts(4);
644   l_actions(2).action := 'top.main.simpleSearch()';
645 else
646   l_actions(2).text := c_prompts(3);
647   l_actions(2).action := 'top.main.advancedSearch()';
648 end if;
649 l_actions(2).targetframe := 'main';
650 l_actions(2).enabled := 'b_enabled';
651 l_actions(2).gap := 'b_narrow_gap';
652 
653 icx_cabo.buttons(p_actions =>l_actions);
654 
655 htp.p('</FORM>');
656 htp.p('</body>');
657 
658 exception
659 	when others then
660 		htp.p(SQLERRM);
661 end;
662 
663 procedure displayPage is
664 
665 l_timer		number;
666 
667 l_flow_appl_id  number(15);
668 l_flow_code     varchar2(30);
669 l_page_appl_id	number(15);
670 l_page_code	varchar2(30);
671 
672 l_region_count	number;
673 l_region_temp	number;
674 l_region_seq_temp number;
675 l_region	number_table;
676 l_region_seq	number_table;
677 l_prompt	varchar2(50);
678 l_S		varchar2(2000);
679 l_language_code varchar2(30)	:= icx_sec.getID(icx_sec.pv_language_code);
680 l_cookie        owa_cookie.cookie;
681 l_page_title    varchar2(240);
682 l_page_description varchar2(2000);
683 l_region_description varchar2(2000);
684 l_message	varchar2(2000);
685 l_status	varchar2(240);
686 l_continue	boolean;
687 
688 l_actions icx_cabo.actionTable;
689 l_toolbar icx_cabo.toolbar;
690 
691 begin
692 
693 icx_cabo.g_base_href := FND_WEB_CONFIG.WEB_SERVER;
694 icx_cabo.g_plsql_agent := icx_cabo.plsqlagent;
695 
696 -- select HSECS into l_timer from v$timer;htp.p('begin displayPage @ '||l_timer);htp.nl;
697 
698 l_flow_appl_id := ak_query_pkg.g_regions_table(ak_query_pkg.g_regions_table.FIRST).flow_application_id;
699 l_flow_code := ak_query_pkg.g_regions_table(ak_query_pkg.g_regions_table.FIRST).flow_code;
700 l_page_appl_id := ak_query_pkg.g_regions_table(ak_query_pkg.g_regions_table.FIRST).page_application_id;
701 l_page_code := ak_query_pkg.g_regions_table(ak_query_pkg.g_regions_table.FIRST).page_code;
702 
703 select  NAME,DESCRIPTION
704 into    l_page_title,l_page_description
705 from    AK_FLOW_PAGES_VL
706 where   PAGE_CODE = l_page_code
707 and	PAGE_APPLICATION_ID = l_page_appl_id
708 and	FLOW_CODE = l_flow_code
709 and	FLOW_APPLICATION_ID = l_flow_appl_id;
710 
711 l_cookie := owa_cookie.get('onquery');
712 
713 htp.htmlOpen;
714 htp.p('<BASE HREF="'||icx_cabo.g_base_href||'">');
715 htp.p('<link rel=stylesheet type="text/css" href="OA_HTML/webtools/images/cabo_styles.css">');
716 htp.headOpen;
717 
718 icx_util.copyright;
719 
720 htp.p('<SCRIPT LANGUAGE="JavaScript">');
721 htp.p('function goto_button(X) {self.location="'||icx_cabo.g_base_href||'" + X; };');
722 
723 htp.p('function help_window(){
724              help_win = window.open("'||icx_cabo.g_base_href||icx_cabo.g_plsql_agent||'OracleON.IC?X='||icx_call.encrypt2(l_flow_appl_id||'*'||l_flow_code||'*'||l_page_appl_id||'*'||l_page_code||'*'||'ICX_HLP_INQUIRIES'||'**]')||'",
725              "help_win","resizable=yes,scrollbars=yes,toolbar=yes,width=600,height=500")};');
726 
727 htp.p('</SCRIPT>');
728 
729 htp.title(l_page_title);
730 htp.headClose;
731 
732    l_S := icx_on_utilities.g_on_parameters(1)||'*'||icx_on_utilities.g_on_parameters(2)||'*'||icx_on_utilities.g_on_parameters(3)||'*'||icx_on_utilities.g_on_parameters(4)||'*'||icx_on_utilities.g_on_parameters(5)
733 	||'*'||icx_on_utilities.g_on_parameters(6)||'*'||icx_on_utilities.g_on_parameters(7)||'*'||icx_on_utilities.g_on_parameters(8)||'*'||icx_on_utilities.g_on_parameters(9)||'*'||icx_on_utilities.g_on_parameters(10)
734 	||'*'||icx_on_utilities.g_on_parameters(11)||'*'||icx_on_utilities.g_on_parameters(12)||'*'||icx_on_utilities.g_on_parameters(13)||'*'||icx_on_utilities.g_on_parameters(14)||'*'||icx_on_utilities.g_on_parameters(15)
735 	||'*'||icx_on_utilities.g_on_parameters(16)||'*'||icx_on_utilities.g_on_parameters(17)||'*'||icx_on_utilities.g_on_parameters(18)||'*'||icx_on_utilities.g_on_parameters(19)||'*'||icx_on_utilities.g_on_parameters(20)
736 	||'*'||icx_on_utilities.g_on_parameters(21)||'*'||icx_on_utilities.g_on_parameters(22)||'**]';
737 
738 htp.p('<body class=panel>');
739 -- htp.p('<FONT SIZE=+2>'||l_page_title||' </FONT>'||l_page_description);
740 -- htp.nl;
741 icx_plug_utilities.sessionjavascript;
742 
743 htp.p('<FORM NAME="exportON" ACTION="'||icx_cabo.g_plsql_agent||'OracleON.csv" METHOD="POST">');
744 htp.formHidden('S',icx_call.encrypt2(l_S));
745 htp.p('</FORM>');
746 
747 if ak_query_pkg.g_results_table.COUNT = 0
748 then
749 	htp.p('<!-- Flow '||ak_query_pkg.g_regions_table(0).flow_code||' Page '||ak_query_pkg.g_regions_table(0).page_code||' Region '||ak_query_pkg.g_regions_table(0).region_code||' -->');
750         fnd_message.set_name('ICX','ICX_NO_RECORDS_FOUND');
751         fnd_message.set_token('NAME_OF_REGION_TOKEN',ak_query_pkg.g_regions_table(0).name);
752         l_message := fnd_message.get;
753 
754         htp.strong(l_message);htp.nl;
755 
756 else
757   l_continue := TRUE;
758 
759 -- bubble sort for bug 625660
760   l_region_count := ak_query_pkg.g_regions_table.COUNT-1;
761 
762   if l_region_count > 0
763   then
764 
765     for x in 0..l_region_count loop
766       l_region(x)     := x;
767       l_region_seq(x) := ak_query_pkg.g_regions_table(x).display_sequence;
768     end loop;
769 
770     for x in 0..l_region_count-1 loop
771       for y in 0..l_region_count-1-x loop
772         if l_region_seq(y) > l_region_seq(y+1)
773         then
774        	  l_region_seq_temp := l_region_seq(y);
775 	  l_region_temp := l_region(y);
776 	  l_region_seq(y) := l_region_seq(y+1);
777 	  l_region(y) := l_region(y+1);
778           l_region_seq(y+1) := l_region_seq_temp;
779           l_region(y+1) := l_region_temp;
780         end if;
781       end loop;
782     end loop;
783 
784     for x in 0..l_region_count loop
785       ak_query_pkg.g_regions_table(l_region(x)).display_sequence := x;
786     end loop;
787 
788   else
789     ak_query_pkg.g_regions_table(0).display_sequence := 0;
790   end if;
791 
792 -- second region loop added for bug 591931
793   for c in 0..l_region_count loop
794     for r in 0..l_region_count loop
795 
796     if r = ak_query_pkg.g_regions_table(c).display_sequence
797     then
798 
799       if l_continue
800       then
801 
802       select	DESCRIPTION
803       into	l_region_description
804       from	AK_REGIONS_VL
805       where	REGION_APPLICATION_ID = ak_query_pkg.g_regions_table(r).region_application_id
806       and	REGION_CODE = ak_query_pkg.g_regions_table(r).region_code;
807 
808       if l_region_description is not null
809       then
810         htp.p(l_region_description);
811       end if;
812 
813       htp.p('<!-- Flow '||ak_query_pkg.g_regions_table(r).flow_code||' Page '||ak_query_pkg.g_regions_table(r).page_code||' Region '||ak_query_pkg.g_regions_table(r).region_code||' -->');
814 
815       if ak_query_pkg.g_regions_table(r).total_result_count = 0
816       then
817         fnd_message.set_name('ICX','ICX_NO_RECORDS_FOUND');
818         fnd_message.set_token('NAME_OF_REGION_TOKEN',ak_query_pkg.g_regions_table(r).name);
819         l_message := fnd_message.get;
820 
821         htp.strong(l_message);htp.nl;
822 
823 	elsif ak_query_pkg.g_regions_table(r).region_style = 'FORM'
824 	  and ak_query_pkg.g_regions_table(r).total_result_count > 1
825 	then
826 	    fnd_message.set_name('ICX','ICX_LIMIT_ROWS_ONE');
827        	    l_message := fnd_message.get;
828 
829        	    htp.strong(l_message);
830 	    l_continue := FALSE;
831        	else
832        	    icx_on_utilities2.displayRegion(ak_query_pkg.g_regions_table(r).region_rec_id);
833       end if; -- total_result_count = 0
834       end if; -- l_continue
835       end if; -- display_sequence
836 
837     end loop; -- regions r
838   end loop; -- regions c
839 
840 end if;  -- COUNT = 0
841 
842 toolbar(p_title => l_page_title,
843         p_export => TRUE);
844 
845 if (nvl(icx_on_utilities.g_on_parameters(21),'X') <> 'W')
846 and (icx_on_utilities.g_on_parameters(1) <> 'X')
847 then
848 
849     htp.p('<SCRIPT LANGUAGE="JavaScript">');
850 
851     htp.p('top.tc.currentTab = 2;
852            top.tc.modifytab(2,"text:'||l_page_title||'")
853            top.tabs.location.reload();');
854 
855     htp.p('</SCRIPT>');
856 
857     icx_cabo.buttons(p_actions =>l_actions);
858 end if;
859 
860 htp.htmlClose;
861 
862 -- select HSECS into l_timer from v$timer;htp.p('end displayPage @ '||l_timer);htp.nl;
863 
864 end;
865 
866 procedure wherePage is
867 
868 l_toolbar               icx_cabo.toolbar;
869 l_helpmsg               varchar2(240);
870 l_page_title            varchar2(240);
871 l_page_description      varchar2(2000);
872 l_helptitle             varchar2(240);
873 l_X varchar2(2000);
874 
875 begin
876 
877   select  NAME,DESCRIPTION
878   into    l_page_title,l_page_description
879   from    AK_FLOW_PAGES_VL
880   where   PAGE_CODE = icx_on_utilities.g_on_parameters(5)
881   and     PAGE_APPLICATION_ID = icx_on_utilities.g_on_parameters(4)
882   and     FLOW_CODE = icx_on_utilities.g_on_parameters(3)
883   and     FLOW_APPLICATION_ID = icx_on_utilities.g_on_parameters(2);
884 
885   l_toolbar.title := l_page_title;
886   l_toolbar.menu_url := 'insert_help_url_here';
887   l_toolbar.menu_mouseover := '';
888   l_toolbar.print_frame := 'main';
889   l_toolbar.print_mouseover := '';
890   l_toolbar.help_url := 'insert_help_url_here';
891   l_toolbar.help_mouseover := '';
892   l_toolbar.custom_option1_url := 'insert_help_url_here';
893   l_toolbar.custom_option1_mouseover := '';
894   l_toolbar.custom_option1_gif := 'OA_MEDIA/FNDEXP.gif';
895   l_toolbar.custom_option1_mouseover_gif := 'OA_MEDIA/FNDEXP.gif';
896   l_toolbar.custom_option1_disabled_gif := 'OA_MEDIA/FNDEXP.gif';
897 
898 
899   l_X := icx_call.encrypt2('DQ'||'*'||
900                            icx_on_utilities.g_on_parameters(2)||'*'||
901                            icx_on_utilities.g_on_parameters(3)||'*'||
902                            icx_on_utilities.g_on_parameters(4)||'*'||
903                            icx_on_utilities.g_on_parameters(5)||'*'||
904                            icx_on_utilities.g_on_parameters(6)||'*'||
905                            icx_on_utilities.g_on_parameters(7)||'*'||
906                            icx_on_utilities.g_on_parameters(8)||'*'||
907                            icx_on_utilities.g_on_parameters(9)||'***]',
908                            icx_sec.g_session_id);
909 
910   icx_cabo.container(p_toolbar => l_toolbar,
911                      p_helpmsg => l_page_description,
912                      p_helptitle => '',
913                      p_url => icx_cabo.g_base_href||icx_cabo.g_plsql_agent||'oracleON.DisplayWhere?X='||l_X);
914 
915 ak_query_pkg.g_regions_table(0).flow_application_id := 0;
916 
917 end;
918 
919 procedure WFPage is
920 
921 l_toolbar               icx_cabo.toolbar;
922 l_helpmsg               varchar2(240);
923 l_flow_appl_id          number;
924 l_flow_code             varchar2(30);
925 l_page_appl_id          number;
926 l_page_code             varchar2(30);
927 l_page_title            varchar2(240);
928 l_page_description      varchar2(2000);
929 l_helptitle             varchar2(240);
930 l_X varchar2(2000);
931 
932 begin
933 
934   select  FLOW_APPLICATION_ID,FLOW_CODE,
935           TO_PAGE_APPL_ID,TO_PAGE_CODE
936   into    l_flow_appl_id,l_flow_code,
937           l_page_appl_id,l_page_code
938   from    AK_FLOW_REGION_RELATIONS
939   where   ROWID = icx_on_utilities.g_on_parameters(10);
940 
941   select  NAME,DESCRIPTION
942   into    l_page_title,l_page_description
943   from    AK_FLOW_PAGES_VL
944   where   PAGE_CODE = l_page_code
945   and     PAGE_APPLICATION_ID = l_page_appl_id
946   and     FLOW_CODE = l_flow_code
947   and     FLOW_APPLICATION_ID = l_flow_appl_id;
948 
949   l_toolbar.title := l_page_title;
950   l_toolbar.menu_url := 'insert_help_url_here';
951   l_toolbar.menu_mouseover := '';
952   l_toolbar.print_frame := 'main';
953   l_toolbar.print_mouseover := '';
954   l_toolbar.help_url := 'insert_help_url_here';
955   l_toolbar.help_mouseover := '';
956   l_toolbar.custom_option1_url := 'insert_help_url_here';
957   l_toolbar.custom_option1_mouseover := '';
958   l_toolbar.custom_option1_gif := 'OA_MEDIA/FNDEXP.gif';
959   l_toolbar.custom_option1_mouseover_gif := 'OA_MEDIA/FNDEXP.gif';
960   l_toolbar.custom_option1_disabled_gif := 'OA_MEDIA/FNDEXP.gif';
961 
962   l_X := icx_call.encrypt2('X'||'*'||
963                            icx_on_utilities.g_on_parameters(2)||'*'||
964                            icx_on_utilities.g_on_parameters(3)||'*'||
965                            icx_on_utilities.g_on_parameters(4)||'*'||
966                            icx_on_utilities.g_on_parameters(5)||'*'||
967                            icx_on_utilities.g_on_parameters(6)||'*'||
968                            icx_on_utilities.g_on_parameters(7)||'*'||
969                            icx_on_utilities.g_on_parameters(8)||'*'||
970                            icx_on_utilities.g_on_parameters(9)||'*'||
971                            icx_on_utilities.g_on_parameters(10)||'*'||
972                            icx_on_utilities.g_on_parameters(11)||'*'||
973                            icx_on_utilities.g_on_parameters(12)||'*'||
974                            icx_on_utilities.g_on_parameters(13)||'*'||
975                            icx_on_utilities.g_on_parameters(14)||'*'||
976                            icx_on_utilities.g_on_parameters(15)||'*'||
977                            icx_on_utilities.g_on_parameters(16)||'*'||
978                            icx_on_utilities.g_on_parameters(17)||'*'||
979                            icx_on_utilities.g_on_parameters(18)||'*'||
980                            icx_on_utilities.g_on_parameters(19)||'*'||
981                            icx_on_utilities.g_on_parameters(20)||'*'||
982                            icx_on_utilities.g_on_parameters(21)||
983                            '***]',
984                            icx_sec.g_session_id);
985 
986   icx_cabo.container(p_toolbar => l_toolbar,
987                      p_helpmsg => l_page_description,
988                      p_helptitle => '',
989                      p_url => icx_cabo.g_base_href||icx_cabo.g_plsql_agent||'ora
990 cleON.IC?Y='||l_X);
991 
992 ak_query_pkg.g_regions_table(0).flow_application_id := 0;
993 
994 end;
995 
996 end icx_on_cabo;