270 lines
5.4 KiB
Plaintext
270 lines
5.4 KiB
Plaintext
COMPILE SUBROUTINE Print_Reactor_Maint_ToDo(Dummy)
|
|
|
|
/*
|
|
Print Reactor PM To Do List report
|
|
6/10/2013 - John C. Henry, J.C. Henry & Co., Inc. - Initial coding
|
|
|
|
*/
|
|
|
|
|
|
|
|
DECLARE SUBROUTINE Utility, ErrMsg, Set_Status, Set_Printer, RList, Btree.Extract, Make.List
|
|
DECLARE FUNCTION Set_Printer, Get_Printer, Msg, Get_Status, Printer_Select, obj_Install, Dialog_Box, Key_Sort
|
|
|
|
$INSERT OIPRINT_EQUATES
|
|
$INSERT APPCOLORS
|
|
$INSERT MSG_EQUATES
|
|
|
|
|
|
EQU TAB$ TO \09\
|
|
EQU TARGET_ACTIVELIST$ TO 5
|
|
|
|
|
|
ErrorTitle = 'Error in stored procedure Print_Reactor_Maint_ToDo'
|
|
|
|
OPEN 'REACTOR_PM' TO ReactorPMTable ELSE
|
|
ErrMsg('Unable to open "DICT.REACTOR_PM" for Query.')
|
|
RETURN
|
|
END
|
|
|
|
OPEN 'DICT.REACTOR_PM' TO @DICT ELSE
|
|
ErrMsg('Unable to open "DICT.REACTOR_PM" for Query.')
|
|
RETURN
|
|
END
|
|
|
|
EndDt = OCONV((Date()+60),'D4/')
|
|
|
|
SearchString = 'DUE_DT':@VM:'<=':EndDt:@FM
|
|
SearchString := 'COMPLETE_DATE':@VM:@FM
|
|
|
|
Set_Status(0)
|
|
Btree.Extract(SearchString,'REACTOR_PM',@DICT,ReactPMKeys,'',Flag)
|
|
|
|
IF Get_Status(errCode) THEN
|
|
ErrMsg(errCode)
|
|
RETURN
|
|
END
|
|
|
|
CONVERT @VM TO @FM IN ReactPMKeys
|
|
|
|
ReactPMKeys = Key_Sort(ReactPMKeys,'REACTOR_PM','REACTOR':@FM:'#DUE_DT':@FM:'SERV_DESC', 1 )
|
|
|
|
CONVERT @VM TO @FM IN ReactPMKeys
|
|
|
|
Make.List(0,ReactPMKeys,ReactorPMTable,@DICT)
|
|
|
|
* Start of printing process
|
|
|
|
FileName = 'Reactor PM Report'
|
|
Title = 'Printing Reactor PM Report'
|
|
|
|
TopMargin = 1.0
|
|
BottomMargin = 0.75
|
|
LeftMargin = 0.5
|
|
RightMargin = 0.5
|
|
|
|
Margins = LeftMargin:@FM:TopMargin:@FM:RightMargin:@FM:BottomMargin
|
|
|
|
PageSetup = '0' ;* Landscape = 1
|
|
PrintSetup = '2' ;* Preview Normal
|
|
PrintPath = Printer_Select()
|
|
|
|
stat = Set_Printer('INIT',FileName,Title,Margins,PageSetup,PrintSetup,PrintPath)
|
|
IF stat < 0 THEN GOTO OIPrintErr
|
|
|
|
* Headings
|
|
|
|
DateRange = 'With Due Dates: Thru ':OCONV(Date()+60,'D4/')
|
|
|
|
Header = "'D'":@VM:obj_Install('Get_Prop','CompTitle'):' Reactor PM To Do Report':@VM:"Page 'P'"
|
|
Header<-1> = "'T'":@VM:DateRange
|
|
Header<-1> = '' ;* Blank line following heading
|
|
|
|
font = 'Arial'
|
|
font<2> = '10'
|
|
font<4> = '1' ;* Bold
|
|
|
|
stat = Set_Printer('FONTHEADFOOT',font) ; IF stat < 0 THEN GOTO OIPrintErr
|
|
stat = Set_Printer('HEADER',Header) ; IF stat < 0 THEN GOTO OIPrintErr
|
|
|
|
Footer = " 'D' 'T'":@VM:@VM:"Page: 'P'"
|
|
stat = Set_Printer('FOOTER',Footer) ; IF stat < 0 THEN GOTO OIPrintErr
|
|
|
|
@RECCOUNT = 0
|
|
|
|
FirstPass = 1
|
|
LastRecord = 0
|
|
FirstLine = 1
|
|
|
|
* Make Column Heading
|
|
|
|
colHead = '' ; colFmt = ''
|
|
colHead<1,1> = 'PM Key' ; colFmt<1,1> = '^1080'
|
|
colHead<1,2> = 'Reactor' ; colFmt<1,2> = '^1080'
|
|
colHead<1,3> = 'Due Dt' ; colFmt<1,3> = '^1800'
|
|
colHead<1,4> = 'React Serv ID' ; colFmt<1,4> = '^1440'
|
|
colHead<1,5> = 'Service Desc' ; colFmt<1,5> = '~3660'
|
|
|
|
|
|
* Null Previous Break Buckets
|
|
|
|
PrevReactor=''
|
|
LastReactorBreak = 1
|
|
|
|
* * * * * * *
|
|
ReadRecord:
|
|
* * * * * * *
|
|
|
|
* Zero Break Flags to False
|
|
|
|
ReactorBreak=0
|
|
|
|
READNEXT @ID,WhichValue ELSE
|
|
LastRecord = 1
|
|
ReactorBreak = 1
|
|
Reactor = PrevReactor
|
|
END
|
|
|
|
SReactPMKey = @ID
|
|
|
|
IF FirstPass AND LastRecord THEN
|
|
GOTO Bail
|
|
END
|
|
|
|
IF LastRecord THEN GOTO BREAKS
|
|
|
|
READ @RECORD From ReactorPMTable,@ID ELSE
|
|
GOTO ReadRecord
|
|
END
|
|
|
|
@RECCOUNT += 1
|
|
|
|
* Calculate Value(s) for Column(s)
|
|
|
|
SReactPMKey = {@ID}
|
|
IReactPMKey = SReactPMKey
|
|
S.Reactor = {REACTOR}
|
|
I.Reactor = S.Reactor
|
|
SDueDt = {DUE_DT}
|
|
IDueDt = SDueDt
|
|
SReactServID = {REACT_SERV_ID}
|
|
IReactServID = SReactServID
|
|
SServDesc = {SERV_DESC}
|
|
IServDesc = SServDesc
|
|
|
|
* Test for Control Break(s)
|
|
|
|
IF (S.Reactor NE PrevReactor) OR ReactorBreak THEN
|
|
Reactor = PrevReactor
|
|
PrevReactor = S.Reactor
|
|
ReactorBreak += 1
|
|
END
|
|
|
|
IF FirstPass THEN
|
|
FirstPass = 0
|
|
GOTO Detail
|
|
END
|
|
|
|
* * * * * * *
|
|
Breaks:
|
|
* * * * * * *
|
|
|
|
* Print Break Total(s) and Accumulate Total(s)
|
|
|
|
IF ReactorBreak THEN
|
|
|
|
NULL
|
|
|
|
END
|
|
|
|
* Perform Last Record Output If Done
|
|
*
|
|
IF LastRecord THEN
|
|
GOTO Bail
|
|
END
|
|
|
|
* * * * * * *
|
|
DETAIL:
|
|
* * * * * * *
|
|
|
|
* DO CONVERSIONS IF ANY
|
|
|
|
IF S.Reactor NE "" THEN S.Reactor = OCONV(S.Reactor,"MD0")
|
|
IF SDueDt NE "" THEN SDueDt = OCONV(SDueDt,"D4/")
|
|
IF SReactServID NE "" THEN SReactServID = OCONV(SReactServID,"MD0")
|
|
|
|
* Print Detail Line
|
|
|
|
colData = ''
|
|
colData<1,1> = SReactPMKey
|
|
colData<1,2> = S.Reactor
|
|
colData<1,3> = SDueDt
|
|
colData<1,4> = SReactServID
|
|
colData<1,5> = SServDesc
|
|
|
|
|
|
GOSUB PrintTable
|
|
|
|
GOTO ReadRecord
|
|
|
|
|
|
|
|
|
|
|
|
* * * * * * *
|
|
Bail:
|
|
* * * * * * *
|
|
|
|
stat = Set_Printer('TERM',1)
|
|
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
OIPrintErr:
|
|
* * * * * * *
|
|
|
|
ErrMsg(ErrorTitle:@SVM:ErrorMsg)
|
|
ErrMsg(ErrorTitle:@SVM:'Set_Printer returned errorcode ':stat)
|
|
stat = Set_Printer('TERM',1)
|
|
|
|
RETURN
|
|
|
|
|
|
* * * * * *
|
|
PrintTable:
|
|
* * * * * *
|
|
|
|
|
|
stat = Set_Printer('CALCTABLE',colFmt:@FM:colData)
|
|
TableSize = Get_Printer('CALCTABLE')
|
|
TableHeight = TableSize<2>
|
|
Test = Get_Printer('POS')<2>
|
|
|
|
IF Get_Printer('POS')<2> + TableHeight > 9.00 OR FirstLine THEN
|
|
IF NOT(FirstLine) THEN
|
|
stat = Set_Printer('PAGEBREAK')
|
|
END
|
|
FirstLine = 0
|
|
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)
|
|
|
|
END ELSE
|
|
font<2> = 10
|
|
font<4> = 0
|
|
stat = Set_Printer('FONT',font,fontSpacing)
|
|
stat = Set_Printer('ADDTABLE',colFmt,'',colData,LTGREY$,'',1,TB_ALL)
|
|
|
|
END
|
|
|
|
RETURN
|