Function NDW_Makeup_Wafer_NCR_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        :   NDW_Makeup_Wafer_NCR_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)
        02/12/19    djs  Duplicated from NDW_MAKEUP_WAFER_EVENTS.
        02/11/22    djs  Fixed a typo in the PUB_AUTO_NCR.CLICK() event.

***********************************************************************************************************************/

#pragma precomp SRP_PreCompiler
#Window NDW_MAKEUP_WAFER_NCR

$insert APP_INSERTS
$insert EVENT_SETUP
$insert WO_MAT_EQUATES
$insert MSG_EQUATES
$insert WM_OUT_EQUATES

Declare subroutine  SRP_EditTable_Manager, SRP_Show_Window, BTree.Extract, Database_Services, Set_Status, ErrMsg
Declare subroutine  Obj_WO_Wfr, Obj_Notes
Declare function    SRP_EditTable_Manager, Database_Services, Material_Services, SRP_Array, Obj_NCR, ErrMsg

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 WINDOW.CREATE(CreateParam)

    // Get all work orders associated with the now inactive PSN. Use first work order found to find
    // makeup wafers associated with the now inactive PSN.
    // AllMakeupWafers = Material_Services('GetAvailableMakeupWafers', ThisWorkOrderNo, False$)
    InactivePSN         = CreateParam
    Set_Property(@Window, '@INACTIVE_PSN', InactivePSN)
    AllMakeupWafers     = ''
    WorkOrderList       = ''
    SearchTable         = 'WO_LOG'
    SearchString        = 'PS_NO' : @VM : InactivePSN : @FM
    hDictSearchTable    = Database_Services('GetTableHandle', 'DICT.' : SearchTable)   
    If Error_Services('NoError') then
        rv              = Set_Status(0)
        Flag            = ''
        StatusCode      = ''
        Btree.Extract(SearchString, SearchTable, hDictSearchTable, WorkOrderList, '', Flag)
        If Get_Status(StatusCode) then
            Error_Services('Add', 'Error calling Btree.Extract in the ':Event:' event. StatusCode: ':StatusCode)
        end else
            If WorkOrderList NE '' then
                // We just need one work order with this PSN to lookup available makeup wafers
                WorkOrderNo = WorkOrderList<1,1>
                WOMakeupWafers = ''
                WOMakeupWafers = Material_Services('GetAvailableMakeupWafers', WorkOrderNo, False$)
                SignedWafers   = ''
                UnsignedWafers = ''
                If WOMakeupWafers NE '' then
                    SignedWafers    = WOMakeupWafers<1>
                    UnsignedWafers  = WOMakeupWafers<2>
                end
                AllMakeupWafers = SRP_Array('Join', AllMakeupWafers, SignedWafers, 'OR', @VM)
                AllMakeupWafers = SRP_Array('Join', AllMakeupWafers, UnsignedWafers, 'OR', @VM)
            end
        end
    end

    GoSub Setup_OLE_Controls

    SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$, FormSize)

end event


Event WINDOW.READ()

end event


Event WINDOW.CLOSE(CancelFlag)

end event


Event WINDOW.CLEAR(bSaveKey, bSuppressWarning, bMaintainFocus, CtrlIDFocus)

end event


