DBA Data[Home] [Help]

PACKAGE BODY: APPS.POS_ASL_TOLERANCE_PKG

Source


1 PACKAGE BODY POS_ASL_TOLERANCE_PKG AS
2 /* $Header: POSASLTB.pls 115.3 99/10/15 17:16:55 porting shi $ */
3 
4 /* Internal Procedures */
5 
6 FUNCTION set_session_info RETURN BOOLEAN is
7 BEGIN
8 
9   IF NOT icx_sec.validatesession THEN
10     RETURN FALSE;
11   END IF;
12 
13   l_org_id := icx_sec.getID(icx_sec.PV_ORG_ID);
14   l_language := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
15   l_script_name := owa_util.get_cgi_env('SCRIPT_NAME');
16   l_user_id := icx_sec.getID(icx_sec.PV_WEB_USER_ID);
17   l_session_id := icx_sec.getID(icx_sec.PV_SESSION_ID);
18   l_responsibility_id := icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID);
19 
20   fnd_client_info.set_org_context(l_org_id);
21 
22   RETURN TRUE;
23 
24 END set_session_info;
25 
26 PROCEDURE button(src1 IN varchar2,
27                  txt1 IN varchar2) IS
28 BEGIN
29 
30   htp.p('
31          <table cellpadding=0 cellspacing=0 border=0>
32           <tr>
33            <td rowspan=5><img src=/OA_MEDIA/FNDBRNDL.gif ></td>
34            <td bgcolor=#333333><img src=/OA_MEDIA/FNDPX3.gif ></td>
35            <td rowspan=5><img src=/OA_MEDIA/FNDBRNDR.gif ></td>
36            <td width=15 rowspan=5></td>
37           </tr>
38           <tr>
39            <td bgcolor=#ffffff><img src=/OA_MEDIA/FNDPX6.gif></td>
40           </tr>
41           <tr>
42            <td bgcolor=#cccccc height=20 nowrap><a target="tolerance"
43 href="' || src1 || '"><font class=button>'|| txt1 || '</font></a></td>
44           </tr>
45           <tr>
46            <td bgcolor=#666666><img src=/OA_MEDIA/FNDPX3.gif></td>
47           </tr>
48           <tr>
49            <td bgcolor=#333333><img src=/OA_MEDIA/FNDPX3.gif></td>
50           </tr>
51          </table>
52        ');
53 
54 END button;
55 
56 
57 FUNCTION item_reqd(l_index in number) RETURN VARCHAR2 IS
58 BEGIN
59    if ak_query_pkg.g_items_table(l_index).required_flag = 'Y' then
60       return  '<IMG src=/OA_MEDIA/FNDIREQD.gif border=no>';
61    else
62       return '';
63    end if;
64 END item_reqd;
65 
66 FUNCTION item_halign(l_index in number) RETURN VARCHAR2 IS
67 BEGIN
68 
69    RETURN ' align=' ||
70            ak_query_pkg.g_items_table(l_index).horizontal_alignment;
71 
72 END item_halign;
73 
74 FUNCTION item_valign(l_index in number) RETURN VARCHAR2 IS
75 BEGIN
76 
77    RETURN ' valign=' ||
78           ak_query_pkg.g_items_table(l_index).vertical_alignment;
79 
80 END item_valign;
81 
82 FUNCTION item_name(l_index in number) RETURN VARCHAR2 IS
83 BEGIN
84 
85    RETURN ak_query_pkg.g_items_table(l_index).attribute_label_long;
86 
87 END item_name;
88 
89 FUNCTION item_code(l_index in number) RETURN VARCHAR2 IS
90 BEGIN
91 
92    RETURN ak_query_pkg.g_items_table(l_index).attribute_code;
93 
94 END item_code;
95 
96 FUNCTION item_style(l_index in number) RETURN VARCHAR2 IS
97 BEGIN
98 
99   RETURN ak_query_pkg.g_items_table(l_index).item_style;
100 
101 END item_style;
102 
103 FUNCTION item_displayed(l_index in number) RETURN BOOLEAN IS
104 BEGIN
105 
106   RETURN (ak_query_pkg.g_items_table(l_index).node_display_flag = 'Y');
107 
108 END item_displayed;
109 
110 FUNCTION item_updateable(l_index in number) RETURN BOOLEAN IS
111 BEGIN
112 
113  RETURN (ak_query_pkg.g_items_table(l_index).update_flag = 'Y');
114 
115 END item_updateable;
116 
117 FUNCTION item_size (l_index in number) RETURN VARCHAR2 IS
118 BEGIN
119 
120   RETURN ' size='  || to_char(ak_query_pkg.g_items_table(l_index).display_value_length);
121 
122 END item_size;
123 
124 FUNCTION item_lov(l_index in number) RETURN VARCHAR2 IS
125 BEGIN
126 
127   IF (ak_query_pkg.g_items_table(l_index).lov_region_code IS NOT NULL AND
128                    ak_query_pkg.g_items_table(l_index).lov_attribute_code IS NOT NULL)
129       THEN
130       return  '<A HREF="javascript:call_LOV('''||
131                          item_code(l_index) || ''')"' ||
132                         '><IMG SRC="/OA_MEDIA/FNDLSTOV.gif" BORDER=0 WIDTH=23 ' ||
133                         'HEIGHT=21 border=no align=absmiddle></A>';
134   ELSE
135      return '';
136   END IF;
137 
138 END item_lov;
139 
140 FUNCTION item_lov_multi(l_index in number, l_row in number) RETURN VARCHAR2 IS
141 BEGIN
142 
143   IF (ak_query_pkg.g_items_table(l_index).lov_region_code IS NOT NULL AND
144                    ak_query_pkg.g_items_table(l_index).lov_attribute_code IS NOT NULL)
145       THEN
146       return  '<A HREF="javascript:call_LOV('''||
147                          item_code(l_index) || '''' || ',' || '''' || to_char(l_row-1) ||
148                          '''' || ',' || '''' || l_script_name ||
149                          ''')"' ||
150                         '><IMG SRC="/OA_MEDIA/FNDLSTOV.gif" BORDER=0 WIDTH=23 ' ||
151                         'HEIGHT=21 border=no align=absmiddle></A>';
152   ELSE
153      return '';
154   END IF;
155 
156 END item_lov_multi;
157 
158 PROCEDURE init_page IS
159 
160 BEGIN
161 
162   htp.htmlOpen;
163   htp.headOpen;
164   htp.linkRel('STYLESHEET', '/OA_HTML/US/POSSTYLE.css');
165 
166 END init_page;
167 
168 PROCEDURE init_body IS
169 BEGIN
170 
171   htp.headClose;
172   htp.bodyOpen(null,'bgcolor=#cccccc link=blue vlink=blue alink=#ff0000');
173 
174 END init_body;
175 
176 PROCEDURE close_page IS
177 BEGIN
178 
179   htp.bodyClose;
180   htp.htmlClose;
181 
182 END close_page;
183 
184 function get_result_value(p_index in number, p_col in number) return varchar2 is
185     sql_statement  VARCHAR2(300);
186     l_cursor       INTEGER;
187     l_execute      INTEGER;
188     l_result       VARCHAR2(2000);
189 BEGIN
190 
191   IF ak_query_pkg.g_results_table.count > 0 THEN
192 
193       sql_statement := 'begin ' ||
194                        ':l_result := ak_query_pkg.g_results_table(:p_index).value' ||
195                                              to_char(p_col) || '; ' ||
196                        ' end;';
197 
198       l_cursor := dbms_sql.open_cursor;
199       dbms_sql.parse(l_cursor, sql_statement, dbms_sql.v7);
200       dbms_sql.bind_variable(l_cursor, 'l_result', l_result, 2000);
201       dbms_sql.bind_variable(l_cursor, 'p_index', p_index);
202 
203       l_execute := dbms_sql.execute(l_cursor);
204       dbms_sql.variable_value(l_cursor, 'l_result', l_result);
205       dbms_sql.close_cursor(l_cursor);
206       return l_result;
207 
208   ELSE
209 
210       return null;
211 
212   END IF;
213 
214 END get_result_value;
215 
216 
217 PROCEDURE show_tolerance(p_option         IN NUMBER,
218         	p_where_clause            IN VARCHAR2 DEFAULT NULL,
219                 p_msg                     IN VARCHAR2 DEFAULT NULL,
220                 p_asl_id		  IN VARCHAR2 DEFAULT NULL,
221                 pos_asl_id                IN t_text_table DEFAULT g_dummy,
222 		pos_using_organization_id IN t_text_table DEFAULT g_dummy,
223 		pos_days_in_advance       IN t_text_table DEFAULT g_dummy,
224                 pos_tolerance             IN t_text_table DEFAULT g_dummy,
225                 pos_tol_rows              IN VARCHAR2 DEFAULT NULL,
226                 pos_more_rows             IN VARCHAR2 DEFAULT '5',
227                 pos_error_row            IN VARCHAR2 DEFAULT '0') IS
228 
229   l_attribute_index  NUMBER;
230   l_result_index     NUMBER;
231   l_current_col      NUMBER;
232   l_current_row      NUMBER;
233   l_where_clause     VARCHAR2(2000) := '' ;
234   l_value            VARCHAR2(100);
235 
236   l_rows	     NUMBER;
237   l_current_rows     NUMBER;
238   l_cap              VARCHAR2(100);
239 
240 BEGIN
241 
242   l_cap := fnd_message.get_string('ICX', 'ICX_POS_TOLERANCE');
243   init_page;
244 
245   js.scriptOpen;
246   icx_util.LOVscript;
247   js.scriptClose;
248 
249   htp.p('  <script src="/OA_HTML/POSASLTJ.js" language="JavaScript">');
250   htp.p('  </script>');
251   htp.headClose;
252 
253   if p_msg is not null then
254     htp.p('<BODY bgcolor=#cccccc onLoad="javascript:show_error(''' || p_msg  || ''')">');
255   else
256     htp.p('<BODY bgcolor=#cccccc>');
257   end if;
258 
259   htp.p('<form name="POS_TOL_UPDATE" ACTION="' || l_script_name ||
260         '/POS_ASL_TOLERANCE_PKG.submit_tolerance" target="tolerance" method="GET">');
261 
262   htp.p('<input name="POS_TOL_ACTION" type="HIDDEN" value="ADDROWS">');
263   htp.p('<input name="P_ASL_ID" type="HIDDEN" value="' || p_asl_id || '">');
264   htp.p('<input name="POS_ERROR_ROW" type="HIDDEN" value="0">');
265 
266   if p_option = -1 then
267     htp.p('<input name="POS_TOL_ROWS" type="HIDDEN" value="-1">');
268     htp.p('</FORM>');
269     htp.bodyClose;
270     htp.htmlClose;
271     return;
272   end if;
273 
274   if p_where_clause is not null then
275     l_where_clause := p_where_clause;
276   end if;
277 
278   ak_query_pkg.exec_query(p_parent_region_appl_id   =>  178,
279                           p_parent_region_code      =>  'POS_ASL_TOLERANCE_R',
280                           p_where_clause            =>  l_where_clause,
281                           p_responsibility_id       =>  l_responsibility_id,
282                           p_user_id                 =>  l_user_id,
283                           p_return_parents          =>  'T',
284                           p_return_children         =>  'F');
285 
286   l_attribute_index := ak_query_pkg.g_items_table.FIRST;
287 
288   htp.p('<table width=100% bgcolor=#cccccc cellpadding=2 cellspacing=0 border=2>');
289   htp.p('<tr><td>');
290 
291   htp.p('<table align=center bgcolor=#cccccc cellpadding=2 cellspacing=1 border=0>');
292   htp.p('<CAPTION>' || l_cap || '</CAPTION>');
293 
294   /* ---- Print the table heading --- */
295 
296   htp.p('<tr>');
297 
298   WHILE (l_attribute_index IS NOT NULL) LOOP
299 
300     IF (item_style(l_attribute_index) = 'HIDDEN') THEN
301 
302        htp.p('<!-- ' ||  item_code(l_attribute_index)  ||
303              ' - '   ||  item_style(l_attribute_index) || ' -->' );
304 
305     ELSIF item_displayed(l_attribute_index)  THEN
306 
307           htp.p('<td bgcolor=#336699' ||
308                  item_halign(l_attribute_index) ||
309                  item_valign(l_attribute_index) ||
310                 '>' ||
311                 item_reqd(l_attribute_index)
312                 );
313 
314 
315           htp.p('<font class=promptwhite>' || item_name(l_attribute_index) || '</font>');
316 
317           htp.p('</td>');
318 
319     END IF;
320 
321     l_attribute_index := ak_query_pkg.g_items_table.NEXT(l_attribute_index);
322 
323   END LOOP;
324 
325   htp.p('</tr>');
326 
327   /* ----- end print table heading ----*/
328 
329   if ((p_option = 1) or (p_option = 2)) then
330     /* Add rows */
331 
332     /* ----- print contents -----------*/
333     l_current_row := 0;
334     if (pos_tol_rows is not null) then
335       FOR l_counter IN 1..to_number(pos_tol_rows) LOOP
336 
337         l_current_row := l_current_row + 1;
338 
339         if (l_current_row = to_number(pos_error_row))THEN
340           htp.p('<tr BGCOLOR=''#cc033'' >');
341         elsif ((l_current_row mod 2) = 0) THEN
342           htp.p('<tr BGCOLOR=''#ffffff'' >');
343         else
344           htp.p('<tr BGCOLOR=''#99ccff'' >');
345         end if;
346 
347         l_attribute_index := ak_query_pkg.g_items_table.FIRST;
348 
349         l_current_col := 0;
350 
351         WHILE (l_attribute_index IS NOT NULL) LOOP
352 
353           l_current_col := l_current_col + 1;
354           if (item_code(l_attribute_index) = 'POS_ASL_ID') then
355            if (l_counter <= pos_asl_id.count) then
356              l_value := pos_asl_id(l_counter);
357            end if;
358           elsif (item_code(l_attribute_index) = 'POS_USING_ORGANIZATION_ID') then
359            if (l_counter <= pos_using_organization_id.count) then
360              l_value := pos_using_organization_id(l_counter);
361            end if;
362           elsif (item_code(l_attribute_index) = 'POS_DAYS_IN_ADVANCE') then
363            l_value := pos_days_in_advance(l_counter);
364           elsif (item_code(l_attribute_index) = 'POS_TOLERANCE') then
365            l_value := pos_tolerance(l_counter);
366           end if;
367 
368 
369           IF (item_style(l_attribute_index) = 'HIDDEN') THEN
370             if (item_code(l_attribute_index) = 'POS_USING_ORGANIZATION_ID') then
371               if (l_counter <= pos_using_organization_id.count) then
372                 htp.p('<input name="' || item_code(l_attribute_index) ||
373                       '" type="HIDDEN" VALUE="' || l_value ||
374                       '">');
375               end if;
376             elsif (item_code(l_attribute_index) = 'POS_ASL_ID') then
377               if (l_counter <= pos_asl_id.count) then
378                htp.p('<input name="' || item_code(l_attribute_index) ||
379                     '" type="HIDDEN" VALUE="' || l_value ||
380                     '">');
381               end if;
382             else
383               htp.p('<input name="' || item_code(l_attribute_index) ||
384                     '" type="HIDDEN" VALUE="' || l_value ||
385                     '">');
386             end if;
387           ELSE
388             IF item_displayed(l_attribute_index)  THEN
389               IF (item_style(l_attribute_index) = 'TEXT') THEN
390                 IF item_updateable(l_attribute_index) THEN
391                   htp.p('<td nowrap ' ||
392                         item_halign(l_attribute_index) ||
393                         item_valign(l_attribute_index) ||
394                       '>' ||
395                       '<font class=datablack>' ||
396                       '<input type=text ' || item_size(l_attribute_index) ||
397                         ' name="' || item_code(l_attribute_index)  || '"' ||
398                       ' value="' || l_value  ||
399                       '" ></font>' ||
400 		      item_lov_multi(l_attribute_index,l_current_row) ||
401                       '</td>');
402 
403                 ELSE
404 
405                  htp.p('<td ' ||
406                         item_halign(l_attribute_index) ||
407                         item_valign(l_attribute_index) ||
408                       '>');
409 
410                  htp.p('<font class=tabledata>' ||
411                        l_value ||
412                      '</font>');
413 
414                  htp.p('</td>');
415 
416                 END IF;
417 
418               END IF;
419             END IF;
420           END IF;
421 
422           l_attribute_index := ak_query_pkg.g_items_table.NEXT(l_attribute_index);
423 
424         END LOOP;
425 
426         htp.p('</tr>');
427 
428       END LOOP;
429 
430     end if;/* pos_tol_rows is not null */
431 
432     if (p_option = 1) then
433 
434     -- print extra rows
435 
436     l_rows := to_number(pos_more_rows);
437     WHILE (l_rows > 0) LOOP
438 
439       l_current_row := l_current_row + 1;
440 
441       if ((l_current_row mod 2) = 0) THEN
442          htp.p('<tr BGCOLOR=''#ffffff'' >');
443       else
444          htp.p('<tr BGCOLOR=''#99ccff'' >');
445       end if;
446 
447       l_attribute_index := ak_query_pkg.g_items_table.FIRST;
448 
449       l_current_col := 0;
450 
451       WHILE (l_attribute_index IS NOT NULL) LOOP
452 
453         l_current_col := l_current_col + 1;
454 
455 	IF item_displayed(l_attribute_index)  THEN
456              IF (item_style(l_attribute_index) = 'TEXT') THEN
457                 IF item_updateable(l_attribute_index) THEN
458 
459                   htp.p('<td nowrap ' ||
460                           item_halign(l_attribute_index) ||
461                           item_valign(l_attribute_index) ||
462                         '>' ||
463                         '<font class=datablack>' ||
464                         '<input type=text ' || item_size(l_attribute_index) ||
465                         ' name="' || item_code(l_attribute_index)  || '"' ||
466                         ' value=""' ||
467                          '></font>' || item_lov_multi(l_attribute_index,l_current_row) ||
468                          '</td>');
469 
470                 END IF;
471 
472             END IF;
473         END IF;
474 
475         l_attribute_index := ak_query_pkg.g_items_table.NEXT(l_attribute_index);
476 
477       END LOOP;
478 
479       htp.p('</tr>');
480 
481       l_rows := l_rows - 1;
482 
483     END LOOP;
484 
485     end if;  /* p_option = 1 */
486 
487     htp.p('</table>');
488 
489     htp.p('<input name="POS_TOL_ROWS" type="HIDDEN" value="' ||
490 	  l_current_row || '">');
491 
492   else
493 
494     /* ----- print contents -----------*/
495     l_current_row := 0;
496 
497     IF ak_query_pkg.g_results_table.count > 0 THEN
498 
499       l_result_index := ak_query_pkg.g_results_table.FIRST;
500 
501       WHILE (l_result_index IS NOT NULL) LOOP
502 
503         l_current_row := l_current_row + 1;
504 
505         if ((l_current_row mod 2) = 0) THEN
506            htp.p('<tr BGCOLOR=''#ffffff'' >');
507         else
508           htp.p('<tr BGCOLOR=''#99ccff'' >');
509         end if;
510 
511         l_attribute_index := ak_query_pkg.g_items_table.FIRST;
512 
513         l_current_col := 0;
514 
515         WHILE (l_attribute_index IS NOT NULL) LOOP
516 
517           l_current_col := l_current_col + 1;
518 
519           IF (item_style(l_attribute_index) = 'HIDDEN') THEN
520 
521              htp.p('<input name="' || item_code(l_attribute_index) ||
522                    '" type="HIDDEN" VALUE="' ||
523                    get_result_value(l_result_index, l_current_col) || '">');
524 
525           ELSE
526            IF item_displayed(l_attribute_index)  THEN
527              IF (item_style(l_attribute_index) = 'TEXT') THEN
528                 IF item_updateable(l_attribute_index) THEN
529 
530                   htp.p('<td nowrap ' ||
531                           item_halign(l_attribute_index) ||
532                           item_valign(l_attribute_index) ||
533                         '>' ||
534                         '<font class=datablack>' ||
535                         '<input type=text ' || item_size(l_attribute_index) ||
536                           ' name="' || item_code(l_attribute_index)  || '"' ||
537                         ' value="' || nvl(get_result_value(l_result_index, l_current_col),'')  ||
538                          '" ></font>' || item_lov_multi(l_attribute_index,l_current_row) ||
539                          '</td>');
540 
541                 ELSE
542 
543                  htp.p('<td ' ||
544                           item_halign(l_attribute_index) ||
545                           item_valign(l_attribute_index) ||
546                         '>');
547 
548                  htp.p('<font class=tabledata>' ||
549                          nvl(get_result_value(l_result_index, l_current_col), ' ') ||
550                        '</font>');
551 
552                  htp.p('</td>');
553 
554                 END IF;
555 
556             END IF;
557            END IF;
558           END IF;
559 
560           l_attribute_index := ak_query_pkg.g_items_table.NEXT(l_attribute_index);
561 
562         END LOOP;
563 
564         htp.p('</tr>');
565 
566         l_result_index := ak_query_pkg.g_results_table.NEXT(l_result_index);
567 
568       END LOOP;
569 
570     END IF;
571 
572     htp.p('<input name="POS_TOL_ROWS" type="HIDDEN" value="' ||
573           l_current_row || '">');
574 
575     htp.p('</table>');
576 
577   end if;
578 
579   /* Print Add Button */
580   htp.p('<br>');
581   htp.p('<table align=center cellpadding=2 cellspacing=1 border=0>');
582 
583   htp.p('<tr><td>');
584 
585   button('javascript:addrows()',
586 	 fnd_message.get_string('ICX', 'ICX_POS_ADD_ROW'));
587 
588   htp.p('</td><td>');
589 
590   htp.p( '<font class=datablack>' ||
591 	 '<input type="text"  size=1' ||
592 	 ' name="POS_MORE_ROWS" value="' || to_number(pos_more_rows) || '"></font>  ');
593 
594   htp.p('</td></tr>');
595 
596   htp.p('</table>');
597 
598   htp.p('</td></tr></table>');
599   htp.p('</form>');
600 
601   close_page;
602 
603 END show_tolerance;
604 
605 
606 
607 /* Main Procedures */
608 
609 PROCEDURE tolerance_frame(pos_asl_id         IN VARCHAR2 DEFAULT NULL
610 ) IS
611 
612   l_where_clause     VARCHAR2(2000) := NULL;
613 
614 BEGIN
615 
616   IF (pos_asl_id IS NULL) THEN
617     show_tolerance(-1);
618     return;
619   END IF;
620 
621   l_where_clause := 'asl_id = ' || pos_asl_id ;
622 
623   show_tolerance(0, l_where_clause, null, pos_asl_id);
624 
625 EXCEPTION
626 
627   when others then
628     show_tolerance(-1, null, 'Exception Raised in tolerance_Frame');
629 null;
630 
631 END tolerance_frame;
632 
633 
634 PROCEDURE submit_tolerance(pos_asl_id         IN t_text_table DEFAULT g_dummy,
635                   pos_using_organization_id   IN t_text_table DEFAULT g_dummy,
636                   pos_days_in_advance         IN t_text_table DEFAULT g_dummy,
637                   pos_tolerance               IN t_text_table DEFAULT g_dummy,
638                   p_asl_id	              IN VARCHAR2 DEFAULT NULL,
639                   pos_tol_action              IN VARCHAR2 DEFAULT NULL,
640                   pos_tol_rows                IN VARCHAR2 DEFAULT NULL,
641                   pos_more_rows               IN VARCHAR2 DEFAULT NULL,
642                   pos_error_row               IN VARCHAR2 DEFAULT NULL )  IS
643 
644  l_counter 	NUMBER;
645  l_where_clause VARCHAR2(2000) := NULL;
646 
647 BEGIN
648 
649   if (pos_tol_action = 'ADDROWS') then
650   -- Add more rows ---
651     show_tolerance(1, '1=0', null, p_asl_id, pos_asl_id,
652 	          pos_using_organization_id, pos_days_in_advance,
653                   pos_tolerance, pos_tol_rows, pos_more_rows);
654 
655   elsif (pos_tol_action = 'ERROR') then
656     show_tolerance(2, null, null, p_asl_id, pos_asl_id,
657 	          pos_using_organization_id, pos_days_in_advance,
658                   pos_tolerance, pos_tol_rows, pos_more_rows, pos_error_row);
659 
660   elsif (pos_tol_action = 'CLEAR') then
661 
662     show_tolerance(-1);
663 
664   elsif (pos_tol_action = 'SUBMIT') then
665 
666     delete from po_supplier_item_tolerance
667     where asl_id = to_number(p_asl_id)
668     and using_organization_id = -1;
669 
670     FOR l_counter IN 1..to_number(pos_tol_rows) LOOP
671       if (pos_days_in_advance(l_counter) is not null and
672           pos_tolerance(l_counter) is not null) then
673         insert into po_supplier_item_tolerance
674           (
675            ASL_ID,
676            USING_ORGANIZATION_ID,
677            NUMBER_OF_DAYS,
678            TOLERANCE,
679            LAST_UPDATE_DATE,
680            LAST_UPDATED_BY,
681            LAST_UPDATE_LOGIN,
682            CREATION_DATE,
683            CREATED_BY
684            )
685         values (
686            to_number(p_asl_id),
687            -1,
688            nvl(to_number(pos_days_in_advance(l_counter)), 0),
689            nvl(to_number(pos_tolerance(l_counter)), 0),
690            sysdate,
691            l_user_id,
692            l_user_id,
693            sysdate,
694            l_user_id );
695 
696       end if;
697 
698     END LOOP;
699 
700     COMMIT;
701 
702     l_where_clause := 'asl_id = ' || p_asl_id ;
703     show_tolerance(0, l_where_clause, null, p_asl_id);
704 
705   end if;
706 
707 END submit_tolerance;
708 
709 
710 /* Initialize the session info only once per session */
711 BEGIN
712 
713   IF NOT set_session_info THEN
714     RETURN;
715   END IF;
716 
717 END POS_ASL_TOLERANCE_PKG;