none
consulta RRS feed

  • Pregunta

  • Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click

            If grid.myGrid.Rows.Count = 0 Then

                Me.Cursor = Cursors.Default
                MessageBox.Show("No data to report per selections", "Blank Report", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub

            End If

            Me.Cursor = Cursors.WaitCursor
            Dim filter As String = GetFilterStringForRemoteData()

            If String.IsNullOrEmpty(filter.Trim()) Then

                filter = If(Not ShowAllRecors, " active = 'T' ", " active in ('T','F') ")

            Else

                filter = filter & If(Not ShowAllRecors, " and active = 'T' ", " and active in ('T','F') ")

            End If

            Dim listObjectBO As List(Of PrmregBO) = PrmregBLL.GetDataforReport_Special(filter)
            Dim rpt As New RptPrmreg

                 SE CAE ACA

            rpt.Database.Tables.Item("FrmMain_Reports_RptPrmregBO").SetDataSource(listObjectBO)

            Dim rptObject As Object
            '
            ' set report parameters
            '
            rptObject = FrmMain.SecusrBO.Secnam.Trim
            rpt.SetParameterValue("rptUser", rptObject)

            '
            'Code to get the Report's parameters.
            '
            rptObject = "Week Number......................................"
            rpt.SetParameterValue("rptRunDescr01", rptObject)
            rpt.SetParameterValue("rptRunValue01", IIf(String.IsNullOrEmpty(txtWknum.Text.Trim()), "[not set]", "Start With: " & txtWknum.Text.Trim()))
            rptObject = "Project Id......................................."
            rpt.SetParameterValue("rptRunDescr02", rptObject)
            rpt.SetParameterValue("rptRunValue02", IIf(String.IsNullOrEmpty(txtPrmpro.Text.Trim()), "[not set]", "Start With: " & txtPrmpro.Text.Trim()))
            rptObject = "User Id.........................................."
            rpt.SetParameterValue("rptRunDescr03", rptObject)
            rpt.SetParameterValue("rptRunValue03", IIf(String.IsNullOrEmpty(txtPrmuser.Text.Trim()), "[not set]", "Start With: " & txtPrmuser.Text.Trim()))
            rptObject = " "
            rpt.SetParameterValue("rptRunDescr04", rptObject)
            rpt.SetParameterValue("rptRunValue04", rptObject)
            rpt.SetParameterValue("rptRunDescr05", rptObject)
            rpt.SetParameterValue("rptRunValue05", rptObject)
            rpt.SetParameterValue("rptRunDescr06", rptObject)
            rpt.SetParameterValue("rptRunValue06", rptObject)
            rpt.SetParameterValue("rptRunDescr07", rptObject)
            rpt.SetParameterValue("rptRunValue07", rptObject)
            rpt.SetParameterValue("rptRunDescr08", rptObject)
            rpt.SetParameterValue("rptRunValue08", rptObject)
            rpt.SetParameterValue("rptRunDescr09", rptObject)
            rpt.SetParameterValue("rptRunValue09", rptObject)
            rpt.SetParameterValue("rptRunDescr10", rptObject)
            rpt.SetParameterValue("rptRunValue10", rptObject)
            '
            'End Code.
            '

            'show time
            frmReport.CrystalReportViewer1.ReportSource = rpt
            frmReport.reportDescription = meTableDescr & " Listing"

            Me.Cursor = Cursors.Default

            frmReport.ShowDialog()

            If frmReport.wasDone Then

                '
            'Code to get the focus on the first filter TextBox.
            '
            txtWknum.Select()
            '
            'End Code.
            '

            End If

            Try

                frmReport.Dispose()

            Catch ex As Exception
            End Try

            Try

                rpt.Dispose()

            Catch ex As Exception
            End Try
        End Sub

    jueves, 9 de mayo de 2019 17:59

Todas las respuestas