Event PUB_AUTO_NCR.CLICK()
    
    ErrorMsg    = ''
    InternalDTM = IConv(OConv(Date(),'D'):' ':OConv(Time(),'MT'), 'DT')
    // To do: NCR all makeup wafers and send a message to Dan S. and Mark C.
    WafersToNCR = Get_Property(@Window:'.OLE_RPT_WAFERS_TO_NCR', 'OLE.List')
    InactivePSN = Get_Property(@Window, '@INACTIVE_PSN')
    ReactType   = Xlate('PROD_SPEC', InactivePSN, 'REACTOR_TYPE', 'X')
    If InactivePSN NE '' then
        If (ReactType EQ 'EPP') or (ReactType EQ 'P') then
            // EpiPro Routine - Code adapted from COMM_WM_OUT('RejMat')
            For each Row in WafersToNCR              
                WoNo        = Row<0,1>
                CassNo      = Row<0,2>
                SAPBatchNo  = Row<0,3>
                MakeupPSN   = Row<0,4>
                CustPartNo  = Row<0,5>
                CurrWfrQty  = Row<0,6>
                RDSNo       = Row<0,7>         
                WOStep		= 1
                OutCassNo	= CassNo
                WMOKey      = WONo:'*':WOStep:'*':OutCassNo
                Database_Services('ActivateRecord', 'WM_OUT', WMOKey)
                InCassNos 	= ''
                InSlotNos	= ''
                RDSNos		= ''
                PocketNos	= ''
                Zones		= ''
                OutSlotNos	= ''
                OutCassNos	= ''
                SlotNCRs	= ''
                MUWONos		= ''
                MUWOSteps	= ''
                MUCassIDs	= ''
                MUSlotNos	= ''
                GoodLines   = 0
                LastSlot    = 25
                For vPos = 1 to LastSlot ;// NCR all wafers that meet the following criteria.
                    If ({UMW_CASS_ID}<0,vPos> EQ '') and ({RDS}<0,vPos> NE '') and (({SLOT_NCR}<0,vPos> EQ '') or ({MU_WO_NO}<0,vPos> NE '')) then
                        GoodLines += 1
                        RDSNos<1,GoodLines> 	= {RDS}<0,vPos>
                        InCassNos<1,GoodLines>	= {IN_CASS_NO}<0,vPos>
                        InSlotNos<1,GoodLines>	= {IN_SLOT_NO}<0,vPos>
                        PocketNos<1,GoodLines>	= {POCKET}<0,vPos>
                        Zones<1,GoodLines>		= {ZONE}<0,vPos>
                        OutSlotNos<1,GoodLines>	= {SLOT_NO}<0,vPos>
                        OutCassNos<1,GoodLines> = OutCassNo                     
                        SlotNCRs				= {SLOT_NCR}<0,vPos>
                        MUWONos					= {MU_WO_NO}<0,vPos>
                        MUWOSteps				= {MU_WO_STEP}<0,vPos>
                        MUCassIDs				= {MU_CASS_NO}<0,vPos>
                        MUSlotNos				= {MU_SLOT_NO}<0,vPos>         
                    end
                Next vPos
                If GoodLines NE False$ then       
                    ncrParms  = WONo:@RM
                    ncrParms := WOStep:@RM
                    ncrParms := OutCassNo:@RM			;* Place holder for WO_MAT_CASS_NO **** Changed 9/26/2011 JCH
                    ncrParms := '':@RM					;* Single RDS field (Non-EpiPro)
                    ncrParms := '':@RM					;* Reactor No (Non-EpiPro)					
                    ncrParms := 'POST':@RM              ;* Stage
                    ncrParms := InCassNos:@RM           ;* InCassNos
                    ncrParms := InSlotNos:@RM           ;* InSlotNos
                    ncrParms := PocketNos:@RM           ;* Pocket Numbers
                    ncrParms := Zones:@RM               ;* Zones
                    ncrParms := OutCassNos:@RM          ;* OutCassNos
                    ncrParms := OutSlotNos:@RM          ;* OutSlotNos
                    ncrParms := RDSNos:@RM              ;* Multiple RDS Numbers (EpiPro)
                    ncrParms := '':@RM					;* Placeholder for RejWaferIDS	
                    ncrParms := SlotNCRs:@RM			;* Previous NCR No's				
                    ncrParms := MUWONos:@RM             ;* Makeup Work Order Numbers
                    ncrParms := MUWOSteps:@RM           ;* Makeup Work Order Steps
                    ncrParms := MUCassIDs:@RM           ;* Makeup Cassette IDs
                    ncrParms := MUSlotNos:@RM           ;* Makeup Slot Numbers
                    ncrParms := 'C':@RM                 ;* Loss By
                    ncrParms := 'PSN Inactive':@RM      ;* Containment Actions
                    ncrParms := 'PSN Inactive':@RM      ;* Loss Comments
                    ncrParms := 'PSN Inactive':@RM      ;* AC Comments
                    ncrParms := 'Customer':@RM          ;* Department Responsible
                    ncrParms := '365':@RM               ;* AC Code
                    ncrParms := 'D58':@RM               ;* Loss Code
                    ncrParms := 'C':@RM                 ;* NCR Status - Closed
                    ncrParms := '0':@RM                 ;* Shift
                    ncrParms := @USER4:@RM              ;* Shipment Signature
                    ncrParms := @USER4:@RM              ;* Reject Signature
                    ncrParms := InternalDTM:@RM         ;* Sent to SPC Datetime
                    ncrParms := InternalDTM:@RM         ;* Shipment Signature Datetime
                    ncrParms := 'Production'            ;* Department Handled
                    
                    Set_Status(0)
                    NCRNo       = obj_NCR('Create',ncrParms)	;* Create new NCR for this wafer/group of wafers                   
                    errCode = ''
                    IF Get_Status(errCode) THEN
