Thursday, November 3, 2016

Dynamics GP Manufacturing - Prevent MO Receipts from posting if there is insufficient Raw Material or component stock

Add This code to the Manufacturing Order Receipt Entry window.
This only works if Inventory Override Adjustments are disabled

------------------------------------------------------------------------------------------------
Private Sub Window_BeforeModalDialog(ByVal DlgType As DialogType, PromptString As String, Control1String As String, Control2String As String, Control3String As String, Answer As DialogCtrl)
   
'View>Immediate to capture exact wording of error prompts
'Debug.Print PromptString
'Debug.Print "Button 1: " & Control1String
'Debug.Print "Button 2: " & Control2String
'Debug.Print "Button 3: " & Control3String
   
   
    Dim ErrMsg
    ErrMsg = "There is insufficient stock of at least one component. Ensure that adequate component stock is available before posting a receipt."
   
    If PromptString = "You haven't backflushed the planned quantity for at least one component.  Do you want to continue?" Then
        MsgBox ErrMsg, vbExclamation
        Answer = dcButton2
    End If
   
    If PromptString = "At least one component has a shortage that has been overridden.  Do you want to continue?" Then
    MsgBox ErrMsg, vbExclamation
    Answer = dcButton2
    End If
   
    If PromptString = "A quantity shortage exists for this item.  Would you like to use the available quantity or cancel?" Then
    MsgBox ErrMsg, vbExclamation
    Answer = dcButton2
    End If
End Sub

No comments:

Post a Comment