Imports Microsoft.Reporting.WinForms Imports System.IO Public Class frmTransportauftrag Private autoCreate As Boolean Public CMR As List(Of cCMRLadeliste) Private param1 As String Private param2 As String Private param3 As String Private param4 As String Private param5 As String Private param6 As String Private param7 As String Private param8 As String Private param9 As String Private param10 As String Private param11 As String Private param12 As String Private param13 As String Private param14 As String Private param15 As String Private param16 As String Private param17 As String Private param18 As String Private param19 As String Private param20 As String Private param21 As String Private param22 As String Private param23 As String Private param27_1 As String Private param27_2 As String Private table1 As DataTable Private Sub frmCMR_Load(sender As Object, e As EventArgs) Handles MyBase.Load datTA.Format = DateTimePickerFormat.Custom datTA.CustomFormat = "dd.MM.yyyy" ' intiParams() ' fillCMRReport() End Sub Private Sub ReportViewer1_Load(sender As Object, e As EventArgs) Handles ReportViewer1.Load End Sub Public Sub fillCMRReport() If False Then Dim rdlcName As String = "DISPO.rptTransportauftrag.rdlc" Me.ReportViewer1.LocalReport.ReportEmbeddedResource = rdlcName table1 = data() Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param1", param1)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param2", param2)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param3", param3)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param4", param4)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param5", param5)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param6", param6)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param7", param7)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param8", param8)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param9", param9)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param10", param10)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param11", param11)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param12", param12)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param13", param13)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param14", param14)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param15", param15)) Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param16", param16)) Me.ReportViewer1.LocalReport.DataSources.Clear() Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("CMR", table1)) ReportViewer1.LocalReport.Refresh() Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout) Me.ReportViewer1.RefreshReport() End If End Sub Public Sub ReportViewer1_SubreportProcessing(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs) ' e.DataSources.Add((New ReportDataSource("CMR", table1))) ' Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter("param23", param23)) End Sub Public Function data() As DataTable Dim table1 As DataTable = New DataTable("CMR") table1.Columns.Add("ZeNr") table1.Columns.Add("AnzPack") table1.Columns.Add("Art") table1.Columns.Add("Bez") table1.Columns.Add("Stat") table1.Columns.Add("BruttoKg") table1.Columns.Add("Umfang") For Each c As cCMRLadeliste In CMR table1.Rows.Add(c.ZeNr, c.AnzPack, c.Art, c.Bez, c.Stat, c.BruttoKg, c.Umfang) Next Return table1 End Function Private Sub intiParams() param1 = "" param1 += datTA.Text param1 = param1.Trim() param2 = "" param2 += VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME param2 = param2.Trim() param3 = txtFrachtpos.Text param4 = "" param4 += txtFrachtf_firma.Text & vbNewLine param4 += txtFrachtf_str.Text & " " & txtFrachtf_strnr.Text & vbNewLine param4 += cboFrachtf_land.Text & " " & txtFrachtf_plz.Text & " - " & txtFrachtf_ort.Text & vbNewLine param4 = param4.Trim() param5 = txtFrachtfAnpsr.Text() param6 = txtLkw_Kennz.Text param7 = txtLkw_Art.Text param8 = datLadest_terminDat.Text & " " & txtLadest_terminBis.Text & " - " & txtLadest_terminVon.Text param9 = "" param9 += txtAbs_firma.Text & vbNewLine param9 += txtAbs_str.Text & " " & txtAbs_strnr.Text & vbNewLine param9 += cboAbs_land.Text & " " & txtAbs_plz.Text & " - " & txtAbs_ort.Text & vbNewLine param9 = param9.Trim() param10 = "Öffnungszeiten" param11 = datEntladest_terminDat.Text & " " & txtEntladest_terminBis.Text & " - " & txtEntladest_terminVon.Text param12 = "" param12 += txtEntladest_firma.Text & vbNewLine param12 += txtEntladest_str.Text & " " & txtEntladest_strnr.Text & vbNewLine param12 += cboEntladest_land.Text & " " & txtEntladest_plz.Text & " - " & txtEntladest_ort.Text & vbNewLine param12 = param12.Trim() param13 = "Öffnungszeiten" param14 = rtbBem.Text param15 = rtbVerzollungsadresse.Text param16 = rtbFrachtkosten.Text CMR = New List(Of cCMRLadeliste) Dim cCMR = New cCMRLadeliste cCMR.ZeNr = txt6_1.Text cCMR.AnzPack = txt7_1.Text cCMR.Art = txt8_1.Text cCMR.Bez = txt9_1.Text cCMR.Stat = txt10_1.Text cCMR.BruttoKg = txt11_1.Text cCMR.Umfang = txt12_1.Text CMR.Add(cCMR) cCMR = New cCMRLadeliste cCMR.ZeNr = txt6_2.Text cCMR.AnzPack = txt7_2.Text cCMR.Art = txt8_2.Text cCMR.Bez = txt9_2.Text cCMR.Stat = txt10_2.Text cCMR.BruttoKg = txt11_2.Text cCMR.Umfang = txt12_2.Text CMR.Add(cCMR) cCMR = New cCMRLadeliste cCMR.ZeNr = txt6_3.Text cCMR.AnzPack = txt7_3.Text cCMR.Art = txt8_3.Text cCMR.Bez = txt9_3.Text cCMR.Stat = txt10_3.Text cCMR.BruttoKg = txt11_3.Text cCMR.Umfang = txt12_3.Text CMR.Add(cCMR) cCMR = New cCMRLadeliste cCMR.ZeNr = txt6_4.Text cCMR.AnzPack = txt7_4.Text cCMR.Art = txt8_4.Text cCMR.Bez = txt9_4.Text cCMR.Stat = txt10_4.Text cCMR.BruttoKg = txt11_4.Text cCMR.Umfang = txt12_4.Text CMR.Add(cCMR) End Sub Private Sub LostFocusEvent_Abs(sender As Object, e As EventArgs) Handles txtAbs_firma.LostFocus, txtAbs_str.LostFocus, txtAbs_strnr.LostFocus, txtAbs_plz.LostFocus, txtAbs_ort.LostFocus, cboAbs_land.LostFocus If Not (txtAbs_firma.Focused Or txtAbs_str.Focused Or txtAbs_strnr.Focused Or txtAbs_plz.Focused Or txtAbs_ort.Focused Or cboAbs_land.Focused) Then If autoCreate Then intiParams() : fillCMRReport() End If End Sub Private Sub LostFocusEvent_BeigefDok(sender As Object, e As EventArgs) If autoCreate Then intiParams() : fillCMRReport() End Sub Private Sub LostFocusEvent_Table_1(sender As Object, e As EventArgs) _ Handles txt6_1.LostFocus, txt7_1.LostFocus, txt8_1.LostFocus, txt9_1.LostFocus, txt10_1.LostFocus, txt11_1.LostFocus, txt12_1.LostFocus If Not (txt6_1.Focused Or txt7_1.Focused Or txt8_1.Focused Or txt9_1.Focused Or txt10_1.Focused Or txt11_1.Focused Or txt12_1.Focused) Then If autoCreate Then intiParams() : fillCMRReport() End If End Sub Private Sub LostFocusEvent_Table_2(sender As Object, e As EventArgs) _ Handles txt6_2.LostFocus, txt7_2.LostFocus, txt8_2.LostFocus, txt9_2.LostFocus, txt10_2.LostFocus, txt11_2.LostFocus, txt12_2.LostFocus If Not (txt6_2.Focused Or txt7_2.Focused Or txt8_2.Focused Or txt9_2.Focused Or txt10_2.Focused Or txt11_2.Focused Or txt12_2.Focused) Then If autoCreate Then intiParams() : fillCMRReport() End If End Sub Private Sub LostFocusEvent_Table_3(sender As Object, e As EventArgs) _ Handles txt6_3.LostFocus, txt7_3.LostFocus, txt8_3.LostFocus, txt9_3.LostFocus, txt10_3.LostFocus, txt11_3.LostFocus, txt12_3.LostFocus If Not (txt6_3.Focused Or txt7_3.Focused Or txt8_3.Focused Or txt9_3.Focused Or txt10_3.Focused Or txt11_3.Focused Or txt12_3.Focused) Then If autoCreate Then intiParams() : fillCMRReport() End If End Sub Private Sub LostFocusEvent_Table_4(sender As Object, e As EventArgs) _ Handles txt6_4.LostFocus, txt7_4.LostFocus, txt8_4.LostFocus, txt9_4.LostFocus, txt10_4.LostFocus, txt11_4.LostFocus, txt12_4.LostFocus If Not (txt6_4.Focused Or txt7_4.Focused Or txt8_4.Focused Or txt9_4.Focused Or txt10_4.Focused Or txt11_4.Focused Or txt12_4.Focused) Then If autoCreate Then intiParams() : fillCMRReport() End If End Sub Private Sub LostFocusEvent_AnwAbs(sender As Object, e As EventArgs) If autoCreate Then intiParams() : fillCMRReport() End Sub Private Sub LostFocusEvent_Rueckerst(sender As Object, e As EventArgs) If autoCreate Then intiParams() : fillCMRReport() End Sub Private Sub LostFocusEvent_VorbehBem(sender As Object, e As EventArgs) Handles rtbBem.LostFocus If autoCreate Then intiParams() : fillCMRReport() End Sub Private Sub LostFocusEvent_BesVereinb(sender As Object, e As EventArgs) If autoCreate Then intiParams() : fillCMRReport() End Sub Private Sub LostFocusEvent_Ausgef(sender As Object, e As EventArgs) If autoCreate Then intiParams() : fillCMRReport() End Sub Private Sub LostFocusEvent_UnterAbs(sender As Object, e As EventArgs) If autoCreate Then intiParams() : fillCMRReport() End Sub Private Sub LostFocusEvent_UnterFrachtf(sender As Object, e As EventArgs) If autoCreate Then intiParams() : fillCMRReport() End Sub Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click intiParams() : fillCMRReport() End Sub Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged autoCreate = CheckBox1.Checked End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnFrachtf_search.Click frmSearch.Show() End Sub End Class