*                        ErrMsg(errCode)
                        ErrorMsg = errCode
                    END ELSE
                        RejDTM = OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTS')              
                        RejWfrIDs	= ''
                        CurrSlotIDs = ''
                       
                        FOR N = 1 TO COUNT(OutSlotNos,@VM) + (OutSlotNos NE '')               
                            * * * *   Added 4/23/2016  JCH - wafer history   * * * *                    
                            CurrSlotID 	= WONo:'*':OutCassNos<1,N>:'*':OutSlotNos<1,N>                  
                            CurrSlotIDs<1,-1> = CurrSlotID                                       
                            IF MUWONos<1,N> = '' THEN
                                RejWfrID = WONo:'*':InCassNos<1,N>:'*':InSlotNos<1,N>
                            END ELSE
                                RejWfrID = MUWONos<1,N>:'*':MUCassIDs<1,N>:'*':MUSlotNos<1,N>
                            END                    
                            RejWfrIDs<1,-1> = RejWfrID                   
                            Parms  = RejWfrID:@RM			;* WfrID
                            Parms := RejDTM:@RM				;* EventDtm
                            Parms := @USER4:@RM				;* EventBy
                            Parms := 'NCR':@RM				;* Event
                            Parms := '':@RM					;* NewSlotID
                            Parms := '':@RM					;* RunLoc
                            Parms := NCRNo:@RM				;* NCRNo
                            Parms := '':@RM					;* TWUse
                            Parms := CurrSlotID:@RM			;* CurrSlotID
                            Parms := '':@RM					;* NewToolID
                            Parms := '':@RM					;* CurrToolID
                            Parms := '':@RM					;* NewInvLoc
                            Parms := '':@RM					;* CurrInvLoc
                            Parms := 'O'					;* Wfr Side
                            obj_WO_Wfr('AddEvent',Parms)                               
                            LineNo = OutSlotNos<1,N>
*                            @Record<WM_OUT_RDS$,LineNo>         = ''
*                            @Record<WM_OUT_POCKET$,LineNo>      = ''
*                            @Record<WM_OUT_ZONE$,LineNo>        = ''
*                            @Record<WM_OUT_IN_CASS_NO$,LineNo>  = ''
*                            @Record<WM_OUT_IN_SLOT_NO$,LineNo>  = ''
*                            @Record<WM_OUT_SLOT_NCR$,LineNo>    = NCRNo
*                            @Record<WM_OUT_WO_NO$,LineNo>       = ''
*                            @Record<WM_OUT_MU_WO_STEP$,LineNo>  = ''
*                            @Record<WM_OUT_MU_CASS_NO$,LineNo>  = ''
*                            @Record<WM_OUT_MU_SLOT_NO$,LineNo>  = ''                   
                        NEXT N            
                    END

