Compile function COMM_OVERRIDE_REPORT(Method) #pragma precomp SRP_PreCompiler Declare function Get_Property, SRP_DateTime, Datetime, RList, SRP_SORT_ARRAY Declare Subroutine Errmsg, Btree.Extract, RList, Set_Property $Insert OVERRIDE_LOG_EQUATES ErrTitle = 'Error in Comm_RDS' ErrorMsg = '' Result = '' BEGIN CASE CASE Method = 'Search' ; GOSUB Search CASE Method = 'SearchTypeControls' ; GOSUB SearchTypeControls CASE 1 ErrMsg(ErrTitle:@SVM:'Unknown method ':QUOTE(Method):' passed to routine.') END CASE Return Result * * * * * * * * Search: * * * * * * * * SearchType = Get_Property(@WINDOW:'.REPORT_BY','DEFPROP') Filter = Get_Property(@WINDOW:'.ITEM_FILTER','DEFPROP') DateFrom = Get_Property(@WINDOW:'.DATE_FROM','DEFPROP') DateFrom = ICONV(DateFrom,'DT') DateTo = Get_Property(@WINDOW:'.DATE_TO','DEFPROP') DateTo = ICONV(DateTo,'DT') IF DateTo EQ '' then DateTo = DateTime() end IF DateFrom EQ '' then DateFrom = SRP_DateTime('AddDays', DateTo, -7) end dataarray = '' open "OVERRIDE_LOG" To OverRideTable else Status = Set_FSError() return end select OverRideTable Begin Case Case SearchType = 'ALL' Done = 0 Loop ReadNext @ID else Done = 1 Until Done Do read @Record from OverRideTable, @ID else status = Set_FSError() return end RecordTime = @RECORD IF RecordTime GE DateFrom AND RecordTime LE DateTo Then RecToWrite = @Record User = @Record Comment = @Record LogTime = OCONV(@Record,'DT4/HS') Category = @Record DynamicValues = @Record dataarray:= User :@VM:Comment:@VM:LogTime:@VM:Category :@VM:DynamicValues :@FM end Repeat DynamicFields = @RECORD swap @VM with @FM in DynamicFields HeaderText = Get_Property(@WINDOW:'.OVERRIDE_TABLE','LABEL') HeaderText<5> = DynamicFields Set_Property(@WINDOW:'.OVERRIDE_TABLE','LABEL',HeaderText) ////////////////////// Case SearchType = 'RDS' Or SearchType = 'REACTOR' Done = 0 Loop ReadNext @ID else Done = 1 Until Done Do read @Record from OverRideTable, @ID else status = Set_FSError() return end RecordTables = @RECORD RecordKeys = @RECORD Locate SearchType in RecordTables using @VM setting tPos then RecordTime = @RECORD IF RecordTime GE DateFrom AND RecordTime LE DateTo AND RecordKeys<1,tPos> EQ Filter Then RecToWrite = @Record User = @Record Comment = @Record LogTime = OCONV(@Record,'DT4/HS') Category = @Record DynamicValues = @Record dataarray:= User :@VM:Comment:@VM:LogTime:@VM:Category :@VM:DynamicValues :@FM end end Repeat //////////////////// Case SearchType = 'OVERRIDE' debug OverrideFilter = Get_Property(@WINDOW:'.OVERRIDE_TYPE','DEFPROP') Done = 0 Loop ReadNext @ID else Done = 1 Until Done Do read @Record from OverRideTable, @ID else status = Set_FSError() return end RecordTime = @RECORD IF RecordTime GE DateFrom AND RecordTime LE DateTo AND @RECORD EQ OverrideFilter Then RecToWrite = @Record User = @Record Comment = @Record LogTime = OCONV(@Record,'DT4/HS') Category = @Record DynamicValues = @Record dataarray:= User :@VM:Comment:@VM:LogTime:@VM:Category :@VM:DynamicValues :@FM end Repeat Case SearchType = 'USER' debug Done = 0 Loop ReadNext @ID else Done = 1 Until Done Do read @Record from OverRideTable, @ID else status = Set_FSError() return end RecordTime = @RECORD IF RecordTime GE DateFrom AND RecordTime LE DateTo AND @RECORD EQ Filter Then RecToWrite = @Record User = @Record Comment = @Record LogTime = OCONV(@Record,'DT4/HS') Category = @Record DynamicValues = @Record dataarray:= User :@VM:Comment:@VM:LogTime:@VM:Category :@VM:DynamicValues :@FM end Repeat End Case dataarray = SRP_SORT_Array(dataarray, "DR3", 1) Set_Property(@WINDOW:'.OVERRIDE_TABLE','LIST',dataarray) HeaderText = Get_Property(@WINDOW:'.OVERRIDE_TABLE','LABEL') * HeaderText = HeaderText:CHAR(13):'' * HeaderText = HeaderText:CHAR(13):'' * HeaderText = HeaderText:CHAR(13):'' * HeaderText = HeaderText:CHAR(13):'' * HeaderText = HeaderText:CHAR(13):'' * * Set_Property(@WINDOW:'.LS_TABLE','LABEL',HeaderText) //NewList = SRP_Sort_Array(List, "AL2", 1) //Set_Property(@Window:".EDT_TEST", "LIST", NewList) return //Set the correct filter label and enable field * * * * * * * * SearchTypeControls: * * * * * * * * Selection = Get_Property(@WINDOW:'.REPORT_BY','DEFPROP') //Set the correct filter label and enable field IF Selection EQ 'ALL' then Set_Property(@Window:'.ITEM_FILTER', 'ENABLED', -1) Set_Property(@WINDOW:'.LABEL_FILTER','TEXT','') end else IF Selection EQ 'OVERRIDE' THEN Set_Property(@Window:'.OVERRIDE_TYPE', 'ENABLED', 1) Set_Property(@Window:'.ITEM_FILTER', 'ENABLED', -1) Set_Property(@WINDOW:'.LABEL_FILTER','TEXT','') end else Set_Property(@Window:'.ITEM_FILTER', 'ENABLED', 1) Set_Property(@WINDOW:'.LABEL_FILTER','TEXT',Selection : '#:') Set_Property(@Window:'.OVERRIDE_TYPE', 'ENABLED', 0) end end return * * * * * * * * ExportCSV: * * * * * * * *