' Set up ToFax report
Dim ToFaxReport As New Microsoft.Reporting.WinForms.LocalReport
ToFaxReport.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetCallingAssembly.Evidence)
ToFaxReport.AddTrustedCodeModuleInCurrentAppDomain(GetType(FNet.slotID).AssemblyQualifiedName)
ToFaxReport.ReportEmbeddedResource = "Edit_Purchase_Order.ToFax PO Report.rdlc"
' Filter results, removing from ToFax report any rows with alerts: "Item Size Upgrade", "Broken-Up Set", or "Gift Set Upgrade"
POLineBindingSource.DataSource = New SuperCollection(Of POLine)
CType(POLineBindingSource.DataSource, SuperCollection(Of POLine)).ApplySort(TypeDescriptor.GetProperties(GetType(POLine)).Find("itemName", True), _
ListSortDirection.Ascending)
CType(POLineBindingSource.DataSource, SuperCollection(Of POLine)).AddRange(Business.GetFilteredItemsDataSource(cmboPO.Text, cmboSupplier.SelectedValue))
ToFaxReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("Edit_Purchase_Order_POLine", POLineBindingSource.DataSource))
' Set up report parameters for both reports
Dim ReportParameters As New SuperCollection(Of Microsoft.Reporting.WinForms.ReportParameter)
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("poID", Me.cmboPO.Text))
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("poDate", Business.GetPODate(Me.cmboPO.Text)))
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("supplierID", Me.cmboSupplier.SelectedValue.ToString))
Dim dt As DataTable = Business.GetSupplierInfo(Me.cmboSupplier.SelectedValue)
With dt.Rows(0)
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("supplierName", .Item("supplierName").ToString))
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("supplierAddress", .Item("address").ToString))
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("supplierCity", .Item("city").ToString))
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("supplierState", .Item("state").ToString))
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("supplierZip", .Item("zip").ToString))
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("supplierFax", .Item("faxNumber").ToString))
End With
ReportParameters.Add(New Microsoft.Reporting.WinForms.ReportParameter("withMatchData", Me.chkMatchData.Checked))
' Add parameters to reports
ToFaxReport.SetParameters(ReportParameters)
' Print preview
If Me.chkPrintPreview.Checked Then
PrintPreview.Show()
End If
''' WHEN I TRY TO SHOW THE PREVIEW HERE, I gET THE PARAMETER X IS MISSING A VALUE.. BUT WHEN I PRINT THE REPORT, ALL THE VALUES GO THROUGH NO PROBLEM
' Print ToFax report
Dim ToFaxReportPrinter As New FNetReports.RDLCPrinter(ToFaxReport)
ToFaxReportPrinter.Print()