Tuesday, 11 February 2014

Check Duplicate PO in Sales Order using BPM in Epicor



Open the Method Directives application (in the standard Epicor menu — Main Menu >> System Management >> Business Process Management >> Setup >> Method Directives).

01-Method Directives

Click the “Method Code” button to open the search window, and search for the Method Name starting at “Update” and the Business Object “SalesOrder.”  Select the “Update” method.

02-Method Search

From the menu or toolbar, select File >> New >> New Pre-Processing.

03-New Pre-Processing

Give your directive the name “Check for Duplicate PO,” and check the “Enabled” and “Prevent Endless Loops” check boxes.

04-New Method

Click the “Conditions” button and then the “Add Line” button.

05-New Condition

Under “User Text” select “number of rows in the designed query…”.

06-Designed Query

Click the “designed query” hyperlink and then give the query a name — “DupPO”, type in the query “for each ttOrderHed no-lock  ,  each OrderHed no-lock  where (OrderHed.CustNum = ttOrderHed.CustNum and OrderHed.PONum = ttOrderHed.PONum and OrderHed.OrderNum <> ttOrderHed.OrderNum )” and then click “OK.”

07-DupPO query

Leave the “is not less than 1″ portion of the condition as is, and click “OK.”

08-Completed Condition

Click the “Actions” button and then the “Add Line” button.

09-Add Action

Select the “show informational message based on the designed template” option.

10-New Action

Click the “designed” hyperlink, and enter the name, severity, and message text.

11-Informational Message

If you want to show the PO number the user entered, click “Insert” and enter the name “PONum”, select the proper table “ttOrderHed”, check all the boxes, and check the “PONum” field name.  Click OK.

12-Select Table Fields

As soon as you save your work, the Method Directive will be called anytime and anywhere the SalesOrder.Update method is called.

13-Informational Message

Sunday, 2 February 2014

Add New Button in Epicor Action menu using VB.net

Private sub AddTools()
Dim custButton As New Infragistics.Win.UltraWinToolbars.ButtonTool("TestTool")
Dim pop As Infragistics.Win.UltraWinToolbars.PopupMenuTool = Nothing
custButton.SharedProps.Caption = "Print Receipt"
If baseToolbarsManager.Tools.Exists("TestTool") = False Then
      baseToolbarsManager.Tools.Add(custButton)
      baseToolbarsManager.Toolbars("Standard Tools").Tools.Add(custButton)
      baseToolbarsManager.Tools("ActionsMenu").SharedProps.Enabled = True
      pop = DirectCast(baseToolbarsManager.Tools("ActionsMenu"),                          

      Infragistics.Win.UltraWinToolbars.PopupMenuTool)
      pop.Tools.AddRange(New Infragistics.Win.UltraWinToolbars.ToolBase() {custButton})
      Dim intFuncImage As System.Drawing.Image = EpiUIImages.GetImage("InternalFunction")
      Dim app As New Infragistics.Win.Appearance()
      app.Image = intFuncImage            

      baseToolbarsManager.Tools("TestTool").SharedProps.AppearancesLarge.Appearance = app
      baseToolbarsManager.Tools("TestTool").SharedProps.AppearancesSmall.Appearance = app
End If
End sub

Private Sub QuoteForm_Load(ByVal sender As Object, ByVal args As EventArgs)
      AddTools()
End Sub

Private Sub baseToolbarsManager_ToolClick(ByVal sender As Object, ByVal args As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs)
If args.Tool.Key.tostring() = "TestTool" then
     Dim QView As EpiDataView = CType(oTrans.EpiDataViews("QuoteHed"), EpiDataView)
     Dim QuoteStr As Int32 = QView.dataView(QView.Row)("QuoteNum")
     Process.Start("Crystal.exe",QuoteStr )
End if
End Sub