diff --git a/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb b/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb index bbdd4956..168abb4c 100644 --- a/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb +++ b/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb @@ -53,6 +53,7 @@ Partial Class frmMDMDatenverarbetiung Me.Button1 = New System.Windows.Forms.Button() Me.btnKunde = New System.Windows.Forms.Button() Me.Label4 = New System.Windows.Forms.Label() + Me.txtPruefsummeBrutto = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.cbx = New System.Windows.Forms.CheckBox() Me.Panel2 = New System.Windows.Forms.Panel() Me.Label43 = New System.Windows.Forms.Label() @@ -63,13 +64,14 @@ Partial Class frmMDMDatenverarbetiung Me.pbPloseAnh_Proz = New System.Windows.Forms.ProgressBar() Me.lblPloseAnh_Proz = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() + Me.txtPruefsummeNetto = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.Label2 = New System.Windows.Forms.Label() + Me.txtAnzahl = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.Button3 = New System.Windows.Forms.Button() Me.Button2 = New System.Windows.Forms.Button() Me.MyDatagridview1 = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components) - Me.txtPruefsummeBrutto = New VERAG_PROG_ALLGEMEIN.MyTextBox() - Me.txtPruefsummeNetto = New VERAG_PROG_ALLGEMEIN.MyTextBox() - Me.txtAnzahl = New VERAG_PROG_ALLGEMEIN.MyTextBox() + Me.lblTTRSum = New System.Windows.Forms.Label() + Me.txtTTRSum = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.pnl.SuspendLayout() Me.Panel4.SuspendLayout() Me.FlowLayoutPanel.SuspendLayout() @@ -260,6 +262,8 @@ Partial Class frmMDMDatenverarbetiung ' 'Panel1 ' + Me.Panel1.Controls.Add(Me.lblTTRSum) + Me.Panel1.Controls.Add(Me.txtTTRSum) Me.Panel1.Controls.Add(Me.lblProzPruef) Me.Panel1.Controls.Add(Me.PictureBox1) Me.Panel1.Controls.Add(Me.pic) @@ -409,6 +413,31 @@ Partial Class frmMDMDatenverarbetiung Me.Label4.TabIndex = 44 Me.Label4.Text = "Prüfsumme brutto:" ' + 'txtPruefsummeBrutto + ' + Me.txtPruefsummeBrutto._DateTimeOnly = False + Me.txtPruefsummeBrutto._numbersOnly = False + Me.txtPruefsummeBrutto._numbersOnlyKommastellen = "" + Me.txtPruefsummeBrutto._numbersOnlyTrennzeichen = True + Me.txtPruefsummeBrutto._Prozent = False + Me.txtPruefsummeBrutto._ShortDateNew = False + Me.txtPruefsummeBrutto._ShortDateOnly = False + Me.txtPruefsummeBrutto._TimeOnly = False + Me.txtPruefsummeBrutto._TimeOnly_Seconds = False + Me.txtPruefsummeBrutto._value = "" + Me.txtPruefsummeBrutto._Waehrung = False + Me.txtPruefsummeBrutto._WaehrungZeichen = True + Me.txtPruefsummeBrutto.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.txtPruefsummeBrutto.ForeColor = System.Drawing.Color.Black + Me.txtPruefsummeBrutto.Location = New System.Drawing.Point(1051, 69) + Me.txtPruefsummeBrutto.MaxLineLength = -1 + Me.txtPruefsummeBrutto.MaxLines_Warning = "" + Me.txtPruefsummeBrutto.MaxLines_Warning_Label = Nothing + Me.txtPruefsummeBrutto.Name = "txtPruefsummeBrutto" + Me.txtPruefsummeBrutto.Size = New System.Drawing.Size(100, 20) + Me.txtPruefsummeBrutto.TabIndex = 43 + Me.txtPruefsummeBrutto.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + ' 'cbx ' Me.cbx.AutoSize = True @@ -505,6 +534,31 @@ Partial Class frmMDMDatenverarbetiung Me.Label3.TabIndex = 38 Me.Label3.Text = "Prüfsumme netto:" ' + 'txtPruefsummeNetto + ' + Me.txtPruefsummeNetto._DateTimeOnly = False + Me.txtPruefsummeNetto._numbersOnly = False + Me.txtPruefsummeNetto._numbersOnlyKommastellen = "" + Me.txtPruefsummeNetto._numbersOnlyTrennzeichen = True + Me.txtPruefsummeNetto._Prozent = False + Me.txtPruefsummeNetto._ShortDateNew = False + Me.txtPruefsummeNetto._ShortDateOnly = False + Me.txtPruefsummeNetto._TimeOnly = False + Me.txtPruefsummeNetto._TimeOnly_Seconds = False + Me.txtPruefsummeNetto._value = "" + Me.txtPruefsummeNetto._Waehrung = False + Me.txtPruefsummeNetto._WaehrungZeichen = True + Me.txtPruefsummeNetto.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.txtPruefsummeNetto.ForeColor = System.Drawing.Color.Black + Me.txtPruefsummeNetto.Location = New System.Drawing.Point(1051, 43) + Me.txtPruefsummeNetto.MaxLineLength = -1 + Me.txtPruefsummeNetto.MaxLines_Warning = "" + Me.txtPruefsummeNetto.MaxLines_Warning_Label = Nothing + Me.txtPruefsummeNetto.Name = "txtPruefsummeNetto" + Me.txtPruefsummeNetto.Size = New System.Drawing.Size(100, 20) + Me.txtPruefsummeNetto.TabIndex = 37 + Me.txtPruefsummeNetto.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + ' 'Label2 ' Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) @@ -515,6 +569,31 @@ Partial Class frmMDMDatenverarbetiung Me.Label2.TabIndex = 36 Me.Label2.Text = "Anzahl:" ' + 'txtAnzahl + ' + Me.txtAnzahl._DateTimeOnly = False + Me.txtAnzahl._numbersOnly = False + Me.txtAnzahl._numbersOnlyKommastellen = "" + Me.txtAnzahl._numbersOnlyTrennzeichen = True + Me.txtAnzahl._Prozent = False + Me.txtAnzahl._ShortDateNew = False + Me.txtAnzahl._ShortDateOnly = False + Me.txtAnzahl._TimeOnly = False + Me.txtAnzahl._TimeOnly_Seconds = False + Me.txtAnzahl._value = "" + Me.txtAnzahl._Waehrung = False + Me.txtAnzahl._WaehrungZeichen = True + Me.txtAnzahl.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.txtAnzahl.ForeColor = System.Drawing.Color.Black + Me.txtAnzahl.Location = New System.Drawing.Point(1051, 16) + Me.txtAnzahl.MaxLineLength = -1 + Me.txtAnzahl.MaxLines_Warning = "" + Me.txtAnzahl.MaxLines_Warning_Label = Nothing + Me.txtAnzahl.Name = "txtAnzahl" + Me.txtAnzahl.Size = New System.Drawing.Size(100, 20) + Me.txtAnzahl.TabIndex = 35 + Me.txtAnzahl.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + ' 'Button3 ' Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat @@ -552,80 +631,42 @@ Partial Class frmMDMDatenverarbetiung Me.MyDatagridview1.Size = New System.Drawing.Size(1163, 577) Me.MyDatagridview1.TabIndex = 0 ' - 'txtPruefsummeBrutto + 'lblTTRSum ' - Me.txtPruefsummeBrutto._DateTimeOnly = False - Me.txtPruefsummeBrutto._numbersOnly = False - Me.txtPruefsummeBrutto._numbersOnlyKommastellen = "" - Me.txtPruefsummeBrutto._numbersOnlyTrennzeichen = True - Me.txtPruefsummeBrutto._Prozent = False - Me.txtPruefsummeBrutto._ShortDateNew = False - Me.txtPruefsummeBrutto._ShortDateOnly = False - Me.txtPruefsummeBrutto._TimeOnly = False - Me.txtPruefsummeBrutto._TimeOnly_Seconds = False - Me.txtPruefsummeBrutto._value = "" - Me.txtPruefsummeBrutto._Waehrung = False - Me.txtPruefsummeBrutto._WaehrungZeichen = True - Me.txtPruefsummeBrutto.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.txtPruefsummeBrutto.ForeColor = System.Drawing.Color.Black - Me.txtPruefsummeBrutto.Location = New System.Drawing.Point(1051, 69) - Me.txtPruefsummeBrutto.MaxLineLength = -1 - Me.txtPruefsummeBrutto.MaxLines_Warning = "" - Me.txtPruefsummeBrutto.MaxLines_Warning_Label = Nothing - Me.txtPruefsummeBrutto.Name = "txtPruefsummeBrutto" - Me.txtPruefsummeBrutto.Size = New System.Drawing.Size(100, 20) - Me.txtPruefsummeBrutto.TabIndex = 43 - Me.txtPruefsummeBrutto.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + Me.lblTTRSum.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.lblTTRSum.AutoSize = True + Me.lblTTRSum.Location = New System.Drawing.Point(953, 95) + Me.lblTTRSum.Name = "lblTTRSum" + Me.lblTTRSum.Size = New System.Drawing.Size(87, 13) + Me.lblTTRSum.TabIndex = 52 + Me.lblTTRSum.Text = "Prüfsumme TTR:" + Me.lblTTRSum.Visible = False ' - 'txtPruefsummeNetto + 'txtTTRSum ' - Me.txtPruefsummeNetto._DateTimeOnly = False - Me.txtPruefsummeNetto._numbersOnly = False - Me.txtPruefsummeNetto._numbersOnlyKommastellen = "" - Me.txtPruefsummeNetto._numbersOnlyTrennzeichen = True - Me.txtPruefsummeNetto._Prozent = False - Me.txtPruefsummeNetto._ShortDateNew = False - Me.txtPruefsummeNetto._ShortDateOnly = False - Me.txtPruefsummeNetto._TimeOnly = False - Me.txtPruefsummeNetto._TimeOnly_Seconds = False - Me.txtPruefsummeNetto._value = "" - Me.txtPruefsummeNetto._Waehrung = False - Me.txtPruefsummeNetto._WaehrungZeichen = True - Me.txtPruefsummeNetto.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.txtPruefsummeNetto.ForeColor = System.Drawing.Color.Black - Me.txtPruefsummeNetto.Location = New System.Drawing.Point(1051, 43) - Me.txtPruefsummeNetto.MaxLineLength = -1 - Me.txtPruefsummeNetto.MaxLines_Warning = "" - Me.txtPruefsummeNetto.MaxLines_Warning_Label = Nothing - Me.txtPruefsummeNetto.Name = "txtPruefsummeNetto" - Me.txtPruefsummeNetto.Size = New System.Drawing.Size(100, 20) - Me.txtPruefsummeNetto.TabIndex = 37 - Me.txtPruefsummeNetto.TextAlign = System.Windows.Forms.HorizontalAlignment.Right - ' - 'txtAnzahl - ' - Me.txtAnzahl._DateTimeOnly = False - Me.txtAnzahl._numbersOnly = False - Me.txtAnzahl._numbersOnlyKommastellen = "" - Me.txtAnzahl._numbersOnlyTrennzeichen = True - Me.txtAnzahl._Prozent = False - Me.txtAnzahl._ShortDateNew = False - Me.txtAnzahl._ShortDateOnly = False - Me.txtAnzahl._TimeOnly = False - Me.txtAnzahl._TimeOnly_Seconds = False - Me.txtAnzahl._value = "" - Me.txtAnzahl._Waehrung = False - Me.txtAnzahl._WaehrungZeichen = True - Me.txtAnzahl.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.txtAnzahl.ForeColor = System.Drawing.Color.Black - Me.txtAnzahl.Location = New System.Drawing.Point(1051, 16) - Me.txtAnzahl.MaxLineLength = -1 - Me.txtAnzahl.MaxLines_Warning = "" - Me.txtAnzahl.MaxLines_Warning_Label = Nothing - Me.txtAnzahl.Name = "txtAnzahl" - Me.txtAnzahl.Size = New System.Drawing.Size(100, 20) - Me.txtAnzahl.TabIndex = 35 - Me.txtAnzahl.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + Me.txtTTRSum._DateTimeOnly = False + Me.txtTTRSum._numbersOnly = False + Me.txtTTRSum._numbersOnlyKommastellen = "" + Me.txtTTRSum._numbersOnlyTrennzeichen = True + Me.txtTTRSum._Prozent = False + Me.txtTTRSum._ShortDateNew = False + Me.txtTTRSum._ShortDateOnly = False + Me.txtTTRSum._TimeOnly = False + Me.txtTTRSum._TimeOnly_Seconds = False + Me.txtTTRSum._value = "" + Me.txtTTRSum._Waehrung = False + Me.txtTTRSum._WaehrungZeichen = True + Me.txtTTRSum.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.txtTTRSum.ForeColor = System.Drawing.Color.Black + Me.txtTTRSum.Location = New System.Drawing.Point(1051, 92) + Me.txtTTRSum.MaxLineLength = -1 + Me.txtTTRSum.MaxLines_Warning = "" + Me.txtTTRSum.MaxLines_Warning_Label = Nothing + Me.txtTTRSum.Name = "txtTTRSum" + Me.txtTTRSum.Size = New System.Drawing.Size(100, 20) + Me.txtTTRSum.TabIndex = 51 + Me.txtTTRSum.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + Me.txtTTRSum.Visible = False ' 'frmMDMDatenverarbetiung ' @@ -704,4 +745,6 @@ Partial Class frmMDMDatenverarbetiung Friend WithEvents cbxTestdaten As CheckBox Friend WithEvents cbxASFINAGAbgerechnet As CheckBox Friend WithEvents cbxBelegeerstellt As CheckBox + Friend WithEvents lblTTRSum As Label + Friend WithEvents txtTTRSum As VERAG_PROG_ALLGEMEIN.MyTextBox End Class diff --git a/SDL/mdm/frmMDMDatenverarbetiung.vb b/SDL/mdm/frmMDMDatenverarbetiung.vb index c948365d..e06fea66 100644 --- a/SDL/mdm/frmMDMDatenverarbetiung.vb +++ b/SDL/mdm/frmMDMDatenverarbetiung.vb @@ -1,4 +1,5 @@ Imports System.Data.OleDb +Imports System.DirectoryServices.ActiveDirectory Imports System.IO Imports com.sun.jdi Imports com.sun.net.httpserver.Authenticator @@ -101,9 +102,11 @@ Public Class frmMDMDatenverarbetiung datum = SQL.getValueTxtBySql("select top (1) Abrechnungsdatum from Abrechnungsdatum", "ASFINAG") End If - Dim inputKdNr = InputBox("Wenn einzelner Kunde abgerechnet werde soll, bitte KdNr eingeben" & vbNewLine & "Wenn keine KdNr angegeben wird, dann werden alle Kunden abgerechnet:", "Asfinag abrechen") + Dim inputKdNr = "" 'InputBox("Wenn einzelner Kunde abgerechnet werde soll, bitte KdNr eingeben" & vbNewLine & "Wenn keine KdNr angegeben wird, dann werden alle Kunden abgerechnet:", "Asfinag abrechen") - genRGAtt_ASFINAG(abrechnungsDatum, datum, inputKdNr) + If genRGAtt_ASFINAG(abrechnungsDatum, datum, inputKdNr) Then + MautD_Befuellen(inputKdNr) + End If initDgv_ASFINAG(cbxASFINAGAbgerechnet.Checked, cbxBelegeerstellt.Checked) End Select @@ -769,6 +772,7 @@ Public Class frmMDMDatenverarbetiung Return False End If + Dim dt_Main_PDF As DataTable = SQL.loadDgvBySql_Param("SELECT Maut.cardnumber, Maut.licenceplate, Maut.turnoverdate, Maut.contractPartner, Maut.netAmount, Maut.VATamount, Maut.totalAmount, Maut.[additionalData],Maut.receiptNumber, KUK.KundenNr, KUK.[Name 1] FROM ( SELECT Kreditkarten.KartenNr AS Kartennummer, Adressen.AdressenNr AS KundenNr, Adressen.[Name 1] FROM Adressen INNER JOIN Kreditkarten ON Adressen.AdressenNr = Kreditkarten.AdressenNr) as KUK @@ -796,10 +800,12 @@ Public Class frmMDMDatenverarbetiung End If If vbYes = MsgBox(Info & vbNewLine & "Möchten Sie die Rechnungen + Anhänge erstellen?", vbYesNoCancel) Then - Dim dir = "F:\FMZoll\Maut\AT\Anlagen" '"C:\Users\d.breimaier\Desktop\Asfinag\Mautberichte" + Dim dir = "F:\FMZoll\Maut\AT\Anlagen" & IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "\Test", "") '"C:\Users\d.breimaier\Desktop\Asfinag\Mautberichte" + + If Not Directory.Exists(dir) Then + Directory.CreateDirectory(dir) + End If - 'If Directory.Exists(dir) Then dir &= "_" & Now.ToShortTimeString.Replace(":", "") - 'Directory.CreateDirectory(dir) If dt_Main_PDF IsNot Nothing AndAlso dt_Main_PDF.Rows.Count > 0 Then @@ -895,10 +901,15 @@ Public Class frmMDMDatenverarbetiung ' Next 'End If 'If Not Directory.Exists(dirAnhang) Then Directory.CreateDirectory(dirAnhang) + Dim dirCSV = "F:\FMZoll\Maut\Anlagen\" & IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "Test\", "") - 'For Each f In Directory.GetFiles(dir) - ' File.Copy(f, dirAnhang & (New FileInfo(f)).Name) - 'Next + If Not Directory.Exists(dirCSV) Then + Directory.CreateDirectory(dirCSV) + End If + + For Each f In Directory.GetFiles(dir) + If f.EndsWith(".csv") Then File.Copy(f, dirCSV & (New FileInfo(f)).Name, True) + Next pbPloseAnh_Proz.Value = 100 txtPloseAnh_Einarbeitung.Text = dt_Main.Rows.Count & " / " & dt_Main.Rows.Count @@ -956,7 +967,7 @@ Public Class frmMDMDatenverarbetiung Dim connectionString = "" If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then - connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\DEVELOPER\f\FMZoll\MautD.accdb" + connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD_Test.accd" Else connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD.accdb" End If @@ -1051,11 +1062,140 @@ Public Class frmMDMDatenverarbetiung End Function + Function genASFINAGInsertMautAT(kdNr) As Boolean + Try + pic.Visible = False + Dim displayFilter = False + Dim sqlstr As String = "" + + Dim sqlWhere As String = "" + If kdNr <> "" Then + sqlWhere &= " AND Adressen.AdressenNr=" & kdNr + End If + + + sqlstr = " select + 'AT' + ,Adressen.AdressenNr + ,licenceplate + ,turnoverdate + ,'AT' + ,contractPartner as ProductCode + ,[cardnumber] as CardNumber + ,[netAmount] as Netamount + ,[VATamount] as VATAmount + ,[totalAmount] as totalAmount + FROM [VERAG].[dbo].[tblAsfinagMaut] + INNER JOIN [VERAG].[dbo].Kreditkarten ON cardnumber = Kreditkarten.KartenNr + INNER JOIN [VERAG].[dbo].Adressen ON Adressen.AdressenNr = Kreditkarten.AdressenNr + WHERE 1 = 1 " & sqlWhere & " + order by Adressen.AdressenNr" + + + + Dim dt As DataTable = SQL.loadDgvBySql_Param(sqlstr, "FMZOLL") + Dim sqlstrAT As String = "" + + sqlstrAT &= "select 'AT' + ,Adressen.AdressenNr + ,licenceplate + ,turnoverdate + ,'AT' as land + ,'' as ProductCode + ,[cardnumber] as CardNumber + ,sum([netAmount]) as Netamount + ,sum([VATamount]) as VATAmount + ,sum([totalAmount]) as totalAmount + FROM [VERAG].[dbo].[tblAsfinagMaut] + INNER JOIN [VERAG].[dbo].Kreditkarten ON cardnumber = Kreditkarten.KartenNr + INNER JOIN [VERAG].[dbo].Adressen ON Adressen.AdressenNr = Kreditkarten.AdressenNr + WHERE 1 = 1 " & sqlWhere & " + group by Adressen.AdressenNr, licenceplate,turnoverdate,CardNumber + order by Adressen.AdressenNr" + + + + Dim dtAT As DataTable = SQL.loadDgvBySql_Param(sqlstrAT, "FMZOLL") + + + 'AT ---> Gruppiert + If dtAT IsNot Nothing AndAlso dtAT.Rows.Count > 0 Then + If dt Is Nothing OrElse dt.Rows.Count = 0 Then + dt = dtAT + Else + For Each r In dtAT.Rows + dt.Rows.Add({r(0), r(1), r(2), r(3), r(4), r(5), r(6), r(7), r(8), r(9)}) + Next + End If + End If + + Dim connectionString = "" + If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then + connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD_Test.accdb" + Else + connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD.accdb" + End If + + Dim con As New OleDbConnection(connectionString) + Dim cmd As New OleDbCommand + Dim var1 As String + + Dim adapter As OleDbDataAdapter = New OleDbDataAdapter() + Dim reader As OleDbDataReader = Nothing + + + + If dt IsNot Nothing Then + con.Open() + For Each r In dt.Rows + Try + 'Zeitstempel + + Dim SQLQuery = "INSERT INTO tblMautbericht (Datenquelle,[Customer No],[Licence Plate Number],[Transaction Date],[Transaction Country],[Product description],[Card Number],[Nett Amount],[VAT Amount],[Total Amount]) VALUES (@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9,@P10) " + ' "SELECT * FROM DBParent WHERE P_ID = " & UniqeID & ";" + Using Command As New OleDbCommand(SQLQuery, con) + + Command.Parameters.AddWithValue("@P1", r(0)) + Command.Parameters.AddWithValue("@P2", r(1)) + Command.Parameters.AddWithValue("@P3", r(2)) + Command.Parameters.AddWithValue("@P4", r(3)) + Command.Parameters.AddWithValue("@P5", r(4)) + Command.Parameters.AddWithValue("@P6", r(5)) + Command.Parameters.AddWithValue("@P7", r(6)) + Command.Parameters.AddWithValue("@P8", CDbl(r(7))) + Command.Parameters.AddWithValue("@P9", CDbl(r(8))) + Command.Parameters.AddWithValue("@P10", CDbl(r(9))) + + Command.ExecuteNonQuery() + Command.Dispose() + End Using + + Catch ex2 As System.Exception + MsgBox("err: " & ex2.Message & ex2.StackTrace) + + Finally + If reader IsNot Nothing Then reader.Close() + End Try + + + Next + con.Close() + End If + pic.Visible = True + Return True + + Catch ex As System.Exception + MsgBox(ex.Message & ex.StackTrace) + End Try + Return False + + End Function + Function deleteMautD(Datenquelle As String) As Boolean Try Dim connectionString = "" If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then - connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\DEVELOPER\f\FMZoll\MautD.accdb" + connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD_Test.accdb" Else connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD.accdb" End If @@ -2537,9 +2677,10 @@ Public Class frmMDMDatenverarbetiung End If End Sub - Function MautD_Befuellen() As Boolean + Function MautD_Befuellen(Optional kdNr = "") As Boolean Select Case LIEFERANT Case "PLOSE" : deleteMautD("PLOSE") : Return genPLOSEInsertMautD(dat_Sum_Von.Value.ToShortDateString, dat_Sum_Bis.Value.ToShortDateString) + Case "ASFINAG" : deleteMautD("AT") : Return genASFINAGInsertMautAT(kdNr) End Select Return False End Function @@ -2640,7 +2781,7 @@ Public Class frmMDMDatenverarbetiung If SQL.doSQL("Update Abrechnungsdatum SET Abrechnungsdatum = '" & f.Datum.ToShortDateString & "'", "ASFINAG") Then If SQL.doSQL("UPDATE dbo.TTRBody SET Abrechnungsdatum = '" & f.Datum.ToShortDateString & "' WHERE (PKHistory = 0) AND (PKFileName LIKE N'" & checkifTestfiles() & ".%') AND (FileCreationDate <= '" & f.Datum.ToShortDateString & "') AND abrechnungsdatum IS NULL AND belegerstellungsdatum IS NULL", "ASFINAG") Then - Dim dt As DataTable = SQL.loadDgvBySql("Select dbo.TTRBody.OBUID, dbo.TTRBody.CardNumber, dbo.TTRBody.receiptNumber, dbo.TTRBody.VATAmount, dbo.TTRBody.amountInclVAT, dbo.TTRBody.DeliveryDate,dbo.TTRBody.abrechnungsdatum,dbo.TTRBody.belegerstellungsdatum, dbo.tblWarenarten.WarenartDE, dbo.CLFArchiv.vehicleLicensePlate, dbo.TTRBody.InfoField, dbo.TTRBody.ProductCode, dbo.TTRBody.Town + Dim dt As DataTable = SQL.loadDgvBySql("Select dbo.TTRBody.OBUID, dbo.TTRBody.CardNumber, dbo.TTRBody.receiptNumber, dbo.TTRBody.VATAmount, dbo.TTRBody.amountInclVAT, dbo.TTRBody.DeliveryDate,dbo.TTRBody.abrechnungsdatum,dbo.TTRBody.belegerstellungsdatum, dbo.tblWarenarten.WarenartDE, dbo.CLFArchiv.vehicleLicensePlate, dbo.TTRBody.InfoField, dbo.TTRBody.ProductCode, dbo.TTRBody.Town, dbo.TTRBody.PKFileName From dbo.CLFArchiv RIGHT OUTER Join dbo.TTRBody ON dbo.CLFArchiv.OBUID = dbo.TTRBody.OBUID LEFT OUTER Join dbo.tblWarenarten ON dbo.TTRBody.ProductCode = dbo.tblWarenarten.ProductCode @@ -2664,10 +2805,24 @@ Public Class frmMDMDatenverarbetiung maut.receiptCreated = IIf(IsDBNull(row.Item("belegerstellungsdatum")), False, True) maut.SAVE() Next + + Dim pruefSumTTR = SQL.getValueTxtBySql("select sum(checksumAmounntInclVAT) from [ASFINAG].[dbo].[TTRTrailer] where PKHistory = 0 and [TTRTrailer].PKFileName in (select distinct([TTRBody].PKFileName) as Test from [ASFINAG].[dbo].[TTRBody] where (TTRBody.PKHistory = 0) And (TTRBody.PKFileName Like N'" & checkifTestfiles() & ".%') AND TTRBody.abrechnungsdatum = '" & f.Datum.ToShortDateString & "')", "FMZOLL") + If pruefSumTTR IsNot Nothing AndAlso IsNumeric(pruefSumTTR) Then + txtTTRSum.Text = CDbl(pruefSumTTR).ToString("C2") + lblTTRSum.Visible = True + txtTTRSum.Visible = True + Else + lblTTRSum.Visible = False + txtTTRSum.Visible = False + End If + + MsgBox("Abrechnungsdatum gesetzt!") End If End If + + cbxASFINAGAbgerechnet.Checked = True 'initDgv_ASFINAG(Not cbxASFINAGNichtAbgerechnet.Checked) End If diff --git a/SDL/mdm/usrCntlMDMAuswertungen.Designer.vb b/SDL/mdm/usrCntlMDMAuswertungen.Designer.vb index aa597abe..717e0ac6 100644 --- a/SDL/mdm/usrCntlMDMAuswertungen.Designer.vb +++ b/SDL/mdm/usrCntlMDMAuswertungen.Designer.vb @@ -170,6 +170,10 @@ Partial Class usrCntlMDMAuswertungen Me.btnContractdaten = New System.Windows.Forms.Button() Me.Button15 = New System.Windows.Forms.Button() Me.pnl = New System.Windows.Forms.Panel() + Me.GroupBox17 = New System.Windows.Forms.GroupBox() + Me.Label55 = New System.Windows.Forms.Label() + Me.Button16 = New System.Windows.Forms.Button() + Me.Label56 = New System.Windows.Forms.Label() Me.GroupBox1.SuspendLayout() Me.GroupBox2.SuspendLayout() CType(Me.pic, System.ComponentModel.ISupportInitialize).BeginInit() @@ -201,6 +205,7 @@ Partial Class usrCntlMDMAuswertungen Me.GroupBox15.SuspendLayout() Me.GroupBox14.SuspendLayout() Me.pnl.SuspendLayout() + Me.GroupBox17.SuspendLayout() Me.SuspendLayout() ' 'GroupBox1 @@ -1628,6 +1633,8 @@ Partial Class usrCntlMDMAuswertungen ' 'TabPage5 ' + Me.TabPage5.Controls.Add(Me.Label56) + Me.TabPage5.Controls.Add(Me.GroupBox17) Me.TabPage5.Controls.Add(Me.Label53) Me.TabPage5.Controls.Add(Me.GroupBox16) Me.TabPage5.Controls.Add(Me.Label49) @@ -1842,6 +1849,47 @@ Partial Class usrCntlMDMAuswertungen Me.pnl.Size = New System.Drawing.Size(1057, 54) Me.pnl.TabIndex = 26 ' + 'GroupBox17 + ' + Me.GroupBox17.Controls.Add(Me.Label55) + Me.GroupBox17.Controls.Add(Me.Button16) + Me.GroupBox17.Location = New System.Drawing.Point(6, 367) + Me.GroupBox17.Name = "GroupBox17" + Me.GroupBox17.Size = New System.Drawing.Size(697, 94) + Me.GroupBox17.TabIndex = 13 + Me.GroupBox17.TabStop = False + ' + 'Label55 + ' + Me.Label55.AutoSize = True + Me.Label55.Location = New System.Drawing.Point(147, 19) + Me.Label55.Name = "Label55" + Me.Label55.Size = New System.Drawing.Size(161, 13) + Me.Label55.TabIndex = 6 + Me.Label55.Text = "Abrechnungszeitraum auswerten" + ' + 'Button16 + ' + Me.Button16.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button16.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(54, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Button16.Location = New System.Drawing.Point(6, 19) + Me.Button16.Name = "Button16" + Me.Button16.Size = New System.Drawing.Size(121, 49) + Me.Button16.TabIndex = 4 + Me.Button16.Text = "Abrechnungsliste" + Me.Button16.UseVisualStyleBackColor = True + ' + 'Label56 + ' + Me.Label56.AutoSize = True + Me.Label56.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label56.ForeColor = System.Drawing.SystemColors.ControlDarkDark + Me.Label56.Location = New System.Drawing.Point(9, 354) + Me.Label56.Name = "Label56" + Me.Label56.Size = New System.Drawing.Size(150, 17) + Me.Label56.TabIndex = 14 + Me.Label56.Text = "Datenbereitstellung" + ' 'usrCntlMDMAuswertungen ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -1905,6 +1953,8 @@ Partial Class usrCntlMDMAuswertungen Me.GroupBox14.PerformLayout() Me.pnl.ResumeLayout(False) Me.pnl.PerformLayout() + Me.GroupBox17.ResumeLayout(False) + Me.GroupBox17.PerformLayout() Me.ResumeLayout(False) End Sub @@ -2055,4 +2105,8 @@ Partial Class usrCntlMDMAuswertungen Friend WithEvents GroupBox16 As GroupBox Friend WithEvents Label54 As Label Friend WithEvents btnKartenpruefung As Button + Friend WithEvents Label56 As Label + Friend WithEvents GroupBox17 As GroupBox + Friend WithEvents Label55 As Label + Friend WithEvents Button16 As Button End Class diff --git a/SDL/mdm/usrCntlMDMAuswertungen.vb b/SDL/mdm/usrCntlMDMAuswertungen.vb index 89f5a9ec..14540c12 100644 --- a/SDL/mdm/usrCntlMDMAuswertungen.vb +++ b/SDL/mdm/usrCntlMDMAuswertungen.vb @@ -1030,16 +1030,6 @@ Public Class usrCntlMDMAuswertungen Dim displayFilter = False Dim sqlstr As String = "" - 'falls Berichte nicht nur für letzten Abrechnungszeitraum benötigt werden, diesen Part aktivieren und mit abrechnungsdatum "dat_sum_bis" koppeln! - - ' sqlstr &= " SELECT dbo.TTRBody.CardNumber,Adressen.AdressenNr AS KundenNr,Adressen.[Name 1], dbo.CLFArchiv.vehicleLicensePlate,dbo.TTRBody.DeliveryDate, 'ASFINAG ' + ISNULL(dbo.tblWarenarten.WarenartDE, dbo.tblWarenarten.ProductCode) as ProductCode,dbo.TTRBody.amountInclVAT - dbo.TTRBody.VATAmount as netAmount,dbo.TTRBody.VATAmount,dbo.TTRBody.amountInclVAT as totalAmount - ' FROM dbo.CLFArchiv RIGHT OUTER JOIN - ' dbo.TTRBody ON dbo.CLFArchiv.OBUID = dbo.TTRBody.InfoField LEFT OUTER JOIN - ' dbo.tblWarenarten ON dbo.TTRBody.ProductCode = dbo.tblWarenarten.ProductCode - 'INNER JOIN [VERAG].[dbo].Kreditkarten ON dbo.TTRBody.CardNumber = Kreditkarten.KartenNr - 'INNER JOIN [VERAG].[dbo].Adressen ON Adressen.AdressenNr = Kreditkarten.AdressenNr - ' WHERE (dbo.TTRBody.PKHistory = 0) AND (dbo.TTRBody.PKFileName LIKE N'" & checkifTestfiles() & ".%') AND (TTRBody.abrechnungsdatum = '" & dat_Sum_Bis.Value.ToShortDateString & "') - ' ORDER BY dbo.TTRBody.CardNumber" sqlstr &= " SELECT [cardnumber] as CardNumber ,[licenceplate] @@ -1246,6 +1236,46 @@ Public Class usrCntlMDMAuswertungen ' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) 'End Try End Sub + + Private Sub Button16_Click_1(sender As Object, e As EventArgs) Handles Button16.Click + Try + + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Dim frm As New Form + Dim dgv As New DataGridView() + Dim dt As DataTable = SQL.loadDgvBySql("SELECT + PKFileName, + FileCreationDate, + Abrechnungsdatum, + round(SUM(amountInclVAT) - SUM(VATAmount),2) AS Nettobetrag, + round(SUM(VATAmount),2) AS Umsatzsteuer, + VATRate AS 'USt %', + round(SUM(amountInclVAT),2) AS Bruttobetrag + FROM TTRBody + WHERE (PKHistory = 0) AND (Abrechnungsdatum = (SELECT Abrechnungsdatum FROM Abrechnungsdatum)) + GROUP BY PKFileName, FileCreationDate, Abrechnungsdatum, VATRate + ORDER BY PKFileName", "ASFINAG") + + dgv.DataSource = dt + If dgv IsNot Nothing Then + frm.Size = New Size(1400, 1000) + dgv.Size = New Size(frm.Size.Width - 50, frm.Size.Height - 50) + dgv.Dock = DockStyle.Fill + dgv.Anchor = AnchorStyles.Left + dgv.Anchor = AnchorStyles.Top + dgv.ReadOnly = True + frm.Controls.Add(dgv) + frm.StartPosition = FormStartPosition.CenterScreen + frm.ShowDialog() + End If + + + Catch ex As System.Exception + + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + End Sub End Class