[Home] [Help]
PACKAGE BODY: APPS.POS_ASN_DETAILS_S
Source
1 PACKAGE BODY pos_asn_details_s AS
2 /* $Header: POSASNDB.pls 115.6 2000/10/12 16:40:48 pkm ship $ */
3
4
5 /* set_session_info
6 * ----------------
7 * This is a generic function to get various icx security attributes. These
8 * are assigned into global variables and used throughout this package.
9 */
10 FUNCTION set_session_info RETURN BOOLEAN is
11 BEGIN
12
13 IF NOT icx_sec.validatesession THEN
14 RETURN FALSE;
15 END IF;
16
17 l_org_id := icx_sec.getID(icx_sec.PV_ORG_ID);
18 l_language := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
19 l_script_name := owa_util.get_cgi_env('SCRIPT_NAME');
20 l_user_id := icx_sec.getID(icx_sec.PV_WEB_USER_ID);
21 l_session_id := icx_sec.getID(icx_sec.PV_SESSION_ID);
22 l_responsibility_id := icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID);
23
24 fnd_client_info.set_org_context(l_org_id);
25
26 RETURN TRUE;
27 END;
28
29
30 /* item_halign
31 * -----------
32 * Generic utility to return the horizontal alignment of the attribute
33 */
34 FUNCTION item_halign(l_index in number) RETURN VARCHAR2 IS
35 BEGIN
36 RETURN ak_query_pkg.g_items_table(l_index).horizontal_alignment;
37 END;
38
39
40 /* item_valign
41 * -----------
42 * Generic utility to return the vertical alignment of the attribute
43 */
44 FUNCTION item_valign(l_index in number) RETURN VARCHAR2 IS
45 BEGIN
46 RETURN ak_query_pkg.g_items_table(l_index).vertical_alignment;
47 END;
48
49
50 /* item_name
51 * ---------
52 * Generic utility to retrieve the attribute label
53 */
54 FUNCTION item_name(l_index in number) RETURN VARCHAR2 IS
55 BEGIN
56 RETURN ak_query_pkg.g_items_table(l_index).attribute_label_long;
57 END;
58
59
60 /* item_code
61 * ---------
62 * Generic utility to retrieve the attribute code
63 */
64 FUNCTION item_code(l_index in number) RETURN VARCHAR2 IS
65 BEGIN
66 RETURN ak_query_pkg.g_items_table(l_index).attribute_code;
67 END;
68
69
70 /* item_style
71 * ----------
72 */
73 FUNCTION item_style(l_index in number) RETURN VARCHAR2 IS
74 BEGIN
75 RETURN ak_query_pkg.g_items_table(l_index).item_style;
76 END;
77
78
79 /* item_displayed
80 * --------------
81 */
82 FUNCTION item_displayed(l_index in number) RETURN BOOLEAN IS
83 BEGIN
84 RETURN (ak_query_pkg.g_items_table(l_index).node_display_flag = 'Y');
85 END;
86
87
88 /* item_updateable
89 * ---------------
90 */
91 FUNCTION item_updateable(l_index in number) RETURN BOOLEAN IS
92 BEGIN
93 RETURN (ak_query_pkg.g_items_table(l_index).update_flag = 'Y');
94 END;
95
96
97 /* item_sequence
98 * -------------
99 */
100 FUNCTION item_sequence(l_index in number) RETURN NUMBER IS
101 BEGIN
102 RETURN ak_query_pkg.g_items_table(l_index).display_sequence;
103 END;
104
105
106 /* item_maxlength
107 * --------------
108 */
109 FUNCTION item_maxlength (l_index in number) RETURN VARCHAR2 IS
110 BEGIN
111
112 RETURN ' maxlength=' ||
113 to_char(ak_query_pkg.g_items_table(l_index).attribute_value_length);
114
115 END item_maxlength;
116
117
118 /* item_size
119 * ---------
120 */
121 FUNCTION item_size (l_index in number) RETURN VARCHAR2 IS
122 BEGIN
123
124 RETURN ' size=' || to_char(ak_query_pkg.g_items_table(l_index).display_value_length);
125
126 END item_size;
127
128
129 /* item_lov
130 * --------
131 */
132 FUNCTION item_lov(l_index in number) RETURN VARCHAR2 IS
133 BEGIN
134
135 IF ((ak_query_pkg.g_items_table(l_index).lov_region_code IS NOT NULL) AND
136 (ak_query_pkg.g_items_table(l_index).lov_attribute_code IS NOT NULL))
137 THEN
138
139 return '<A HREF="javascript:call_LOV('''||
140 item_code(l_index) || ''')"' ||
141 '><IMG SRC="/OA_MEDIA/FNDLSTOV.gif" BORDER=0 WIDTH=23 ' ||
142 'HEIGHT=21 border=no align=absmiddle></A>';
143 ELSE
144 return '';
145 END IF;
146
147 END item_lov;
148
149 FUNCTION ASBN RETURN BOOLEAN IS
150 invoice_num varchar2(30);
151 BEGIN
152
153 SELECT invoice_num
154 INTO invoice_num
155 FROM pos_asn_shop_cart_headers
156 WHERE session_id = l_session_id;
157
158 IF invoice_num is null THEN
159 return false;
160 ELSE
161 return true;
162 END IF;
163
164 END ASBN;
165
166
167
168 /* show_details
169 * ------------
170 */
171 PROCEDURE show_details(p_asn_line_id VARCHAR2,
172 p_asn_line_split_id VARCHAR2,
173 p_quantity VARCHAR2 DEFAULT NULL,
174 p_unit_of_measure VARCHAR2 DEFAULT NULL) IS
175 BEGIN
176
177 -- set global variables that i need for invoice details region.
178 -- i need invoiced quantity and uom.
179 g_quantity := p_quantity;
180 g_unit_of_measure := p_unit_of_measure;
181
182 htp.htmlOpen;
183 htp.headOpen;
184
185 htp.linkRel('STYLESHEET', '/OA_HTML/US/POSSTYLE.css');
186
187 js.scriptOpen;
188 icx_util.LOVscript;
189
190 htp.p('
191
192 function closeWindow(p)
193 {
194 if (p != "")
195 {
196 top.close();
197 }
198 }
199
200 ');
201
202
203 htp.p('
204
205 function call_LOV(c_attribute_code)
206 {
207 var c_js_where_clause = "";
208
209 if (c_attribute_code == "POS_FREIGHT_CARRIER")
210 {
211 c_js_where_clause = "ORGANIZATION_ID=" +
212 document.pos_asn_details.POS_SHIP_TO_ORGANIZATION_ID.value;
213 }
214
215 c_js_where_clause = escape(c_js_where_clause, 1);
216
217 LOV("178", c_attribute_code, "178", "POS_ASN_DETAILS_SHIPMENTS_R",
218 "pos_asn_details", "content", "", c_js_where_clause);
219 }
220
221 ');
222
223
224 js.scriptClose;
225
226 htp.headClose;
227
228 htp.bodyOpen(null, 'onLoad="javascript:closeWindow(' || '''' ||
229 g_flag || '''' || ')"' ||
230 ' bgcolor=#cccccc link=blue vlink=blue alink=#ff0000');
231
232
233 htp.p('<form name="pos_asn_details" action="' || l_script_name ||
234 '/pos_asn_details_s.update_details" target="content" method=GET">');
235
236
237 set_asn_ids(p_asn_line_id, p_asn_line_split_id);
238
239 htp.p('<table width=100% cellpadding=0 cellspacing=0 border=0>');
240
241 htp.p('<tr bgcolor=#cccccc>');
242
243 fnd_global.apps_initialize(l_user_id, l_responsibility_id, 178);
244
245 paint_shipment_details(p_asn_line_id,
246 p_asn_line_split_id,
247 'POS_ASN_SHIPMENT_DETAILS_PO_R');
248
249 paint_shipment_details(p_asn_line_id,
250 p_asn_line_split_id,
251 'POS_ASN_DETAILS_SHIPMENTS_R');
252
253
254 -- use function security to disable or enable the invoice details
255 -- region. if fnd_function.test() returns true, then display
256 -- the region.
257 IF (fnd_function.test('ICX_DISABLE_ASBN')) and ASBN THEN
258 paint_shipment_details(p_asn_line_id,
259 p_asn_line_split_id,
260 'POS_ASN_DETAILS_INVOICE_R');
261 END IF;
262
263 htp.p('</tr>');
264 htp.p('</table>');
265 htp.p('</form>');
266
267
268 htp.bodyClose;
269 htp.htmlClose;
270
271 END show_details;
272
273
274
275
276 /* set_asn_ids
277 * -----------
278 */
279 PROCEDURE set_asn_ids(p_asn_line_id VARCHAR2, p_asn_line_split_id VARCHAR2) IS
280 BEGIN
281
282 htp.p('<input name="POS_ASN_LINE_ID"' ||
283 ' type="HIDDEN" VALUE="' ||
284 p_asn_line_id ||
285 '">');
286 htp.p('<input name="POS_ASN_LINE_SPLIT_ID"' ||
287 ' type="HIDDEN" VALUE="' ||
288 p_asn_line_split_id ||
289 '">');
290
291 END set_asn_ids;
292
293
294 /* paint_region_title
295 * ------------------
296 */
297 PROCEDURE paint_region_title(p_product VARCHAR2,
298 p_title VARCHAR2) IS
299 BEGIN
300
301 htp.p('<tr><td height=20></td></tr>');
302 htp.p('<tr>');
303 htp.p('<td colspan=6 height=1><img src=/OA_MEDIA/FNDPXG5.gif></td>');
304 htp.p('</tr>');
305 htp.p('<tr>');
306
307 htp.p('<td colspan=6 valign=bottom height=15 VALIGN=CENTER ALIGN=LEFT><B>' ||
308 '<font class=datablack>' || ' ' ||
309 fnd_message.get_string(p_product, p_title) ||
310 '</font></B></td>');
311
312 htp.p('</tr>');
313 htp.p('<tr>');
314 htp.p('<td colspan=6 height=1 bgcolor=black>' ||
315 '<img src=/OA_MEDIA/FNDPX1.gif></td>');
316 htp.p('</tr>');
317 htp.p('<tr>');
318 htp.p('<td height=10></td>');
319 htp.p('</tr>');
320 htp.p('<tr>');
321
322 END paint_region_title;
323
324
325
326 /* paint_single_record_prompt
327 * --------------------------
328 */
329 PROCEDURE paint_single_record_prompt(p_attribute_index NUMBER) IS
330 BEGIN
331
332 htp.p('<td nowrap bgcolor=#cccccc' ||
333 ' align=' || item_halign(p_attribute_index) ||
334 ' valign=' || item_valign(p_attribute_index) ||
335 '>' ||
336 '<font class=promptblack>' ||
337 item_name(p_attribute_index) ||
338 '</font>' ||
339 ' ' ||
340 '</td>');
341
342 END paint_single_record_prompt;
343
344
345
346 /* paint_updateable_field
347 * ----------------------
348 */
349 PROCEDURE paint_updateable_field(p_attribute_index NUMBER,
350 p_result_index NUMBER,
351 p_current_col NUMBER) IS
352 BEGIN
353
354 htp.p('<td nowrap' ||
355 ' align=LEFT' ||
356 ' valign=CENTER' ||
357 '>' ||
358 '<font class=datablack>'||
359 '<input type=text ' ||
360 item_size(p_attribute_index) ||
361 item_maxlength(p_attribute_index) ||
362 ' name="' || item_code(p_attribute_index) || '"' ||
363 ' value="' || get_result_value(p_result_index, p_current_col) ||
364 '" ></font>' ||
365 item_lov(p_attribute_index) ||
366 '</td>');
367
368 END paint_updateable_field;
369
370
371
372 /* paint_nonupdateable_field
373 * -------------------------
374 */
375 PROCEDURE paint_nonupdateable_field(p_attribute_index NUMBER,
376 p_result_index NUMBER,
377 p_current_col NUMBER,
378 p_colspan NUMBER DEFAULT NULL) IS
379 l_colspan VARCHAR2(12);
380 BEGIN
381
382 IF p_colspan IS NULL THEN
383 l_colspan := null;
384 ELSE
385 l_colspan := 'colspan=' || to_char(p_colspan);
386 END IF;
387
388 IF item_code(p_attribute_index) = 'POS_QUANTITY_INVOICED' THEN
389
390 htp.p('<td ' || l_colspan ||
391 ' align=LEFT' ||
392 ' valign=CENTER' ||
393 '>' ||
394 '<b><font class=tabledata>' ||
395 nvl(g_quantity, fnd_message.get_string('ICX', 'ICX_POS_NA')) ||
396 '</font></b></td>');
397
398 ELSIF item_code(p_attribute_index) = 'POS_UNIT_OF_MEASURE' THEN
399
400 htp.p('<td ' || l_colspan ||
401 ' align=LEFT' ||
402 ' valign=CENTER' ||
403 '>' ||
404 '<b><font class=tabledata>' ||
405 g_unit_of_measure ||
406 '</font></b></td>');
407
408 ELSIF item_code(p_attribute_index) = 'POS_EXTENDED_PRICE' THEN
409
410 htp.p('<td ' || l_colspan ||
411 ' align=LEFT' ||
412 ' valign=CENTER' ||
413 '>' ||
414 '<b><font class=tabledata>' ||
415 nvl(to_char(to_number(g_quantity) * to_number(get_result_value(p_result_index, p_current_col-1))), fnd_message.get_string('ICX', 'ICX_POS_NA')) ||
416 '</font></b></td>');
417
418 ELSE
419
420 htp.p('<td ' || l_colspan ||
421 ' align=LEFT' ||
422 ' valign=CENTER' ||
423 '>' ||
424 '<b><font class=tabledata>' ||
425 nvl(get_result_value(p_result_index, p_current_col),
426 fnd_message.get_string('ICX', 'ICX_POS_NA')) ||
427 '</font></b></td>');
428
429 END IF;
430
431 END paint_nonupdateable_field;
432
433
434
435 /* paint_hidden_field
436 * ------------------
437 */
438 PROCEDURE paint_hidden_field(p_attribute_index NUMBER,
439 p_result_index NUMBER,
440 p_current_col NUMBER) IS
441 BEGIN
442
443 htp.p('<!-- ' || item_code(p_attribute_index) ||
444 ' - ' || item_style(p_attribute_index) || ' -->');
445
446 htp.p('<input name="' || item_code(p_attribute_index) ||
447 '" type="HIDDEN" VALUE="' ||
448 get_result_value(p_result_index, p_current_col) ||
449 '">');
450
451 END paint_hidden_field;
452
453
454
455
456 /* paint_shipment_details
457 * ----------------------
458 */
459 PROCEDURE paint_shipment_details(p_asn_line_id VARCHAR2,
460 p_asn_line_split_id VARCHAR2,
461 p_region VARCHAR2) IS
462
463 l_attribute_index NUMBER;
464 l_result_index NUMBER;
465 l_current_col NUMBER;
466 l_current_row NUMBER;
467 l_paint_col NUMBER;
468 l_region_header VARCHAR2(240);
469 l_where_clause VARCHAR2(2000) := 'SESSION_ID = ' || to_char(l_session_id);
470
471 BEGIN
472
473 l_where_clause := l_where_clause ||
474 ' AND ASN_LINE_ID = ' || p_asn_line_id ||
475 ' AND ASN_LINE_SPLIT_ID = ' || p_asn_line_split_id;
476
477
478 ak_query_pkg.exec_query(p_parent_region_appl_id => 178,
479 p_parent_region_code => p_region,
480 p_where_clause => l_where_clause,
481 p_responsibility_id => l_responsibility_id,
482 p_user_id => l_user_id,
483 p_return_parents => 'T',
484 p_return_children => 'F');
485
486 l_attribute_index := ak_query_pkg.g_items_table.FIRST;
487 l_result_index := ak_query_pkg.g_results_table.FIRST;
488
489 l_current_col := 0;
490 l_paint_col := 0;
491
492 IF p_region = 'POS_ASN_SHIPMENT_DETAILS_PO_R' THEN
493 l_region_header := 'ICX_POS_ASN_DETAILS_PO';
494 ELSIF p_region = 'POS_ASN_DETAILS_SHIPMENTS_R' THEN
495 l_region_header := 'ICX_POS_ASN_SHIPMENT_DETAILS';
496 ELSIF p_region = 'POS_ASN_DETAILS_INVOICE_R' THEN
497 l_region_header := 'ICX_POS_ASN_INVOICE_DETAILS';
498 END IF;
499
500 paint_region_title('ICX', l_region_header);
501
502 WHILE (l_attribute_index IS NOT NULL) LOOP
503
504 l_current_col := l_current_col + 1;
505 l_paint_col := l_paint_col + 1;
506
507 IF (item_style(l_attribute_index) = 'HIDDEN') THEN
508 paint_hidden_field(l_attribute_index, l_result_index, l_current_col);
509 l_paint_col := l_paint_col - 1;
510 ELSIF item_displayed(l_attribute_index) THEN
511 IF (item_style(l_attribute_index) = 'TEXT') THEN
512 IF item_updateable(l_attribute_index) THEN
513
514 paint_single_record_prompt(l_attribute_index);
515 paint_updateable_field(l_attribute_index,
516 l_result_index,
517 l_current_col);
518
519 ELSE
520
521 IF item_code(l_attribute_index) = 'POS_ITEM_DESCRIPTION' THEN
522 htp.tableRowOpen;
523 paint_single_record_prompt(l_attribute_index);
524 paint_nonupdateable_field(l_attribute_index,
525 l_result_index,
526 l_current_col,
527 6);
528 htp.tableRowClose;
529 ELSE
530 paint_single_record_prompt(l_attribute_index);
531 paint_nonupdateable_field(l_attribute_index,
532 l_result_index,
533 l_current_col);
534 END IF;
535
536 END IF;
537 END IF;
538
539 END IF;
540
541 l_attribute_index := ak_query_pkg.g_items_table.NEXT(l_attribute_index);
542
543 if ((l_paint_col mod 2) = 0) THEN
544 htp.p('</tr>');
545 htp.p('<tr bgcolor=#cccccc>');
546 end if;
547
548 END LOOP;
549
550
551 END paint_shipment_details;
552
553
554
555
556
557 /* update_details
558 * --------------
559 */
560 PROCEDURE update_details(pos_asn_line_id IN VARCHAR2 DEFAULT NULL,
561 pos_asn_line_split_id IN VARCHAR2 DEFAULT NULL,
562 pos_expected_receipt_date IN VARCHAR2 DEFAULT NULL,
563 pos_packing_slip IN VARCHAR2 DEFAULT NULL,
564 pos_waybill_airbill_num IN VARCHAR2 DEFAULT NULL,
565 pos_bill_of_lading IN VARCHAR2 DEFAULT NULL,
566 pos_barcode_label IN VARCHAR2 DEFAULT NULL,
567 pos_country_of_origin IN VARCHAR2 DEFAULT NULL,
568 pos_country_of_origin_code IN VARCHAR2 DEFAULT NULL,
569 pos_vendor_cum_shipped_qty IN VARCHAR2 DEFAULT NULL,
570 pos_num_of_containers IN VARCHAR2 DEFAULT NULL,
571 pos_container_num IN VARCHAR2 DEFAULT NULL,
572 pos_vendor_lot_num IN VARCHAR2 DEFAULT NULL,
573 pos_freight_carrier IN VARCHAR2 DEFAULT NULL,
574 pos_freight_carrier_code IN VARCHAR2 DEFAULT NULL,
575 pos_truck_num IN VARCHAR2 DEFAULT NULL,
576 pos_reason_id IN VARCHAR2 DEFAULT NULL,
577 pos_reason_name IN VARCHAR2 DEFAULT NULL,
578 pos_ship_to_organization_id IN VARCHAR2 DEFAULT NULL)
579
580 IS
581
582 l_format_mask icx_sessions.DATE_FORMAT_MASK%TYPE;
583
584 BEGIN
585
586 -- Bug 1196968
587
588 select date_format_mask
589 into l_format_mask
590 from icx_sessions
591 where session_id = l_session_id;
592
593 fnd_date.initialize(l_format_mask);
594
595 UPDATE pos_asn_shop_cart_details SET
596
597 expected_receipt_date = fnd_date.chardate_to_date(pos_expected_receipt_date),
598 packing_slip = pos_packing_slip,
599 waybill_airbill_num = pos_waybill_airbill_num,
600 bill_of_lading = pos_bill_of_lading,
601 barcode_label = pos_barcode_label,
602 country_of_origin_code = pos_country_of_origin_code,
603 vendor_cum_shipped_qty = to_number(pos_vendor_cum_shipped_qty),
604 num_of_containers = to_number(pos_num_of_containers),
605 container_num = pos_container_num,
606 vendor_lot_num = pos_vendor_lot_num,
607 freight_carrier_code = pos_freight_carrier_code,
608 truck_num = pos_truck_num,
609 reason_id = to_number(pos_reason_id)
610
611 WHERE asn_line_id = to_number(pos_asn_line_id) AND
612 asn_line_split_id = to_number(pos_asn_line_split_id) AND
613 session_id = l_session_id;
614
615 COMMIT;
616
617
618 -- reload the page, should only need to reload the frame
619 g_flag := 'Y';
620 show_details(pos_asn_line_id, pos_asn_line_split_id);
621
622 END update_details;
623
624
625
626 /* get_result_value
627 * ----------------
628 */
629 function get_result_value(p_index in number, p_col in number) return varchar2 is
630
631 BEGIN
632
633 if p_col = 1 then
634 return ak_query_pkg.g_results_table(p_index).value1;
635 elsif p_col = 2 then
636 return ak_query_pkg.g_results_table(p_index).value2;
637 elsif p_col = 3 then
638 return ak_query_pkg.g_results_table(p_index).value3;
639 elsif p_col = 4 then
640 return ak_query_pkg.g_results_table(p_index).value4;
641 elsif p_col = 5 then
642 return ak_query_pkg.g_results_table(p_index).value5;
643 elsif p_col = 6 then
644 return ak_query_pkg.g_results_table(p_index).value6;
645 elsif p_col = 7 then
646 return ak_query_pkg.g_results_table(p_index).value7;
647 elsif p_col = 8 then
648 return ak_query_pkg.g_results_table(p_index).value8;
649 elsif p_col = 9 then
650 return ak_query_pkg.g_results_table(p_index).value9;
651 elsif p_col = 10 then
652 return ak_query_pkg.g_results_table(p_index).value10;
653 elsif p_col = 11 then
654 return ak_query_pkg.g_results_table(p_index).value11;
655 elsif p_col = 12 then
656 return ak_query_pkg.g_results_table(p_index).value12;
657 elsif p_col = 13 then
658 return ak_query_pkg.g_results_table(p_index).value13;
659 elsif p_col = 14 then
660 return ak_query_pkg.g_results_table(p_index).value14;
661 elsif p_col = 15 then
662 return ak_query_pkg.g_results_table(p_index).value15;
663 elsif p_col = 16 then
664 return ak_query_pkg.g_results_table(p_index).value16;
665 elsif p_col = 17 then
666 return ak_query_pkg.g_results_table(p_index).value17;
667 elsif p_col = 18 then
668 return ak_query_pkg.g_results_table(p_index).value18;
669 elsif p_col = 19 then
670 return ak_query_pkg.g_results_table(p_index).value19;
671 elsif p_col = 20 then
672 return ak_query_pkg.g_results_table(p_index).value20;
673 elsif p_col = 21 then
674 return ak_query_pkg.g_results_table(p_index).value21;
675 elsif p_col = 22 then
676 return ak_query_pkg.g_results_table(p_index).value22;
677 elsif p_col = 23 then
678 return ak_query_pkg.g_results_table(p_index).value23;
679 elsif p_col = 24 then
680 return ak_query_pkg.g_results_table(p_index).value24;
681 elsif p_col = 25 then
682 return ak_query_pkg.g_results_table(p_index).value25;
683 elsif p_col = 26 then
684 return ak_query_pkg.g_results_table(p_index).value26;
685 elsif p_col = 27 then
686 return ak_query_pkg.g_results_table(p_index).value27;
687 elsif p_col = 28 then
688 return ak_query_pkg.g_results_table(p_index).value28;
689 elsif p_col = 29 then
690 return ak_query_pkg.g_results_table(p_index).value29;
691 elsif p_col = 30 then
692 return ak_query_pkg.g_results_table(p_index).value30;
693 end if;
694
695 END get_result_value;
696
697
698 /* Initialize the session info only once per session */
699 BEGIN
700
701 IF NOT set_session_info THEN
702 RETURN;
703 END IF;
704
705 END pos_asn_details_s;