compile SUBROUTINE Print_React_Read_Worksheet( ReactList )

DECLARE FUNCTION SECURITY_CHECK, SET_PRINTER, GET_PRINTER, MSG, FIELDCOUNT, ENTID, REPOSITORY, PRINTER_SELECT
DECLARE FUNCTION OBJ_INSTALL
DECLARE SUBROUTINE SECURITY_ERR_MSG, ErrMsg

$INSERT OIPRINT_EQUATES
$INSERT MSG_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



EQU COL$REACTOR				TO 1
EQU COL$TYPE				TO 2
EQU COL$ASSIGN				TO 3
EQU COL$WAFER_CNT			TO 4


IF NOT(ASSIGNED(ReactList)) THEN RETURN


* * *   PRINT SETUP   * * *

PageInfo			= ''
PageInfo<PI$LEFT>	= 0.5		;* Margins
PageInfo<PI$TOP>	= 1.35
PageInfo<PI$RIGHT>	= 0.5
PageInfo<PI$BOTTOM>	= 0.50

PageSetup	= 0					;* 1 = Landscape mode
PrintSetup	= 2					;* 0 = Print to printer without Preview

stat = Set_Printer("INIT",'Printing','Reactor Reading Worksheet',PageInfo,PageSetup,PrintSetup)


font = 'Arial'		;* Font basics
font<2> = 10
font<4> = 0

stat = Set_Printer('FONTHEADFOOT', font)

stat = Set_Printer('FOOTER',"Page 'P' ":@VM:@VM:"'T' 'D'")

stat = Set_Printer('LINESTYLE', PS_SOLID:@FM:2)
stat = Set_Printer('LINE', -0.1:@FM:-1.2:@FM:7.5:@FM:-1.2, 1)
stat = Set_Printer('LINE', -0.1:@FM:-0.1:@FM:7.5:@FM:-0.1, 1)
 
location = -.15:@fm:-1.150:@fm:1.57:@fm:1
stat = Set_Printer('BMP',obj_Install('Get_Prop','ColorBMP'),location, 0,1)


* * * *  Added 10/8/2015 JCH - Updated 'CONFIG','COMPANY'  * * * *

InstDat		= obj_Install('Get_Prop','Company':@FM:'Division')
Company		= InstDat<1>
Division	= InstDat<2>
	
font	= 'Arial'
font<2>	= '12'		;* Big type
font<4>	= 1			;* Bold on
font<5> = 0			;* Italics

stat = Set_Printer('TEXTXY',Company,5.7:@FM:-1.15,font,1)
stat = Set_Printer('TEXTXY',Division,5.7:@FM:-0.970,font,1)

font<2> = 10	;* 10 point font
font<4> = 0		;* Bold off
font<5> = 0		;* Italics Off

stat = Set_Printer('TEXTXY',obj_Install('Get_Prop','Address'), 5.7:@fm:-0.775, font,1)
stat = Set_Printer('TEXTXY',obj_Install('Get_Prop','CSZC'), 5.7:@fm:-0.625, font,1)
stat = Set_Printer('TEXTXY','Tel:      ':obj_Install('Get_Prop','Phone'), 5.7:@fm:-0.475, font, 1)
stat = Set_Printer('TEXTXY','FAX:    ':obj_Install('Get_Prop','FAX'), 5.7:@fm:-0.325, font, 1)

* * * *  End of changes 10/8/2015 JCH  * * * *


font<2>	= '16'		;* Big type
font<4>	= 1			;* Bold on
font<5> = 1			;* Italics

stat = Set_Printer('TEXTXY','Reactor Readings Worksheet',1.95:@FM:-0.80,font,0)

font<2> = '10'
font<4> = 0		;* Bold off
font<5>	= 0		;* Italics Off

stat = Set_Printer('FONT', font)		;* Problem with default font getting set by 'TEXTXY' messages above

colHeader = 'Reactor No'				; colFormat = '^1440'
colHeader<1,2> = 'Type'					; colFormat<1,2> = '<1800'
colHeader<1,3> = 'Assignment'			; colFormat<1,3> = '^1800'
colHeader<1,4> = 'Reactor No'			; colFormat<1,4> = '^1440'
colHeader<1,5> = 'WaferCnt'				; colFormat<1,5> = '^1800'

font = 'Arial'		;* Font basics
font<2> = 10
font<4> = 1			;* Bold
font<5> = 0			;* Italic Off

fontSpacing = 110

stat = Set_Printer("FONT",font,fontspacing)

IF stat < 0 THEN GOTO OIPrintErr
	
stat = Set_Printer('ADDTABLE', colFormat,colHeader,'',LTGREY$,'',0,7)	;* Print column headings bold w/grey background

font<4> = 0		;* Bold off

stat = Set_Printer('FONT',font,fontspacing)


LineCnt = COUNT(ReactList,@FM) + (ReactList NE '')

FOR I = 1 TO LineCnt
	colData = ReactList<I,COL$REACTOR>:@VM:ReactList<I,COL$TYPE>:@VM:ReactList<I,COL$ASSIGN>:@VM:ReactList<I,COL$REACTOR>:@VM:ReactList<I,COL$WAFER_CNT>
	IF MOD(I,2) THEN
		stat = Set_Printer('ADDTABLE',colFormat,'',colData,'',RCV_BLUE$,1,7)		;* Print column data
	END ELSE
		stat = Set_Printer('ADDTABLE',colFormat,'',colData,'','',1,7)		;* Print column data
	END
NEXT I

stat = Set_Printer('TEXT')

Void = Set_Printer('TERM')


RETURN



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

ErrMsg(ErrorTitle:@SVM:ErrorMsg)
ErrMsg(ErrorTitle:@SVM:'Set_Printer returned errorcode ':stat)
stat = Set_Printer('TERM',1)

RETURN


