;==File=================================================================;
; POIRECV.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=============================================================;
;	po_inq_recv	Order receivings line item search routine.
;	poll_porecv	Load List with receivings information
;==Changes==============================================================;
; 07/15/1998 TAH - Modify list processing for Synergy V6
;=======================================================================;
.subroutine po_inq_recv

	a_porecv	,a	; I/O - Record to return
	a_key		,a	; IN  - Key value for begin of search

.start nopage,nolist
.include "WND:tools.def"
.include "WND:system.def"
.include "WND:inpctl.def"
.include "UTS:dteut.def"
.include "POS:dtepo.def"

.include "UTS:utcomm.gbl"
.include "POS:pocomm.gbl"
.include "POS:porecv.rec"
record	,X
	sel_line	,a139

global data section list_porecv, init
record
	c_key		,a24
	c_pos		,d3
endglobal

.align
record
	colid		,i4		; column id
	fndid		,i4		; find id
	inpid		,i4		; input column id
	selid		,i4		; selection column id
	req		,i4
	srch		,i4		; search parameter
	field_no	,d3		; field number from i_fldinf
	lfind		,a*,	'i_lxxxxxx'
	  lfind_file	,a6	@lfind+3
	lclass		,a*,	'l_xxxxxx'
	  lclass_file	,a6	@lclass+2
	wind_header	,a160		; window header from script
	  wind_hleft	,a80	@wind_header
	  wind_hright	,a80	@wind_header+80
.start nopage,list

.proc
	lfind_file = 'porecv'
	lclass_file = lfind_file
	if (a_key.eq.ut_blanks) xreturn		; return if no key to match
	c_key = a_key
	c_pos = %trim(c_key)

.include "UTS:utfind.inc"

	if (g_entnam.eq.'O_EXIT')
	 then clear a_porecv
	 else a_porecv = porecv
	xcall e_exit
	xreturn

find_first_match,
	xcall db_find (porecv_chan,a_key(1:c_pos),0,'M',,,opcde)
	case opcde of
	  begincase
	  1: xcall message (DTER_RNF)
	  2: xcall message (DTER_LOK)
	  endcase
	return

utfind_find,
	return
.end
;=======================================================================;
.subroutine poll_porecv

	a_listid	,n	; IN  - ID for list
	a_request	,n	; IN  - List request code
	a_data		,a	; I/O - Data record area
	a_inpid		,n	; IN  - Input window ID
	a_disabled	,n	; IN  - True/False to disable list item
	a_index		,n	; IN  - List item index

.start nopage,nolist
.include "POS:pocomm.gbl"
.include "UTS:utcomm.gbl"

.include "POS:porecv.rec"
record	,X
	sel_line	,a139

global data section list_porecv
record
	c_key		,a24
	c_pos		,d3
endglobal

record
	wrk_rfa		,d6
.start nopage,list

.proc
	repeat
	  begin
	    xcall db_next (porecv_chan,porecv,'F','M',,,opcde)
	    unlock porecv_chan
	    case opcde of
	      begincase
	      1: a_request = D_LEOF
	      2: a_request = D_LEOF
	      endcase
	     else
	      begin
		if (c_key(1:c_pos).ne.por_key)
		  begin
		    a_request = D_LEOF
		    exitloop
		  end
		if (por_linetype.eq.'I') .or.
		&  (por_linetype.eq.'N')
		  begin
		    xcall i_display (a_inpid,'set1',porecv)
		    a_data = porecv
		    exitloop
		  end
	      end
	    if (a_request.eq.D_LEOF) exitloop
	  end
	xreturn
.end
;=======================================================================;

