open-insight/LSL2/STPROC/REACTOR_LOG_RPT3.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

160 lines
5.0 KiB
Plaintext

compile function REACTOR_LOG_RPT3()
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_rpt3_prn
$insert rlist_equates
$insert msg_equates
Params = dialog_box( 'REACTOR_LOG_RPT3', @window, '*CENTER' )
if Params = 'CANCEL' or Params = '' then
return 0
end
open 'SYSLISTS' to SysListsTable else
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'Unable to open SYSLISTS...'
Void = msg( '', MsgInfo )
return 0
end
ListsId = 'REACTOR_LOG_RPT3*':@station
write '' on SysListsTable, ListsId else
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'Unable to clear SYSLISTS ':ListsId:'...'
Void = msg( '', MsgInfo )
return 0
end
convert '*' to @fm in Params
StartDateFrom = Params<1>
StartDateThru = Params<2>
Reactors = Params<3>
DetSum = Params<4>
DirToPrinter = Params<5>
ItemIds = Params<6>
ProbIds = Params<7>
ServIds = Params<8>
if DetSum = 'Summary' then
DetSum = 'DET-SUPP'
end else
DetSum = ''
end
Stat = utility( 'CURSOR', 'H' )
Stmt = 'SELECT REACTOR_LOG BY REACTOR BY REACT_PROB_DESC BY REACT_SERV_DESC BY START_DATE'
* FORCE TO MAINTENANCE RECORDS
* THIS WAY NO PASS DOWN RECORDS WILL SHOW UP
Stmt := ' WITH CATEGORY = "M"'
if StartDateFrom and StartDateThru then
Stmt := ' AND WITH START_DATE FROM ':QUOTE(StartDateFrom):' TO ':QUOTE(StartDateThru)
end else
if StartDateFrom then
Stmt := " AND WITH START_DATE GE ":QUOTE(StartDateFrom)
end
if StartDateThru then
Stmt := " AND 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 ItemIds then
swap @vm with "' '" in ItemIds
ItemIds = "'":ItemIds:"'"
Stmt := ' AND WITH REACT_ITEM_IDS = ':ItemIds
end
if ProbIds then
swap @vm with "' '" in ProbIds
ProbIds = "'":ProbIds:"'"
Stmt := ' AND WITH REACT_PROB_ID = ':ProbIds
end
if ServIds then
swap @vm with "' '" in ServIds
ServIds = "'":ServIds:"'"
Stmt := ' AND WITH REACT_SERV_ID = ':ServIds
end
*IF @user4 = 'BRYCE_M' THEN
* DEBUG
*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:= " REA_DESC BREAK-ON REACT_PROB_DESC "
Cmd:= " JUSTLEN 30 BREAK-ON REACT_SERV_DESC JUSTLEN 30 REACT_ITEM_IDS REACT_ITEMS_DESC "
Cmd:= " JUSTLEN 30 REACT_ITEM_QTY JUSTLEN 4 COLHEAD 'Qty' NOTES JUSTLEN 30 START_DATE JUSTLEN 10 START_TIME JUSTLEN 10 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
*rlist( Cmd, 0, '', '', 1 )
PrintPath = Printer_Select('',1) ;* Gets default printer path
Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '', PrintPath )
reactor_log_rpt3_prn( iconv( StartDateFrom, 'D' ), iconv( StartDateThru, 'D' ), DetSum )
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<mcol$> = -2
MsgInfo<mrow$> = -2
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_rpt3_prn( iconv( StartDateFrom, 'D' ), iconv( StartDateThru, 'D' ), DetSum )
Void = set_printer( 'TERM' )
Void = set_printer( 'INIT', '', '', '', 0, '' )
Void = set_printer( 'TERM' )
end
end
end else
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'NO Records meeting your date criteria!!'
MsgInfo<micon$> = '!'
Void = MSG( '', MsgInfo )
end
write '' on SysListsTable, ListsId else
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'Unable to clear SYSLISTS ':ListsId:'...'
Void = msg( '', MsgInfo )
return 0
end
return 0