Compile function RDS_UNLOAD_LOAD_EX_EVENTS(CtrlEntId, Event, @PARAMS) /*********************************************************************************************************************** This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written permission from Infineon. Name : RDS_Unload_Load_Ex_Events Description : This function acts as a commuter module for all events related to this window. Notes : Commuter Modules are automatically called from the Promoted_Events function which is called by the application-specific promoted event handler. This makes it possible to add QuickEvents that need to execute Basic+ logic without having use the Form Designer to make the association, although this is limited to the events which are currently promoted. If the form needs to call the commuter module directly then the QuickEvent parameters should be formatted like this: '@SELF','@EVENT',['@PARAM1','@PARAMx'] Parameters : CtrlEntId [in] -- The fully qualified name of the control calling the promoted event Event [in] -- The event being executed. See the Notes section regarding "PRE" events Param1-15 [in] -- Additional event parameter holders EventFlow [out] -- Set to 1 or 0 so the calling event knows whether or not to chain forward. See comments in EVENT_SETUP insert History : (Date, Initials, Notes) 10/26/2021 djs Created initial commuter module. ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler #window RDS_UNLOAD_LOAD_EX $insert APP_INSERTS $insert EVENT_SETUP $insert RDS_EQUATES Declare subroutine ErrMsg, Database_Services Declare function Database_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$ //----------------------------------------------------------------------------- // EVENT HANDLERS //----------------------------------------------------------------------------- Event WINDOW.CREATE(CreateParam) EventFlow = 1 End Event Event OO_EX1_DATE.LOSTFOCUS(Flag, FocusID) // Compare to original LOAD date (DATE_IN) RDSNo = Get_Property('RDS.RDS_NO', 'TEXT') PrevDt = Xlate('RDS', RDSNo, 'DATE_IN', 'X') GoSub VerifyDate end event Event OI_EX2_DATE.LOSTFOCUS(Flag, FocusID) // Compare to UNLOAD Extra 1 RDSNo = Get_Property('RDS.RDS_NO', 'TEXT') PrevDt = Xlate('RDS', RDSNo, 'OP_OUT_EX1_DATE', 'X') GoSub VerifyDate end event Event OO_EX2_DATE.LOSTFOCUS(Flag, FocusID) // Compare to LOAD Extra 2 RDSNo = Get_Property('RDS.RDS_NO', 'TEXT') PrevDt = Xlate('RDS', RDSNo, 'OP_IN_EX2_DATE', 'X') GoSub VerifyDate end event Event OI_EX3_DATE.LOSTFOCUS(Flag, FocusID) // Compare to UNLOAD Extra 2 RDSNo = Get_Property('RDS.RDS_NO', 'TEXT') PrevDt = Xlate('RDS', RDSNo, 'OP_OUT_EX2_DATE', 'X') GoSub VerifyDate end event //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal GoSubs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// VerifyDate: Error = True$ DateVal = IConv(Get_Property(CtrlEntID, 'TEXT'), 'D') Begin Case Case DateVal GT Date() ErrorMsg = 'Invalid date ':OConv(DateVal, 'D/'):'! ' ErrorMsg := 'Date cannot be in the future!' Case DateVal LT PrevDt ErrorMsg = 'Invalid date ':OConv(DateVal, 'D/'):'! ' ErrorMsg := 'Date cannot be before the previous LOAD/UNLOAD EXTRA/LOAD EXTRA date ':OConv(PrevDt, 'D/'):'.' Case Otherwise$ Error = False$ End Case If Error then ErrMsg(ErrorMsg) // Return focus to control and highlight the invalid date entered. Set_Property(CtrlEntID, 'FOCUS', True$) Set_Property(CtrlEntID, 'SELECTION', 1:@FM:65534) end return