added LSL2 stored procedures
This commit is contained in:
134
LSL2/STPROC/REACTOR_LOG_RPT1.txt
Normal file
134
LSL2/STPROC/REACTOR_LOG_RPT1.txt
Normal file
@ -0,0 +1,134 @@
|
||||
compile function REACTOR_LOG_RPT1()
|
||||
begin condition
|
||||
pre:
|
||||
post:
|
||||
end condition
|
||||
declare function getprinterlist, getprofilestring, writeprofilestring, extdevicemode
|
||||
declare function msg, set_property, send_event, dialog_box, utility, get_property
|
||||
declare function set_printer, Printer_Select
|
||||
declare subroutine rlist, or_view, activate_save_select, yield
|
||||
declare subroutine reactor_log_rpt1_prn
|
||||
$insert rlist_equates
|
||||
$insert msg_equates
|
||||
* IF THIS CODE IS EVER USED, IT MUST CHANGE THE MSG CALLS WITH MCOL=-2 MROW=-2
|
||||
|
||||
Params = dialog_box( 'REACTOR_LOG_RPT1', @window, '*CENTER' )
|
||||
if Params = 'CANCEL' or Params = '' then
|
||||
return 0
|
||||
end
|
||||
|
||||
convert '*' to @fm in Params
|
||||
StartDateFrom = Params<1>
|
||||
StartDateThru = Params<2>
|
||||
Reactors = Params<3>
|
||||
Service = Params<4>
|
||||
Maint = Params<5>
|
||||
Pass = Params<6>
|
||||
Other = Params<7>
|
||||
Prove = Params<8>
|
||||
Eng = Params<9>
|
||||
DetSum = Params<10>
|
||||
DirToPrinter = Params<11>
|
||||
if DetSum = 'Summary' then
|
||||
DetSum = 'DET-SUPP'
|
||||
end else
|
||||
DetSum = ''
|
||||
end
|
||||
|
||||
Stat = utility( 'CURSOR', 'H' )
|
||||
Stmt = 'SELECT REACTOR_LOG BY REACTOR BY CATEGORY BY SERVICE BY START_DATE'
|
||||
if StartDateFrom and StartDateThru then
|
||||
Stmt := " WITH START_DATE FROM ":QUOTE(StartDateFrom):' TO ':QUOTE(StartDateThru)
|
||||
end else
|
||||
if StartDateFrom then
|
||||
Stmt := " WITH START_DATE GE ":QUOTE(StartDateFrom)
|
||||
end
|
||||
if StartDateThru then
|
||||
Stmt := " WITH START_DATE LE ":QUOTE(StartDateThru)
|
||||
end
|
||||
end
|
||||
if Reactors then
|
||||
swap @vm with "' '" in Reactors
|
||||
Reactors = "'":Reactors:"'"
|
||||
Stmt := ' AND WITH REACTOR = ':Reactors
|
||||
end
|
||||
if Service then
|
||||
swap @vm with "' '" in Service
|
||||
Service = "'":Service:"'"
|
||||
Stmt := ' AND WITH SERVICE = ':Service
|
||||
end
|
||||
if ( Maint ) and ( Pass ) and ( Other ) and ( Prove ) and ( Eng ) else
|
||||
CatVar = ''
|
||||
if Maint then
|
||||
CatVar = quote('M')
|
||||
end
|
||||
if Pass then
|
||||
CatVar := ' ':quote('A')
|
||||
end
|
||||
if Other then
|
||||
CatVar := ' ':quote('O')
|
||||
end
|
||||
if Prove then
|
||||
CatVar := ' ':quote('P')
|
||||
end
|
||||
if Eng then
|
||||
CatVar := ' ':quote('E')
|
||||
end
|
||||
CatVar = trim( CatVar )
|
||||
if CatVar then
|
||||
Stmt := ' AND WITH CATEGORY = ':CatVar
|
||||
end
|
||||
end
|
||||
|
||||
rlist( Stmt, target_savelist$, ListsId, '', '' )
|
||||
|
||||
activate_save_select( ListsId )
|
||||
|
||||
if @reccount then
|
||||
Cmd = "LIST REACTOR_LOG ":DetSum:" ID-SUPP BREAK-ON REACTOR ":quote( "'V'" ):' JUSTLEN 5'
|
||||
Cmd:= " BREAK-ON CATEGORY ":quote( "'V'" ):" JUSTLEN 11 BREAK-ON SERVICE ":quote( "'V'" ):' JUSTLEN 13'
|
||||
Cmd:= " NOTES START_DATE JUSTLEN 10 START_TIME JUSTLEN 10 END_DATE JUSTLEN 8 END_TIME JUSTLEN 8 TOTAL ELAPSED_HOURS JUSTLEN 7 COLHEAD 'Hours'"
|
||||
Cmd:= " HEADING ":'"':" Run Date: 'TS39'Page 'P''LS22'Reactor Log Report "
|
||||
Cmd:= StartDateFrom:' To ':StartDateThru:'"'
|
||||
if DirToPrinter = 'Yes' then
|
||||
PrintPath = Printer_Select('',1)
|
||||
Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '', PrintPath )
|
||||
reactor_log_rpt1_prn( iconv( StartDateFrom, 'D' ), iconv( StartDateThru, 'D' ) )
|
||||
Void = set_printer( 'TERM' )
|
||||
Void = set_printer( 'INIT', '', '', '', 0, '' )
|
||||
Void = set_printer( 'TERM' )
|
||||
end else
|
||||
or_view( '', Cmd )
|
||||
Void = set_property( 'ORPRV.PRINT', 'ENABLED', 0 )
|
||||
*Void = set_property( 'ORPRV', 'VISIBLE', 3 )
|
||||
WinId = 'ORPRV'
|
||||
loop
|
||||
while get_property( WinId, 'HANDLE' )
|
||||
yield()
|
||||
repeat
|
||||
ToPrint = ''
|
||||
MsgInfo = ''
|
||||
MsgInfo<mtext$> = 'Do you want to print this report?'
|
||||
MsgInfo<micon$> = '?'
|
||||
MsgInfo<mtype$> = 'BNY'
|
||||
MsgInfo<mdefbtn$> = 2 ;* default to no
|
||||
ToPrint = msg( @window, MsgInfo )
|
||||
if ToPrint then
|
||||
activate_save_select( ListsId )
|
||||
*rlist( Cmd, 0, '', '', '' )
|
||||
Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '' )
|
||||
reactor_log_rpt1_prn( iconv( StartDateFrom, 'D' ), iconv( StartDateThru, 'D' ) )
|
||||
Void = set_printer( 'TERM' )
|
||||
Void = set_printer( 'INIT', '', '', '', 0, '' )
|
||||
Void = set_printer( 'TERM' )
|
||||
end
|
||||
end
|
||||
end else
|
||||
MsgInfo = ''
|
||||
MsgInfo<mtext$> = 'NO Records meeting your date criteria!!'
|
||||
MsgInfo<micon$> = '!'
|
||||
Void = MSG( '', MsgInfo )
|
||||
end
|
||||
|
||||
return 0
|
||||
|
Reference in New Issue
Block a user