added LSL2 stored procedures
This commit is contained in:
160
LSL2/STPROC/REACTOR_MAINT_TODO_EVENTS.txt
Normal file
160
LSL2/STPROC/REACTOR_MAINT_TODO_EVENTS.txt
Normal file
@ -0,0 +1,160 @@
|
||||
Compile function REACTOR_MAINT_TODO_EVENTS(CtrlEntId, Event, @PARAMS)
|
||||
#pragma precomp SRP_PreCompiler
|
||||
|
||||
$insert APP_INSERTS
|
||||
$insert EVENT_SETUP
|
||||
$insert MSG_EQUATES
|
||||
$INSERT RLIST_EQUATES
|
||||
$INSERT REACT_SERVS_EQU
|
||||
$INSERT REACTOR_PM_EQU
|
||||
$INSERT REACTOR_EQUATES
|
||||
|
||||
Equ MSG_WIDTH$ to 600
|
||||
|
||||
|
||||
Declare subroutine SRP_Show_Window, Msg,SRP_Show_Window, Errmsg
|
||||
|
||||
Declare function Utility, Datetime, SRP_DateTime, SRP_SORT_ARRAY, Environment_Services
|
||||
|
||||
|
||||
SubclassInfo = Form_Services('FindSubclassControl')
|
||||
Subclass = SubclassInfo<1>
|
||||
|
||||
// Update the arguments so that the OpenInsight OLE event will treate the ActiveX event as a native event handler.
|
||||
If Event EQ 'OLE' then
|
||||
Transfer Event to OIEvent
|
||||
Transfer Param1 to Event
|
||||
Transfer Param2 to Param1
|
||||
Transfer Param3 to Param2
|
||||
* Transfer Param4 to Param3
|
||||
* Transfer Param5 to Param4
|
||||
* Transfer Param6 to Param5
|
||||
* Transfer Param7 to Param6
|
||||
* Transfer Param8 to Param7
|
||||
end
|
||||
|
||||
GoToEvent Event for CtrlEntID
|
||||
|
||||
Return EventFlow else EVENT_CONTINUE$
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Events
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Event PUB_DIR_BROWSE.CLICK
|
||||
Server = Environment_Services('GetServer')
|
||||
value = ''
|
||||
Begin Case
|
||||
Case Server EQ 'MESST5202' OR Server EQ 'MESST5201'
|
||||
value = "Select a directory" : @fm : '\\tsclient\C\Users\'
|
||||
|
||||
End Case
|
||||
|
||||
dir = Utility( "CHOOSEDIR", @window, value)
|
||||
|
||||
if dir NE '' then
|
||||
Reactor = Get_Property(@Window: '.REACT_NO','DEFPROP')
|
||||
Set_Property(@Window : '.FILE_PATH', 'DEFPROP', dir: '\PM_Active.csv')
|
||||
end
|
||||
|
||||
end event
|
||||
|
||||
Event PUB_EXPORT_TO_EXCEL.CLICK
|
||||
SaveFile = Get_Property(@Window: '.FILE_PATH', 'DEFPROP')
|
||||
DataOut = ''
|
||||
IF SaveFile NE '' then
|
||||
Void = Utility( 'CURSOR', 'H' )
|
||||
OPEN 'REACTOR_PM' TO RPMTable ELSE
|
||||
ErrMsg('Unable to open REACTOR_PM table...')
|
||||
RETURN 0
|
||||
END
|
||||
|
||||
EndDt = Date() + 60
|
||||
|
||||
Statement = 'SELECT REACTOR_PM WITH COMPLETE_DATE = "" AND WITH DUE_DT < ':QUOTE(OConv(EndDt, 'D4/')):' BY REACTOR BY-DSND NEXT_DONE'
|
||||
RList( Statement, target_activelist$, '', '', '' )
|
||||
|
||||
ReactNos = ''
|
||||
NextDueDts = ''
|
||||
ServiceIDs = ''
|
||||
|
||||
Done = 0
|
||||
LOOP
|
||||
READNEXT RPMKey ELSE Done = 1
|
||||
UNTIL Done
|
||||
READ RPMRec FROM RPMTable,RPMKey THEN
|
||||
ReactNo = RPMRec<REACTOR_PM_REACTOR$>
|
||||
ServiceID = RPMRec<REACTOR_PM_REACT_SERV_ID$>
|
||||
NextDueDt = RPMRec<REACTOR_PM_NEXT_DONE$>
|
||||
|
||||
LOCATE ReactNo IN ReactNos BY 'AR' USING @FM SETTING RPos ELSE
|
||||
ReactNos = INSERT(ReactNos,RPos,0,0,ReactNo)
|
||||
END
|
||||
|
||||
LOCATE NextDueDt IN NextDueDts<RPos> BY 'AR' USING @VM SETTING DPos ELSE
|
||||
NextDueDts = INSERT(NextDueDts,RPos,DPos,0,NextDueDt)
|
||||
ServiceIDs = INSERT(ServiceIDs,RPos,DPos,0,ServiceID)
|
||||
END
|
||||
END ;* End of RPMRec read
|
||||
REPEAT
|
||||
|
||||
Lines = ''
|
||||
|
||||
ReactCnt = COUNT(ReactNos,@FM) + (ReactNos NE '')
|
||||
|
||||
PrevReactNo = ''
|
||||
FOR R = 1 TO ReactCnt
|
||||
ReactNo = ReactNos<R>
|
||||
ndCnt = COUNT(NextDueDts<R>,@VM) + (NextDueDts<R> NE '')
|
||||
|
||||
FOR I = 1 TO ndCnt
|
||||
NextDueDt = OCONV(NextDueDts<R,I>,'D4/')
|
||||
ServiceID = ServiceIDs<R,I>
|
||||
Service = XLATE('REACT_SERVS',ServiceID,REACT_SERVS_DESCRIPTION$,'X' )
|
||||
|
||||
Lines<-1> = ReactNo : "," :NextDueDt:',':ServiceID:',':Service
|
||||
NEXT I
|
||||
|
||||
NEXT R
|
||||
HeaderOut = 'REACTOR,PM DUE DATE,SERVICE ID,SERVICE DESC':crlf$
|
||||
For Each line in Lines using @FM
|
||||
For a = 1 to COUNT(line,@VM)
|
||||
line<1,a> = QUOTE(line<1,a>)
|
||||
Next a
|
||||
DataOut := line: crlf$
|
||||
Next line
|
||||
|
||||
OSOPEN SaveFile TO hFilePath THEN
|
||||
OSWrite DataOut ON SaveFile ;* Clear file it was already there
|
||||
END ELSE
|
||||
OSWrite DataOut ON SaveFile ;* Create the file if it wasn't
|
||||
OSOPEN SaveFile TO hFilePath ELSE
|
||||
Msg(@Window, 'Unable to write the file!')
|
||||
RETURN ''
|
||||
END
|
||||
END
|
||||
|
||||
FilePointer = 0
|
||||
|
||||
OSBWrite HeaderOut ON SaveFile AT FilePointer
|
||||
FilePointer += LEN(HeaderOut)
|
||||
|
||||
OSBWrite DataOut ON SaveFile AT FilePointer
|
||||
OSClose hFilePath
|
||||
Msg(@Window, 'Successfuly wrote file at ' : SaveFile : '.')
|
||||
|
||||
end else
|
||||
msg(@Window,'Must enter a valid location to save export!')
|
||||
return
|
||||
end
|
||||
end event
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal GoSubs
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Setup_OLE_Controls:
|
||||
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user