;==File=================================================================;
; PO4000F.DBL
;=======================================================================;
; Copyright 1999 by TAH Software Systems (TAH), Oklahoma City, Oklahoma ;
;									;
;	TAH provides this software under a license and may only be	;
;	used in accordance with the terms and conditions of such	;
;	license and with the inclusion of the above Copyright notice.	;
;==Function=============================================================;
;	po4000f		Purchase Order reference entry.
;==Changes==============================================================;
;=======================================================================;
.subroutine po4000f

	a_poline	,a	; IN  - Order line item record
	a_initem	,a	; IN  - Inventory item record

.start nopage,nolist
.include "UTL:tools.def"
.include "UTS:dteut.def"
.include "POS:dtepo.def"

.include "UTS:utcomm.gbl"
.include "POS:pocomm.gbl"
.include "POS:poline.rec"
.include "INS:initem.rec"

static record
	ref_id		,i4
	ref_name	,a*,	'po4000f'
.start nopage,list

.proc
	xcall status
	poline = a_poline
	initem = a_initem
	xcall lodwin ('LPL',ref_name,ref_id)

	if (pol_refrnce1.eq.UT_BLANKS)
	    begin
	        clear pol_refrnce2
		pol_ref1prt = 'P'
		pol_ref2prt = 'P'
		clear g_setsts, g_select
            end
	xcall i_display (ref_id,'set1',poline)
	xcall i_next (ref_id,'set1','*FRST*')
	do begin
	  xcall i_input (ref_id,'set1',poline,,ut_col_sel,,1)
	  if g_select
	    begin
	      case g_entnam of
		begincase
		'END': exitloop
		'@':   call process_signal
		endcase
	    end
	end until (.not.g_setsts) .and. (.not.g_select)

	a_poline = poline
	xcall lodwin ('D',,ref_id)
	xreturn		; to calling program

	;	Process any break signals
process_signal,
	case g_entnam of
	  begincase
	  '@PLREF1': if (pol_refrnce1.eq.UT_BLANKS)
		      begin
		        clear pol_refrnce2
			pol_ref1prt = 'N'
			pol_ref2prt = 'N'
			clear g_setsts, g_select
		      end
		     else
		      if (.not.ut_windows)
			xcall i_next (ref_id,'set1','*NEXT*')
	  endcase
	return

.end

