[Home] [Help]
PACKAGE BODY: APPS.ICX_REQ_ORDER
Source
1 PACKAGE BODY ICX_REQ_ORDER as
2 /* $Header: ICXREQMB.pls 115.6 99/07/17 03:22:01 porting ship $ */
3
4
5
6 --**********************************************************
7 -- LOCAL PROCEDURES NOT DECLARED IN SPEC
8 --**********************************************************
9
10
11 ------------------------------------------------------------
12 procedure popWindow is
13 ------------------------------------------------------------
14 begin
15 htp.p('function popWindow(sourceURL) {
16 win = window.open(sourceURL, "drillDown", "resizable=yes,scrollbars=yes,width=750,height=300");
17 win = window.open(sourceURL, "drillDown", "resizable=yes,scrollbars=yes,width=750,height=300");
18 }
19 ');
20
21 end popWindow;
22
23 ------------------------------------------------------------------------
24 function chk_exclude_on(v_attribute_code IN varchar2)
25 return varchar2 is
26 ------------------------------------------------------------------------
27 cursor RespExclAttrs(resp_id number,appl_id number,attr_code varchar2) is
28 select attribute_code
29 from ak_excluded_items
30 where responsibility_id = resp_id
31 and resp_application_id = appl_id
32 and attribute_code = attr_code;
33
34 v_resp_id number;
35 v_attr_code varchar2(80);
36
37 begin
38
39 v_resp_id := icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID);
40 if v_resp_id is not NULL then
41
42 open RespExclAttrs(v_resp_id,178,v_attribute_code);
43 fetch RespExclAttrs into v_attr_code;
44 if RespExclAttrs%NOTFOUND then
45 close RespExclAttrs;
46 return 'N';
47 else
48 close RespExclAttrs;
49 return 'Y';
50 end if;
51 else
52 return 'N';
53 end if;
54 -- return 'N';
55 end;
56
57
58
59 ------------------------------------------------------------
60 procedure giveWarning is
61 ------------------------------------------------------------
62 begin
63
64 FND_MESSAGE.SET_NAME('ICX', 'ICX_CART_RMV_ALL');
65 htp.p('function giveWarning() {
66 if (confirm(''' || icx_util.replace_quotes(FND_MESSAGE.GET) || ''')) {
67 return true;
68 } else {
69 return false;
70 }
71 }
72 ');
73
74 end giveWarning;
75
76
77 ------------------------------------------------------------
78 procedure sysadmin_error is
79 ------------------------------------------------------------
80 v_lang varchar2(5);
81
82 begin
83 -- set lang code
84 v_lang := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
85
86 -- icx_admin_sig.openHeader;
87 -- icx_admin_sig.closeHeader;
88
89 htp.htmlOpen;
90 htp.headOpen;
91 icx_admin_sig.toolbar(language_code => v_lang);
92 icx_util.copyright;
93 js.scriptOpen;
94
95 htp.p('function help_window() {
96 help_win = window.open(''/OA_DOC/' || v_lang || '/awe' || '/icxhlprq.htm'', "help_win","resizable=yes,scrollbars=yes,toolbar=yes,width=450,height=250");
97 help_win = window.open(''/OA_DOC/' || v_lang || '/awe' || '/icxhlprq.htm'', "help_win","resizable=yes,scrollbars=yes,toolbar=yes,width=450,height=250")}
98 ');
99 js.scriptClose;
100
101
102 htp.headClose;
103 htp.bodyOpen('/OA_MEDIA/' || v_lang || '/ICXBCKGR.jpg');
104
105 FND_MESSAGE.SET_NAME('ICX', 'ICX_DATA_INCORRECT');
106 icx_util.add_error(FND_MESSAGE.GET);
107 icx_util.error_page_print;
108 -- htp.p(FND_MESSAGE.GET);
109
110
111 htp.bodyClose;
112
113 end sysadmin_error ;
114
115
116
117
118 ------------------------------------------------
119 procedure drawCartErrors(l_cart_id number) is
120 ------------------------------------------------
121 cursor get_errors(v_cart_id number) is
122 select error_text
123 from icx_req_cart_errors
124 where cart_id = v_cart_id;
125
126 l_message varchar2(1000);
127 l_first_time varchar2(1);
128
129 begin
130 --dc htp.p('//Draw errors at top of the cart.
131 --dc function drawCartErrors() {
132 --dc if (top.cartErrors.length > 0 ) {
133 --dc var result = "";
134 --dc result += "<TABLE Border=5>";
135 --dc for(var i=1; i<= top.cartErrors.length; i++){
136 --dc result += "<TR><TD>" + replaceQuotes(top.cartErrors[i]) + "</TD></TR>";
137 --dc }
138 --dc result += "</TABLE>";
139 --dc document.write(result);
140 --dc }
141 --dc }
142 --dc ');
143
144 l_first_time := 'Y';
145 for prec in get_errors(l_cart_id) loop
146 if l_first_time = 'Y' then
147 htp.p('<TABLE BORDER=5>');
148 l_first_time := 'N';
149 end if;
150
151 htp.p('<TR><TD>' || prec.error_text || '</TD></TR>');
152 end loop;
153 if l_first_time = 'N' then
154 htp.p('</TABLE>');
155 end if;
156
157 end drawCartErrors;
158
159
160
161 ------------------------------------------------
162 procedure updateCartHeaderObject is
163 ------------------------------------------------
164 begin
165 htp.p('//Update the requestor.
166 function Update_requestor(id, name,org_id,loc_id,loc_cd) {
167 document.KEVIN.ICX_DEST_ORG_ID.value = document.KEVIN.ICX_REQ_ORG_ID.value;
168 document.KEVIN.ICX_DELIVER_TO_LOCATION_ID.value = document.KEVIN.ICX_REQ_LOC_ID.value;
169 document.KEVIN.ICX_DELIVER_TO_LOCATION.value = document.KEVIN.ICX_REQ_LOC_CD.value;
170
171 }');
172
173 end updateCartHeaderObject;
174
175
176 ------------------------------------------------
177 procedure get_po(n_org varchar2,n_cart_id number) is
178 ------------------------------------------------
179 v_dcdName varchar2(2000);
180 begin
181
182 -- FND_MESSAGE.SET_NAME('ICX', 'ICX_ONE_PO_PER_REQUISITION');
183 /*
184 var po_num = "" + parent.my_cart_header.ICX_RESERVED_PO_NUM;
185 alert(po_num);
186 if (po_num <> "") {
187 alert("' || icx_util.replace_quotes(FND_MESSAGE.GET) || '");
188 //alert("Can not reserve more than one PO # for a single requisition.");
189 return;
190 }
191
192 */
193
194
195 --get dcd name
196 v_dcdName := owa_util.get_cgi_env('SCRIPT_NAME');
197
198 htp.p('//Reserve a po number.
199 function get_po(){
200 open("' || v_dcdName || '/ICX_REQ_ORDER.get_emergency_po_num?n_org=' || n_org || '&n_cart_id= ' || n_cart_id || '", "navigation");
201
202 }
203
204 ');
205 end get_po;
206
207
208
209 ------------------------------------------------------------
210 procedure cart_line_actions(n_org varchar2) is
211 --
212 -- This procedure prints javascript functions
213 -- required for various actions on cart lines.
214 --
215 -- Actions JavaScript Function
216 -- ------- -------------------
217 --
218 -- Change Quantity quantity_changed
219 --
220 -- Change Price price_changed
221 --
222 -- Remove a line remove
223 --
224 -- Split a line into 2 splitLine
225 --
226 ------------------------------------------------------------
227 v_dcdName varchar2(1000);
228 v_message varchar2(240);
229
230 begin
231
232 --get dcd name
233 v_dcdName := owa_util.get_cgi_env('SCRIPT_NAME');
234
235
236 FND_MESSAGE.SET_NAME('RG', 'RG_DELETE_ROW');
237 v_message := FND_MESSAGE.GET;
238
239 htp.p('function remove(number) {
240 if (confirm("' || icx_util.replace_quotes(v_message) || '") ) {
241 //dc parent.removeItem(number);
242 document.LINE.cartLineId.value = number;
243 document.LINE.cartLineAction.value = "DELETE";
244 document.LINE.submit();
245
246 //dc top.switchFrames("my_order");
247 }
248 }
249 ');
250
251
252 htp.p('function splitLine(number) {
253 //dc parent.splitLine(number);
254 document.LINE.cartLineId.value = number;
255 document.LINE.cartLineAction.value = "COPY";
256 document.LINE.submit();
257 //dc top.switchFrames("my_order");
258 }');
259
260 -- Added for account distributions
261 htp.p('function accountDist(number) {
262 document.LINE.cartLineId.value = number;
263 document.LINE.cartLineAction.value = "ACCOUNT";
264 parent.parent.account_dist="Y";
265 parent.parent.cartLineId=number;
266 top.switchFrames("my_order");
267
268 // document.LINE.submit();
269 }');
270
271 end cart_line_actions;
272
273 procedure submit_line_actions is
274 v_confirm_text varchar2(240);
275 v_empty_cart_msg varchar2(1000);
276 begin
277
278 FND_MESSAGE.SET_NAME('ICX','ICX_CONFIRM_COMPLETE');
279 v_confirm_text := FND_MESSAGE.GET;
280
281 FND_MESSAGE.SET_NAME('ICX','ICX_CART_EMPTY');
282 v_empty_cart_msg := FND_MESSAGE.GET;
283
284 htp.p('function save_order() {
285
286 // if (parent.frames[0].document.LINE.itemCount.value == 0) {
287 // alert("' || icx_util.replace_quotes(v_empty_cart_msg) || '");
288 // } else {
289
290 // if (confirm("' || icx_util.replace_quotes(v_confirm_text) || '")) {
291 parent.frames[0].document.KEVIN.user_action.value = "SAVE";
292 parent.frames[0].document.KEVIN.submit();
293 // }
294 // }
295 }');
296
297
298 FND_MESSAGE.SET_NAME('ICX','ICX_APPLY_CHANGES_CONFIRM');
299 v_confirm_text := FND_MESSAGE.GET;
300
301 htp.p('function modify_order() {
302
303 // if (parent.frames[0].document.LINE.itemCount.value == 0) {
304 // alert("' || icx_util.replace_quotes(v_empty_cart_msg) || '");
305 // } else {
306
307 parent.frames[0].document.KEVIN.user_action.value = "MODIFY";
308 parent.frames[0].document.KEVIN.submit();
309 // }
310 }');
311
312 htp.p('function get_po_modify_order() {
313 // if (parent.frames[0].document.LINE.itemCount.value == 0) {
314 // alert ("' || icx_util.replace_quotes(v_empty_cart_msg) || '");
315 // } else {
316 parent.frames[0].document.KEVIN.user_action.value = "GET_PO_MODIFY";
317 parent.frames[0].document.KEVIN.submit();
318 // }
319 }');
320
321
322 FND_MESSAGE.SET_NAME('ICX','ICX_CONFIRM_ORDER');
323 v_confirm_text := FND_MESSAGE.GET;
324 htp.p('function submit_order() {
325
326 if (parent.frames[0].document.LINE.itemCount.value == 0) {
327 alert("' || icx_util.replace_quotes(v_empty_cart_msg) || '");
328 } else {
329
330 if (confirm("' || icx_util.replace_quotes(v_confirm_text) || '")) {
331 parent.frames[0].document.KEVIN.user_action.value = "PLACE ORDER";
332 parent.frames[0].document.KEVIN.submit();
333 }
334 }
335 }');
336
337 FND_MESSAGE.SET_NAME('ICX','ICX_CANCEL_CONFIRM');
338 v_confirm_text := FND_MESSAGE.GET;
339 htp.p('function delete_saved_cart() {
340
341 // if (parent.frames[0].document.LINE.itemCount.value == 0) {
342 // alert("' || icx_util.replace_quotes(v_empty_cart_msg) || '");
343 // } else {
344
345 if (confirm("' || icx_util.replace_quotes(v_confirm_text) || '")) {
346 parent.frames[0].document.KEVIN.user_action.value = "CANCEL";
347 parent.frames[0].document.KEVIN.submit();
348 }
349 // }
350 }
351 ');
352 end submit_line_actions;
353
354 ------------------------------------------------------------
355 procedure PrintHead(l_total_price_column IN OUT number,l_pos IN OUT number,v_currency in varchar2) is
356 ------------------------------------------------------------
357 i number := 0;
358 v_table_attribute varchar2(32);
359 v_vendor_on_flag varchar2(1);
360 v_req_overwrite_flag varchar2(1);
361 l_col number;
362
363 begin
364
365 l_col := 0;
366 v_req_overwrite_flag := icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_LOC_FLAG);
367
368 ICX_REQ_NAVIGATION.chk_vendor_on(v_vendor_on_flag);
369
370 -- old background
371 htp.p('<TABLE BORDER=5 bgcolor=''#F8F8F8''>');
372 htp.p('<TR bgcolor=''#D8D8D8''>');
373
374 for i in ak_query_pkg.g_items_table.first .. ak_query_pkg.g_items_table.last loop
375
376 if ( ak_query_pkg.g_items_table(i).item_style <> 'HIDDEN' and
377 ((ak_query_pkg.g_items_table(i).node_display_flag = 'Y' and
378 ak_query_pkg.g_items_table(i).secured_column <> 'T') or
379 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_QTY_V' or
380 ((ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_SITE'
381 or ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_CONTACT'
382 or ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_PHONE') and
383 v_vendor_on_flag = 'Y' and ak_query_pkg.g_items_table(i).item_style <> 'HIDDEN' and ak_query_pkg.g_items_table(i).node_display_flag = 'Y' and
384 ak_query_pkg.g_items_table(i).secured_column <> 'T' ))) or
385 (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_NAME' and
386 v_vendor_on_flag = 'Y') then
387
388 v_table_attribute := '';
389 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_QTY_V' then
390 v_table_attribute := ' COLSPAN=2 ';
391 l_col := l_col + 1;
392 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_NAME' and v_vendor_on_flag = 'Y' then
393
394 v_table_attribute := ' COLSPAN=2 ';
395 l_col := l_col + 1;
396
397 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_LOCATION' and ak_query_pkg.g_items_table(i).update_flag = 'Y' and v_req_overwrite_flag = 'Y' then
398 v_table_attribute := ' COLSPAN=2 ';
399 l_col := l_col + 1;
400
401 elsif ak_query_pkg.g_items_table(i).lov_attribute_code is not NULL and
402 ak_query_pkg.g_items_table(i).lov_region_code is not NULL and
403 ak_query_pkg.g_items_table(i).update_flag = 'Y' then
404
405 if ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_PHONE' and
406 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_SITE' and
407 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_CONTACT' and
408 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DELIVER_TO_LOCATION' then
409
410 v_table_attribute := ' COLSPAN=2 ';
411 l_col := l_col + 1;
412
413 end if;
414 end if;
415
416 if (ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DEST_ORG_ID' and
417 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DELIVER_TO_LOCATION_ID' and
418 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DELIVER_TO_REQUESTOR_ID' and
419 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SHOPPER_ID' and
420 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_CART_ID' and
421 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_APPROVER_ID' and
422 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_REQ_ORG_ID' and
423 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_REQ_LOC_ID' and
424 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_REQ_LOC_CD') then
425
426 if ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_UNIT_PRICE' and ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_EXT_PRICE' then
427
428 htp.p( '<TD' || v_table_attribute || ' ALIGN="CENTER" >' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>' );
429
430 else
431
432 htp.p( '<TD' || v_table_attribute || ' ALIGN="CENTER" >' || ak_query_pkg.g_items_table(i).attribute_label_long || ' (' || v_currency || ') </TD>' );
433
434
435 end if;
436
437 l_col := l_col + 1;
438
439 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_EXT_PRICE' then
440 l_total_price_column := l_col;
441 end if;
442 end if;
443
444 end if;
445
446
447 end loop;
448
449 htp.p('</TR><TR></TR><TR></TR><TR></TR>');
450 end PrintHead;
451
452
453 /* new PrintItem server side XXXXXXXXXXXXXXXXXXX*/
454 ------------------------------------------------------------
455 procedure PrintItems(p_cart_line_id_value number,
456 v_money_fmt_mask varchar2,
457 l_pos in out number,
458 v_vendor_LOV_flag in out varchar2,
459 v_location_LOV_flag in out varchar2,
460 p_ext_price_total out number) is
461 ------------------------------------------------------------
462 l_values icx_util.char240_table;
463 l_value varchar2(240);
464 l_language_code varchar2(30);
465 l_multirow_color varchar2(30);
466 l_colspan number;
467 c_prompts ICX_UTIL.g_prompts_table;
468 c_title varchar2(45);
469 l_org_id_pos number;
470 l_loc_id_pos number;
471 l_spin_pos number;
472 l_ext_price_total number := 0;
473
474 --add by alex
475 pk varchar2(240);
476 url varchar2(500);
477 attachment_status varchar2(10);
478 v_dcdname varchar2(1000) := owa_util.get_cgi_env('SCRIPT_NAME');
479 --
480
481 begin
482
483 l_language_code := icx_sec.getID(icx_sec.pv_language_code);
484 l_multirow_color := icx_util.get_color('TABLE_DATA_MULTIROW');
485 -- icx_util.getprompts(601, 'ICX_SHOPPING_CART_LINES_R', c_title, c_prompts);
486 icx_util.getprompts(601, 'ICX_LOV', c_title, c_prompts);
487
488 for r in 0..ak_query_pkg.g_results_table.LAST loop
489
490 icx_util.transfer_Row_To_Column(ak_query_pkg.g_results_table(r),l_values);
491
492 for i in 0..ak_query_pkg.g_items_table.LAST loop
493
494 if ak_query_pkg.g_items_table(i).node_display_flag = 'Y'
495 and ak_query_pkg.g_items_table(i).secured_column = 'F'
496 and ak_query_pkg.g_items_table(i).item_style = 'HIDDEN'
497 then
498
499 htp.formHidden(cname => ak_query_pkg.g_items_table(i).attribute_code || 'A', cvalue => replace(l_values(ak_query_pkg.g_items_table(i).value_id),'"','"'));
500
501 -- remember org id and loc id positions for LOV use
502 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DEST_ORG_ID_L' then
503 l_org_id_pos := l_pos;
504 end if;
505 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_LOCATION_ID_L' then
506 l_loc_id_pos := l_pos;
507 end if;
508
509 l_pos := l_pos + 1;
510 end if;
511
512 end loop;
513
514 htp.p('<TR BGColor="#'||l_multirow_color||'">');
515
516 for i in 0..ak_query_pkg.g_items_table.LAST loop
517
518 --add by alex
519 pk := l_values(p_cart_line_id_value);
520 --
521 if ak_query_pkg.g_items_table(i).value_id is null
522 then
523 l_value := '';
524 else
525 l_value := l_values(ak_query_pkg.g_items_table(i).value_id);
526
527 /* compute price total */
528 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_EXT_PRICE' then
529 l_ext_price_total := l_ext_price_total + to_number(nvl(l_value,0));
530 end if;
531
532 end if;
533
534 IF (NOT (ak_query_pkg.g_items_table(i).node_display_flag = 'Y'
535 and ak_query_pkg.g_items_table(i).secured_column = 'F'))
536 THEN
537 /* if item is on of suggested_vendor_phone/contact/name and
538 it's not displayed, we still need to save a space for it to
539 store its value in case if user changes the suggested_vendor */
540 if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_PHONE' or
541 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_CONTACT' or
542 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_SITE') and
543 v_vendor_LOV_flag = 'Y' then
544 htp.p('<INPUT TYPE="HIDDEN" NAME="'
545 || ak_query_pkg.g_items_table(i).attribute_code
546 || 'A'
547 || '" VALUE= "'
548 || replace(l_value,'"','"')
549 || '">');
550
551 l_pos := l_pos + 1;
552
553 end if;
554
555 ELSE /* if node_display_flag='Y' and secured_column = 'F' */
556 if ak_query_pkg.g_items_table(i).item_style = 'HIDDEN'
557 then
558 null;
559 elsif ak_query_pkg.g_items_table(i).item_style = 'IMAGE'
560 then
561 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELETE'
562 then
563 htp.tableData(cvalue => '<a href="javascript:remove('
564 || l_values(p_cart_line_id_value)
565 -- || ')"><IMG SRC=/OA_MEDIA/'
566 || ')" onMouseOver="window.status='''
567 || icx_util.replace_onmouseover_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
568 || '''; return true"><IMG SRC=/OA_MEDIA/'
569 || l_language_code
570 -- || '/FNDIDELR.gif HEIGHT=18 WIDTH=18 BORDER=no></TD>',
571 || '/FNDIDELR.gif HEIGHT=18 WIDTH=18 BORDER=no ALT="'
572 || icx_util.replace_alt_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
573 || '"></TD>',
574 crowspan => 2,
575 -- add by Mary
576 calign => ak_query_pkg.g_items_table(i).horizontal_alignment);
577
578 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SPLIT'
579 then
580 htp.tableData(cvalue => '<a href="javascript:splitLine('
581 || l_values(p_cart_line_id_value)
582 -- || ')"><IMG SRC=/OA_MEDIA/'
583 || ')" onMouseOver="window.status='''
584 || icx_util.replace_onmouseover_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
585 || '''; return true"><IMG SRC=/OA_MEDIA/'
586 || l_language_code
587 -- || '/FNDISPLT.gif HEIGHT=18 WIDTH=18 BORDER=no></TD>',
588 || '/FNDISPLT.gif HEIGHT=18 WIDTH=18 BORDER=no ALT="'
589 || icx_util.replace_alt_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
590 || '"></TD>',
591 crowspan => 2,
592 -- add by Mary
593 calign => ak_query_pkg.g_items_table(i).horizontal_alignment);
594
595 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_ACCT_DIST'
596 then
597 htp.tableData(cvalue => '<a
598 href="javascript:accountDist('
599 || l_values(p_cart_line_id_value)
600 -- || ')"><IMG SRC=/OA_MEDIA/'
601 || ')" onMouseOver="window.status='''
602 || icx_util.replace_onmouseover_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
603 || '''; return true"><IMG SRC=/OA_MEDIA/'
604 || l_language_code
605 -- || '/FNDIMADS.gif HEIGHT=16 WIDTH=16 BORDER=no></TD>',
606 || '/FNDISPLT.gif HEIGHT=16 WIDTH=16 BORDER=no ALT="'
607 || icx_util.replace_alt_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
608 || '"></TD>',
609 crowspan => 2,
610 -- add by Mary
611 calign => ak_query_pkg.g_items_table(i).horizontal_alignment);--
612
613 --add by alex
614 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_PAPER_CLIP' then
615 fnd_webattch.GetSummaryStatus('ICX_REQS', 'REQ_LINES',
616 pk, NULL, NULL, NULL, NULL, attachment_status);
617 if (attachment_status <> 'DISABLE' AND attachment_status = 'FULL') then
618 htp.tableData(cvalue => '<a
619 href="javascript:attachment(2, '''
620 || pk
621 || ''' ,'''' , '''
622 || v_dcdname
623 ||''')" onMouseOver="window.status='''
624 || icx_util.replace_onmouseover_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
625 || '''; return true"><IMG SRC=/OA_MEDIA/'
626 || l_language_code
627 || '/FNDIATTE.gif HEIGHT=16 WIDTH=16 BORDER=no ALT="'
628 || icx_util.replace_alt_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
629 || '"></TD>',
630 crowspan => 2,
631 -- add by Mary
632 calign => ak_query_pkg.g_items_table(i).horizontal_alignment);
633 elsif (attachment_status <> 'DISABLE') then
634 htp.tableData(cvalue => '<a
635 href="javascript:attachment(2, '''
636 || pk
637 || ''' ,'''' , '''
638 ||v_dcdname
639 -- ||''')"><IMG SRC=/OA_MEDIA/'
640 ||''')" onMouseOver="window.status='''
641 || icx_util.replace_onmouseover_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
642 || '''; return true"><IMG SRC=/OA_MEDIA/'
643 || l_language_code
644 || '/FNDIATT.gif HEIGHT=16 WIDTH=16 BORDER=no ALT="'
645 || icx_util.replace_alt_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
646 || '"></TD>',
647 crowspan => 2,
648 -- add by Mary
649 calign => ak_query_pkg.g_items_table(i).horizontal_alignment);
650 end if;
651 --
652
653 end if; -- attribute_code
654 else
655 if ak_query_pkg.g_items_table(i).update_flag = 'Y'
656 then
657
658 l_colspan := 1;
659
660 -- if location code, null out locaiton id and org id if user
661 -- type in code manually, so that submit will validate the
662 -- code and fill in the ids
663 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_LOCATION_L' then
664
665 htp.tableData(cvalue => '<INPUT TYPE="TEXT" NAME = ' || ak_query_pkg.g_items_table(i).attribute_code || 'A' || ' size=' || ak_query_pkg.g_items_table(i).display_value_length
666 || ' maxlength=' || ak_query_pkg.g_items_table(i).attribute_value_length || ' VALUE = "'|| replace(l_value,'"','"') ||'" onBlur='' document.KEVIN.elements['
667 || to_char(l_org_id_pos) || '].value ="";document.KEVIN.elements[' || to_char(l_loc_id_pos) || '].value="";''>', crowspan => 2);
668 else
669
670 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_EXT_PRICE' then
671 l_value := to_char(to_number(l_value),v_money_fmt_mask);
672 l_value := replace(l_value,',','');
673 end if;
674
675 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_QTY_V' or
676 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_UNIT_PRICE' then
677 l_value := replace(l_value,',','');
678
679 htp.tableData(cvalue => '<INPUT TYPE="TEXT" NAME = ' || ak_query_pkg.g_items_table(i).attribute_code || 'A' || ' size=' ||
680 ak_query_pkg.g_items_table(i).display_value_length || ' maxlength=' || ak_query_pkg.g_items_table(i).attribute_value_length || ' VALUE = "'
681 || replace(l_value,'"','"') ||'" onChange=''if(!parent.parent.checkNumber(this)){this.focus();this.value="";}''>', crowspan => 2);
682
683 else
684
685 htp.tableData(cvalue => '<INPUT TYPE="TEXT" NAME = ' || ak_query_pkg.g_items_table(i).attribute_code
686 || 'A' || ' size=' || ak_query_pkg.g_items_table(i).display_value_length || ' maxlength='
687 || ak_query_pkg.g_items_table(i).attribute_value_length || ' VALUE = "'|| replace(l_value,'"','"') ||'">', crowspan => 2);
688
689 end if;
690
691 end if;
692
693 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_QTY_V'
694 then
695 l_spin_pos := l_pos;
696 htp.tableData(cvalue => '<A HREF="javascript:parent.parent.up(document.KEVIN.elements['
697 ||l_spin_pos
698 ||'])" onMouseOver="window.status=''Add Quantity'';return true"><IMG SRC="/OA_MEDIA/'
699 ||l_language_code
700 ||'/FNDISPNU.gif" BORDER=NO>',cattributes => 'width=18 valign=bottom');
701 end if;
702
703 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_NAME' then
704
705 htp.tableData(cvalue => htf.anchor('javascript:PRE_LOV1(''178'',''ICX_SUGGESTED_VENDOR_NAME'',''601'',''ICX_SHOPPING_CART_LINES_R'',''LOVFIELDS'',''my_order1'','''','''','''
706 || to_char(l_pos) || ''',''' || to_char(l_pos + 1) || ''',''' || to_char(l_pos + 2) || ''',''' || to_char(l_pos + 3) || ''')',htf.img('/OA_MEDIA/'
707 ||l_language_code||'/FNDILOV.gif','LEFT',c_title,'','BORDER=0 WIDTH=22 HEIGHT=22'),'','onMouseOver="window.status='''
708 || icx_util.replace_onMouseOver_quotes(c_title) ||''';return true"'), crowspan => 2);
709
710 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_LOCATION_L' then -- must be location LOV
711
712 htp.tableData(cvalue => htf.anchor('javascript:PRE_LOV2(''178'',''ICX_DELIVER_TO_LOCATION_L'',''601'',''ICX_SHOPPING_CART_LINES_R'',''LOVFIELDS'',''my_order1'','''','''',''' ||
713 to_char(l_org_id_pos) || ''',''' || to_char(l_loc_id_pos) || ''',''' || to_char(l_pos) || ''')',htf.img('/OA_MEDIA/'||l_language_code||
714 '/FNDILOV.gif','LEFT',c_title,'','BORDER=0 WIDTH=22 HEIGHT=22'),'','onMouseOver="window.status='''|| icx_util.replace_onMouseOver_quotes(c_title) ||''';return true"'), crowspan => 2);
715
716 -- user has LOV
717 elsif ak_query_pkg.g_items_table(i).lov_attribute_code is not NULL and
718 ak_query_pkg.g_items_table(i).lov_region_code is not NULL and
719 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_CONTACT' and
720 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_SITE' and
721 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_PHONE' and
722 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DELIVER_TO_LOCATION_ID_L' and
723 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DEST_ORG_ID_L' then
724
725
726 htp.tableData(cvalue => htf.anchor('javascript:PRE_LOV0(''178'',''' || ak_query_pkg.g_items_table(i).attribute_code ||
727 ''',''601'',''ICX_SHOPPING_CART_LINES_R'',''LOVFIELDS'',''my_order1'','''','''',''' || to_char(l_pos) || ''')',htf.img('/OA_MEDIA/'||
728 l_language_code||'/FNDILOV.gif','LEFT',c_title,'','BORDER=0 WIDTH=22 HEIGHT=22'),'','onMouseOver="window.status='''||
729 icx_util.replace_onMouseOver_quotes(c_title) || ''';return true"'), crowspan => 2);
730
731 end if;
732
733 l_pos := l_pos + 1;
734
735 ELSE /* if update_flag <> 'Y' */
736 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_EXT_PRICE' then
737 l_value := to_char(to_number(l_value),v_money_fmt_mask);
738 end if;
739
740 if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_PHONE' or
741 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_CONTACT' or
742 ak_query_pkg.g_items_table(i).attribute_code =
743 'ICX_SUGGESTED_VENDOR_SITE')
744 AND v_vendor_LOV_flag = 'Y'
745 THEN
746 /* Even if update_flag <> 'Y', we still want it to be an
747 input text field so that it can be dynamically changed
748 when ICX_SUGGESTED_VENDOR_NAME is changed */
749 htp.tableData(cvalue => '<INPUT TYPE="TEXT" NAME = '
750 || ak_query_pkg.g_items_table(i).attribute_code|| 'A'
751 || ' size='|| ak_query_pkg.g_items_table(i).display_value_length
752 || ' maxlength=' || ak_query_pkg.g_items_table(i).attribute_value_length
753 || ' VALUE = "'|| replace(l_value,'"','"')
754 ||'" onFocus=''document.KEVIN.elements['
755 || to_char(l_pos-1) || '].focus(); ''>',
756 crowspan => 2);
757 l_pos := l_pos + 1;
758 ELSE /* if attribute_code <> 'ICX_SUGGESTED_VENDOR_*' */
759 htp.tableData(cvalue =>
760 icx_on_utilities.formatText(replace(l_value,'"','"'),
761 ak_query_pkg.g_items_table(i).bold,
762 ak_query_pkg.g_items_table(i).italic),
763 calign => ak_query_pkg.g_items_table(i).horizontal_alignment,
764 cattributes =>'VALIGN="'||ak_query_pkg.g_items_table(i).vertical_alignment||'"', crowspan => 2);
765 END IF; /* attribute_code */
766 -- end if;
767 end if; -- update_flag
768
769 end if; -- item_style
770
771 end if; -- display
772
773 end loop; -- g_items_table
774
775 htp.p('</TR>');
776
777 htp.p('<TR>');
778 htp.tableData(cvalue => '<A HREF="javascript:parent.parent.down(document.KEVIN.elements['
779 ||l_spin_pos
780 ||'])" onMouseOver="window.status=''Reduce Quantity'';return true"><IMG SRC="/OA_MEDIA/'
781 ||l_language_code
782 ||'/FNDISPND.gif" BORDER=NO>',cattributes => 'width=18 valign=top');
783
784 htp.p('</TR>');
785
786 end loop; -- g_results_table
787
788 p_ext_price_total := l_ext_price_total;
789
790 end PrintItems;
791
792
793 ------------------------------------------------------------
794 procedure PrintTotal(v_items_table ak_query_pkg.items_table_type) is
795 ------------------------------------------------------------
796
797 i number := 0;
798 column_number number := 0;
799 v_table_valign varchar2(32);
800 v_table_halign varchar2(32);
801 v_ext_price_is_on boolean := FALSE;
802
803
804 begin
805
806 --
807 -- Try to place total under extended price
808 --
809 for i in v_items_table.first .. v_items_table.last loop
810 if ( v_items_table(i).item_style <> 'HIDDEN' and
811 v_items_table(i).node_display_flag = 'Y' ) then
812
813 column_number := column_number + 1;
814
815 -- Add extra column for quantity because, quantity is colspan 2
816 -- Extra column is used by the spin boxes.
817 if v_items_table(i).attribute_code = 'ICX_QTY_V' then
818 column_number := column_number + 1;
819 end if;
820
821 if v_items_table(i).attribute_code = 'ICX_EXT_PRICE' then
822 if (v_items_table(i).node_display_flag = 'Y') then
823 v_ext_price_is_on := TRUE;
824 end if;
825 v_table_valign := ' VALIGN=' || v_items_table(i).vertical_alignment;
826 v_table_halign := ' ALIGN=' || v_items_table(i).horizontal_alignment;
827 exit;
828 end if;
829 end if;
830 end loop;
831
832 -- Print total only if the EXT_PRICE is turned on
833 if ( v_ext_price_is_on ) then
834 htp.p('function PrintTotal() {
835 var result = "<TR></TR><TR></TR><TR></TR><TR>";');
836
837 for i in 1 .. (column_number - 2) loop
838 htp.p('result += "<TD></TD>";');
839 end loop;
840
841 FND_MESSAGE.SET_NAME('MRP','EC_TOTAL');
842 htp.p('
843 result += "<FORM ACTION='''' onSubmit=''return(false)'' METHOD=''POST''><TD bgcolor=''#D8D8D8''><DIV ALIGN=RIGHT> ' || icx_util.replace_quotes(FND_MESSAGE.GET) || ' (";
844 result += parent.currencyCode + ")</DIV></TD>";
845 result += "<TD' || v_table_valign || v_table_halign || '><INPUT TYPE=''text'' NAME=''total'' SIZE=8 VALUE=" +
846 parent.AddDecimal(parent.largeComputeLoop()) +
847 " onBlur=large_compute()></TD>";
848 result += "</TR>";
849 //parent.frames[1].document.write(result);
850 document.write(result);
851 }
852 ');
853 else
854 -- print a dummy total to get around the fucntion reference
855 htp.p('function PrintTotal() {
856 }');
857 end if;
858
859 end PrintTotal;
860
861 procedure ak_mandatory_setup(l_cart_line_id_value IN OUT number,v_vendor_LOV_flag in out varchar2,v_location_LOV_flag in out varchar2) is
862 v_req_overwrite_flag varchar2(1);
863 v_vendor_name_pos number := NULL;
864 v_location_pos number := NULL;
865 begin
866
867 v_vendor_LOV_flag := 'N';
868 v_location_LOV_flag := 'N';
869 v_req_overwrite_flag := icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_LOC_FLAG);
870 if v_req_overwrite_flag = 'Y' then
871 v_location_LOV_flag := 'Y';
872 end if;
873
874 -- cartline id is always return as the first item
875 -- required to pass back for delete and split button
876 l_cart_line_id_value := ak_query_pkg.g_items_table(0).value_id;
877
878 for i in 0..ak_query_pkg.g_items_table.last loop
879
880 -- turn all on if one is on for supplier LOV
881 if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_NAME' or
882 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_CONTACT' or
883 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_PHONE' or
884 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_SITE') and
885 ak_query_pkg.g_items_table(i).node_display_flag = 'Y' and
886 ak_query_pkg.g_items_table(i).secured_column <> 'T' and
887 ak_query_pkg.g_items_table(i).item_style <> 'HIDDEN' and
888 ak_query_pkg.g_items_table(i).update_flag = 'Y' then
889
890 v_vendor_LOV_flag := 'Y';
891 exit;
892 end if;
893 end loop; -- g_items_table
894
895 --dc
896 --dc for j in ak_query_pkg.g_items_table.FIRST..ak_query_pkg.g_items_table.LAST loop
897
898 --dc if (ak_query_pkg.g_items_table(j).attribute_code = 'ICX_SUGGESTED_VENDOR_NAME' or
899 --dc ak_query_pkg.g_items_table(j).attribute_code = 'ICX_SUGGESTED_VENDOR_CONTACT' or
900 --dc ak_query_pkg.g_items_table(j).attribute_code = 'ICX_SUGGESTED_VENDOR_PHONE' or
901 --dc ak_query_pkg.g_items_table(j).attribute_code = 'ICX_SUGGESTED_VENDOR_SITE') and
902 --dc v_vendor_LOV_flag = 'Y' then
903 --dc
904 --dc ak_query_pkg.g_items_table(j).node_display_flag := 'Y';
905 --dc if ak_query_pkg.g_items_table(j).attribute_code = 'ICX_SUGGESTED_VENDOR_NAME' then
906 --dc ak_query_pkg.g_items_table(j).item_style := 'POPLIST';
907 --dc
908 --dc end if;
909
910 --dc end if;
911
912
913 -- required to pass back for delete and split button
914 --dc if ak_query_pkg.g_items_table(j).attribute_code = 'ICX_CART_LINE_ID' then
915 --dc l_cart_line_id_value := ak_query_pkg.g_items_table(j).value_id;
916 --dc end if; -- attribute_code
917
918 -- required hidden ids fields
919 --dc if ak_query_pkg.g_items_table(j).attribute_code = 'ICX_CART_LINE_ID' then
920 --dc -- ak_query_pkg.g_items_table(j).attribute_code = 'ICX_LINE_ID' or
921 --dc -- ak_query_pkg.g_items_table(j).attribute_code = 'ICX_CATEGORY_ID' or
922 --dc -- ak_query_pkg.g_items_table(j).attribute_code = 'ICX_DEST_ORG_ID' or
923 --dc -- ak_query_pkg.g_items_table(j).attribute_code = 'ICX_LINE_TYPE_ID' or
924 --dc -- ak_query_pkg.g_items_table(j).attribute_code = 'ICX_DELIVER_TO_LOCATION_ID' then
925 --dc ak_query_pkg.g_items_table(j).item_style := 'HIDDEN';
926 --dc ak_query_pkg.g_items_table(j).node_display_flag := 'Y';
927
928 --dc end if;
929
930 -- required and updatable fields
931 --dc if ak_query_pkg.g_items_table(j).attribute_code = 'ICX_QTY_V' then
932 --dc ak_query_pkg.g_items_table(j).node_display_flag := 'Y';
933 --dc ak_query_pkg.g_items_table(j).update_flag := 'Y';
934 --dc ak_query_pkg.g_items_table(j).item_style := 'TEXT';
935 --dc end if;
936
937 -- location LOV and flag setting
938 --dc if ak_query_pkg.g_items_table(j).attribute_code = 'ICX_DELIVER_TO_LOCATION' then
939 --dc if v_req_overwrite_flag = 'Y' and ak_query_pkg.g_items_table(j).update_flag = 'Y' then
940 --dc ak_query_pkg.g_items_table(j).item_style := 'POPLIST';
941 --dc v_location_LOV_flag := 'Y';
942 --dc else
943 --dc ak_query_pkg.g_items_table(j).update_flag := 'N';
944 --dc end if;
945 --dc end if;
946
947 -- image fields
948 --dc if ak_query_pkg.g_items_table(j).attribute_code = 'ICX_SPLIT' or
949 --dc ak_query_pkg.g_items_table(j).attribute_code = 'ICX_DELETE' then
950 --dc ak_query_pkg.g_items_table(j).item_style := 'IMAGE';
951 --dc end if;
952
953 --dc end loop;
954
955
956 end;
957
958 /* new drawCartLines procedure for server side only */
959 ------------------------------------------------------------
960 procedure drawCartLines( l_pos in out number,v_currency in varchar2,v_lines_region in varchar2,l_total_price_column in out number, v_money_fmt_mask in varchar2) is
961 ------------------------------------------------------------
962 l_total_price number := 0;
963 l_total_h_align varchar2(100);
964 l_total_v_align varchar2(100);
965 l_timer number;
966
967 l_cart_line_id_value number;
968 v_vendor_LOV_flag varchar2(1);
969 v_location_LOV_flag varchar2(1);
970
971 begin
972
973 -- YYYYYYYYYYY
974 --select HSECS into l_timer from v$timer;htp.p('BEGIN PreProcess = '||l_timer);htp.nl;
975 --
976 ak_mandatory_setup(l_cart_line_id_value,v_vendor_LOV_flag,v_location_LOV_flag); -- preprocess and mask the required flags for
977 -- mandatory fields
978
979 PrintHead(l_total_price_column,l_pos,v_currency);
980
981
982 --select HSECS into l_timer from v$timer;htp.p('BEGIN PrintItems = '||l_timer);htp.nl;
983
984 PrintItems(l_cart_line_id_value,v_money_fmt_mask,l_pos,v_vendor_LOV_flag,v_location_LOV_flag,l_total_price);
985
986 --select HSECS into l_timer from v$timer;htp.p('END PrintItems = '||l_timer);htp.nl;
987
988 /* when total price colum is > 0 , then exten price is begin printed */
989 if l_total_price_column > 2 then
990 htp.p('<TR></TR><TR></TR><TR></TR>');
991 htp.p('<TR>');
992 for i in 1 .. (l_total_price_column - 2) loop
993 htp.p('<TD></TD>');
994 end loop;
995 FND_MESSAGE.SET_NAME('MRP','EC_TOTAL');
996 htp.p('<TD ALIGN=CENTER BGCOLOR="#D8D8D8' || icx_util.get_color('TABLE_HEADER') ||'" >' || FND_MESSAGE.GET || ' (' || v_currency || ') </TD>');
997 htp.p('<TD ALIGN=RIGHT CALIGN=' || l_total_h_align || ' VALIGN=' || l_total_v_align || '>' || to_char(l_total_price,v_money_fmt_mask) || '</TD>' );
998
999 htp.p('</TR>');
1000 elsif l_total_price_column > 0 then
1001 htp.p('<TR></TR><TR></TR><TR></TR>');
1002 htp.p('<TR>');
1003 FND_MESSAGE.SET_NAME('MRP','EC_TOTAL');
1004 htp.p('<TD ALIGN=CENTER BGCOLOR="#' || icx_util.get_color('TABLE_HEADER') ||'" >' || FND_MESSAGE.GET || ' (' || v_currency || ') </TD>');
1005 htp.p('<TD ALIGN=RIGHT CALIGN=' || l_total_h_align || ' VALIGN=' || l_total_v_align || '>' || to_char(l_total_price,v_money_fmt_mask) || '</TD>' );
1006
1007 htp.p('</TR>');
1008
1009 end if;
1010
1011 htp.p('</TABLE>');
1012
1013 end drawCartLines;
1014
1015
1016
1017 --add by alex
1018 ------------------------------------------------------------
1019 procedure addAttachmentScript is
1020 ------------------------------------------------------------
1021
1022 begin
1023 htp.p('
1024
1025 function attachment(en, pk1, pk2, dcd) {
1026 var temp = "";
1027 if (en == 1){
1028 document.KEVIN.entity_name.value = "REQ_HEADERS";
1029 } else {
1030 document.KEVIN.entity_name.value = "REQ_LINES";
1031 }
1032
1033 document.KEVIN.pk1.value = pk1;
1034
1035 temp = dcd + "/ICX_REQ_NAVIGATION.ic_parent?cart_id=" + document.LINE.cartId.value;
1036 temp = temp + "' || '&' || 'emergency=" + document.LINE.n_emergency.value;
1037
1038 document.KEVIN.from_url.value = temp;
1039 document.KEVIN.query_only.value = "N";
1040 parent.frames[0].document.KEVIN.user_action.value = "ATTACHMENT";
1041 document.KEVIN.target = "_top";
1042 parent.frames[0].document.KEVIN.submit();
1043 }
1044 ');
1045
1046 end;
1047
1048
1049 ------------------------------------------------------------
1050 procedure updateCarts is
1051 ------------------------------------------------------------
1052 begin
1053 htp.p('function resetItemCount(fld) {
1054 fld.value = 0;
1055 }');
1056
1057 htp.p('function formSequence(seq) {
1058 this.sequence = seq }');
1059
1060 htp.p('LOVSequence1 = new formSequence("0")');
1061 htp.p('LOVSequence2 = new formSequence("0")');
1062 htp.p('LOVSequence3 = new formSequence("0")');
1063 htp.p('LOVSequence4 = new formSequence("0")');
1064 htp.p('LOVSequence5 = new formSequence("0")');
1065 htp.p('LOVSequence6 = new formSequence("0")');
1066 htp.p('LOVSequence7 = new formSequence("0")');
1067 htp.p('LOVSequence0 = new formSequence("0")');
1068
1069 htp.p('function PRE_LOV0(attr_id, attr_code, region_id, region_code, form_name, frame_name, where_clause, c_js_where_clause,sequence0) {
1070 LOVSequence0.sequence = sequence0
1071
1072 LOV(attr_id, attr_code, region_id, region_code, form_name, frame_name , where_clause,c_js_where_clause)
1073 }');
1074
1075
1076 htp.p('function PRE_LOV1(attr_id, attr_code, region_id, region_code, form_name, frame_name, where_clause, c_js_where_clause,sequence1,sequence2,sequence3,sequence4) {
1077 LOVSequence1.sequence = sequence1
1078 LOVSequence2.sequence = sequence2
1079 LOVSequence3.sequence = sequence3
1080 LOVSequence4.sequence = sequence4
1081
1082 LOV(attr_id, attr_code, region_id, region_code, form_name, frame_name, where_clause,c_js_where_clause)
1083 }');
1084
1085
1086 htp.p('function PRE_LOV2(attr_id, attr_code, region_id, region_code, form_name, frame_name, where_clause, c_js_where_clause,sequence5,sequence6,sequence7){
1087 LOVSequence5.sequence = sequence5
1088 LOVSequence6.sequence = sequence6
1089 LOVSequence7.sequence = sequence7
1090
1091 LOV(attr_id, attr_code, region_id, region_code, form_name, frame_name, where_clause,c_js_where_clause)
1092 }');
1093
1094
1095 htp.p('function postLOV(value0,value01,value02) {
1096 var seq0 = LOVSequence0.sequence
1097 document.KEVIN.elements[seq0].value = value0
1098 }');
1099
1100 htp.p('function updateCarts(value1,value2,value3,value4) {
1101 var seq1 = LOVSequence1.sequence
1102 var seq2 = LOVSequence2.sequence
1103 var seq3 = LOVSequence3.sequence
1104 var seq4 = LOVSequence4.sequence
1105 document.KEVIN.elements[seq1].value = value1
1106 document.KEVIN.elements[seq2].value = value2
1107 document.KEVIN.elements[seq3].value = value3
1108 document.KEVIN.elements[seq4].value = value4
1109
1110 }
1111 ');
1112
1113
1114 htp.p('function Updatelineloc(value1,value2,value3) {
1115 var seq5 = LOVSequence5.sequence
1116 var seq6 = LOVSequence6.sequence
1117 var seq7 = LOVSequence7.sequence
1118 document.KEVIN.elements[seq5].value = value1
1119 document.KEVIN.elements[seq6].value = value2
1120 document.KEVIN.elements[seq7].value = value3
1121
1122 }
1123 ');
1124
1125 end updateCarts;
1126
1127 /* new way of drawing cart header from server */
1128 ------------------------------------------------------------
1129 procedure drawCartHeader(n_org in varchar2,
1130 n_cart_id in number,
1131 v_org number,
1132 v_emergency varchar2,
1133 v_po_number number,
1134 l_pos in out number ) is
1135 ------------------------------------------------------------
1136 i number := 0;
1137 where_clause varchar2(240);
1138 v_language varchar2(30) := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
1139 dbutton varchar2(5000);
1140 y_table icx_util.char240_table;
1141 l_requestor_id number;
1142 l_requestor_name varchar2(240);
1143 l_location_id number;
1144 l_location_code varchar2(240);
1145 l_org_id number;
1146 l_po_number number;
1147 display_text varchar2(2000);
1148
1149 --add by alex
1150 url varchar2(500);
1151 attachment_status varchar2(10);
1152 --
1153
1154 cursor requestor(requestor_id number) is
1155 select hrev.full_name
1156 from hr_employees_current_v hrev
1157 where hrev.employee_id = requestor_id;
1158
1159 cursor location(v_location_id number) is
1160 select hrl.location_code
1161 from hr_locations hrl,
1162 org_organization_definitions ood,
1163 financials_system_parameters fsp
1164 where hrl.location_id = v_location_id
1165 and ood.organization_id = nvl(hrl.inventory_organization_id,
1166 fsp.inventory_organization_id)
1167 and sysdate < nvl(hrl.inactive_date, sysdate + 1);
1168
1169 v_dcdName varchar2(1000) := owa_util.get_cgi_env('SCRIPT_NAME');
1170
1171 begin
1172
1173 icx_util.transfer_Row_To_Column( ak_query_pkg.g_results_table(ak_query_pkg.g_results_table.first),y_table);
1174
1175 for l in ak_query_pkg.g_items_table.first .. ak_query_pkg.g_items_table.last loop
1176 if ak_query_pkg.g_items_table(l).attribute_code = 'ICX_DELIVER_TO_LOCATION_ID' then
1177 l_location_id := y_table(ak_query_pkg.g_items_table(l).value_id);
1178 elsif ak_query_pkg.g_items_table(l).attribute_code = 'ICX_DEST_ORG_ID' then
1179 l_org_id := y_table(ak_query_pkg.g_items_table(l).value_id);
1180 elsif ak_query_pkg.g_items_table(l).attribute_code = 'ICX_DELIVER_TO_REQUESTOR_ID' then
1181 l_requestor_id := y_table(ak_query_pkg.g_items_table(l).value_id);
1182 -- open requestor(l_requestor_id);
1183 -- fetch requestor into l_requestor_name;
1184 -- close requestor;
1185 elsif ak_query_pkg.g_items_table(l).attribute_code = 'ICX_DELIVER_TO_REQUESTOR' then
1186 l_requestor_name := y_table(ak_query_pkg.g_items_table(l).value_id);
1187 end if;
1188 end loop;
1189
1190 htp.p('<TABLE BORDER=0>');
1191
1192 htp.p('<INPUT TYPE="HIDDEN" NAME="user_action" VALUE = "">');
1193 htp.p('<INPUT TYPE="HIDDEN" NAME="emergency" VALUE = "' || v_emergency || '">');
1194 htp.p('<INPUT TYPE="HIDDEN" NAME="entity_name" VALUE = "">');
1195 htp.p('<INPUT TYPE="HIDDEN" NAME="pk1" VALUE = "">');
1196 htp.p('<INPUT TYPE="HIDDEN" NAME="pk2" VALUE = "">');
1197 htp.p('<INPUT TYPE="HIDDEN" NAME="pk3" VALUE = "">');
1198 htp.p('<INPUT TYPE="HIDDEN" NAME="from_url" VALUE = "">');
1199 htp.p('<INPUT TYPE="HIDDEN" NAME="query_only" VALUE = "">');
1200 l_pos := l_pos + 8;
1201
1202 for i in ak_query_pkg.g_items_table.first .. ak_query_pkg.g_items_table.last loop
1203
1204 if (ak_query_pkg.g_items_table(i).node_display_flag = 'Y' and
1205 ak_query_pkg.g_items_table(i).secured_column <> 'T') or
1206 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_CART_ID' then
1207 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SHOPPER_ID' or
1208 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DEST_ORG_ID' or
1209 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_LOCATION_ID' or
1210 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_REQUESTOR' then
1211 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_APPROVER_ID' or
1212 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_REQUESTOR_ID' or
1213 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_REQ_ORG_ID' or
1214 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_REQ_LOC_ID' or
1215 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_REQ_LOC_CD' then
1216
1217
1218 if (ak_query_pkg.g_items_table(i).value_id is not null and
1219 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DELIVER_TO_LOCATION' and ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DELIVER_TO_REQUESTOR') then
1220
1221 --Special treatment object attributes
1222 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_CART_ID' or
1223 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SHOPPER_ID' or
1224 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DEST_ORG_ID' or
1225 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_REQUESTOR' then
1226 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_LOCATION_ID' or
1227 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_APPROVER_ID' or
1228 -- ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_REQUESTOR_ID' then
1229
1230 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_REQUESTOR' then
1231 display_text := l_requestor_name;
1232 else
1233 display_text := y_table(ak_query_pkg.g_items_table(i).value_id);
1234
1235 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_CART_ID' then
1236 display_text := icx_call.encrypt2(y_table(ak_query_pkg.g_items_table(i).value_id));
1237 end if;
1238
1239 end if;
1240
1241 htp.p('<INPUT TYPE=''' || 'HIDDEN' || ''' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE='
1242 || ak_query_pkg.g_items_table(i).display_value_length || ' VALUE="' || replace(display_text,'"','"e;') || '">');
1243
1244 l_pos := l_pos + 1;
1245 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_RESERVED_PO_NUM' then
1246
1247 /* if a brand new po number, not yet reserve */
1248 /* print the button, if already reserved or a value */
1249 /* is already stored in the database, display the */
1250 /* newly reserved po or the value from database */
1251 l_po_number := v_po_number;
1252 if l_po_number is NULL then
1253 if y_table(ak_query_pkg.g_items_table(i).value_id) is not NULL then
1254 l_po_number := y_table(ak_query_pkg.g_items_table(i).value_id);
1255 end if;
1256 end if;
1257
1258 htp.p('<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>');
1259
1260 htp.p('<TD WIDTH=10 COLSPAN=1 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || ' bgcolor=#FFFFFF>');
1261 htp.p('<b>');
1262 if (l_po_number is not null) then
1263 htp.p(l_po_number);
1264
1265 else
1266
1267 htp.p('<br>');
1268 end if;
1269 htp.p('</b>');
1270 htp.p('</TD>');
1271 htp.p('<TD></TD>');
1272
1273
1274 --htp.p('result += "<TD COLSPAN=1 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>";');
1275
1276 htp.p('<TD COLSPAN=1 ALIGN=CENTER VALIGN=CENTER>');
1277 if (l_po_number is NULL) then
1278
1279 FND_MESSAGE.SET_NAME('ICX','ICX_RESERVE_PO_NUM');
1280
1281 icx_util.DynamicButton(P_ButtonText => FND_MESSAGE.GET,
1282 P_ImageFileName => 'FNDBNEW.gif',
1283 P_OnMouseOverText => FND_MESSAGE.GET,
1284 -- P_HyperTextCall => v_dcdName || '/ICX_REQ_ORDER.get_emergency_po_num?n_org=' || n_org || '&n_cart_id=' || n_cart_id,
1285 P_HyperTextCall => 'javascript:parent.frames[1].get_po_modify_order()',
1286
1287 P_LanguageCode => v_language,
1288 P_JavaScriptFlag => FALSE);
1289
1290
1291
1292 --dc htp.p('} result = "";');
1293
1294 end if;
1295 htp.p('</TD></TR>');
1296 /* 837698 increment l_pos if reserve po num is visible in emergency reqs*/
1297 l_pos := l_pos + 1;
1298
1299
1300 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_APPROVER_NAME' then
1301
1302 if ( ak_query_pkg.g_items_table(i).update_flag = 'Y' and
1303 ak_query_pkg.g_items_table(i).item_style <> 'HIDDEN') then
1304
1305 where_clause :='';--' = ' || icx_sec.getID(icx_sec.PV_WEB_USER_ID);
1306
1307 htp.p('<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>');
1308 htp.p('<TD COLSPAN=1 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>');
1309
1310
1311
1312 htp.p('<INPUT TYPE=''text'' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE=' || ak_query_pkg.g_items_table(i).display_value_length
1313 || ' maxlength=' || ak_query_pkg.g_items_table(i).attribute_value_length
1314 || ' VALUE="' || replace(y_table(ak_query_pkg.g_items_table(i).value_id),'"','"') ||
1315 '" onBlur='' document.KEVIN.ICX_APPROVER_ID.value ="";''>');
1316
1317
1318 l_pos := l_pos + 1;
1319
1320 -- 'parent.my_cart_header.ICX_APPROVER_NAME=this.value''>";');
1321 htp.p('</TD>');
1322 htp.p('<TD ALIGN="LEFT" width=200>');
1323 htp.p(icx_util.LOVButton(c_attribute_app_id => 178,
1324 c_attribute_code => 'ICX_APPROVER_NAME',
1325 c_region_app_id => 601,
1326 c_region_code => 'ICX_SHOPPING_CART_HEADER_R',
1327 c_form_name => 'KEVIN',
1328 c_frame_name => 'my_order1',
1329 c_where_clause => where_clause));
1330 htp.p('</TD></TR>');
1331 --dc htp.p('} else {');
1332 --dc htp.p('result += "<TD></TD></TR>"; }');
1333
1334 elsif (ak_query_pkg.g_items_table(i).item_style = 'HIDDEN') then
1335
1336 htp.p('<INPUT TYPE=''HIDDEN'' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE=' || ak_query_pkg.g_items_table(i).display_value_length
1337 || ' VALUE="' || replace(y_table(ak_query_pkg.g_items_table(i).value_id),'"','"') || '">' );
1338
1339 l_pos := l_pos + 1;
1340
1341 elsif (ak_query_pkg.g_items_table(i).update_flag = 'N' ) then
1342 htp.p('<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>');
1343 htp.p('<TD COLSPAN=2 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>');
1344
1345
1346 --dc htp.p('if (parent.my_cart_header.' || ak_query_pkg.g_items_table(i).attribute_code || ' == "")');
1347
1348 if y_table(ak_query_pkg.g_items_table(i).value_id) is NULL then
1349
1350 htp.p('<TABLE><TR><TD WIDTH=200 border=0 bgcolor=#FFFFFF>');
1351 else
1352
1353 htp.p('<TABLE><TR><TD border=0 bgcolor=#FFFFFF >');
1354 end if;
1355
1356 --Bold
1357 if ak_query_pkg.g_items_table(i).bold = 'Y' then
1358 htp.p('<B>');
1359 end if;
1360 --Italics
1361 if ak_query_pkg.g_items_table(i).italic = 'Y' then
1362 htp.p('<I>');
1363 end if;
1364 htp.p(y_table(ak_query_pkg.g_items_table(i).value_id) || '<br>' );
1365
1366 --Bold
1367 if ak_query_pkg.g_items_table(i).italic = 'Y' then
1368 htp.p('</I>');
1369 end if;
1370 --Italics
1371 if ak_query_pkg.g_items_table(i).bold = 'Y' then
1372 htp.p('</B>');
1373 end if;
1374 htp.p('</TD><TD></TD><TD></TD></TR></TABLE>');
1375 htp.p('</TD></TR>');
1376
1377 end if;
1378
1379 else -- Special treatment object attributes
1380
1381 if ak_query_pkg.g_items_table(i).update_flag = 'Y' then
1382 if ( ak_query_pkg.g_items_table(i).item_style = 'TEXT' ) then
1383
1384 htp.p('<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>');
1385
1386 /* dynamic LOV */
1387 if ak_query_pkg.g_items_table(i).lov_attribute_code is not NULL and ak_query_pkg.g_items_table(i).lov_region_code is not NULL then
1388 htp.p('<TD COLSPAN=1 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>');
1389 else
1390 htp.p('<TD COLSPAN=2 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>');
1391 end if;
1392
1393 display_text := '<INPUT TYPE=''' || ak_query_pkg.g_items_table(i).item_style || ''' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE=' ||
1394 ak_query_pkg.g_items_table(i).display_value_length || ' maxlength=' || ak_query_pkg.g_items_table(i).attribute_value_length
1395 || ' VALUE="' || replace(y_table(ak_query_pkg.g_items_table(i).value_id),'"','"') || '"';
1396
1397 l_pos := l_pos + 1;
1398
1399 /* do not allow to change requisition number */
1400 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_REQ_NUMBER_SEG1' then
1401 --dc htp.p('result += " onBlur=''this.value=parent.my_cart_header.ICX_REQ_NUMBER_SEG1''>";');
1402
1403 display_text := display_text || ' onBlur=''this.value= ' || y_table(ak_query_pkg.g_items_table(i).value_id) || '>';
1404 else
1405 display_text := display_text || '>';
1406
1407 end if;
1408
1409 htp.p(display_text);
1410 htp.p('</TD>');
1411
1412 /* dynamic LOV */
1413 if ak_query_pkg.g_items_table(i).lov_attribute_code is not NULL and ak_query_pkg.g_items_table(i).lov_region_code is not NULL then
1414
1415 htp.p('<TD ALIGN="LEFT" width=200>');
1416 htp.p(icx_util.LOVButton(c_attribute_app_id => 178,
1417 c_attribute_code => ak_query_pkg.g_items_table(i).attribute_code,
1418 c_region_app_id => 601,
1419 c_region_code => 'ICX_SHOPPING_CART_HEADER_R',
1420 c_form_name => 'KEVIN',
1421 c_frame_name => 'my_order1'));
1422 htp.p('</TD>');
1423 end if;
1424
1425 htp.p('</TR>');
1426
1427 elsif (ak_query_pkg.g_items_table(i).item_style = 'HIDDEN' ) then
1428 htp.p('<INPUT TYPE=''' || ak_query_pkg.g_items_table(i).item_style || ''' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE='
1429 || ak_query_pkg.g_items_table(i).display_value_length || ' VALUE="' || replace(y_table(ak_query_pkg.g_items_table(i).value_id),'"','"') || '">');
1430
1431 l_pos := l_pos + 1;
1432 else
1433 null;
1434 end if;
1435 else -- Update falg not set
1436 if ( ak_query_pkg.g_items_table(i).item_style <> 'HIDDEN' ) then
1437
1438 htp.p('<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>');
1439 htp.p('<TD COLSPAN=2 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>');
1440 --
1441 -- Add a table to create a white background
1442 -- htp.p('if (parent.my_cart_header.' || ak_query_pkg.g_items_table(i).attribute_code || ' == "")');
1443 if (y_table(ak_query_pkg.g_items_table(i).value_id) is NULL) then
1444
1445 htp.p('<TABLE><TR><TD WIDTH=200 border=0 bgcolor=#FFFFFF>');
1446 else
1447 htp.p('<TABLE><TR><TD border=0 bgcolor=#FFFFFF >');
1448 end if;
1449 --Bold
1450 if ak_query_pkg.g_items_table(i).bold = 'Y' then
1451 htp.p('<B>');
1452 end if;
1453 --Italics
1454 if ak_query_pkg.g_items_table(i).italic = 'Y' then
1455 htp.p('<I>');
1456 end if;
1457 htp.p(y_table(ak_query_pkg.g_items_table(i).value_id) || '<br>' );
1458
1459 --add by alex
1460 -- if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_CART_ID' then
1461 pk1 := icx_call.decrypt2(n_cart_id);
1462 --
1463 -- end if;
1464 --
1465
1466 --Bold
1467 if ak_query_pkg.g_items_table(i).italic = 'Y' then
1468 htp.p('</I>');
1469 end if;
1470 --Italics
1471 if ak_query_pkg.g_items_table(i).bold = 'Y' then
1472 htp.p('</B>');
1473 end if;
1474 htp.p('</TD><TD></TD><TD></TD></TR></TABLE>');
1475 htp.p('</TD></TR>');
1476 --changed by alex
1477 else --it is a hidden field
1478 htp.p('<INPUT TYPE="HIDDEN" NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE='
1479 || ak_query_pkg.g_items_table(i).display_value_length || ' VALUE="' || '">');
1480 l_pos := l_pos + 1;
1481 end if;
1482 end if;
1483 --
1484 end if; -- Special treatment object attributes
1485
1486 else -- It is an attribute, treat each of them individually.
1487
1488
1489 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_LOCATION' then
1490
1491 if ak_query_pkg.g_items_table(i).node_display_flag = 'Y' and
1492 ak_query_pkg.g_items_table(i).item_style <> 'HIDDEN' then
1493
1494
1495 if ( icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_LOC_FLAG) = 'Y' and
1496 ak_query_pkg.g_items_table(i).update_flag = 'Y') or
1497 ( icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_REQUESTOR) = 'ALL' OR
1498 icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_REQUESTOR) = 'ORG'
1499 ) then
1500
1501
1502 htp.p('<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>');
1503 htp.p('<TD COLSPAN=1 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>');
1504
1505 display_text := '<INPUT TYPE=''text'' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE=' || ak_query_pkg.g_items_table(i).display_value_length || ' maxlength='
1506 || ak_query_pkg.g_items_table(i).attribute_value_length || ' VALUE="' || replace(y_table(ak_query_pkg.g_items_table(i).value_id),'"','"') || '"';
1507
1508 l_pos := l_pos + 1;
1509
1510 if ( icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_REQUESTOR) = 'ALL' OR
1511 icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_REQUESTOR) = 'ORG') and
1512 ( icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_LOC_FLAG) = 'N' or
1513 ak_query_pkg.g_items_table(i).update_flag = 'N') then
1514
1515 display_text := display_text || ' onBlur=''this.value ="' || replace(y_table(ak_query_pkg.g_items_table(i).value_id),'"','"') || '"''>';
1516 htp.p(display_text || '</TD></TR>');
1517 else
1518
1519 --dc htp.p('result += " onBlur=''parent.my_cart_header.ICX_DELIVER_TO_LOCATION=this.value;''>";');
1520
1521 display_text := display_text || ' onBlur=''document.KEVIN.ICX_DELIVER_TO_LOCATION_ID.value = "";document.KEVIN.ICX_DEST_ORG_ID.value= "";''>';
1522 htp.p(display_text || '</TD>');
1523
1524
1525 htp.p('<TD ALIGN="LEFT" width=200>');
1526 htp.p(icx_util.LOVButton(178,'ICX_DELIVER_TO_LOCATION', 601, 'ICX_SHOPPING_CART_HEADER_R', 'KEVIN', 'my_order1'));
1527
1528 htp.p('</TD></TR>');
1529
1530 end if;
1531
1532 else
1533
1534 htp.p('<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>');
1535 htp.p('<TD WIDTH=40 COLSPAN=2 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>');
1536
1537 --dc htp.p('if (parent.my_cart_header.' || ak_query_pkg.g_items_table(i).attribute_code || ' == "")');
1538
1539 if y_table(ak_query_pkg.g_items_table(i).value_id) is NULL then
1540 htp.p('<TABLE><TR><TD WIDTH=200 border=0 bgcolor=#FFFFFF>');
1541 --dc htp.p('else');
1542 else
1543 htp.p('<TABLE><TR><TD border=0 bgcolor=#FFFFFF >');
1544 end if;
1545
1546 --Bold
1547 if ak_query_pkg.g_items_table(i).bold = 'Y' then
1548 htp.p('<B>');
1549 end if;
1550 --Italics
1551 if ak_query_pkg.g_items_table(i).italic = 'Y' then
1552 htp.p('<I>');
1553 end if;
1554 htp.p(y_table(ak_query_pkg.g_items_table(i).value_id) || '<br>');
1555
1556 --Bold
1557 if ak_query_pkg.g_items_table(i).bold = 'Y' then
1558 htp.p('</B>');
1559 end if;
1560 --Italics
1561 if ak_query_pkg.g_items_table(i).italic = 'Y' then
1562 htp.p('</I>');
1563 end if;
1564 htp.p('</TD><TD></TD><TD></TD></TR></TABLE>');
1565 htp.p('</TD></TR>');
1566
1567 end if;
1568
1569 else
1570
1571 htp.p('<INPUT TYPE=''' || 'HIDDEN' || ''' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE='
1572 || ak_query_pkg.g_items_table(i).display_value_length || ' VALUE="' || replace(y_table(ak_query_pkg.g_items_table(i).value_id),'"','"') || '">');
1573
1574 l_pos := l_pos + 1;
1575 end if;
1576
1577
1578 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_DELIVER_TO_REQUESTOR' then
1579
1580 if ( icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_REQUESTOR) = 'ALL' OR
1581 icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_REQUESTOR) = 'ORG'
1582 ) and
1583 ak_query_pkg.g_items_table(i).update_flag = 'Y' and
1584 ak_query_pkg.g_items_table(i).node_display_flag = 'Y' and
1585 ak_query_pkg.g_items_table(i).item_style <> 'HIDDEN' then
1586
1587 where_clause := 'WEB_USER_ID = ' || icx_sec.getID(icx_sec.PV_WEB_USER_ID);
1588
1589 htp.p('<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>');
1590 htp.p('<TD COLSPAN=1 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>');
1591
1592 display_text := '<INPUT TYPE=''text'' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE=' || ak_query_pkg.g_items_table(i).display_value_length
1593 || ' maxlength=' || ak_query_pkg.g_items_table(i).attribute_value_length || ' VALUE="' || replace(l_requestor_name,'"','"') || '"';
1594
1595 l_pos := l_pos + 1;
1596
1597 display_text := display_text || ' onBlur=''document.KEVIN.ICX_DELIVER_TO_REQUESTOR_ID.value="";''>';
1598 htp.p(display_text);
1599
1600 htp.p('</TD>');
1601 htp.p('<TD ALIGN="LEFT" width=200>');
1602 htp.p(icx_util.LOVButton(c_attribute_app_id => 178,
1603 c_attribute_code => 'ICX_DELIVER_TO_REQUESTOR',
1604 c_region_app_id => 601,
1605 c_region_code => 'ICX_SHOPPING_CART_HEADER_R',
1606 c_form_name => 'KEVIN',
1607 c_frame_name => 'my_order1',
1608 c_where_clause => where_clause));
1609 htp.p('</TD></TR>');
1610
1611 elsif ( icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_REQUESTOR) = 'ALL' OR
1612 icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_REQUESTOR) = 'ORG') and
1613 (ak_query_pkg.g_items_table(i).node_display_flag ='Y' and
1614 ak_query_pkg.g_items_table(i).item_style = 'HIDDEN') then
1615
1616 htp.p('<INPUT TYPE=''HIDDEN'' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE='
1617 || ak_query_pkg.g_items_table(i).display_value_length || ' VALUE="' || replace(l_requestor_name,'"','"') || '">');
1618
1619 l_pos := l_pos + 1;
1620
1621
1622
1623 elsif (ak_query_pkg.g_items_table(i).node_display_flag = 'Y') and ( icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_REQUESTOR) = 'NO' or
1624 ak_query_pkg.g_items_table(i).update_flag = 'N' ) then
1625
1626 htp.p('<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || ak_query_pkg.g_items_table(i).attribute_label_long || '</TD>');
1627 htp.p('<TD COLSPAN=2 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>');
1628
1629
1630
1631 --dc htp.p('if (parent.my_cart_header.' || ak_query_pkg.g_items_table(i).attribute_code || ' == "")');
1632
1633 if l_requestor_name is NULL then
1634
1635 htp.p('<TABLE><TR><TD WIDTH=200 border=0 bgcolor=#FFFFFF>');
1636 --dc htp.p('else');
1637 else
1638 htp.p('<TABLE><TR><TD border=0 bgcolor=#FFFFFF >');
1639 end if;
1640 --Bold
1641 if ak_query_pkg.g_items_table(i).bold = 'Y' then
1642 htp.p('<B>');
1643 end if;
1644 --Italics
1645 if ak_query_pkg.g_items_table(i).italic = 'Y' then
1646 htp.p('<I>');
1647 end if;
1648 htp.p(l_requestor_name || '<br>' );
1649 --Bold
1650 if ak_query_pkg.g_items_table(i).bold = 'Y' then
1651 htp.p('</B>');
1652 end if;
1653 --Italics
1654 if ak_query_pkg.g_items_table(i).italic = 'Y' then
1655 htp.p('</I>');
1656 end if;
1657 htp.p('</TD><TD></TD><TD></TD></TR></TABLE>');
1658 htp.p('</TD></TR>');
1659
1660 end if;
1661
1662 elsif ak_query_pkg.g_items_table(i).attribute_code = 'ICX_PO_BUTTON' then
1663 /*
1664 htp.p('result += "<TR><TD ALIGN=RIGHT VALIGN=CENTER WIDTH=200> ' || icx_util.replace_quotes(ak_query_pkg.g_items_table(i).attribute_label_long) || '</TD>";');
1665
1666 htp.p('result += "<TD COLSPAN=1 ALIGN=' || ak_query_pkg.g_items_table(i).horizontal_alignment || ' VALIGN=' || ak_query_pkg.g_items_table(i).vertical_alignment || '>";');
1667
1668
1669 --dbutton := icx_util.DynamicButton(P_ButtonText => 'Get a PO Number',
1670 -- P_ImageFileName => 'FNDBNEW.gif',
1671 -- P_OnMouseOverText => 'Reserve a PO Number',
1672 -- P_HyperTextCall => 'javascript:get_po()',
1673 -- P_LanguageCode => v_language,
1674 -- P_JavaScriptFlag => FALSE);
1675 --dbutton := replace( dbutton, '"', '\"' );
1676 --htp.p('result += "' || dbutton || '";');
1677
1678
1679 htp.p('result += "<INPUT TYPE=''button'' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code
1680 || ''' SIZE=' || ak_query_pkg.g_items_table(i).display_value_length
1681 || ' VALUE=''' || icx_util.replace_quotes(ak_query_pkg.g_items_table(i).attribute_code) || ''' onClick=''get_po()''>";');
1682
1683 l_pos := l_pos + 1;
1684 htp.p('result += "</TD></TR>";');
1685 */ null;
1686
1687 elsif (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_REQ_ORG_ID' or
1688 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_REQ_LOC_ID' or
1689 ak_query_pkg.g_items_table(i).attribute_code = 'ICX_REQ_LOC_CD') and
1690 ak_query_pkg.g_items_table(i).node_display_flag = 'Y' then
1691
1692 htp.p('<INPUT TYPE=''' || 'HIDDEN' || ''' NAME=''' || ak_query_pkg.g_items_table(i).attribute_code || ''' SIZE=' || ak_query_pkg.g_items_table(i).display_value_length || ' VALUE="">');
1693
1694 l_pos := l_pos + 1;
1695
1696
1697 end if;
1698
1699 end if; -- Object Attribute / Attribute
1700
1701 end if;
1702 -- add by alex
1703 if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_PAPER_CLIP') then
1704 --l_pos := l_pos + 1;
1705 fnd_webattch.GetSummaryStatus('ICX_REQS', 'REQ_HEADERS',
1706 pk1, NULL, NULL,
1707 NULL, NULL,
1708 attachment_status);
1709
1710
1711 htp.p('<tr align="right"><td>'
1712 || ak_query_pkg.g_items_table(i).attribute_label_long || '</td>');
1713
1714 if (attachment_status <> 'DISABLE'
1715 AND attachment_status = 'FULL')
1716 then
1717 htp.tableData(cvalue => '<a href="javascript:attachment(1, '''
1718 || pk1
1719 || ''' ,'''', '''
1720 ||v_dcdname
1721 ||''')" onMouseOver="window.status='''
1722 || icx_util.replace_onmouseover_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
1723 ||''';return true"><IMG SRC=/OA_MEDIA/'
1724 || v_language
1725 || '/FNDIATTE.gif HEIGHT=16 WIDTH=16 BORDER=no ALT="'
1726 || icx_util.replace_alt_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
1727 ||'"></TD>'
1728 ,calign => 'LEFT');
1729 elsif (attachment_status <> 'DISABLE') then
1730 htp.tableData(cvalue => '<a href="javascript:attachment(1, '''
1731 || pk1
1732 || ''' ,'''', '''
1733 ||v_dcdname
1734 ||''')" onMouseOver="window.status='''
1735 || icx_util.replace_onmouseover_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
1736 ||'''; return true"><IMG SRC=/OA_MEDIA/'
1737 || v_language
1738 || '/FNDIATT.gif HEIGHT=16 WIDTH=16 BORDER=no ALT="'
1739 || icx_util.replace_alt_quotes(ak_query_pkg.g_items_table(i).attribute_label_long)
1740 ||'"></TD>'
1741 , calign => 'LEFT');
1742 end if;
1743 /* icx_util.DynamicButton(ak_query_pkg.g_items_table(i).attribute_label_long,
1744 'FNDBPLAY', ak_query_pkg.g_items_table(i).attribute_label_long,
1745 'javascript:attachment( 1, ''' || pk1 || ''', '''','''|| v_dcdName || ''')',v_language, false); */
1746 htp.p('</tr>');
1747 htp.p('<tr></tr>');
1748
1749 end if;
1750
1751
1752 end loop;
1753
1754 htp.p('</TABLE>');
1755
1756 end drawCartHeader;
1757
1758 procedure submit_item(n_org in varchar2,
1759 n_emergency in varchar2 default null,
1760 v_po_number in varchar2 default null,
1761 cartId in number,
1762 cartLineId in number,
1763 cartLineAction in varchar2,
1764 itemCount in number) is
1765 begin
1766 if cartLineAction = 'COPY' then
1767 copy_line(n_org,cartId,cartLineId);
1768 elsif cartLineAction = 'DELETE' then
1769 delete_line(n_org,cartId,cartLineId);
1770 elsif cartLineAction = 'ACCOUNT' then
1771 -- icx_req_acct_dist.display_acct_distributions(p_cart_id => cartId,
1772 -- p_cart_line_id => cartLineId);
1773 my_order(n_org => n_org, n_cart_id => cartId,
1774 n_cart_line_id => cartLineId, n_account_dist => 'Y');
1775 RETURN;
1776 end if;
1777
1778 my_order1(n_org,n_emergency,cartId,v_po_number);
1779
1780
1781 end;
1782
1783 procedure copy_line(n_org number,cartId number,cartLineId number) is
1784 l_cart_id number;
1785 l_org_id number;
1786 l_cart_line_number number;
1787 l_dummy number;
1788 l_cart_line_id number;
1789 l_dist_num number;
1790
1791 cursor get_line_number(v_cart_id number,v_cart_line_id number) is
1792 select cart_line_number
1793 from icx_shopping_cart_lines
1794 where cart_id = v_cart_id
1795 and cart_line_id = v_cart_line_id;
1796
1797 cursor get_dist_number(v_cart_id number,v_cart_line_id number,v_org_id number) is
1798 select *
1799 from icx_cart_line_distributions
1800 where cart_id = v_cart_id
1801 and cart_line_id = v_cart_line_id
1802 and nvl(org_id,-9999) = nvl(v_org_id,-9999);
1803
1804 begin
1805 if icx_sec.validatesession then
1806
1807 l_cart_id := icx_call.decrypt2(cartId);
1808 l_org_id := icx_sec.getId(icx_sec.PV_ORG_ID);
1809
1810 l_cart_line_number := NULL;
1811 open get_line_number(l_cart_id,cartLineId);
1812 fetch get_line_number into l_cart_line_number;
1813 close get_line_number;
1814
1815 if l_cart_line_number is not NULL and l_cart_line_number > 0 then
1816
1817 /* semaphore for getting max line number */
1818 select 1 into l_dummy
1819 from icx_shopping_carts
1820 where cart_id = l_cart_id
1821 for update;
1822
1823 update icx_shopping_cart_lines
1824 set cart_line_number = cart_line_number + 1
1825 where cart_id = l_cart_id
1826 and cart_line_number > l_cart_line_number;
1827
1828 l_cart_line_number := l_cart_line_number + 1;
1829 --changed by alex for attachment
1830 -- select icx_shopping_cart_lines_s.nextval into l_cart_line_id from dual;
1831 --new code:
1832 select PO_REQUISITION_LINES_S.nextval into l_cart_line_id from dual;
1833
1834
1835 insert into icx_shopping_cart_lines
1836 (CART_LINE_ID, CART_LINE_NUMBER,LAST_UPDATE_DATE, LAST_UPDATED_BY,
1837 CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN,
1838 CART_ID, ITEM_ID, ITEM_REVISION,
1839 UNIT_OF_MEASURE, QUANTITY, UNIT_PRICE,
1840 SUPPLIER_ITEM_NUM, CATEGORY_ID, LINE_TYPE_ID,
1841 LINE_ID, ITEM_DESCRIPTION,
1842 EXPENDITURE_TYPE,
1843 DESTINATION_ORGANIZATION_ID, DELIVER_TO_LOCATION,DELIVER_TO_LOCATION_ID, SUGGESTED_BUYER_ID,
1844 SUGGESTED_VENDOR_NAME, SUGGESTED_VENDOR_SITE,LINE_ATTRIBUTE_CATEGORY,
1845 LINE_ATTRIBUTE1, LINE_ATTRIBUTE2, LINE_ATTRIBUTE3,
1846 LINE_ATTRIBUTE4, LINE_ATTRIBUTE5, LINE_ATTRIBUTE6,
1847 LINE_ATTRIBUTE7, LINE_ATTRIBUTE8, LINE_ATTRIBUTE9,
1848 LINE_ATTRIBUTE10, LINE_ATTRIBUTE11, LINE_ATTRIBUTE12,
1849 LINE_ATTRIBUTE13, LINE_ATTRIBUTE14, LINE_ATTRIBUTE15,
1850 NEED_BY_DATE, AUTOSOURCE_DOC_HEADER_ID, AUTOSOURCE_DOC_LINE_NUM,
1851 PROJECT_ID,TASK_ID , EXPENDITURE_ITEM_DATE,
1852 SUGGESTED_VENDOR_CONTACT, SUGGESTED_VENDOR_PHONE, SUGGESTED_VENDOR_ITEM_NUM,
1853 EXPENDITURE_ORGANIZATION_ID,ORG_ID,EXPRESS_NAME,ITEM_NUMBER,CUSTOM_DEFAULTED)
1854 select l_cart_line_id,l_cart_line_number,
1855 LAST_UPDATE_DATE, LAST_UPDATED_BY,
1856 CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN,
1857 CART_ID, ITEM_ID, ITEM_REVISION,
1858 UNIT_OF_MEASURE, QUANTITY, UNIT_PRICE,
1859 SUPPLIER_ITEM_NUM, CATEGORY_ID, LINE_TYPE_ID,
1860 LINE_ID, ITEM_DESCRIPTION,
1861 EXPENDITURE_TYPE,
1862 DESTINATION_ORGANIZATION_ID, DELIVER_TO_LOCATION,DELIVER_TO_LOCATION_ID, SUGGESTED_BUYER_ID,
1863 SUGGESTED_VENDOR_NAME, SUGGESTED_VENDOR_SITE,LINE_ATTRIBUTE_CATEGORY,
1864 LINE_ATTRIBUTE1, LINE_ATTRIBUTE2, LINE_ATTRIBUTE3,
1865 LINE_ATTRIBUTE4, LINE_ATTRIBUTE5, LINE_ATTRIBUTE6,
1866 LINE_ATTRIBUTE7, LINE_ATTRIBUTE8, LINE_ATTRIBUTE9,
1867 LINE_ATTRIBUTE10, LINE_ATTRIBUTE11, LINE_ATTRIBUTE12,
1868 LINE_ATTRIBUTE13, LINE_ATTRIBUTE14, LINE_ATTRIBUTE15,
1869 NEED_BY_DATE, AUTOSOURCE_DOC_HEADER_ID, AUTOSOURCE_DOC_LINE_NUM,
1870 PROJECT_ID,TASK_ID , EXPENDITURE_ITEM_DATE,
1871 SUGGESTED_VENDOR_CONTACT, SUGGESTED_VENDOR_PHONE, SUGGESTED_VENDOR_ITEM_NUM,
1872 EXPENDITURE_ORGANIZATION_ID,ORG_ID,EXPRESS_NAME,ITEM_NUMBER,CUSTOM_DEFAULTED
1873 from icx_shopping_cart_lines
1874 where cart_line_id = cartLineId
1875 and cart_id = l_cart_id;
1876 -- and nvl(l_org_id,-9999) = nvl(org_id,-9999);
1877
1878
1879 for prec in get_dist_number(l_cart_id,cartLineId,l_org_id) loop
1880
1881 INSERT INTO icx_cart_line_distributions
1882 (cart_line_id,
1883 distribution_id,
1884 last_updated_by,
1885 last_update_date,
1886 last_update_login,
1887 creation_date,
1888 created_by,
1889 org_id,
1890 cart_id,
1891 distribution_num,
1892 charge_account_id,
1893 charge_account_num,
1894 allocation_type,
1895 allocation_value,
1896 charge_account_segment1,
1897 charge_account_segment2,
1898 charge_account_segment3,
1899 charge_account_segment4,
1900 charge_account_segment5,
1901 charge_account_segment6,
1902 charge_account_segment7,
1903 charge_account_segment8,
1904 charge_account_segment9,
1905 charge_account_segment10,
1906 charge_account_segment11,
1907 charge_account_segment12,
1908 charge_account_segment13,
1909 charge_account_segment14,
1910 charge_account_segment15,
1911 charge_account_segment16,
1912 charge_account_segment17,
1913 charge_account_segment18,
1914 charge_account_segment19,
1915 charge_account_segment20,
1916 charge_account_segment21,
1917 charge_account_segment22,
1918 charge_account_segment23,
1919 charge_account_segment24,
1920 charge_account_segment25,
1921 charge_account_segment26,
1922 charge_account_segment27,
1923 charge_account_segment28,
1924 charge_account_segment29,
1925 charge_account_segment30)
1926 VALUES (l_cart_line_id,
1927 icx_cart_line_distributions_s.nextval,
1928 prec.last_updated_by,
1929 sysdate,
1930 prec.last_updated_by,
1931 sysdate,
1932 prec.created_by,
1933 prec.org_id,
1934 l_cart_id,
1935 prec.distribution_num,
1936 prec.charge_account_id,
1937 prec.charge_account_num,
1938 prec.allocation_type,
1939 prec.allocation_value,
1940 prec.charge_account_segment1,
1941 prec.charge_account_segment2,
1942 prec.charge_account_segment3,
1943 prec.charge_account_segment4,
1944 prec.charge_account_segment5,
1945 prec.charge_account_segment6,
1946 prec.charge_account_segment7,
1947 prec.charge_account_segment8,
1948 prec.charge_account_segment9,
1949 prec.charge_account_segment10,
1950 prec.charge_account_segment11,
1951 prec.charge_account_segment12,
1952 prec.charge_account_segment13,
1953 prec.charge_account_segment14,
1954 prec.charge_account_segment15,
1955 prec.charge_account_segment16,
1956 prec.charge_account_segment17,
1957 prec.charge_account_segment18,
1958 prec.charge_account_segment19,
1959 prec.charge_account_segment20,
1960 prec.charge_account_segment21,
1961 prec.charge_account_segment22,
1962 prec.charge_account_segment23,
1963 prec.charge_account_segment24,
1964 prec.charge_account_segment25,
1965 prec.charge_account_segment26,
1966 prec.charge_account_segment27,
1967 prec.charge_account_segment28,
1968 prec.charge_account_segment29,
1969 prec.charge_account_segment30);
1970 end loop;
1971
1972
1973 update icx_shopping_carts
1974 set last_update_date = sysdate
1975 where cart_id = l_cart_id;
1976 /* close semaphore */
1977
1978 commit;
1979
1980 end if;
1981 end if;
1982 end;
1983
1984 procedure delete_line(n_org number,cartId number,cartLineId number) is
1985 l_org_id number;
1986 l_cart_id number;
1987 l_cart_line_number number;
1988 l_dummy number;
1989
1990 cursor get_line_number(v_cart_id number,v_cart_line_id number) is
1991 select cart_line_number
1992 from icx_shopping_cart_lines
1993 where cart_id = v_cart_id
1994 and cart_line_id = v_cart_line_id;
1995
1996
1997 begin
1998 if icx_sec.validatesession then
1999
2000 l_org_id := icx_sec.getId(icx_sec.PV_ORG_ID);
2001 l_cart_id := icx_call.decrypt2(cartId);
2002
2003
2004 l_cart_line_number := NULL;
2005 open get_line_number(l_cart_id,cartLineId);
2006 fetch get_line_number into l_cart_line_number;
2007 close get_line_number;
2008
2009 if l_cart_line_number is not NULL and l_cart_line_number > 0 then
2010
2011 /* semaphore for getting max line number */
2012 select 1 into l_dummy
2013 from icx_shopping_carts
2014 where cart_id = l_cart_id
2015 for update;
2016
2017 delete from icx_shopping_cart_lines
2018 where cart_line_id = cartLineId
2019 and cart_id = l_cart_id;
2020 -- and nvl(org_id,-9999) = nvl(l_org_id,-9999);
2021
2022 delete from icx_cart_line_distributions
2023 where cart_line_id = cartLineId
2024 and cart_id = l_cart_id;
2025
2026 update icx_shopping_cart_lines
2027 set cart_line_number = cart_line_number - 1
2028 where cart_id = l_cart_id
2029 and cart_line_number > l_cart_line_number;
2030
2031 update icx_shopping_carts
2032 set last_update_date = sysdate
2033 where cart_id = l_cart_id;
2034 /* close semaphore */
2035
2036 commit;
2037
2038 end if;
2039 end if;
2040 end;
2041
2042
2043 procedure printHiddenflds(shopper_id number,v_cart_id number,v_header_region varchar2,v_lines_region varchar2,l_pos in out number) is
2044
2045 v_where_clause varchar2(2000);
2046 v_vendor_on_flag varchar2(1);
2047 v_req_overwrite_flag varchar2(1);
2048 l_col number;
2049 l_shopper_id number;
2050 /* Change wrto Bug Fix to implement the Bind Vars **/
2051 where_clause_binds ak_query_pkg.bind_tab;
2052 v_index NUMBER;
2053
2054 begin
2055
2056 v_index := 1;
2057
2058 /* now for Line level hidden fields */
2059 -- v_where_clause := 'SHOPPER_ID = ' || shopper_id || 'AND CART_ID = ' || v_cart_id;
2060 v_where_clause := 'SHOPPER_ID = :shopper_id1_bin AND CART_ID = :cart_id1_bin';
2061 /* added code to take care of Bind vars Bug **/
2062 where_clause_binds(v_index).name := 'shopper_id1_bin';
2063 where_clause_binds(v_index).value := shopper_id;
2064 v_index := v_index + 1;
2065 where_clause_binds(v_index).name := 'cart_id1_bin';
2066 where_clause_binds(v_index).value := v_cart_id;
2067 v_index := v_index + 1;
2068
2069
2070 ak_query_pkg.exec_query(P_PARENT_REGION_APPL_ID => 601,
2071 P_PARENT_REGION_CODE => v_lines_region,
2072 P_RESPONSIBILITY_ID => icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID),
2073 P_USER_ID => icx_sec.getID(icx_sec.PV_WEB_USER_ID),
2074 P_WHERE_CLAUSE => v_where_clause,
2075 P_RETURN_PARENTS => 'F',
2076 P_RETURN_CHILDREN => 'F',
2077 P_WHERE_BINDS => where_clause_binds);
2078
2079
2080 l_col := 0;
2081
2082 -- code the required hidden fields for LOV use
2083 htp.p('<INPUT TYPE="HIDDEN" NAME="ICX_DEST_ORG_ID_L" VALUE="">');
2084 htp.p('<INPUT TYPE="HIDDEN" NAME="ICX_DELIVER_TO_LOCATION_ID_L" VALUE="">');
2085 htp.p('<INPUT TYPE="HIDDEN" NAME="ICX_DELIVER_TO_LOCATION_L" VALUE="">');
2086
2087 l_pos := l_pos + 3;
2088
2089 v_req_overwrite_flag := icx_sec.getID(icx_sec.PV_USER_REQ_OVERRIDE_LOC_FLAG);
2090 ICX_REQ_NAVIGATION.chk_vendor_on(v_vendor_on_flag);
2091
2092 for i in ak_query_pkg.g_items_table.FIRST..ak_query_pkg.g_items_table.LAST loop
2093
2094 if (ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SUGGESTED_VENDOR_NAME' and
2095 v_vendor_on_flag = 'Y') then
2096
2097 -- for LOV use
2098 htp.p('<INPUT TYPE="HIDDEN" NAME="ICX_SUGGESTED_VENDOR_NAME" VALUE="">');
2099 htp.p('<INPUT TYPE="HIDDEN" NAME="ICX_SUGGESTED_VENDOR_SITE" VALUE="">');
2100 htp.p('<INPUT TYPE="HIDDEN" NAME="ICX_SUGGESTED_VENDOR_CONTACT" VALUE="">');
2101 htp.p('<INPUT TYPE="HIDDEN" NAME="ICX_SUGGESTED_VENDOR_PHONE" VALUE="">');
2102
2103 l_pos := l_pos + 4;
2104 end if;
2105
2106
2107 /* determine if LOV is user configurable */
2108 if ak_query_pkg.g_items_table(i).lov_attribute_code is not NULL and
2109 ak_query_pkg.g_items_table(i).lov_region_code is not NULL and
2110 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_NAME' and
2111 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_CONTACT' and
2112 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_SITE' and
2113 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_SUGGESTED_VENDOR_PHONE' and
2114 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DELIVER_TO_LOCATION_L' and
2115 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DELIVER_TO_LOCATION_ID_L' and
2116 ak_query_pkg.g_items_table(i).attribute_code <> 'ICX_DEST_ORG_ID_L' then
2117
2118 if ak_query_pkg.g_items_table(i).attribute_code = 'ICX_SHOPPER_ID' then
2119 l_shopper_id := icx_call.encrypt2(to_char(shopper_id));
2120 htp.p('<INPUT TYPE="HIDDEN" NAME="' || ak_query_pkg.g_items_table(i).attribute_code || '" VALUE="' || l_shopper_id || '">');
2121 else
2122
2123 htp.p('<INPUT TYPE="HIDDEN" NAME="' || ak_query_pkg.g_items_table(i).attribute_code || '" VALUE = "">');
2124 end if;
2125
2126 l_pos := l_pos + 1;
2127
2128 end if;
2129
2130 end loop;
2131
2132
2133 end;
2134
2135
2136 ------------------------------------------------------------
2137 procedure my_order(n_org varchar2,
2138 n_emergency varchar2 default NULL,
2139 n_cart_id number default NULL,
2140 v_po_number varchar2 default NULL,
2141 n_cart_line_id number default NULL,
2142 n_account_dist varchar2 default NULL) is
2143 ------------------------------------------------------------
2144 v_dcdName varchar2(1000) := owa_util.get_cgi_env('SCRIPT_NAME');
2145
2146 begin
2147 IF (n_account_dist is NULL) THEN
2148 --add by alex
2149 ICX_REQ_ORDER.pk1 := icx_call.decrypt2(n_cart_id);
2150
2151 htp.htmlOpen;
2152 htp.headOpen;
2153 htp.headClose;
2154
2155 htp.framesetOpen('*,44','','BORDER=0');
2156 htp.frame(v_dcdName ||
2157 '/ICX_REQ_ORDER.my_order1?n_org=' || n_org || '&n_emergency=' ||
2158 n_emergency || '&n_cart_id=' || n_cart_id || '&v_po_number=' || v_po_number,'my_order1','0','0','auto','', 'FRAMEBORDER=YES');
2159
2160 htp.frame(v_dcdName ||
2161 '/ICX_REQ_ORDER.my_order2?n_org=' || n_org || '&n_emergency=' ||
2162 n_emergency || '&n_cart_id=' || n_cart_id || '&v_po_number=' || v_po_number,'my_order2','0','0','no','NORESIZE', 'FRAMEBORDER=YES');
2163
2164 htp.framesetClose;
2165 htp.htmlClose;
2166
2167 -- ELSIF n_account_dist = 'Y' THEN
2168 ELSE
2169
2170 htp.htmlOpen;
2171 htp.headOpen;
2172 htp.headClose;
2173 htp.framesetOpen('*,44','','BORDER=0');
2174 htp.frame(v_dcdName ||
2175 '/icx_req_acct_dist.display_acct_distributions?p_cart_id=' || n_cart_id || '&p_cart_line_id=' ||
2176 n_cart_line_id ,'my_order_account1','0','0','auto','', 'FRAMEBORDER=YES');
2177
2178 htp.frame(v_dcdName ||
2179 '/icx_req_acct_dist.print_action_buttons' ,'my_order_account2','0','0','no','NORESIZE', 'FRAMEBORDER=YES');
2180
2181 htp.framesetClose;
2182 htp.htmlClose;
2183
2184 END IF;
2185
2186 end my_order;
2187
2188
2189 ------------------------------------------------------------
2190 procedure my_order1(n_org varchar2,
2191 n_emergency varchar2 default NULL,
2192 n_cart_id number default NULL,
2193 v_po_number varchar2 default NULL) is
2194 ------------------------------------------------------------
2195
2196 v_regions_table ak_query_pkg.regions_table_type;
2197 v_items_table ak_query_pkg.items_table_type;
2198 v_results_table ak_query_pkg.results_table_type;
2199
2200 v_emergency varchar2(10);
2201 v_org number;
2202 v_cart_id number;
2203 v_header_region varchar2(100);
2204 v_lines_region varchar2(100);
2205 shopper_id number;
2206 v_where_clause varchar2(1000);
2207 v_dcdName varchar2(240) := owa_util.get_cgi_env('SCRIPT_NAME');
2208 l_session_id number;
2209 v_order_button_text varchar2(80);
2210 v_confirm_text varchar2(240);
2211 v_lang varchar2(20);
2212 v_money_fmt_mask varchar2(32);
2213 v_currency varchar2(30);
2214 v_precision number;
2215 l_total_price_column number := 0;
2216 l_pos number;
2217
2218 /* Change wrto Bug Fix to implement the Bind Vars **/
2219 where_clause_binds ak_query_pkg.bind_tab;
2220 where_clause_binds_empty ak_query_pkg.bind_tab;
2221 v_index NUMBER;
2222 begin
2223
2224
2225
2226 if (icx_sec.validatesession()) then
2227
2228 v_index := 1;
2229
2230 shopper_id := icx_sec.getID(icx_sec.PV_WEB_USER_ID);
2231
2232 v_lang := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
2233 --decrypt parameters
2234 v_org := icx_call.decrypt2(n_org);
2235 if n_emergency is not null then
2236 v_emergency := icx_call.decrypt2(n_emergency);
2237 end if;
2238 v_cart_id := icx_call.decrypt2(n_cart_id);
2239
2240 ICX_REQ_NAVIGATION.get_currency(v_org, v_currency, v_precision, v_money_fmt_mask);
2241 v_money_fmt_mask := FND_CURRENCY.GET_FORMAT_MASK(v_currency,30);
2242
2243
2244 htp.htmlOpen;
2245 htp.headOpen;
2246 icx_util.copyright;
2247 js.scriptOpen;
2248
2249 js.replaceDBQuote;
2250 icx_util.LOVScript;
2251
2252
2253 --debug
2254 l_session_id := to_number(icx_sec.getID(icx_sec.PV_SESSION_ID));
2255 --insert into debug_timings values (1000, l_session_id,
2256 -- to_char(sysdate, 'HH24:MI:SS'), 'drawCartErrors started.');
2257 --debug
2258
2259
2260 --debug
2261 --insert into debug_timings values (1001, l_session_id,
2262 -- to_char(sysdate, 'HH24:MI:SS'), 'updateCartHeaderObject started.');
2263 --debug
2264
2265 updateCartHeaderObject;
2266 -- if v_emergency = 'YES' then
2267 -- get_po(n_org,n_cart_id);
2268 -- end if;
2269
2270 updateCarts;
2271
2272 if v_emergency = 'YES' then
2273 v_header_region := 'ICX_SHOPPING_CART_HEADER_EMG_R';
2274 v_lines_region := 'ICX_SHOPPING_CART_LINES_EMG_R';
2275 else
2276 v_header_region := 'ICX_SHOPPING_CART_HEADER_R';
2277 v_lines_region := 'ICX_SHOPPING_CART_LINES_R';
2278 end if;
2279
2280 -- Cart Lines Related Object Navigator
2281 ak_query_pkg.exec_query(P_PARENT_REGION_APPL_ID => 601,
2282 P_PARENT_REGION_CODE => v_lines_region,
2283 P_RESPONSIBILITY_ID => icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID),
2284 P_USER_ID => icx_sec.getID(icx_sec.PV_WEB_USER_ID),
2285 P_RETURN_PARENTS => 'F',
2286 P_RETURN_CHILDREN => 'F');
2287
2288 cart_line_actions(n_org);
2289
2290 --debug
2291 --insert into debug_timings values (1003, l_session_id,
2292 -- to_char(sysdate, 'HH24:MI:SS'), 'PrintHead loading started.');
2293 --debug
2294
2295 --add by alex
2296 addAttachmentScript;
2297
2298 js.scriptClose;
2299 htp.headClose;
2300
2301 htp.bodyOpen('','BGCOLOR="#CCFFFF" onLoad="parent.parent.winOpen(''nav'', ''my_order'')"');
2302
2303 htp.p('<FORM ACTION="' || v_dcdName || '/ICX_REQ_ORDER.submit_item" NAME="LINE" METHOD="POST">');
2304 htp.formHidden('n_org',n_org);
2305 htp.formHidden('n_emergency',n_emergency);
2306 htp.formHidden('v_po_number',v_po_number);
2307 htp.formHidden('cartId',n_cart_id);
2308 htp.formHidden('cartLineId','');
2309 htp.formHidden('cartLineAction','');
2310 htp.formHidden('itemCount',1);
2311 htp.p('</FORM>');
2312
2313 --add by alex
2314 htp.p('<FORM ACTION="' || v_dcdName || '/fnd_webattch.Summary" NAME="HEADER_ATTCH" METHOD="POST" TARGET="_top">');
2315 htp.formHidden('function_name', 'ICX_REQS');
2316 htp.formHidden('entity_name', 'REQ_HEADERS');
2317 htp.formHidden('pk1_value', '');
2318 htp.formHidden('pk2_value', '');
2319 htp.formHidden('pk3_value','');
2320 htp.formHidden('pk4_value', '');
2321 htp.formHidden('pk5_value', '');
2322 htp.formHidden('from_url', '');
2323 htp.formHidden('query_only', 'N');
2324 htp.p('</FORM>');
2325
2326
2327 l_pos := 0;
2328 htp.p('<FORM ACTION="" NAME="LOVFIELDS" METHOD="POST">');
2329 printHiddenflds(shopper_id,v_cart_id,v_header_region,v_lines_region,l_pos);
2330 htp.p('</FORM>');
2331
2332 htp.p('<FORM ACTION="' || v_dcdName || '/ICX_REQ_SUBMIT.finalSubmit" NAME="KEVIN" METHOD="POST" TARGET="navigation">');
2333
2334 --debug
2335 l_session_id := to_number(icx_sec.getID(icx_sec.PV_SESSION_ID));
2336 --insert into debug_timings values (1006, l_session_id,
2337 -- to_char(sysdate, 'HH24:MI:SS'), 'in body drawCartErrors started.');
2338 --debug
2339
2340 drawCartErrors(v_cart_id);
2341
2342 --debug
2343 --insert into debug_timings values (1007, l_session_id,
2344 -- to_char(sysdate, 'HH24:MI:SS'), 'In body drawCartHeader started.');
2345 --debug
2346
2347 -- Cart Header Related Object Navigator
2348 -- v_where_clause := 'SHOPPER_ID = ' || shopper_id || 'AND CART_ID = ' || v_cart_id;
2349 v_where_clause := 'SHOPPER_ID = :shopper_id_bin AND CART_ID = :cart_id_bin';
2350 where_clause_binds(v_index).name := 'shopper_id_bin';
2351 where_clause_binds(v_index).value := shopper_id;
2352 v_index := v_index + 1;
2353 where_clause_binds(v_index).name := 'cart_id_bin';
2354 where_clause_binds(v_index).value := v_cart_id;
2355 v_index := v_index + 1;
2356
2357 --debug
2358 --insert into debug_timings values (1004, l_session_id,
2359 -- to_char(sysdate, 'HH24:MI:SS'), 'AK query header started.');
2360 --debug
2361
2362 ak_query_pkg.exec_query(P_PARENT_REGION_APPL_ID => 601,
2363 P_PARENT_REGION_CODE => v_header_region,
2364 P_RESPONSIBILITY_ID => icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID),
2365 P_USER_ID => icx_sec.getID(icx_sec.PV_WEB_USER_ID),
2366 P_WHERE_CLAUSE => v_where_clause,
2367 P_RETURN_PARENTS => 'T',
2368 P_RETURN_CHILDREN => 'F',
2369 P_WHERE_BINDS => where_clause_binds );
2370
2371
2372 --change by alex
2373 l_pos := 0;
2374 drawCartHeader(n_org,n_cart_id,v_org, v_emergency,v_po_number,l_pos);
2375
2376
2377 where_clause_binds := where_clause_binds_empty;
2378
2379 v_index := 1;
2380
2381 -- Cart Line Related Object Navigator
2382 -- v_where_clause := 'SHOPPER_ID = ' || shopper_id || 'AND CART_ID = ' || v_cart_id;
2383 v_where_clause := 'SHOPPER_ID = :shopper_id1_bin AND CART_ID = :cart_id1_bin';
2384 /* added code to take care of Bind vars Bug **/
2385 where_clause_binds(v_index).name := 'shopper_id1_bin';
2386 where_clause_binds(v_index).value := shopper_id;
2387 v_index := v_index + 1;
2388 where_clause_binds(v_index).name := 'cart_id1_bin';
2389 where_clause_binds(v_index).value := v_cart_id;
2390 v_index := v_index + 1;
2391
2392
2393 --debug
2394 --insert into debug_timings values (1008, l_session_id,
2395 -- to_char(sysdate, 'HH24:MI:SS'), 'AK query lines started.');
2396 --debug
2397
2398 ak_query_pkg.exec_query(P_PARENT_REGION_APPL_ID => 601,
2399 P_PARENT_REGION_CODE => v_lines_region,
2400 P_RESPONSIBILITY_ID => icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID),
2401 P_USER_ID => icx_sec.getID(icx_sec.PV_WEB_USER_ID),
2402 P_WHERE_CLAUSE => v_where_clause,
2403 P_RETURN_PARENTS => 'T',
2404 P_RETURN_CHILDREN => 'F',
2405 P_WHERE_BINDS => where_clause_binds );
2406
2407 --debug
2408 --insert into debug_timings values (1009, l_session_id,
2409 -- to_char(sysdate, 'HH24:MI:SS'), 'AK query line end.');
2410 --debug
2411
2412
2413 if ak_query_pkg.g_results_table.COUNT = 0 then
2414
2415 js.scriptOpen;
2416 htp.p('resetItemCount(document.LINE.itemCount)');
2417 js.scriptClose;
2418
2419 FND_MESSAGE.SET_NAME('ICX','ICX_CART_EMPTY');
2420 htp.p('<BR>' || FND_MESSAGE.GET || '<BR>');
2421
2422 else
2423
2424
2425 --debug
2426 --insert into debug_timings values (1010, l_session_id,
2427 -- to_char(sysdate, 'HH24:MI:SS'), 'drawCartLines body started.');
2428 --debug
2429
2430 drawCartLines(l_pos,v_currency,v_lines_region,l_total_price_column,v_money_fmt_mask);
2431
2432 --debug
2433 --insert into debug_timings values (1011, l_session_id,
2434 -- to_char(sysdate, 'HH24:MI:SS'), 'drawCartLines end.');
2435 --debug
2436
2437
2438 end if;
2439
2440 htp.p('</TABLE></FORM>');
2441
2442 htp.bodyClose;
2443 htp.htmlClose;
2444
2445 end if;
2446
2447 end my_order1;
2448
2449
2450
2451 ------------------------------------------------------------
2452 procedure my_order2(n_org varchar2,
2453 n_emergency varchar2 default NULL,
2454 n_cart_id number default NULL,
2455 v_po_number varchar2 default NULL) is
2456 ------------------------------------------------------------
2457
2458 v_order_button_text varchar2(80);
2459 v_confirm_text varchar2(240);
2460 v_lang varchar2(20);
2461
2462 begin
2463
2464 if icx_sec.validatesession then
2465 v_lang := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
2466
2467 htp.htmlOpen;
2468 htp.headOpen;
2469
2470 js.ScriptOpen;
2471 submit_line_actions;
2472 js.ScriptClose;
2473
2474 htp.headClose;
2475 htp.bodyOpen('','BGCOLOR="#CCFFFF" onLoad="parent.parent.winOpen(''nav'',''my_order'');"');
2476
2477
2478 htp.p('<FORM>');
2479 htp.tableOpen('border=0');
2480 htp.tableRowOpen;
2481 FND_MESSAGE.SET_NAME('MRP','EC_ORDER');
2482 htp.p('<TD>');
2483 FND_MESSAGE.SET_NAME('ICX','ICX_PLACE_ORDER');
2484 v_order_button_text := FND_MESSAGE.GET;
2485 icx_util.DynamicButton(P_ButtonText => v_order_button_text,
2486 P_ImageFileName => 'FNDBSBMT.gif',
2487 P_OnMouseOverText => v_order_button_text,
2488 P_HyperTextCall => 'javascript:submit_order()',
2489 P_LanguageCode => v_lang,
2490 P_JavaScriptFlag => FALSE);
2491 htp.p('</TD>');
2492
2493 htp.p('<TD>');
2494 FND_MESSAGE.SET_NAME('ICX','ICX_SAVE');
2495 v_order_button_text := FND_MESSAGE.GET;
2496 icx_util.DynamicButton(P_ButtonText => v_order_button_text,
2497 P_ImageFileName => 'FNDBSAVE.gif',
2498 P_OnMouseOverText => v_order_button_text,
2499 P_HyperTextCall => 'javascript:save_order()',
2500 P_LanguageCode => v_lang,
2501 P_JavaScriptFlag => FALSE);
2502 htp.p('</TD>');
2503
2504 htp.p('<TD>');
2505 FND_MESSAGE.SET_NAME('ICX','ICX_RQS_DELETE_ORDER');
2506 v_order_button_text := FND_MESSAGE.GET;
2507 icx_util.DynamicButton(P_ButtonText => v_order_button_text,
2508 P_ImageFileName => 'FNDBCNCL.gif',
2509 P_OnMouseOverText => v_order_button_text,
2510 P_HyperTextCall => 'javascript:delete_saved_cart()',
2511 P_LanguageCode => v_lang,
2512 P_JavaScriptFlag => FALSE);
2513 htp.p('</TD>');
2514
2515 htp.p('<TD WIDTH=1000></TD>');
2516
2517 htp.p('<TD>');
2518 FND_MESSAGE.SET_NAME('ICX','ICX_APPLY_CHANGES');
2519 v_order_button_text := FND_MESSAGE.GET;
2520 icx_util.DynamicButton(P_ButtonText => v_order_button_text,
2521 P_ImageFileName => 'FNDBAPLY.gif',
2522 P_OnMouseOverText => v_order_button_text,
2523 P_HyperTextCall => 'javascript:modify_order()',
2524 P_LanguageCode => v_lang,
2525 P_JavaScriptFlag => FALSE);
2526 htp.p('</TD>');
2527
2528
2529 htp.tableRowClose;
2530 htp.tableClose;
2531 htp.p('</FORM>');
2532
2533 htp.bodyClose;
2534 htp.htmlClose;
2535
2536 end if;
2537
2538 end;
2539
2540
2541 ------------------------------------------------
2542 procedure reserve_po_num(reserved_po_num IN OUT varchar2,n_cart_id number,n_org number) is
2543 ------------------------------------------------
2544
2545 CURSOR C3 IS SELECT to_char(current_max_unique_identifier + 1)
2546 FROM po_unique_identifier_control
2547 WHERE table_name = 'PO_HEADERS'
2548 FOR UPDATE OF current_max_unique_identifier;
2549
2550 l_po_num varchar2(1000);
2551 l_cart_id number;
2552 l_org_id number;
2553
2554 begin
2555
2556 l_org_id := icx_call.decrypt2(n_org);
2557 l_cart_id := icx_call.decrypt2(n_cart_id);
2558 -- if icx_sec.validatesession then
2559 if reserved_po_num is null OR reserved_po_num = '' then
2560 OPEN C3;
2561 FETCH C3 into reserved_po_num;
2562 UPDATE po_unique_identifier_control
2563 SET current_max_unique_identifier =
2564 current_max_unique_identifier + 1
2565 WHERE CURRENT of C3;
2566 CLOSE C3;
2567
2568
2569 l_po_num := reserved_po_num;
2570 if l_po_num is not NULL then
2571 update icx_shopping_carts
2572 set reserved_po_num = l_po_num
2573 where cart_id = l_cart_id;
2574 end if;
2575 commit;
2576 end if;
2577 -- end if;
2578
2579 end reserve_po_num;
2580
2581 ------------------------------------------------------------
2582 procedure get_emergency_po_num(n_org varchar2,n_cart_id number) is
2583 ------------------------------------------------------------
2584 v_po_number varchar2(100);
2585
2586 begin
2587
2588 v_po_number := NULL;
2589
2590 reserve_po_num(v_po_number,n_cart_id,n_org);
2591
2592 my_order1(n_org, icx_call.encrypt2('YES'), n_cart_id, v_po_number);
2593
2594 end;
2595
2596 --**********************************************************
2597 -- END PROCEDURES RELATED TO CART/MY ORDER
2598 --**********************************************************
2599
2600
2601
2602 --**********************************************************
2603 -- BEGIN OTHER PROCEDURES
2604 --**********************************************************
2605
2606 ------------------------------------------------------------
2607 function addURL(URL varchar2,
2608 display_text varchar2)
2609 return varchar2 is
2610 ------------------------------------------------------------
2611 v_return varchar2(2000);
2612
2613 begin
2614 if URL is null then
2615 v_return := display_text;
2616 else
2617 v_return := htf.anchor('javascript:top.popWindow(''' || URL || ''')', display_text);
2618 end if;
2619
2620 return v_return;
2621
2622 end addURL;
2623
2624
2625 ------------------------------------------------------------
2626 procedure get_currency(v_org in number,
2627 v_currency out varchar2,
2628 v_precision out number,
2629 v_fmt_mask out varchar2) is
2630 ------------------------------------------------------------
2631 cursor getCurrency is
2632 select gsob.CURRENCY_CODE,
2633 fc.PRECISION
2634 from gl_sets_of_books gsob,
2635 FND_CURRENCIES fc,
2636 org_organization_definitions ood
2637 where ood.ORGANIZATION_ID = v_org
2638 and fc.CURRENCY_CODE = gsob.CURRENCY_CODE
2639 and ood.SET_OF_BOOKS_ID = gsob.SET_OF_BOOKS_ID;
2640
2641 i number := 0;
2642 v_return varchar2(32);
2643 begin
2644
2645 open getCurrency;
2646 fetch getCurrency into v_currency, v_precision;
2647 close getCurrency;
2648
2649
2650 v_return := '999999999D';
2651 for i in 1 .. v_precision loop
2652 v_return := v_return || '9';
2653 end loop;
2654 v_fmt_mask := v_return;
2655
2656 end get_currency;
2657
2658
2659 ------------------------------------------------------------
2660 procedure shopper_info(v_shopper_id IN number,
2661 v_shopper_name OUT VARCHAR2,
2662 v_location_id OUT number,
2663 v_location_code OUT VARCHAR2,
2664 v_org_id OUT NUMBER,
2665 v_org_code OUT VARCHAR2) is
2666 ------------------------------------------------------------
2667
2668 cursor shopper(v_shop_id number) is
2669 select hrev.full_name,
2670 hrl.location_id,
2671 hrl.location_code,
2672 ood.organization_id,
2673 ood.organization_code
2674 from hr_locations hrl,
2675 hr_employees_current_v hrev,
2676 org_organization_definitions ood,
2677 financials_system_parameters fsp
2678 where hrev.employee_id = v_shop_id
2679 and hrev.location_id = hrl.location_id
2680 and ood.organization_id = nvl(hrl.inventory_organization_id,
2681 fsp.inventory_organization_id)
2682 and sysdate < nvl(hrl.inactive_date, sysdate + 1);
2683
2684 begin
2685
2686 open shopper(v_shopper_id);
2687 fetch shopper into v_shopper_name, v_location_id, v_location_code, v_org_id, v_org_code;
2688 close shopper;
2689
2690 end shopper_info;
2691
2692
2693
2694
2695
2696
2697 end ICX_REQ_ORDER;