Files
DISPO/UID/Reports/frmPrintActiveReports.vb

86 lines
3.1 KiB
VB.net

Imports System.IO
Public Class frmPrintActiveReports
Property von As String = ""
Property bis As String = ""
Property filname As String = ""
Property whatshallwedo As String = ""
Property printauftrag As cDispoAuftraege = Nothing
Property istrip As Boolean = False
Property printTrip As cTrips = Nothing
Property Standort As String = ""
Property Reporter As String = ""
Property CMR As New List(Of cCMRLadeliste)
'Public Shared Reporter As String
'Public Shared Standort As String
Private Sub Viewer1_Load(sender As Object, e As EventArgs) Handles Viewer1.Load
Print(Reporter, Standort)
End Sub
Private Sub Print(Reporter As String, Optional Standort As String = "")
Dim tsbPDF As New ToolStripButton("PDF")
tsbPDF.Image = My.Resources.pdf512
Viewer1.Toolbar.MainBar.Items.Insert(5, tsbPDF)
AddHandler tsbPDF.Click, AddressOf tsbPDF_Click
If Reporter = "Transportauftrag" Then
Dim report As New rptTransportauftrag
report.Standort = Standort
report.printTrip = printTrip
report.Printauftrag = printauftrag
' report.CMR = CMR
Viewer1.LoadDocument(report)
ElseIf Reporter = "Auswertung" And frmAuswertung.subrep = "subrptAuswertung" Then
Dim report As rptAuswertung
report = New rptAuswertung
report.whatshallwedo = whatshallwedo
report.von = von
report.bis = bis
report.filname = filname
Viewer1.LoadDocument(report)
ElseIf Reporter = "Auswertung" And frmAuswertung.subrep = "subrptEinzelauswertung" Then
Dim report As New rptAuswertungLandscape
report.von = von
report.bis = bis
report.filname = filname
'report = New rptAuswertungLandscape
Viewer1.LoadDocument(report)
ElseIf Reporter = "Auswertung" And frmAuswertung.subrep = "subrptEinzelStat" Then
Dim report As rptAuswertungLandscape
report = New rptAuswertungLandscape
report.von = von
report.bis = bis
report.filname = filname
Viewer1.LoadDocument(report)
Else
MsgBox("Druckformular nicht erkannt / nicht vorhanden.")
Exit Sub
End If
End Sub
Private Sub tsbPDF_Click(sender As Object, e As EventArgs)
'Dim Dateiname As String
Dim savefiledialog As New SaveFileDialog
savefiledialog.Filter = "PDF files (*.pdf)|*.PDF"
savefiledialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
savefiledialog.ShowDialog()
Dim p As New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
Try
If savefiledialog.FileName <> "" Then p.Export(Viewer1.Document, savefiledialog.FileName)
If System.IO.File.Exists(savefiledialog.FileName) = True Then Process.Start(savefiledialog.FileName)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class