*                    Database_Services('WriteDataRow', 'WM_OUT', WMOKey, @Record, True$, False$, True$)
                  
                end else
                    ErrorMsg = 'Error occurred while attempting to automatically NCR EpiPro makeup wafers. ' |
                             : @SVM:'Notify FI team.'
*                    ErrMsg(ErrorMsg)
                end
                             
            Next Row         
        end else
            AllRDS            = ''
            AllWorkOrders     = ''
            AllCass           = ''
            // Non-EpiPro Routine - Code adapted from COMM_WO_MAT_WFR('RejMat')    
            For each Row in WafersToNCR
                WoNo                = Row<0,1>
                AllWorkOrders<0,-1> = WoNo
                CassNo              = Row<0,2>
                AllCass<0,-1>       = CassNo
                SAPBatchNo          = Row<0,3>
                MakeupPSN           = Row<0,4>
                CustPartNo          = Row<0,5>
                CurrWfrQty          = Row<0,6>
                RDSNo               = Row<0,7>
                AllRDS<0,-1>        = RDSNo
                WOStepNo            = 1   
                Reactor             = Xlate('RDS', RDSNo, 'REACTOR', 'X')
                WOMatKey            = WONo:'*':CassNo
                Database_Services('ActivateRecord', 'WO_MAT', WOMatKey)
                WaferIDs            = {SLOT_WAFER_ID}
                GoodLines           = 0
                RejWaferIDs         = ''
                PrevNCRNos          = ''
                SlotNos             = ''
                For each WaferID in WaferIDs using @VM setting vPos
                    If WaferID NE '' then
                        GoodLines += 1
                        RejWaferIDs<0,GoodLines> = WaferID
                        PrevNCRNos<0,GoodLines>  = {SLOT_NCR}<0,vPos>
                        SlotNos<0,GoodLines>     = {SLOT_NO}<0,vPos>        
                    end
                Next WaferID

                ncrParms  = WONo:@RM
                ncrParms := WOStepNo:@RM
                ncrParms := CassNo:@RM				;* Place holder for WO_MAT_CASS_NO
                ncrParms := RDSNo:@RM				;* Single RDS field 
                ncrParms := Reactor:@RM				;* Reactor No
                ncrParms := 'POST':@RM				;* Stage
                ncrParms := '':@RM					;* InCassNos
                ncrParms := SlotNos:@RM				;* InSlotNos
                ncrParms := '':@RM					;* PockeNots
                ncrParms := '':@RM					;* Zones
                ncrParms := '':@RM					;* OutCassNos
                ncrParms := '':@RM					;* OutSlotNos
                ncrParms := '':@RM					;* Multiple RDSNos (EpiPro)
                ncrParms := RejWaferIDs:@RM			;* Rejected Wafer ID's
                ncrParms := PrevNCRNos:@RM			;* Previous NCR No's
                ncrParms := '':@RM                  ;* Makeup Work Order Numbers
                ncrParms := '':@RM                  ;* Makeup Work Order Steps
                ncrParms := '':@RM                  ;* Makeup Cassette IDs
                ncrParms := '':@RM                  ;* Makeup Slot Numbers
                ncrParms := 'C':@RM                 ;* Loss By
                ncrParms := 'PSN Inactive':@RM      ;* Containment Actions
                ncrParms := 'PSN Inactive':@RM      ;* Loss Comments
                ncrParms := 'PSN Inactive':@RM      ;* AC Comments
                ncrParms := 'Customer':@RM          ;* Department Responsible
                ncrParms := '365':@RM               ;* AC Code
                ncrParms := 'D58':@RM               ;* Loss Code
                ncrParms := 'C':@RM                 ;* NCR Status - Closed
                ncrParms := '0':@RM                 ;* Shift
                ncrParms := @USER4:@RM              ;* Shipment Signature
                ncrParms := @USER4:@RM              ;* Reject Signature
                ncrParms := InternalDTM:@RM         ;* Sent to SPC Datetime
                ncrParms := InternalDTM:@RM         ;* Shipment Signature Datetime
                ncrParms := 'Production'            ;* Department Handled

                Set_Status(0)
                NCRNo       = obj_NCR('Create',ncrParms)		;* Create new NCR for this wafer/group of wafers
                IF Get_Status(errCode) THEN
