Adding a BAQ report to a an Entry Forms Action menu

Hi

For the second thing to send over only the item selected in the tracker i
used a xml as follows
There are other options too but thats what i used


PLACE IN CALLING PROGRAM

BUTTON OR MENU TO CALL

Private Sub importClick(sender As Object, e As
Infragistics.Win.UltraWinToolbars.ToolClickEventArgs)
Dim edvPart As EpiDataView = CType(oTrans.EpiDataViews("Part"),
EpiDataView)
Dim strPartNum As String = edvpart.dataView(edvpart.Row)("PartNum")
WriteReportParam(PartForm.Session,strPartNum)
ProcessCaller.LaunchForm(oTrans, "UDPL")
End Sub




Private Function WriteReportParam(FormSession As Object, ParamArray args As
String()) As Boolean
' function will take as many parameters as you like and pass them over
to report
' make sure your report is expecting at least the number you are
passing.
' you can pass less, the extra fields on the report side will just be
left blank.
' object explorer claims you can do this directly but without the cast
you get compile errors.
Try
Dim Session As Epicor.Mfg.Core.Session = DirectCast(FormSession,
Epicor.Mfg.Core.Session)
' the called report will use the same name to read the data
' in 9.05 the session id has illegal characters for use in a
filename
' so we remove them.
Dim SessionID As String = Session.SessionID
Dim sb As New System.Text.StringBuilder()
For i As Integer = 0 To SessionID.Length - 1
If Char.IsLetterOrDigit(SessionID(i)) Then
sb.Append(SessionID(i))
End If
Next

Dim ReportName As String = Convert.ToString(sb) & ".xml"
Dim FieldName As String = String.Empty
Dim PreFix As String = "Field"
Dim ReportParam As DataTable
' tell GetTable we need as many columns as we have arguments.
ReportParam = GetTable(args.Length)
' create a blank row
Dim Row As DataRow = ReportParam.NewRow()
For i As Integer = 1 To args.Length
' populate field with value passed over
FieldName = PreFix & i.ToString()
Row(FieldName) = args(i - 1)
Next
ReportParam.Rows.Add(Row)
ReportParam.WriteXml(ReportName)
Return True
Catch e As Exception
ExceptionBox.Show(e)
Return False
End Try

End Function

Private Function GetTable(howMany As Integer) As DataTable
'
' Here we create a DataTable that holds all the needed information
'
Dim table As New DataTable()
' this name matches name of report parameter table
' if you change it here you need to change it in the report form
' field names will match the fields in the report parameter table
table.TableName = "ReportParam"
Dim colWork As DataColumn
Dim fieldname As [String] = [String].Empty
' make as many columns as we have arguments/parameters
For i As Integer = 1 To howMany
fieldname = "Field" & i.ToString()
colWork = New DataColumn(fieldname, GetType(String))
table.Columns.Add(colWork)
Next


Return table
End Function



PLACE IN BAQ FORM


Imports System.IO



