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

155 lines
3.9 KiB
Plaintext

compile function REACTOR_LOG_SRPT2()
declare function msg, send_event, dialog_box, utility, Set_Printer, PrintSetup, obj_Install
declare subroutine rlist, activate_save_select, or_view
$insert rlist_equates
$insert msg_equates
$insert rpt_cfg_equ
$INSERT PRINTSETUP_EQUATES
TimeX = Oconv(Time(),'MTS')
CrLf = Char(13):Char(10)
CurDte = OCONV(Date(),"D4/")
ReportID = "REACTOR_LOG002_SRPTCFG"
ReportControl = "REACTOR_LOG_SRPT2"
TableName = 'REACTOR_LOG'
ListsId = ReportControl:'*':@station
TtlLin1 = ''
TtlLin2 = ''
TtlLin3 = ''
TtlLin4 = ''
TtlLin5 = ''
open 'CONFIG' to ConfigTable else
Void = msg( '', 'Unable to open CONFIG...' )
return 0
end
Read SRptConfig From ConfigTable,ReportID Else
Void = msg( '', 'Unable to read ': ReportID:' From CONFIG table!' )
return 0
End
Params = dialog_box( ReportControl, @window, '*CENTER' )
if Params = 'CANCEL' or Params = '' then
return 0
end
convert '*' to @fm in Params
BegDte = Params<1>
EndDte = Params<2>
Reactors = Params<3>
Void = utility( 'CURSOR', 'H' )
WithStmt = 'SELECT ':TableName:' '
WthSwt = 0
Begin Case
Case BegDte and EndDte
TtlLin2 = 'Start Dates: From ':BegDte:' To ':EndDte
WithStmt := " WITH START_DATE FROM '": BegDte:"' TO '":EndDte: "' "
WthSwt = 1
Case BegDte
TtlLin2 = 'Start Dates: From ':BegDte:' To ':CurDte
WithStmt := " WITH START_DATE GE '":BegDte:"' "
WthSwt = 1
Case EndDte
TtlLin2 = 'Start Dates: From Earliest To ':EndDte
WithStmt := " WITH START_DATE LE '":EndDte:"' "
WthSwt = 1
Case 1
TtlLin2 = 'Start Dates: ALL'
End Case
If Reactors then
RCnt = Count(@vm,Reactors)
If RCnt > 20 Then
TtlLin3 = 'Reactors: More Than 20 Selected'
End Else
TtlLin3 = Reactors
swap @vm with ", " in TtlLin3
TtlLin3 = 'Reactors: ':TtlLin3
End
swap @vm with "' '" in Reactors
Reactors = "'":Reactors:"'"
If WthSwt Then WithStmt := ' AND '
WithStmt := ' WITH REACTOR = ':Reactors
WthSwt = 1
end else
TtlLin3 = 'Reactors ALL'
end
*OsWrite WithStmt To 'C:\WithStmt.Txt'
rlist( WithStmt, target_savelist$, ListsId, '', '' )
activate_save_select( ListsId )
Script = SRptConfig<SlistScript$>
*SEE SCHED_SRPT1 FOR LIMITS CLAUSE...
RptWdt = SRptConfig<Width$>
Title = obj_Install('Get_Prop','CompTitle'):' ':SRptConfig<Title$>
Margin = INT((RptWdt - LEN(Title))/2)
LMargin = Margin - 10 ;* 10 equals length of the date
RMargin = Margin - 8 ;* 8 equals length of 'Page....'
Title = OCONV(Date(),'D4/'):SPACE(LMargin):Title:SPACE(RMargin):"Page'PP''L'"
SWAP '~Title~' WITH Title IN Script
TitleLine2 = TtlLin2
TitleLine3 = TtlLin3
TitleLine4 = TtlLin4
IF TitleLine2 NE '' THEN
Margin = INT((RptWdt - LEN(TitleLine2))/2)
LMargin = Margin - 7 ;* 7 equals length of time (12:15PM)
RMargin = Margin
TitleLine2 = OCONV(Time(),'MTH'):SPACE(LMargin):TitleLine2:SPACE(RMargin)
SWAP '~SecondTitleLine~' WITH TitleLine2 IN Script
END ELSE
SWAP '~SecondTitleLine~' WITH '' IN Script
END
IF TitleLine3 NE '' THEN
Margin = INT((RptWdt - LEN(TitleLine3))/2)
SWAP '~ThirdTitleLine~' WITH "'L'":TitleLine3 IN Script
END ELSE
SWAP '~ThirdTitleLine~' WITH '' IN Script
END
IF TitleLine4 NE '' THEN
Margin = INT((RptWdt - LEN(TitleLine4))/2)
SWAP '~FourthTitleLine~' WITH "'L'":TitleLine4 IN Script
END ELSE
SWAP '~FourthTitleLine~' WITH '' IN Script
END
*OsWrite Script To "C:\SLIST.txt"
* Added after upgrade to OI4.13a to reset default printer in OIPI32 engine.
PrintCount = PrintSetup(PRN_GET$,'',Printers,DefaultPrinter)
CONVERT ',' TO @FM IN DefaultPrinter
DefPrintPath = DefaultPrinter<1>:@FM:DefaultPrinter<3>
Void = set_printer( 'INIT', '', '', .63:@fm:.63:@fm:.25:@fm:'', 0,'',DefPrintPath )
Void = Set_Printer('TERM')
call slist( Script )
Void = utility( 'CURSOR', 'A' )
RETURN 0