;==File=================================================================;
; POREPT.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_rept		P/O report column management.
;==Changes==============================================================;
; 12/21/1999 tah - Add codes report option.
; 10/30/1997 tah - Remove inquiry options.
;=======================================================================;
.subroutine po_rept

	a_type		,a	; IN  - Program type.
				;	M - from a menu.
				;	P - from a program module.

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

.include "UTS:utcomm.gbl"
.include "POS:pocomm.gbl"

record
	hld_entnam	,a15			; menu option chosen
	  hld_codetype	,a1	@hld_entnam+5
	secure		,a11			; local routine security
	  secure_e	,a1	@secure
	  secure_a	,a1	@secure+1
	  secure_c	,a1	@secure+2
	  secure_d	,a1	@secure+3
	  secure_l	,a1	@secure+4
	  secure_p	,a6	@secure+5
	secure_save	,a11			; calling program security
.start nopage,list

.proc
	case a_type of
	  begincase
	  'M': begin			; from a menu
		hld_entnam = g_entnam		; save menu option
		call do_option
	       end
	  'P': begin			; from a program module
		xcall getsec (g_entnam,secure)	; get operator security
		if (secure_e.eq.'N')
		  begin
		    xcall message (DTER_SNA,D_ERROR)
		    xreturn
		  end
		hld_entnam = g_entnam		; save menu option
		secure_save = sec_option	; save existing security
		sec_option = secure		; change to local security
		if (sec_opt_pass.ne.ut_blanks)
		  begin
		    xcall passwd (ut_err)	; check for required password
		    if (ut_err) goto no_pass
		  end
		xcall acslog (hld_entnam)	; log operator/option
		xcall m_disable (D_COLUMN,po_menu_col[1])
		call do_option
		xcall m_enable (D_COLUMN,po_menu_col[1])
no_pass,
		sec_option = secure_save	; restore saved security
		clear secure
	       end
	  endcase
	xreturn 	; to calling program

do_option,
	case hld_entnam of
	  begincase
	  'R_COD':  xcall sm6800 (hld_codetype)	; codes
	  'R_ORDE': xcall po6000 ; orders entered
	  'R_VOPN': xcall po6100 ; open orders by vendor
	  'R_IOPN': xcall po6200 ; open orders by item
	  'R_OAGE': xcall po6250 ; aged open items
	  'R_VPER': xcall po6400 ; vendor performance
	  'R_COST': xcall po6600 ; receivings cost
	  'R_RANL': xcall po6700 ; receivings item analysis report
	  'R_RINV': xcall po6720 ; receivings invoice analysis report
	  'R_RFRT': xcall po6740 ; receivings freight analysis report
	  'R_RNYI': xcall po6760 ; receivings not yet invoiced
	  'R_HIST': xcall po6800 ; order history
	  endcase
	return
.end