*                    ErrMsg(errCode)
                    ErrorMsg = errCode
                END ELSE
                    RejDTM = OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTS')                
                    RejWfrIDs	= ''
                    CurrSlotIDs	= ''
                    sCnt = COUNT(SlotNos,@VM) + (SlotNos NE '')
                    FOR N = 1 TO sCnt                 
                        * * * *   Added 3/23/2016  JCH - wafer history   * * * *                     
                        RejWfrID	= RejWaferIDs<1,N>
                        CurrSlotID	= WONo:'*':CassNo:'*':SlotNos<1,N>                      
                        Convert '.' To '*' In RejWfrID                       
                        RejWfrIDs<1,-1>		= RejWfrID
                        CurrSlotIDs<1,-1>	= CurrSlotID
                                               
                        Parms  = RejWfrID:@RM							;* WfrID
                        Parms := RejDTM:@RM								;* EventDtm
                        Parms := @USER4:@RM								;* EventBy
                        Parms := 'NCR':@RM								;* Event
                        Parms := '':@RM									;* NewSlotID
                        Parms := '':@RM									;* RunLoc
                        Parms := NCRNo:@RM								;* NCRNo
                        Parms := '':@RM									;* TWUse
                        Parms := CurrSlotID:@RM							;* CurrSlotID
                        Parms := '':@RM									;* NewToolID
                        Parms := '':@RM									;* CurrToolID
                        Parms := '':@RM									;* NewInvLoc
                        Parms := '':@RM									;* CurrInvLoc
                        Parms := 'O'									;* Wfr Side

                        obj_WO_Wfr('AddEvent',Parms)
                    
                        * * * * * * * **
                        WaferIndex = SlotNos<1,N>
*                        @Record<WO_MAT_SLOT_NCR$,WaferIndex>            = NCRNo
*                        @Record<WO_MAT_SLOT_REP_WAFER_ID$,WaferIndex>   = ''
*                        @Record<WO_MAT_SLOT_REP_BY$,WaferIndex>         = ''
                        
                    NEXT N
                    
                END         
*                Database_Services('WriteDataRow', 'WO_MAT', WOMatKey, @Record, True$, False$, True$)
                
            Next Row
        end
        
        If ErrorMsg = '' then
            
            If Assigned(RejWfrIDs) then
                Recipients		= 'DAN_CR':@VM:'MARK_C'
                SentFrom		= @USER4
                Subject			= 'PSN ':InactivePSN:' Inactivated - Auto-NCR Wafers'
                Message = "The following wafers have been NCR'd and are ready to be physically removed: ":CRLF$
                For each RejWfrID in RejWfrIDs using @VM setting vPos
                    Message := RejWfrID : CRLF$
                Next RejWfrID
                Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message
                obj_Notes('Create',Parms)

                If Get_Status(errCode) then
*                    ErrMsg(errCode)
                    ErrorMsg = errCode
                end
            end
            
            MsgDef = ''
            MsgDef<MTEXT$>  = 'All makeup wafers successfully NCRd.'
            MsgDef<MTYPE$>  = 'BO'
            MsgDef<MICON$>  = '!'
            MsgDef<MMODAL$> = 'W'
            PrevCursor = Set_Property("SYSTEM", "CURSOR", "A")
            Response = Msg(@Window, MsgDef)
            Send_Event(@Window, 'CLOSE')          
        end else
            ErrMsg(ErrorMsg)
        end
        
    end else
        ErrorMsg = 'Error occurred retrieving inactivated PSN. Please notify FI team.'
        ErrMsg(ErrorMsg)
    end

end event


Event PUB_CANCEL.CLICK()

    End_Dialog(@Window, '')

