Compile function WO_DAILY_SCHED_SINGLE_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        :   WO_Daily_Sched_Single_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)
        09/08/22    djs     Created initial commuter module.

***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
#window WO_DAILY_SCHED_SINGLE

$insert APP_INSERTS
$insert EVENT_SETUP
$insert WO_STEP_EQUATES
$insert POPUP_EQUATES
$INSERT LOGICAL
$insert SECURITY_RIGHTS_EQU

Declare subroutine  security_err_msg, Reactor_Log_Services, ErrMsg, Start_Window
Declare function    security_check, Error_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 else
    // Event not implemented
end

Return EventFlow or 1

//-----------------------------------------------------------------------------
// EVENT HANDLERS
//-----------------------------------------------------------------------------

Event PUB_RDS_QUICKVIEW.CLICK()
    
    CurWoVal = get_property( @window:'.WOCUST', 'TEXT' )

    CurWoVal  = CurWoVal[1,' ']
    HoldWoVal = CurWoVal
    
    
    swap '52nd' with '' in CurWoVal
    convert @upper_case to '' in CurWoVal
    convert @lower_case to '' in CurWoVal
    convert " `~!@#$%^&*()_+-=\][{}|';:/?.>,<" to '' in CurWoVal
    convert '"' to '' in CurWoVal
    
    IF LEN(CurWoVal) = 7 THEN
        WOStepKey = CurWoVal[1,6]:'*':CurWoVal[7,1]
    END ELSE
        WOStepKey = CurWoVal:'*1'
    END
    WONo = WOStepKey[1,6]
    
    RDSKeys = Dialog_Box('NDW_RDS_QUERY', 'NDW_MAIN', WONo : @FM : 'quick')
    If RDSKeys NE '' then
        Start_Window( 'RDS', @window, RDSKeys:'*CENTER', '', '' )
    end
    
End Event


Event PUB_WMO_QUICKVIEW.CLICK()
    
    CurWoVal = get_property( @window:'.WOCUST', 'TEXT' )

    CurWoVal  = CurWoVal[1,' ']
    HoldWoVal = CurWoVal
    
    
    swap '52nd' with '' in CurWoVal
    convert @upper_case to '' in CurWoVal
    convert @lower_case to '' in CurWoVal
    convert " `~!@#$%^&*()_+-=\][{}|';:/?.>,<" to '' in CurWoVal
    convert '"' to '' in CurWoVal
    
    IF LEN(CurWoVal) = 7 THEN
        WOStepKey = CurWoVal[1,6]:'*':CurWoVal[7,1]
    END ELSE
        WOStepKey = CurWoVal:'*1'
    END
    WONo = WOStepKey[1,6]
    
    RdsKeys = ''
    
    RDSKeys = XLATE('WO_STEP',WOStepKey,WO_STEP_RDS_KEY$,'X')
    
    TypeOver = ''
    TypeOver<PMODE$> = 'K'
    TypeOver<PDISPLAY$> = RDSKeys

    WMOKeys = Dialog_Box('NDW_WM_OUT_QUICK_QUERY', @Window, WONo)
    
    IF WMOKeys NE '' THEN

        Void = start_window( 'WM_OUT', @window, WMOKeys, '', '' )

    END
    
End Event


Event EDT_LOADED_CASSETTES.DBLCLK(CtrlKey, ShiftKey, MouseButton)

    RowData  = Get_Property(CtrlEntID, 'ROWDATA')
    SelRDSNo = RowData<1>
    Void     = start_window( 'RDS', @window, SelRDSNo:'*CENTER', '', '' )
    
end event


Event PUB_ADD_COMMENT.CLICK()
    
    Reactor   = Get_Property(@Window:'.RWL', 'TEXT')
    Swap '(' with '' in Reactor
    Swap ')' with '' in Reactor
    Response  = Dialog_Box('NDW_ADD_COMMENT', @Window, True$)
    OkClicked = Response<1>
    NewNote   = Response<2>
    If OkClicked and NewNote NE '' then
        Reactor_Log_Services('AddComment', Reactor, NewNote, @User4)
        If Error_Services('NoError') then
            MsgStruct    = ''
            MsgStruct<4> = '*' ; // Present Info Icon
            Msg(@Window, MsgStruct, 'OK', '', 'Success':@FM:'Note saved!')
        end else
            ErrMsg(Error_Services('GetMessage'))
        end
    end
    
end event







