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

251 lines
7.0 KiB
Plaintext

COMPILE FUNCTION Comm_Dialog_Passdown_Rpt(Method, Parm1, Parm2)
#pragma precomp SRP_PreCompiler
/*
Commuter module for Dialog_Passdown_Rpt window.
09/24/2013 - John C. Henry, J.C. Henry & Co., Inc.
*/
DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, ErrMsg, RList, Reduce
DECLARE SUBROUTINE obj_Appwindow, Start_Window, Btree.Extract, Msg, Send_Info, FSMsg, PlaceDialog
DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Send_Message, Popup, Collect.IXVals, Msg, SRP_Array
$INSERT MSG_EQUATES
$INSERT RLIST_EQUATES
$INSERT POPUP_EQUATES
$INSERT LOGICAL
EQU CRLF$ TO \0D0A\
Equ NEW_EXIST$ To 0 ; * Reduce Mode 0
Equ NEXT_CUR$ To 1
Equ ADD_EXIST$ to 2
ErrTitle = 'Error in Comm_Dialog_Passdown_Rpt'
ErrorMsg = ''
Result = ''
BEGIN CASE
CASE Method = 'Create' ; GOSUB Create
CASE Method = 'LUReactor' ; GOSUB LUReactor
CASE Method = 'LUDate' ; GOSUB LUDate
CASE Method = 'Cancel' ; GOSUB Cancel
CASE Method = 'Refresh' ; GOSUB Refresh
CASE Method = 'PerformQuery' ; GOSUB PerformQuery
CASE 1
ErrMsg(ErrTitle:@SVM:'Unknown method ':QUOTE(Method):' passed to routine.')
END CASE
RETURN Result
* * * * * * *
Create:
* * * * * * *
// -2 Centers the dialog in the screen and makes it visible.
PlaceDialog(-2, -2)
RETURN
* * * * * * *
Refresh:
* * * * * * *
* Turn edit table symbolic column backgrounds to green
*stat = Send_Message(@WINDOW:'.CUST_INFO','COLOR_BY_POS',COL$CUST_NAME,0,GREEN$) ;* Turn names column all rows green
RETURN
* * * * * * *
LUReactor:
* * * * * * *
CtrlEntID = @WINDOW:'.REACT_NO'
CurrReactNos = Get_Property(CtrlEntID,'ARRAY')<1> ;* Existing React_Nos
CurrReactNosTrimmed = ''
FOR I = 1 TO COUNT(CurrReactNos,@VM) + (CurrReactNos NE '')
IF CurrReactNos<1,I> NE '' THEN
CurrReactNosTrimmed<1,I> = CurrReactNos<1,I>
END
NEXT I
CurrReactNos = CurrReactNosTrimmed
TypeOver = ''
TypeOver<PSELECT$> = 2 ;* Multiple Selections
NewReactNos = Popup(@WINDOW,TypeOver,'REACTORS')
IF NewReactNos = '' OR NewReactNos = CHAR(27) THEN RETURN
FOR I = 1 TO COUNT(NewReactNos,@VM) + (NewReactNos NE '')
NewReactNo = NewReactNos<1,I>
LOCATE NewReactNo IN CurrReactNos BY 'AL' USING @VM SETTING POS ELSE
CurrReactNos = INSERT(CurrReactNos,1,POS,0,NewReactNo)
END
NEXT I
Set_Property(CtrlEntID,'DEFPROP',CurrReactNos)
*Send_Event(CtrlEntID,'CALCULATE',2)
GOSUB Refresh
RETURN
* * * * * * *
LUDate:
* * * * * * *
ReturnCtrl = Parm1[1,@RM]
IF ReturnCtrl = '' THEN ReturnCtrl = Get_Property(@WINDOW,'FOCUS')
DateSelected = Dialog_Box('POPUP_YEAR',@WINDOW)
RetVal = OCONV(DateSelected, 'D4/')
IF RetVal NE '' THEN
obj_Appwindow('LUValReturn',RetVal:@RM:ReturnCtrl)
END
RETURN
* * * * * * *
Cancel:
* * * * * * *
End_Dialog(@WINDOW,'CANCEL')
RETURN
* * * * * * *
PerformQuery:
* * * * * * *
SearchString = ''
* ReactorNo *
ReactNos = Get_Property(@WINDOW:'.REACT_NO','DEFPROP')
LOOP
TestChar = ReactNos[-1,1]
UNTIL TestChar NE @VM OR ReactNos = ''
ReactNos[-1,1] = ''
REPEAT
* Start and End Dates
StartDt = OCONV(ICONV(Get_Property(@WINDOW:'.START_DT','TEXT'),'D'),'D4/')
EndDt = OCONV(ICONV(Get_Property(@WINDOW:'.END_DT','TEXT'),'D'),'D4/')
RetReactNos = ReactNos ;* Save ReactNos for use in the report heading
Flag = ""
Done = False$
CursorVar = ""
* Clears all cursors
For counter = 0 To 8
ClearSelect counter
Next counter
ReduceStartDt = OCONV(ICONV(Get_Property(@WINDOW:'.START_DT','TEXT'),'D') - 1,'D4/')
ReduceEndDt = OCONV(ICONV(Get_Property(@WINDOW:'.END_DT','TEXT'),'D') + 1,'D4/')
SortList = ''
Mode = NEXT_CUR$
BEGIN CASE
CASE StartDt NE '' AND EndDt = ''
ReduceScript = 'WITH {EVENT_DT} GT ':QUOTE(ReduceStartDt):' AND WITH {EVENT_TYPE} EQ "PD"'
CASE StartDt = '' AND EndDt NE ''
ReduceScript = 'WITH {EVENT_DT} LT ':QUOTE(ReduceEndDt):' AND WITH {EVENT_TYPE} EQ "PD"'
CASE StartDt NE '' AND EndDt NE ''
ReduceScript = 'WITH {EVENT_DT} BETWEEN ':QUOTE(ReduceStartDt):' AND ':QUOTE(ReduceEndDt):' AND WITH {EVENT_TYPE} EQ "PD"'
CASE 1
ReduceScript = 'WITH {EVENT_TYPE} EQ "PD"'
END CASE
Def = ""
Def<MTEXT$> = "Selecting Reactor Events..."
Def<MTYPE$> = "U"
MsgUp = Msg(@window, Def)
EventKeys = ''
TableName = "REACT_EVENT"
ErrorMsg = ''
Reduce(ReduceScript, SortList, Mode, TableName, Cursorvar, Flag)
If Flag then
Select TableName By SortList Using Cursorvar then
Open TableName To FileVar then
Loop
ReadNext Key Using Cursorvar By AT Else Done = True$
Until Done
EventKeys<0, -1> = Key
Repeat
IF ReactNos NE '' THEN
Open 'DICT.':TableName to DictVar then
Flag = ''
Option = ''
RxEvents = ''
SearchString = 'REACT_NO'
For each ReactNo in ReactNos using @VM setting vPos
SearchString := @VM : ReactNo
Next ReactNo
SearchString := @FM
Btree.Extract(SearchString, TableName, DictVar, RxEvents, '', Flag)
If Flag NE 0 then
ErrorMsg = 'Process Error':@FM:'Error calling Btree.Extract. Please contact FI for assistance.'
end
EventKeys = SRP_Array('Join', EventKeys, RxEvents, 'AND', @VM)
END
end
End Else
ErrorMsg = 'Process Error':@FM:'Error opening REACT_EVENT table. Please contact FI for assistance.'
End
End Else
ErrorMsg = 'Process Error':@FM:'Error selecting REACT_EVENT table. Please contact FI for assistance.'
end
End Else
ErrorMsg = 'Process Error':@FM:'Error calling Reduce subroutine. Please contact FI for assistance.'
End
Msg(@window, MsgUp)
If ErrorMsg NE '' then ErrMsg(ErrorMsg)
EventKeys = SRP_Array('SortRows', EventKeys, 'AR1':@FM:'DN2', 'LIST', @VM, '*')
End_Dialog(@WINDOW,EventKeys:@FM:RetReactNos:@FM:StartDt:@FM:EndDt)
RETURN