end event


Event OLE_SUBCLASS.OnComboClick(CtrlId, Sel, Value)

    Send_Event(CtrlId, 'LOSTFOCUS')

end event


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Setup_OLE_Controls:

    Qualify     = ''
    Qualify<1>  = 1
    Qualify<4>  = 0

    RptCtrl       = @Window : '.OLE_RPT_WAFERS_TO_NCR'
    PicCtrl       = @Window : '.OLE_PIC_NO_WAFERS'
    DivCtrl       = @Window : '.OLE_PIC_DIVIDER'
    ColumnList    = ''
    ColumnList<1> = 'WO No' : @VM : 'TEXT' : @VM : 100 : @VM : @VM : @VM : @VM : @VM : @VM : @VM : 'Center' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
    ColumnList<2> = 'Cass No' : @VM : 'TEXT' : @VM : 100 : @VM : @VM : @VM : @VM : @VM : @VM : @VM : 'Center' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
    ColumnList<3> = 'SAP Batch No' : @VM : 'TEXT' : @VM : 150 : @VM : @VM : @VM : @VM : @VM : @VM : @VM : 'Center' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
    ColumnList<4> = 'MU Ps No' : @VM : 'TEXT' : @VM : 100 : @VM : @VM : @VM : @VM : @VM : @VM : @VM : 'Center' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
    ColumnList<5> = 'Cust Part No' : @VM : 'TEXT' : @VM : 200 : @VM : @VM : @VM : @VM : @VM : @VM : @VM : 'Left' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
    ColumnList<6> = 'Curr Wfr Qty' : @VM : 'TEXT' : @VM : 100 : @VM : @VM : @VM : @VM : @VM : @VM : @VM : 'Right' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
    ColumnList<7> = 'RDS No' : @VM : 'TEXT' : @VM : 100 : @VM : @VM : @VM : @VM : @VM : @VM : @VM : 'Right' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
    Set_Property(RptCtrl, 'OLE.ColumnList', ColumnList)
    WafersToNCR   = ''
    If AllMakeupWafers NE '' then
        WafersToNCR = AllMakeupWafers<1>
        Convert @VM to @FM in WafersToNCR
        Convert @SVM to @VM in WafersToNCR
    end

    // Get the design time form size. This will be adjusted based on various conditions.
    FormSize       = Get_Property(@Window, 'SIZE')
    RptCtrlSize    = Get_Property(RptCtrl, 'SIZE')
    PicCtrlSize    = Get_Property(PicCtrl, 'SIZE')
    NumWafersToNCR = DCount(WafersToNCR, @FM)

    If NumWafersToNCR EQ 0 then
        // If there are no affected makeup wafers, display the prompt that informs the user of this.
        Set_Property(DivCtrl, 'VISIBLE', False$)
        Set_Property(RptCtrl, 'VISIBLE', False$)
        // Increase the lenth of the form to accommodate the OLE_PIC control with the message.
        PicLen      = PicCtrlSize<4>
        RptLen      = RptCtrlSize<4>
        Diff        = PicLen - RptLen
        FormSize<4> = FormSize<4> + Diff - 20
        Set_Property(@Window, 'SIZE', FormSize)
        Set_Property(PicCtrl, 'VISIBLE', True$)
        Set_Property(@Window : '.PUB_AUTO_NCR', 'ENABLED', False$)
    end else
        Set_Property(RptCtrl, 'OLE.List', WafersToNCR)
        If NumWafersToNCR GT 1 then
            RptCtrlSize<4> = RptCtrlSize<4> + (20 * (NumWafersToNCR - 1))
            Set_Property(RptCtrl, 'SIZE', RptCtrlSize)
        end
    end

    Set_Property(RptCtrl, 'OLE.List', WafersToNCR)

    Caption = 'There are no makeup wafers associated with this PSN.' :@TM: 'No further action required.'
    Set_Property(PicCtrl, 'OLE.Caption', Caption)

return
