neil.interactit wrote:On one of the forms I built based on your
Sample Plugin - Editable List Maintenance Form, the client went to Printer Setup (which is plumbed by default and I forgot to remove!) and added an invoice based report to print. Printing worked but was blank as it didn't know which SOE.
This would actually be a nice solution for the client, I just need to supply
Pass_SP_InvoiceHistoryID based on the selected grid row.
I have tried 3 or 4 approaches, including hooking into this.ReportDefinitionCollection.ReadEnd and adding there, and overriding this.PrintRecord() and adding there - but nothing seems to work.
Could you explain the approach to use?
Printing a list maintenance form should not require any report parameters, as it's a list so you want to print all of them in the table.
A Maintenance form (as opposed to list maintenance), such as inventory maintenance, does have a specific record identifier it wants to pass to the report - and the base form Maintenance.UserInterface will automatically set the selection formula from business logic properties.
The Maintenance Business logic has a property, RecIDFieldName which must be overridden which returns the table.column of name, for example "IN_Main.InventoryID" for the inventory maintenance business logic- we use that plus the RecID ofr the business logic to set the reports selection formula.
So, in the base class Maintenance.UserInterface, the PrintRecord method does this:
- Code: Select all
SelectionFormula = "{" & BusinessLogic.RecIDFieldName & "} = " & Manager.Database.FormatChar(BusinessLogic.RecID)
Which allows all Maintenance type forms to magically have the selection formula set for you. Sales orders and other forms are a bit special and override the PrintRecord method to set report formulas themselves.
Going back to your list maintenance form and printing - you just need to override the PrintRecord method - this is what the base class ListMaintenance.UserInterface has for the PrintRecord:
- Code: Select all
Public Overridable Sub PrintRecord(ByVal ReportDefinition As JiwaApplication.PrintGroup.FormReports.ReportDefinition)
Dim PrintUIObject As JiwaApplication.JiwaPrintReportUI.MainForm
Dim SelectionFormula As String = ""
PrintUIObject = Manager.CreateReport(ReportDefinition, Me, 1, True, ReportDefinition.Report.ReportType = Report.Configuration.Report.ReportTypes.Menu, True, SelectionFormula)
If Not (PrintUIObject Is Nothing) Then
PrintUIObject.UpdateReport()
PrintUIObject.PrintReportToScreen()
PrintUIObject.Show()
End If
End Sub
Override that method, and you can control everything you like - whether it's setting the SelectionFormula or setting a report formula to pass values to a stored proc.