DBA Data[Home] [Help]

PACKAGE BODY: APPS.ICX_REQ_CATEGORIES

Source


1 PACKAGE BODY ICX_REQ_CATEGORIES as
2 /* $Header: ICXRQCAB.pls 115.4 99/07/17 03:22:45 porting sh $ */
3 
4 --*********************************************************
5 -- GLOBAL VAR
6 --*******************************************************
7 
8 
9 --**********************************************************
10 -- LOCAL PROCEDURES NOT DECLARED IN SPEC
11 --**********************************************************
12 
13 ------------------------------------------------------------
14 procedure createDummyPage(p_where number, nodeId varchar2, nodeIndex varchar2, v_string long,v_first_time_flag varchar2) is
15 ------------------------------------------------------------
16 begin
17    -- open html
18    htp.htmlOpen;
19    htp.headOpen;
20    htp.headClose;
21 
22    if (v_first_time_flag = 'Y') then
23        htp.bodyOpen('','BGCOLOR="#CCFFCC" onLoad="parent.parent.openTemplate(''' || icx_util.replace_quotes(nodeId) || ''',document.GetChildren.nodeId,document.GetChildren.nodeIndex)"');
24    else
25       htp.bodyOpen('','BGCOLOR="#CCFFCC" onLoad="parent.parent.addChildren(''' || icx_util.replace_quotes(nodeId) || ''',document.GetChildren.nodeId,document.GetChildren.nodeIndex)"');
26    end if;
27 
28        htp.formOpen(curl        =>'ICX_REQ_CATEGORIES.GetCategoryChildren',
29                     cmethod     => 'POST',
30                     cattributes => 'name=''GetChildren'''
31                    );
32 
33        htp.formHidden('nodeId',  cvalue => v_string);
34        htp.formHidden('p_where', cvalue => p_where);
35        htp.formHidden('nodeIndex', cvalue => nodeIndex);
36 
37        htp.formClose;
38    htp.bodyClose;
39    htp.htmlClose;
40 
41 end createDummyPage;
42 
43 --**********************************************************
44 -- LOCAL PROCEDURES NOT DECLARED IN SPEC
45 --**********************************************************
46 
47 
48 ------------------------------------------------------------------------
49 function chk_exclude_on(v_attribute_code IN varchar2)
50          return varchar2 is
51 ------------------------------------------------------------------------
52    cursor RespExclAttrs(resp_id number,appl_id number,attr_code varchar2) is
53           select attribute_code
54           from ak_excluded_items
55           where responsibility_id = resp_id
56           and resp_application_id = appl_id
57           and attribute_code = attr_code;
58 
59    v_resp_id number;
60    v_attr_code varchar2(80);
61 
62 begin
63 
64     v_resp_id := icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID);
65     if v_resp_id is not NULL then
66 
67        open RespExclAttrs(v_resp_id,178,v_attribute_code);
68        fetch RespExclAttrs into v_attr_code;
69        if RespExclAttrs%NOTFOUND then
70 	   close RespExclAttrs;
71            return 'N';
72        else
73            close RespExclAttrs;
74            return 'Y';
75        end if;
76     else
77        return 'N';
78     end if;
79 end;
80 
81 ------------------------------------------------------------
82 procedure GetCategoryTop(v_org_id number) is
83 ------------------------------------------------------------
84 
85 
86    cursor cat_set is
87    select category_set_id,
88           validate_flag
89    from   mtl_default_sets_view
90    WHERE  functional_area_id = 2;
91 
92 
93 y_table            icx_util.char240_table;
94 where_clause       varchar2(2000);
95 
96 v_node_id          varchar2(240);
97 v_name             varchar2(240);
98 v_no_of_children   number;
99 v_children_loaded  varchar2(100);
100 p_where            varchar2(240);
101 counter            number;
102 i                  number;
103 v_dcdName          varchar2(240) := owa_util.get_cgi_env('SCRIPT_NAME');
104 v_category_set_id  number;
105 v_validate_flag    varchar2(1);
106 
107 begin
108 
109 -- dbms_session.set_sql_trace(TRUE);
110 
111    -- Need to find the category_set_id for purchasing
112    open cat_set;
113      fetch cat_set into v_category_set_id, v_validate_flag;
114    close cat_set;
115 
116    where_clause := 'relationship_type = ''TOP'' AND CATEGORY_SET_ID =' || v_category_set_id;
117    -- Query childrens.
118    ak_query_pkg.exec_query(P_PARENT_REGION_APPL_ID => 601,
119                               P_PARENT_REGION_CODE    => 'ICX_RELATED_CATEGORIES_DISPLAY',
120                               P_RESPONSIBILITY_ID     => icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID),
121                               P_USER_ID               => icx_sec.getID(icx_sec.PV_WEB_USER_ID),
122                               P_WHERE_CLAUSE 		=> where_clause,
123                               P_RETURN_PARENTS        => 'T',
124                               P_RETURN_CHILDREN       => 'F');
125 
126    counter := 1;
127 
128    if ak_query_pkg.g_results_table.count > 0 then
129       htp.p('TOP_CATEGORIES = new MakeArray(' || ak_query_pkg.g_results_table.count || ');');
130       for i in ak_query_pkg.g_results_table.first .. ak_query_pkg.g_results_table.last loop
131 
132          v_node_id := ak_query_pkg.g_results_table(i).value2;  -- Category id
133          v_name    := ak_query_pkg.g_results_table(i).value4;  -- Category name
134 
135          p_where := icx_call.encrypt2(v_node_id || '*' || v_org_id || '*' || v_name || '**]');
136 
137 
138          select count(-1) into v_no_of_children
139          from   icx_related_categories_val_v
140          where  CATEGORY_ID = v_node_id
141          and    CATEGORY_SET_ID = v_category_set_id  /* new*/
142          and    RELATIONSHIP_TYPE <> 'TOP';
143          if v_no_of_children > 0 then
144                 v_children_loaded := 'false';
145          else
146                 v_children_loaded := 'true';
147          end if;
148 
149          htp.p('TOP_CATEGORIES[' || counter || ']= new node(' || v_node_id || ',"' ||
150                                 v_name || '",' || v_children_loaded || ',"' ||
151                                 v_dcdName || '/ICX_REQ_CATEGORIES.catalog_items?p_where=' || p_where  -- Node Link
152                                 || '","' || p_where || '");');
153          counter := counter + 1;
154 
155       end loop; -- end i
156 
157    else -- No hierchy setup use regular categories
158 
159       ak_query_pkg.exec_query(P_PARENT_REGION_APPL_ID => 178,
160                              P_PARENT_REGION_CODE    => 'ICX_REQ_CATEGORIES',
161                              P_RESPONSIBILITY_ID     => icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID),
162                              P_USER_ID               => icx_sec.getID(icx_sec.PV_WEB_USER_ID),
163                              P_WHERE_CLAUSE          => ' FUNCTIONAL_AREA_ID = 2',
164 
165                              P_RETURN_PARENTS        => 'T',
166                              P_RETURN_CHILDREN       => 'F');
167 
168       if ak_query_pkg.g_results_table.count > 0 then
169          htp.p('TOP_CATEGORIES = new MakeArray(' || ak_query_pkg.g_results_table.count || ');');
170          for i in ak_query_pkg.g_results_table.first .. ak_query_pkg.g_results_table.last loop
171 
172 
173             v_node_id := ak_query_pkg.g_results_table(i).value3;  -- Category id
174             v_name    := ak_query_pkg.g_results_table(i).value1;  -- Category name
175 
176             p_where := icx_call.encrypt2(v_node_id || '*' || v_org_id || '*' || v_name || '**]');
177 
178 
179             v_children_loaded := 'true';
180             htp.p('TOP_CATEGORIES[' || counter || ']= new node(' || v_node_id || ',"' ||
181                                   v_name || '",' || v_children_loaded || ',"' ||
182                                   v_dcdName || '/ICX_REQ_CATEGORIES.catalog_items?p_where=' || p_where  -- Node Link
183                                 || '","' || p_where || '");');
184             counter := counter + 1;
185 
186          end loop;
187       else  -- No Categories
188          htp.p('TOP_CATEGORIES = new MakeArray(0);');
189       end if;
190 
191    end if; -- No hierchy setup
192 
193 -- dbms_session.set_sql_trace(FALSE);
194 
195 end GetCategoryTop;
196 
197 
198 ------------------------------------------------------------
199 procedure categories(start_row in number default 1,
200                      c_end_row in number default null,
201                      p_where   in number) is
202 ------------------------------------------------------------
203 v_lang           varchar2(5);
204 v_dcdName        varchar2(1000);
205 v_frame_location varchar2(1024);
206 n_temp           number;
207 
208 begin
209 
210 -- dbms_session.set_sql_trace(TRUE);
211 
212     -- get lang code
213     v_lang := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
214 
215     --get dcd name
216     v_dcdName := owa_util.get_cgi_env('SCRIPT_NAME');
217 
218     htp.htmlOpen;
219        htp.headOpen;
220        htp.headClose;
221        htp.framesetOpen('','250,*','BORDER=5');
222            htp.framesetOpen('*,0','','BORDER=0');
223                   htp.frame('/OA_HTML/' || v_lang || '/ICXCATH.htm', 'left_frame', '0','0', cscrolling=>'auto', cnoresize => '' );
224                   --htp.frame(csrc  =>  v_dcdName || '/ICX_REQ_CATEGORIES.GetCategoryChildren?n_org=' || n_org, --URL
225                   htp.frame(csrc  =>  v_dcdName || '/ICX_REQ_CATEGORIES.GetCategoryChildren?p_where=' || p_where,  -- URL
226                             cname =>  'dummy', 	   --Window Name
227                             cmarginwidth   => '0', --    Value in pixels
228                             cmarginheight  => '0', --    Value in pixels
229                             cscrolling => 'NO',
230 --		            cnoresize => '',
231 			    cattributes => 'FRAMEBORDER=NO');
232 --                            cscrolling     => 'NO',--    yes | no | auto
233 --                            cnoresize      => 'NORESIZE' );
234            htp.framesetClose;
235 
236            v_frame_location := v_dcdName || '/ICX_REQ_CATEGORIES.catalog_items?';
237 
238            if c_end_row is not null then
239                v_frame_location := v_frame_location || 'p_start_row=' || start_row  ||'&p_end_row=' || c_end_row || '&p_where=' || p_where;
240            else
241                v_frame_location := v_frame_location || 'p_where=' || p_where;
242            end if;
243            htp.frame( v_frame_location, 'right_frame', '0','0',  cscrolling=>'auto');
244 
245        htp.framesetClose;
246     htp.htmlClose;
247 
248 -- dbms_session.set_sql_trace(FALSE);
249 end categories;
250 
251 ------------------------------------------------------------
252 procedure GetCategoryChildren (p_where in number,
253                                nodeId  in varchar2  default null,
254 			       nodeIndex in varchar2 default null) is
255 ------------------------------------------------------------
256 
257 y_table            icx_util.char240_table;
258 where_clause       varchar2(2000);
259 
260 v_p_where          number;
261 -- childrenString     varchar2(2000);
262 -- Fix for bug 517695
263 childrenString     long;
264 
265 v_node_id          varchar2(240);
266 v_name             varchar2(240);
267 v_no_of_children   number;
268 v_org              number;
269 params             icx_on_utilities.v80_table;
270 
271 v_dcdName          varchar2(240) := owa_util.get_cgi_env('SCRIPT_NAME');
272 v_first_time_flag  varchar2(1);
273 
274   cursor cat_set is
275   select category_set_id,
276         validate_flag
277   from   mtl_default_sets_view
278   WHERE  functional_area_id = 2;
279 
280   cursor getAnyTop(v_category_set_id number) is
281   select category_id
282   from icx_related_categories_val_v
283   where relationship_type = 'TOP'
284   and category_set_id = v_category_set_id;
285 
286 
287 v_validate_flag varchar2(1);
288 v_cat_set_id number;
289 v_anytop_id varchar2(240);
290 
291 begin
292 
293 -- dbms_session.set_sql_trace(TRUE);
294 
295 -- Check if session is valid
296 if (icx_sec.validatesession('ICX_REQS')) then
297 
298   --decrypt2 p_where
299   if p_where is not null then
300         icx_on_utilities.unpack_parameters(icx_call.decrypt2(p_where), params);
301         --cat_id := params(1);
302         v_org := params(2);
303   end if;
304 
305 
306    /* Moved from else condition below 1/28/97 */
307     -- Need to find the category_set_id for purchasing
308     open cat_set;
309     fetch cat_set into v_cat_set_id, v_validate_flag;
310     close cat_set;
311 
312   if nodeId is not null  and
313      v_cat_set_id is not NULL then
314      -- where_clause := 'category_id = ' || nodeId || ' AND ';
315      where_clause := 'category_id = ' || nodeId || ' AND category_set_id = ' || v_cat_set_id || ' AND ';
316   else
317 
318 
319     open getAnyTop(v_cat_set_id);
320     fetch getAnyTop into v_anytop_id;
321     close getAnyTop;
322 
323     if v_anytop_id is not NULL  and
324        v_cat_set_id is not NULL then
325 
326     where_clause := 'category_id = ' || v_anytop_id || ' AND category_set_id = '|| v_cat_set_id || ' AND ';
327 
328     end if;
329 
330   end if;
331 
332    where_clause := where_clause || ' relationship_type = ''CHILD''';
333    -- Query childrens.
334    ak_query_pkg.exec_query(P_PARENT_REGION_APPL_ID => 601,
335                               P_PARENT_REGION_CODE    => 'ICX_RELATED_CATEGORIES_DISPLAY',
336                               P_RESPONSIBILITY_ID     => icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID),
337                               P_USER_ID               => icx_sec.getID(icx_sec.PV_WEB_USER_ID),
338                               P_WHERE_CLAUSE 		=> where_clause,
339                               P_RETURN_PARENTS        => 'T',
340                               P_RETURN_CHILDREN       => 'F');
341 
342    if ak_query_pkg.g_results_table.count > 0 then
343    for i in ak_query_pkg.g_results_table.first .. ak_query_pkg.g_results_table.last loop
344 
345          v_node_id := ak_query_pkg.g_results_table(i).value3;  -- Related Category id
346          v_name    := ak_query_pkg.g_results_table(i).value4;  -- Related Category name
347 
348 	 v_p_where := icx_call.encrypt2(v_node_id || '*' || v_org || '*' || v_name || '**]');
349 
350          select count(-1) into v_no_of_children
351          from   icx_related_categories_val_v
352          where    CATEGORY_ID = v_node_id
353          and      CATEGORY_SET_ID = v_cat_set_id
354          and    RELATIONSHIP_TYPE <> 'TOP';
355 
356          childrenString := childrenString || v_node_id || '~~' || v_name || '~~'
357                                           || v_no_of_children || '~~'
358                                           ||  v_dcdName || '/ICX_REQ_CATEGORIES.catalog_items?p_where=' || v_p_where  -- Node Link
359                                           ||  '~~' || v_p_where || '~~' ;
360 
361 
362    end loop; -- end i
363    end if;
364 
365 
366    if nodeId is not NULL then
367       v_first_time_flag := 'N';
368       createDummyPage(v_p_where, nodeId, nodeIndex,childrenString, v_first_time_flag);
369    else
370      if v_node_id is not NULL then
371         v_first_time_flag := 'N';
372         createDummyPage(v_p_where,nodeId,nodeIndex,childrenString,v_first_time_flag);
373      else
374         v_first_time_flag := 'Y';
375         createDummyPage(v_p_where, v_anytop_id, nodeIndex, childrenString,v_first_time_flag);
376      end if;
377    end if;
378 
379 
380 end if;
381 
382 -- dbms_session.set_sql_trace(FALSE);
383 
384 end GetCategoryChildren;
385 
386 procedure total_page(l_cart_id number,
387 		     l_dest_org_id number,
388                      l_rows_added number default 0,
389                      l_rows_updated number default 0,
390 		     p_cat_name varchar2 default NULL,
391                      p_start_row IN number default 1,
392                      p_end_row IN number default NULL,
393                      p_where IN varchar2,
394 		     end_row IN number default null,
395 		     p_query_set IN number default null,
396 		     p_row_count IN number default null) is
397 
398  l_message varchar2(2000);
399  l_messg varchar2(2000);
400  L_RETURN_TO_NEXT_MESSAGE varchar2(2000);
401  l_total_price number;
402  l_currency        varchar2(30);
403  l_fmt_mask        varchar2(30);
404  l_money_precision  number;
405  l_href1 varchar2(2000);
406  l_href2 varchar2(2000);
407  next_start_row number;
408  next_end_row number;
409  v_dcdName varchar2(1000) := owa_util.get_cgi_env('SCRIPT_NAME');
410 
411  cursor get_current_total(v_cart_id number) is
412      select sum(quantity * unit_price) total_price
413      from icx_shopping_cart_lines
414      where cart_id = v_cart_id;
415 
416 begin
417 
418    l_total_price := 0;
419    if l_cart_id is not NULL then
420       open get_current_total(l_cart_id);
421       fetch get_current_total into l_total_price;
422       close get_current_total;
423    end if;
424 
425    FND_MESSAGE.SET_NAME('ICX','ICX_ITEM_ADD_NEW');
426    FND_MESSAGE.SET_TOKEN('ITEM_QUANTITY',l_rows_added);
427    l_message :=  FND_MESSAGE.GET;
428    if l_rows_updated > 0 then
429       FND_MESSAGE.SET_NAME('ICX','ICX_ITEM_ADD_UPDATE');
430       FND_MESSAGE.SET_TOKEN('ITEM_QUANTITY',l_rows_updated);
431       if l_rows_added > 0 then
432          l_message := l_message || '<BR>' || FND_MESSAGE.GET;
433       else
434          l_message := FND_MESSAGE.GET;
435       end if;
436    end if;
437 
438    if l_total_price > 0 then
439       ICX_REQ_NAVIGATION.get_currency(l_dest_org_id,l_currency,l_money_precision,l_fmt_mask);
440       FND_MESSAGE.SET_NAME('ICX','ICX_ITEM_ADD_TOTAL');
441       FND_MESSAGE.SET_TOKEN('CURRENCY_CODE',l_currency);
442       FND_MESSAGE.SET_TOKEN('REQUISITION_TOTAL',to_char(l_total_price,fnd_currency.get_format_mask(l_currency,30)));
443       l_message := l_message || '<BR><BR>' || FND_MESSAGE.GET;
444 
445       l_message := l_message || '<BR><BR><BR>';
446       FND_MESSAGE.SET_NAME('ICX','ICX_ITEM_CATEGORY');
447       l_messg := FND_MESSAGE.GET || ' ' || p_cat_name;
448       FND_MESSAGE.SET_NAME('ICX','ICX_ITEM_ADD_SOURCE');
449       FND_MESSAGE.SET_TOKEN('SOURCE_NAME',l_messg);
450       l_message := l_message || FND_MESSAGE.GET;
451 
452       FND_MESSAGE.SET_NAME('ICX','ICX_ITEM_ADD_RETURN_CURRENT');
453       l_href1 := FND_MESSAGE.GET;
454       FND_MESSAGE.SET_NAME('ICX','ICX_ITEM_ADD_RETURN_NEXT');
455       l_href2 := FND_MESSAGE.GET;
456       l_messg := '<TABLE BORDER=0><TR><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD NOWRAP>' || '<B><A HREF="' || v_dcdName ||
457 '/ICX_REQ_CATEGORIES.catalog_items?p_start_row=' || p_start_row || '&p_end_row=' || p_end_row || '&p_where=' || p_where || '">' ||  l_href1 || '</A></B></TD></TR>';
458 
459       /* find next set start row and next set end row */
460       if end_row < p_row_count
461          and p_query_set is not NULL then
462 
463          next_start_row := end_row+1;
464          if end_row+p_query_set > p_row_count then
465              next_end_row := p_row_count;
466          else
467              next_end_row := end_row+p_query_set;
468          end if;
469 
470 
471          l_messg := l_messg || '<TR><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD NOWRAP>' || '<B><A HREF="' || v_dcdName ||
472 '/ICX_REQ_CATEGORIES.catalog_items?p_start_row=' || next_start_row || '&p_end_row=' || next_end_row || '&p_where=' || p_where || '">' || l_href2 || '</A></B></TD></TR>';
473 
474       end if;
475 
476       -- MESSAGE NEEDS TO BE SWITCHED TO REVIEW MY ORDER
477       FND_MESSAGE.SET_NAME('ICX','ICX_REVIEW_ORDER');
478       l_return_to_next_message := FND_MESSAGE.GET;
479       l_messg := l_messg || '<TR><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD NOWRAP>' || '<B><A HREF="javascript:parent.parent.parent.switchFrames(''my_order'')">' || l_return_to_next_message || '</A></B></TD></TR>';
480 
481 
482       l_messg := l_messg || '</TABLE>';
483       l_message := l_message || l_messg;
484    end if;
485 
486       htp.bodyOpen('','BGCOLOR="#CCFFCC" onLoad="parent.parent.winOpen(''nav'', ''catalog'')"');
487          htp.p('<H3>'|| l_message ||'</H3>');
488       htp.bodyClose;
489 end;
490 
491 
492 
493 procedure submit_items (cartId IN number,
494 		      p_emergency IN number default NULL,
495                       p_start_row IN number default 1,
496 		      p_end_row IN number default NULL,
497 		      p_where IN varchar2,
498 		      p_cat_name IN varchar2 default NULL,
499 		      end_row IN number default NULL,
500 		      p_query_set IN number default NULL,
501                       p_row_count IN number default NULL,
502                       Quantity IN ICX_OWA_PARMS.ARRAY default ICX_OWA_PARMS.empty,
503                       Line_Id IN ICX_OWA_PARMS.ARRAY default ICX_OWA_PARMS.empty) is
504 
505   l_line_id number;
506   l_num_rows number;
507   l_cart_line_id number;
508   l_shopper_id number;
509   l_org_id number;
510   params   icx_on_utilities.v80_table;
511   l_qty number;
512   l_error_id NUMBER;
513   l_err_num NUMBER;
514   l_error_message VARCHAR2(2000);
515   l_err_mesg VARCHAR2(240);
516   l_cart_id number;
517   l_emergency varchar2(10);
518   l_cart_line_number number;
519   l_pad number;
520   l_cat_name varchar2(1000);
521 
522   cursor check_cart_line_exists(v_cart_id number,v_line_id varchar2,v_org_id number) is
523      select cart_line_id
524      from icx_shopping_cart_lines
525      where cart_id = v_cart_id
526      and line_id = v_line_id
527      and nvl(org_id, -9999) = nvl(v_org_id,-9999);
528 
529   cursor get_cart_header_info(v_cart_id number) is
530      select need_by_date,
531             deliver_to_requestor_id,
532 	    deliver_to_location_id,
533             deliver_to_location,
534 	    destination_organization_id,
535             org_id
536      from icx_shopping_carts
537      where cart_id = v_cart_id;
538 --     and nvl(org_id,-9999) = nvl(v_org_id,-9999);
539 
540   cursor get_max_line_number(v_cart_id number) is
541      select max(cart_line_number)
542      from icx_shopping_cart_lines
543      where cart_id = v_cart_id;
544 
545   l_need_by_date date;
546   l_deliver_to_location_id number;
547   l_dest_org_id number;
548   l_rows_added number;
549   l_rows_updated number;
550   l_deliver_to_location varchar2(240);
551   l_total_price number;
552   l_dummy number;
553 
554   l_emp_id number;
555   l_account_id NUMBER := NULL;
556   l_account_num VARCHAR2(2000) := NULL;
557   l_segments fnd_flex_ext.SegmentArray;
558 
559 begin
560 
561   if icx_sec.validatesession then
562 
563   l_rows_added := 0;
564   l_rows_updated := 0;
565   l_num_rows := Quantity.COUNT;
566   l_shopper_id := icx_sec.getID(icx_sec.PV_WEB_USER_ID);
567   -- l_org_id := icx_sec.getId(icx_sec.PV_ORG_ID);
568   if p_where is not NULL then
569        icx_on_utilities.unpack_parameters(icx_call.decrypt2(p_where),params);
570        l_org_id := params(2);
571   end if;
572 
573   l_cart_id := icx_call.decrypt2(cartId);
574   l_emergency := icx_call.decrypt2(p_emergency);
575 
576   if l_cart_id is not NULL then
577      open get_cart_header_info(l_cart_id);
578      fetch get_cart_header_info into l_need_by_date, l_emp_id,
579           l_deliver_to_location_id,l_deliver_to_location,l_dest_org_id,l_org_id;
580      close get_cart_header_info;
581 
582   end if;
583 
584   for i in Quantity.FIRST .. Quantity.LAST loop
585 
586     l_pad := instr(Quantity(i),'.',1,2);
587     if (l_pad > 2) then
588        l_qty := substr(Quantity(i),1,l_pad - 1);
589     elsif (l_pad > 0) then
590        l_qty := 0;
591     else
592        l_qty := Quantity(i);
593     end if;
594 
595     if l_qty  is not NULL and l_qty > 0 then
596 
597       l_cart_line_id := NULL;
598       open check_cart_line_exists(l_cart_id,Line_Id(i),l_org_id);
599       fetch check_cart_line_exists into l_cart_line_id;
600       close check_cart_line_exists;
601 
602       if l_cart_line_id is NULL then
603 
604         l_line_id := Line_Id(i);
605 
606         /* semaphore for getting max line number */
607         select 1 into l_dummy
608         from icx_shopping_carts
609 	where cart_id = l_cart_id
610         for update;
611 
612         l_cart_line_number := NULL;
613         open get_max_line_number(l_cart_id);
614         fetch get_max_line_number into l_cart_line_number;
615         close get_max_line_number;
616 
617         if l_cart_line_number is NULL then
618            l_cart_line_number := 1;
619         else
620            l_cart_line_number := l_cart_line_number + 1;
621         end if;
622 
623         update icx_shopping_carts
624         set last_update_date = sysdate
625         where cart_id = l_cart_id;
626 
627         commit;
628         /* close semaphore */
629 
630 --changed by alex for attachment
631 --        select icx_shopping_cart_lines_s.nextval into l_cart_line_id from dual;
632 --new code:
633         select PO_REQUISITION_LINES_S.nextval into l_cart_line_id from dual;
634 
635         insert into icx_shopping_cart_lines(cart_line_id,cart_id,cart_line_number,creation_date,created_by,quantity,line_id,item_id,item_revision,unit_of_measure,
636         unit_price,category_id,line_type_id,item_description,destination_organization_id,deliver_to_location_id,deliver_to_location,
637         suggested_buyer_id,suggested_vendor_name,suggested_vendor_site,
638         need_by_date,suggested_vendor_contact,
639         suggested_vendor_item_num,item_number,last_update_date,last_updated_by,org_id,custom_defaulted, autosource_doc_header_id, autosource_doc_line_num)
640         select l_cart_line_id,l_cart_id,l_cart_line_number,sysdate,l_shopper_id,l_qty,Line_Id(i),a.item_id,a.item_revision,a.line_uom,
641         a.price,a.category_id,a.line_type_id,a.item_description,l_dest_org_id,
642 /* comment out this line for bug 696626
643         l_deliver_to_location_id,l_deliver_to_location,a.vendor_id,a.vendor_name,a.vendor_site_code,
644  and replace with the following line*/
645         l_deliver_to_location_id,l_deliver_to_location,a.agent_id,a.vendor_name,a.vendor_site_code,
646         l_need_by_date,a.vendor_contact_name,
647         a.vendor_product_num,a.item_number,sysdate,l_shopper_id,l_org_id,'N',
648         a.po_header_id, a.line_num
649         from icx_po_suppl_catalog_items_v a
650         where a.po_line_id = l_line_id;
651 
652 /*
653         insert into icx_cart_line_distributions(cart_id,cart_line_id,distribution_id,
654               last_updated_by,last_update_date,last_update_login,
655 	      creation_date,created_by,org_id)
656         values (l_cart_id,l_cart_line_id,icx_cart_line_distributions_s.nextval,l_shopper_id,
657 		sysdate,l_shopper_id,sysdate,l_shopper_id,l_org_id);
658 */
659           -- Get the default accounts and update distributions
660           icx_req_acct2.get_default_account(l_cart_id,l_cart_line_id,
661                         l_emp_id,l_org_id,l_account_id,l_account_num);
662 
663         commit;
664 
665         l_rows_added := l_rows_added + 1;
666 
667        else
668 
669 
670             update icx_shopping_cart_lines
671             set quantity = quantity + l_qty
672             where cart_id = l_cart_id
673             and cart_line_id = l_cart_line_id
674             and nvl(org_id, -9999) = nvl(l_org_id,-9999);
675 
676             commit;
677 
678          l_rows_updated := l_rows_updated + 1;
679 
680        end if;
681 
682     end if;
683 
684   end loop;
685 
686   /* call customer default line routines */
687   if l_emergency is not NULL and l_emergency = 'YES' then
688      icx_req_custom.reqs_default_lines(l_emergency,l_cart_id);
689   else
690      icx_req_custom.reqs_default_lines('NO',
691 				    l_cart_id);
692   end if;
693 
694   total_page(l_cart_id,l_dest_org_id,l_rows_added,l_rows_updated,p_cat_name,
695              p_start_row,p_end_row,p_where,end_row,p_query_set,p_row_count);
696 /*   catalog_items(p_start_row,p_end_row,p_where); */
697 
698   end if;
699 
700 exception
701 when INVALID_NUMBER or
702      VALUE_ERROR then
703    l_err_num := SQLCODE;
704    l_error_message := SQLERRM;
705    select substr(l_error_message,12,512) into l_err_mesg from dual;
706    icx_util.add_error(l_err_mesg);
707    icx_util.error_page_print;
708 
709 when OTHERS then
710    l_err_num := SQLCODE;
711    l_error_message := SQLERRM;
712 
713    select substr(l_error_message,12,512) into l_err_mesg from dual;
714    icx_util.add_error(l_err_mesg);
715    icx_util.error_page_print;
716 
717 end;
718 
719 
720 
721 ------------------------------------------------------------
722 procedure catalog_items( p_start_row in number default 1,
723                          p_end_row in number default null,
724 				 p_where in varchar2) is
725 ------------------------------------------------------------
726 v_dcdName            varchar2(1000);
727 v_lang               varchar2(5);
728 
729 begin
730 
731    v_dcdName := owa_util.get_cgi_env('SCRIPT_NAME');
732 
733     -- get lang code
734     v_lang := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
735 
736 
737    -- We need to split into 2 frames
738 
739    js.scriptOpen;
740    htp.p('function openButWin(start_row, end_row, total_row, where) {
741 
742          var result = "' || v_dcdName ||
743                       '/ICX_REQ_CATEGORIES.catalog_items_buttons?p_start_row=" +
744                       start_row + "&p_end_row=" + end_row + "&p_total_rows=" +
745                       total_row + "&p_where=" + where;
746             open(result, ''k_buttons'');
747 }
748   ');
749 
750    js.scriptClose;
751 
752    htp.p('<FRAMESET ROWS="*,40" BORDER=0>');
753    htp.p('<FRAME SRC="' || v_dcdName ||
754          '/ICX_REQ_CATEGORIES.catalog_items_display?p_start_row=' ||
755          p_start_row || '&p_end_row=' || p_end_row || '&p_where=' ||
756          p_where || '" NAME="data" FRAMEBORDER=NO MARGINWIDTH=0 MARGINHEIGHT=0 NORESIZE>');
757 
758    htp.p('<FRAME NAME="k_buttons" SRC="/OA_HTML/' ||
759          v_lang || '/ICXGREEN.htm" FRAMEBORDER=NO MARGINWIDTH=0 MARGINHEIGHT=0 NORESIZE SCROLLING="NO">');
760    htp.p('</FRAMESET>');
761 
762 end;
763 
764 ------------------------------------------------------------
765 procedure catalog_items_buttons(p_start_row in number default 1,
766                                  p_end_row in number default null,
767                                  p_total_rows in number,
768                                  p_where in varchar2) is
769 ------------------------------------------------------------
770 
771 v_lang              varchar2(30);
772 c_query_size        number;
773 
774 begin
775 
776    SELECT QUERY_SET INTO c_query_size FROM ICX_PARAMETERS;
777 
778    v_lang := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
779      htp.p('<BODY BGCOLOR="#CCFFCC">');
780 
781      htp.p('<TABLE BORDER=0>');
782      htp.p('<TD>');
783    icx_on_utilities2.displaySetIcons(p_language_code   => v_lang,
784                                      p_packproc        => 'ICX_REQ_CATEGORIES.catalog_items',
785                                      p_start_row       => p_start_row,
786                                      p_stop_row        => p_end_row,
787                                      p_encrypted_where => p_where,
788                                      p_query_set       => c_query_size,
789 				     p_target          => 'parent',
790                                      p_row_count       => p_total_rows);
791      htp.p('</TD>');
792      htp.p('<TD width=1000></TD><TD>');
793      FND_MESSAGE.SET_NAME('ICX','ICX_ADD_TO_ORDER');
794      icx_util.DynamicButton(P_ButtonText      => FND_MESSAGE.GET,
795                             P_ImageFileName   => 'FNDBNEW.gif',
796                             P_OnMouseOverText => FND_MESSAGE.GET,
797                             P_HyperTextCall   => 'javascript:parent.frames[0].su
798 bmit()',
799                             P_LanguageCode    => v_lang,
800                             P_JavaScriptFlag  => FALSE);
801 
802      htp.p('</TD></TABLE>');
803      htp.p('</BODY>');
804 end;
805 
806 
807 
808 ------------------------------------------------------------
809 procedure catalog_items_display(p_start_row in number default 1,
810                                 p_end_row in number default null,
811                                 p_where in varchar2) is
812 ------------------------------------------------------------
813 
814 sess_web_user       number(15);
815 c_title             varchar2(80) := '';
816 c_prompts           icx_util.g_prompts_table;
817 v_lang              varchar2(30);
818 where_clause        varchar2(2000);
819 total_rows          number;
820 temp_start          number;
821 temp_end            number;
822 end_row             number;
823 display_text        varchar2(5000);
824 temp_table          icx_admin_sig.pp_table;
825 c_query_size        number;
826 v_supplier_url	  varchar2(150);
827 v_supplier_item_url varchar2(150);
828 v_item_url          varchar2(150);
829 v_line_id	        varchar2(65);
830 i                   number := 0;
831 j                   number := 0;
832 k	              binary_integer :=0;
833 n	              binary_integer :=0;
834 m	              binary_integer :=0;
835 v_qty_flag	        boolean := false;
836 
837 y_table             icx_util.char240_table;
838 
839 v_cat_id            number;
840 v_org               number;
841 counter             number := 0;
842 v_temp	        varchar2(240);
843 V_QUANTITY_LENGTH   NUMBER :=10;
844 v_dcdName           varchar2(1000);
845 
846 params              icx_on_utilities.v80_table;
847 c_currency          varchar2(15);
848 c_money_precision   number;
849 c_money_fmt_mask    varchar2(32);
850 
851 v_cat_name          varchar2(1000);
852 v_line_id_ind       number;
853 v_supplier_url_ind  number;
854 v_item_url_ind      number;
855 v_supplier_item_url_ind number;
856 g_reg_ind          number;
857 l_dest_org_id      number;
858 l_location_id      number;
859 l_location         varchar2(240);
860 l_pos              number := 0;
861 l_spin_pos         number := 0;
862 
863 begin
864 
865 -- dbms_session.set_sql_trace(TRUE);
866 
867 if icx_sec.validateSession('ICX_REQS') then
868 
869    sess_web_user := icx_sec.getID(icx_sec.PV_WEB_USER_ID);
870    v_lang := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
871    v_dcdName := owa_util.get_cgi_env('SCRIPT_NAME');
872 
873    -- icx_util.getPrompts(178,'ICX_CATALOG_ITEMS',c_title,c_prompts);
874    icx_util.getPrompts(601,'ICX_PO_SUPPL_CATALOG_ITEMS_R',c_title,c_prompts);
875    icx_util.error_page_setup;
876 
877 
878  --decrypt2 p_where
879     if p_where is not null then
880         icx_on_utilities.unpack_parameters(icx_call.decrypt2(p_where), params);
881         v_cat_id := params(1);
882         v_org := params(2);
883         v_cat_name := params(3);
884     end if;
885 
886 
887  --If no catalog is selected then display a blank right frmae
888    if (v_cat_id = '-1') then
889       htp.htmlOpen;
890         htp.headOpen;
891           icx_util.copyright;
892           htp.bodyOpen('','BGCOLOR="#CCFFCC" onLoad="parent.parent.parent.winOpen(''nav'', ''catalog'')"');
893           htp.bodyClose;
894         htp.headClose;
895       htp.htmlClose;
896       return;
897    end if;
898 
899 
900   ICX_REQ_NAVIGATION.get_currency(v_org, c_currency, c_money_precision, c_money_fmt_mask);
901 
902  --query against ICX_PO_SUPPL_CATALOG_ITEMS_R, Only display items in this template
903 --   where_clause := 'organization_id = ' || v_org || ' and category_id = ' || '''' || v_cat_id || '''';
904 /* Modified by Suri to take care of Bug#724529 **/
905    where_clause := 'category_id = ' || '''' || v_cat_id || '''';
906 /* End changes **/
907 
908  --order_by_clause can be done through ON
909  --order_by_clause := 'sequence_num, item_number, item_description';
910 
911   --get number of rows to display
912    select QUERY_SET into c_query_size from ICX_PARAMETERS;
913 
914   --set up end rows to display
915    if p_end_row is null then
916       end_row := c_query_size;
917    else
918       end_row := p_end_row;
919    end if;
920 
921    ak_query_pkg.exec_query(P_PARENT_REGION_APPL_ID => 601,
922                               P_PARENT_REGION_CODE    => 'ICX_PO_SUPPL_CATALOG_ITEMS_R',
923   			            p_where_clause 		=> where_clause,
924                               P_RESPONSIBILITY_ID     => icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID),
925                               P_USER_ID               => icx_sec.getID(icx_sec.PV_WEB_USER_ID),
926                               P_RETURN_PARENTS        => 'T',
927                               P_RETURN_CHILDREN       => 'F',
928 			      P_RANGE_LOW             => p_start_row,
929 			      P_RANGE_HIGH	      => end_row);
930 
931    --get number of rows to display
932     g_reg_ind := ak_query_pkg.g_regions_table.FIRST;
933     total_rows := ak_query_pkg.g_regions_table(g_reg_ind).total_result_count;
934     if end_row > total_rows then
935        end_row := total_rows;
936     end if;
937 
938    if ak_query_pkg.g_results_table.COUNT = 0 then
939       htp.bodyOpen('','BGCOLOR="#CCFFCC" onLoad="parent.parent.parent.winOpen(''nav'', ''catalog'')"');
940          fnd_message.set_name('EC','ICX_NO_RECORDS_FOUND');
941          fnd_message.set_token('NAME_OF_REGION_TOKEN',c_title);
942          htp.p('<H3>'||fnd_message.get||'</H3>');
943       htp.bodyClose;
944 	return;
945    end if;
946 
947 
948  --Navigation buttons
949 
950  	--print javascript functions
951    	htp.htmlOpen;
952      	htp.headOpen;
953       icx_util.copyright;
954       js.scriptOpen;
955 
956       htp.p('function submit() {
957              document.catalog_items.cartId.value = parent.parent.parent.cartId;
958              document.catalog_items.p_emergency.value = parent.parent.parent.emergency;
959 	     document.catalog_items.submit();
960       }');
961 
962       htp.p ('function get_parent_values(cartId,emergency) {
963               cartId.value=parent.parent.parent.cartId;
964               emergency.value=parent.parent.parent.emergency;
965            }');
966 
967 
968 
969 	counter := 0;
970 
971       js.scriptClose;
972       htp.title(c_title);
973       htp.headClose;
974 
975    htp.bodyOpen('','BGCOLOR="#CCFFCC" onLoad="parent.parent.parent.winOpen(''nav'', ''catalog''); parent.parent.parent.lastCatalog.start_row='|| p_start_row ||
976                         ';parent.parent.parent.lastCatalog.end_row='|| end_row ||
977 			';parent.openButWin('|| p_start_row || ',' ||
978                         end_row || ',' || total_rows || ',' || p_where || ');"');
979    htp.br;
980 
981      htp.p('<FORM ACTION="' || v_dcdName || '/ICX_REQ_CATEGORIES.submit_items" METHOD="POST" NAME="catalog_items" TARGET="_parent" onSubmit="return(false)">');
982 
983      htp.formHidden('cartId','');
984      htp.formHidden('p_emergency','');
985      js.scriptOpen;
986       htp.p('get_parent_values(document.catalog_items.cartId,document.catalog_items.p_emergency)');
987      js.scriptClose;
988 
989      htp.formHidden('p_start_row',p_start_row,'cols="60" rows = "10"');
990      htp.formHidden('p_end_row',p_end_row,'cols="60" rows ="10"');
991      htp.formHidden('p_where',p_where,'cols="60" rows = "10"');
992      htp.formHidden('p_cat_name',v_cat_name,'cols="60" rows = "10"');
993      htp.formHidden('end_row',end_row,'cols="60" rows ="10"');
994      htp.formHidden('p_query_set',c_query_size,'cols="60" rows = "10"');
995      htp.formHidden('p_row_count',total_rows,'cols="60" rows="10"');
996 
997      l_pos := l_pos + 9;
998 
999      htp.tableOpen('border=5','','','','bgcolor=#' || icx_util.get_color('TABLE_DATA_MULTIROW') );
1000      htp.p('<TR BGColor="#'||icx_util.get_color('TABLE_HEADER_TABS')||'">');
1001      --print the table column headings
1002      for i in ak_query_pkg.g_items_table.first .. ak_query_pkg.g_items_table.last loop
1003 
1004          if (ak_query_pkg.g_items_table(i).value_id is not null
1005 		and ak_query_pkg.g_items_table(i).item_style <> 'hidden'
1006 		and ak_query_pkg.g_items_table(i).node_display_flag = 'Y'
1007                 and ak_query_pkg.g_items_table(i).secured_column <> 'T') or
1008              ak_query_pkg.g_items_table(i).attribute_code = 'ICX_QTY' then
1009 
1010             if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_QTY' then
1011 	   	   --print quantity heading WITH COLSPAN=2
1012                htp.tableData(ak_query_pkg.g_items_table(i).attribute_label_long,'CENTER','','','','2');
1013             elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_UNIT_PRICE' then
1014                htp.tableData(ak_query_pkg.g_items_table(i).attribute_label_long || ' (' || c_currency || ')', 'CENTER','','','','width=80');
1015             else
1016                htp.tableData(ak_query_pkg.g_items_table(i).attribute_label_long,'CENTER');
1017             end if;
1018         end if;
1019 
1020         -- find line id, urls value id
1021         if ak_query_pkg.g_items_table(i).value_id is not null then
1022 
1023            --need line_id to call javascript function down() and up()
1024            if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_LINE_ID') then
1025               v_line_id_ind := ak_query_pkg.g_items_table(i).value_id;
1026            end if;
1027            -- find item_url and supplier_item_url
1028            if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_ITEM_URL') then
1029               v_item_url_ind := ak_query_pkg.g_items_table(i).value_id;
1030            end if;
1031            if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUPPLIER_URL') then
1032               v_supplier_url_ind := ak_query_pkg.g_items_table(i).value_id;
1033            end if;
1034            if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUPPLIER_ITEM_URL') then
1035               v_supplier_item_url_ind := ak_query_pkg.g_items_table(i).value_id;
1036            end if;
1037         end if;
1038 
1039      end loop;
1040      htp.tableRowClose;
1041 
1042     --get one row of the result and find the catalog name
1043 --   	icx_util.transfer_Row_To_Column( ak_query_pkg.g_results_table(ak_query_pkg.g_results_table.first), y_table) ;
1044 
1045      v_qty_flag := true;
1046 
1047      htp.br; htp.br;
1048 
1049      counter := 0;
1050 --     for j in p_start_row-1 .. end_row-1 loop
1051        for j in ak_query_pkg.g_results_table.FIRST .. ak_query_pkg.g_results_table.LAST loop
1052          temp_table(0) := '<TR BGColor="#'||icx_util.get_color('TABLE_DATA_MULTIROW') || '">';
1053 
1054 	   icx_util.transfer_Row_To_Column( ak_query_pkg.g_results_table(j), y_table) ;
1055 
1056          for i in ak_query_pkg.g_items_table.first .. ak_query_pkg.g_items_table.last loop
1057 
1058  		 --print quantity input text box and up button if v_qty_flag is set
1059              if v_qty_flag and ak_query_pkg.g_items_table(i).attribute_code = 'ICX_QTY' then
1060                 v_line_id := y_table(v_line_id_ind);
1061 
1062        	    display_text := '<TD ROWSPAN=2><CENTER> <INPUT TYPE=''text'' NAME=''Quantity'' '
1063 --dchu                 			onFocus="top.update_quantity(document.forms[' || counter || '].Quantity, ''' || v_line_id || ''')"
1064 --dchu                 			onChange="item' || counter || '(this,''' || v_line_id || ''')" '
1065 	      || ' SIZE='
1066 	      || to_char(V_QUANTITY_LENGTH)
1067 	      || ' onChange=''if(!parent.parent.parent.checkNumber(this)){this.focus();this.value="";}''></CENTER></TD>';
1068 
1069                 --show the quantity in the box filled in in the previous record set
1070                     l_spin_pos := l_pos;
1071      		    display_text := display_text
1072 		      || '<TD width=18 valign=bottom> <a href="javascript:parent.parent.parent.up(document.catalog_items.elements['
1073 		      || l_spin_pos
1074 		      || '])" onMouseOver="window.status=''Add Quantity'';return true"><IMG SRC=/OA_MEDIA/'
1075 		      || v_lang
1076 		      || '/FNDISPNU.gif border=0></a></TD>';
1077                     l_pos := l_pos + 1;
1078 
1079 		    --add the tabledata in temp_table() WITH ROWSPAN=2
1080 	          temp_table(0) := temp_table(0) ||  display_text;
1081              end if;
1082 
1083              if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_LINE_ID' then
1084                    display_text := '<INPUT TYPE="HIDDEN" NAME="Line_Id" VALUE =' || y_table(ak_query_pkg.g_items_table(i).value_id) || '>';
1085 
1086                    l_pos := l_pos + 1;
1087                    temp_table(0) := temp_table(0) || display_text;
1088              end if;
1089 
1090 		-- special treatment for certain columns
1091              if ak_query_pkg.g_items_table(i).value_id is not null --not including ICX_QTY
1092 		    and ak_query_pkg.g_items_table(i).node_display_flag = 'Y'
1093                     and ak_query_pkg.g_items_table(i).secured_column <> 'T'
1094 		    and ak_query_pkg.g_items_table(i).item_style <> 'HIDDEN' then --only for display of item tabledata
1095 
1096 /* Ref Bug #640289 : Changed By Suri. The Standard Requisitions/Emergency Requisitions Unit Price  field should allow more than two decimal places. ***/
1097 
1098                      IF ak_query_pkg.g_items_table(i).attribute_code = 'ICX_UNIT_PRICE' THEN
1099 --                        display_text := to_char(to_number(y_table(ak_query_pkg.g_items_table(i).value_id)), c_money_fmt_mask);
1100                           display_text := to_char(to_number(y_table(ak_query_pkg.g_items_table(i).value_id)));
1101 /* End Change Bug #640289 By Suri ***/
1102 		    else
1103                         display_text := y_table(ak_query_pkg.g_items_table(i).value_id);
1104                 end if;
1105 
1106                 --Display item_description as a link and a tabledata
1107                if display_text is not NULL then
1108                 if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_ITEM_DESCRIPTION') then
1109                    v_item_url := y_table(v_item_url_ind);
1110                    display_text := ICX_REQ_NAVIGATION.addURL(v_item_url, display_text);
1111                 end if;
1112                  --Display source_name as a link
1113                  if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_NAME' then
1114                     v_supplier_url := y_table(v_supplier_url_ind);
1115                     display_text := ICX_REQ_NAVIGATION.addURL(v_supplier_url, display_text);
1116                  end if;
1117                  --Display supplier item number as a link
1118                  if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_ITEM_NUM' then
1119                     v_supplier_item_url := y_table(v_supplier_item_url_ind);
1120                     display_text := ICX_REQ_NAVIGATION.addURL(v_supplier_item_url, display_text);
1121                  end if;
1122                end if;
1123 
1124                 if display_text is null then
1125                    display_text := htf.br;
1126                 end if;
1127                 if display_text = '-' then
1128                    display_text := htf.br;
1129                 end if;
1130                 if display_text = 'null' then
1131                    display_text := htf.br;
1132                 end if;
1133                 if display_text = '-1' then
1134                    display_text := htf.br;
1135                 end if;
1136 
1137 
1138 
1139                 if ak_query_pkg.g_items_table(i).bold = 'Y' then
1140            	       display_text := htf.bold(display_text);
1141                 end if;
1142                 --Italics
1143                 if ak_query_pkg.g_items_table(i).italic = 'Y' then
1144      	             display_text := htf.italic(display_text);
1145            	    end if;
1146 
1147                 temp_table(0) := temp_table(0) ||
1148                                       htf.tableData( cvalue   => display_text,
1149                                                      calign   => ak_query_pkg.g_items_table(i).horizontal_alignment,
1150                                                      crowspan => '2',
1151                                                      cattributes => ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment
1152                                                    );
1153              end if;
1154          end loop;  -- for i in 1 .. ak_query_pkg.g_items_table.first loop
1155 
1156 	   --close the table row
1157          temp_table(0) := temp_table(0) || htf.tableRowClose;
1158 	   if v_qty_flag then
1159 	      --print the down button
1160             display_text := htf.tableRowOpen( cattributes => 'BGColor="#'||icx_util.get_color('TABLE_DATA_MULTIROW')||'"');
1161 		display_text := display_text || '<TD WIDTH=18 valign=top><a href="javascript:parent.parent.parent.down(document.catalog_items.elements[' || l_spin_pos ||
1162    		                '])" onMouseOver="window.status=''Reduce Quantity'';return true"><IMG SRC=/OA_MEDIA/' || v_lang
1163                             || '/FNDISPND.gif  BORDER=0></a>';
1164 		display_text := display_text || '</TD>';
1165 		display_text := display_text || htf.tableRowClose;
1166             temp_table(0) := temp_table(0) ||  display_text;
1167   	   end if;
1168            htp.p(temp_table(0));
1169 	   counter := counter + 1;
1170      end loop;      -- for j in 1 .. ak_query_pkg.g_results_table.COUNT loop
1171      htp.tableClose;
1172 
1173      htp.p('</FORM>');
1174 
1175       htp.bodyClose;
1176       htp.htmlClose;
1177 
1178 end if;
1179 -- dbms_session.set_sql_trace(FALSE);
1180 
1181 end catalog_items_display;
1182 
1183 --**********************************************************
1184 -- END PROCEDURES RELATED TO CATEGORIES
1185 --**********************************************************
1186 
1187 
1188 
1189 end ICX_REQ_CATEGORIES;