;==File=================================================================;
; PO4000E.DBL
;=======================================================================;
; Copyright 2000 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=============================================================;
;	po4000e		Purchase Order extended remarks entry.
;==Changes==============================================================;
;=======================================================================;
.subroutine po4000e

	a_poline	,a	; IN  - Line item record.

.start nopage,nolist
.include "UTL:windows.def"
.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:incomm.gbl"
.include "INS:initem.rec"

static record
	edsc_id		,i4
	edsc_name	,a*,	'po4000e'

record
	bom_documents	,a240
	  bom_docs	,[10]a24	@bom_documents
	descr		,[4]a60		; description array
	ndx		,d4
.start nopage,list

.proc
	xcall status
	poline = a_poline
	xcall lodwin ('LPL',edsc_name,edsc_id)

	xcall i_display (edsc_id,'set1',poline)
	xcall i_next (edsc_id,'set1','*FRST*')
	do begin
	  xcall i_input (edsc_id,'set1',poline,,ut_col_sel,,1)
	  if g_select
	    begin
	      case g_entnam of
		begincase
		'END':		exitloop
		'PO_INDESC':	call get_in_descr
		'PO_BMDOCS':	call get_bm_docs
		'@':		call process_signal
		endcase
	    end
	end until (.not.g_setsts) .and. (.not.g_select)

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

	;	Process any break signals
process_signal,
	case g_entnam of
	  begincase
	  '@': nop
	  endcase
	return

	;	find IN extended description record
get_in_descr,
	if (ini_item.ne.pol_item)
	  begin
	    ini_comp = pol_comp
	    ini_item = pol_item
	    xcall in_get_item (initem)
	  end
	if (ini_item.eq.pol_item)
	  begin
	    pol_extdescr[1] = ini_edesc[1]
	    pol_extdescr[2] = ini_edesc[2]
	    pol_extdescr[3] = ini_edesc[3]
	    pol_extdescr[4] = ini_edesc[4]
	    xcall i_display (edsc_id,'set1',poline)
	  end
	return

	;------ add BOM document descriptions
get_bm_docs,
        xcall bm_get_doc (pol_item,bom_documents)
        if (bom_documents.eq.UT_BLANKS) return 
        for ndx from 1 thru 4 by 1
          begin
            if (bom_docs[ndx])
              begin
                ini_comp = pol_comp
                ini_item = bom_docs[ndx]
                xcall in_get_item (initem)
                if (opcde) clear ini_revision
                unlock initem_chan
                xcall s_bld (descr[ndx],,'Document: %a  Rev: %a',
                &            bom_docs[ndx],ini_revision)
              end
          end
        pol_extdescr[1] = descr[1]
        pol_extdescr[2] = descr[2]
        pol_extdescr[3] = descr[3]
        pol_extdescr[4] = descr[4]
        xcall i_display (edsc_id,'set1',poline)
        return
.end