' code to get report parameters
Private Sub GetReportParam()
Dim Session As Epicor.Mfg.Core.Session =
DirectCast(BAQReportForm.Session, Epicor.Mfg.Core.Session)
' in 9.05 the session id has illegal characters for use in a filename
' so we remove them.
Dim SessionID As [String] = Session.SessionID
Dim sb As New System.Text.StringBuilder()
For i As Integer = 0 To SessionID.Length - 1
If Char.IsLetterOrDigit(SessionID(i)) Then
sb.Append(SessionID(i))
End If
Next
Dim SourceFile As [String] = Convert.ToString(sb) & ".xml"
' dataset xml read is simpler than using datatable xml read
Dim ds As New DataSet()
Try
If File.Exists(SourceFile) Then
ds.ReadXml(SourceFile)
File.Delete(SourceFile)
Dim TableName As [String] = "ReportParam"
Dim edvReport As EpiDataView =
DirectCast(oTrans.EpiDataViews(TableName), EpiDataView)
Dim FieldName As [String] = [String].Empty
Dim Prefix As [String] = "Field"
For i As Integer = 1 To ds.Tables(TableName).Columns.Count
FieldName = Prefix & i.ToString()
If edvReport.dataView.Table.Columns.Contains(FieldName) Then
edvReport.dataView(edvReport.Row)(FieldName) =
ds.Tables(TableName).Rows(0)(FieldName)
Else
MessageBox.Show("Too many Parameters have been passed to
report")
End If
Next
' cheat and notify all
oTrans.NotifyAll()
' nothing special at the moment
Else
End If
Catch e As Exception
ExceptionBox.Show(e)
End Try
End Sub



Private Sub BAQReportForm_Load(ByVal sender As Object, ByVal args As
EventArgs)
'Add Event Handler Code
GetReportParam()
End Sub





On Thu, Feb 3, 2011 at 2:45 PM, cooner_55421 <cooner_55421@...> wrote:

>
>
> Hi,
>
> I want to add a BAQ report to a part tracker screen.
> I haven't had to do the following before:
>
> - add it to the action menu of the part tracker
> - Include only details for part loaded in tracker
>
> Looks like I need to use Infragistics.Win.UltraWinToolbars.ButtonTool?
> Not sure what else might be involved.
>
> Anybody have pointers or a sample I can look at?
>
> Thanks
>
>
>


[Non-text portions of this message have been removed]
Hi

For the first thing to add to the action menu here you have a code snipet in
C# to add to the menu
Its adding a custom UD table with a list of US states to the menu.


'//**************************************************
'// Custom VB.NET code for CustomerEntryForm
'// Created: 7/20/2010 2:40:01 PM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO
Imports System.Reflection
Module Script

'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added
Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **
'// End Wizard Added Module Level Variables **

'// Add Custom Module Level Variables Here **
dim tools as Infragistics.Win.UltraWinToolbars.UltraToolbarsManager
dim custButton as Infragistics.Win.UltraWinToolbars.ButtonTool

Sub InitializeCustomCode()

'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added
Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls
Dim obj as Object =
GetType(Epicor.Mfg.UI.App.CustomerEntry.CustomerEntryForm).InvokeMember("baseToolbarsManager",
BindingFlags.Instance Or BindingFlags.GetField Or BindingFlags.NonPublic,
Nothing, CustomerEntryForm, Nothing)
tools =
ctype(obj,Infragistics.Win.UltraWinToolbars.UltraToolbarsManager)
custButton = addImportButton()
addhandler custButton.ToolClick, addressof importClick
'// End Custom Method Calls
End Sub
function addImportButton() as
Infragistics.Win.UltraWinToolbars.ButtonTool
dim custButton as new
Infragistics.Win.UltraWinToolbars.ButtonTool("USStates")
dim pop as Infragistics.Win.UltraWinToolbars.PopupMenuTool
custButton.SharedProps.Caption = "US States Maintenance"
if tools.Tools.Exists("USStates") = false then

tools.Tools.Add(custButton)

tools.Tools("ActionsMenu").SharedProps.Enabled = true
pop =
ctype(tools.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


tools.Tools("USStates").SharedProps.AppearancesLarge.Appearance = app

tools.Tools("USStates").SharedProps.AppearancesSmall.Appearance = app
end if
return custButton
end function

Private Sub importClick(sender As Object, e As
Infragistics.Win.UltraWinToolbars.ToolClickEventArgs)
ProcessCaller.LaunchForm(oTrans, "UDStates")
End Sub

Sub DestroyCustomCode()

'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added
Object Disposal' lines **
'// Begin Wizard Added Object Disposal
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
'// End Custom Code Disposal
End Sub

End Module


On Thu, Feb 3, 2011 at 2:45 PM, cooner_55421 <cooner_55421@...> wrote:

>
>
> Hi,
>
> I want to add a BAQ report to a part tracker screen.
> I haven't had to do the following before:
>
> - add it to the action menu of the part tracker
> - Include only details for part loaded in tracker
>
> Looks like I need to use Infragistics.Win.UltraWinToolbars.ButtonTool?
> Not sure what else might be involved.
>
> Anybody have pointers or a sample I can look at?
>
> Thanks
>
>
>


[Non-text portions of this message have been removed]