COMPILE SUBROUTINE Print_Vision_Comm_Error(dummy)


DECLARE SUBROUTINE ErrMsg
DECLARE FUNCTION Printer_Select, Set_Printer, Get_Printer

$INSERT OIPRINT_EQUATES
$INSERT APPCOLORS


EQU PI$LEFT		TO 1
EQU PI$TOP		TO 2
EQU PI$RIGHT	TO 3
EQU PI$BOTTOM	TO 4
EQU PI$WIDTH	TO 5
EQU PI$HEIGHT	TO 6
EQU PI$SIZE		TO 7



* Internal method that selects printer, initializes OIPI and then prints block grid

FileName 	= "Printing Error Log"
Title       = "Printing Error Log"	;* Initialize Printing

PageInfo			= ''
PageInfo<PI$LEFT>	= 0.5
PageInfo<PI$TOP>	= 0.5
PageInfo<PI$RIGHT>	= 0.5
PageInfo<PI$BOTTOM>	= 0.25

PageSetup	= '1' 							;* Landscape
PrintSetup  = ''
PrintSetup<1,1>	= '2'						;* Preview Normal
PrintSetup<1,2> = '5'						;* Print and PDF buttons
PrintPath	= Printer_Select('',1)			;* Select default printer


stat = Set_Printer("INIT",FileName,Title,PageInfo,PageSetup,PrintSetup,PrintPath)
IF stat < 0 THEN GOSUB OIPrintErr

Header = "Page  'P'":@VM:"SAP Communications Error Log":@VM:" 'D'  'T'"
Header<-1> = ''

font	= 'Arial'
font<2>	= '10'
font<4>	= '1'		;* Bold

fontSpacing = 120

stat = Set_Printer('FONTHEADFOOT',font)	; IF stat < 0 THEN GOTO OIPrintErr
stat = Set_Printer('HEADER',Header)		; IF stat < 0 THEN GOTO OIPrintErr


ErrorLog = XLATE('SYSLISTS','VISION_COMM_ERROR','','X')

SWAP @VM WITH @FM IN ErrorLog
SWAP '[IBM]' WITH CRLF$:'[IBM]' IN ErrorLog


colHead = 'Error Description'		; colFmt = '<14400'
colData = ErrorLog

font<2> = 10
font<4> = 1		;* Bold
stat = Set_Printer('FONT',font,'100')

stat = Set_Printer('ADDTABLE',colFmt,colHead,'',LTGREY$,'',0,TB_ALL)


font<4> = 0
stat = Set_Printer('FONT',font,fontSpacing)

stat = Set_Printer('ADDTABLE',colFmt,'',colData,LTGREY$,'',0,7)





* * * * * * *
Bail:
* * * * * * *

stat = Set_Printer('TERM',1)

RETURN


* * * * * * *
OIPrintErr:
* * * * * * *

ErrMsg('Set_Printer returned errorcode ':stat)
stat = Set_Printer('TERM',1)

RETURN
