diff --git a/SDL/My Project/AssemblyInfo.vb b/SDL/My Project/AssemblyInfo.vb index 3f8e0e34..292c4ace 100644 --- a/SDL/My Project/AssemblyInfo.vb +++ b/SDL/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/SDL/USTV/frmMDM_USTVAntrag.vb b/SDL/USTV/frmMDM_USTVAntrag.vb index 07dda763..4d6df86e 100644 --- a/SDL/USTV/frmMDM_USTVAntrag.vb +++ b/SDL/USTV/frmMDM_USTVAntrag.vb @@ -106,7 +106,7 @@ Public Class frmMDM_USTVAntrag Dim c As New DataGridViewImageColumn - c.Name = "clmnPDF" : c.HeaderText = "Rechnungen" + c.Name = "clmnPDF" : c.HeaderText = "RE" ' c.Image = Nothing c.DefaultCellStyle.NullValue = Nothing c.ImageLayout = DataGridViewImageCellLayout.Zoom diff --git a/SDL/USTV/frmUSTVoffeneAntraege.Designer.vb b/SDL/USTV/frmUSTVoffeneAntraege.Designer.vb index f02c0465..be7d69b1 100644 --- a/SDL/USTV/frmUSTVoffeneAntraege.Designer.vb +++ b/SDL/USTV/frmUSTVoffeneAntraege.Designer.vb @@ -39,6 +39,8 @@ Partial Class frmUSTVoffeneAntraege Me.dat_Sum_Von = New System.Windows.Forms.DateTimePicker() Me.txtmaxAnz = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.Label3 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.Button2 = New System.Windows.Forms.Button() Me.FlowLayoutPanel.SuspendLayout() CType(Me.MyDatagridview1, System.ComponentModel.ISupportInitialize).BeginInit() Me.Panel4.SuspendLayout() @@ -52,6 +54,8 @@ Partial Class frmUSTVoffeneAntraege Me.FlowLayoutPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.FlowLayoutPanel.Controls.Add(Me.btn) Me.FlowLayoutPanel.Controls.Add(Me.Button7) + Me.FlowLayoutPanel.Controls.Add(Me.Button1) + Me.FlowLayoutPanel.Controls.Add(Me.Button2) Me.FlowLayoutPanel.Location = New System.Drawing.Point(12, 29) Me.FlowLayoutPanel.Name = "FlowLayoutPanel" Me.FlowLayoutPanel.Size = New System.Drawing.Size(1409, 31) @@ -258,6 +262,28 @@ Partial Class frmUSTVoffeneAntraege Me.Label3.TabIndex = 43 Me.Label3.Text = "max. DS:" ' + 'Button1 + ' + Me.Button1.BackColor = System.Drawing.Color.FloralWhite + Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button1.Location = New System.Drawing.Point(255, 3) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(120, 23) + Me.Button1.TabIndex = 2 + Me.Button1.Text = "UTA" + Me.Button1.UseVisualStyleBackColor = False + ' + 'Button2 + ' + Me.Button2.BackColor = System.Drawing.Color.FloralWhite + Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button2.Location = New System.Drawing.Point(381, 3) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(120, 23) + Me.Button2.TabIndex = 3 + Me.Button2.Text = "MSE" + Me.Button2.UseVisualStyleBackColor = False + ' 'frmUSTVoffeneAntraege ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -300,4 +326,6 @@ Partial Class frmUSTVoffeneAntraege Friend WithEvents dat_Sum_Von As DateTimePicker Friend WithEvents txtmaxAnz As VERAG_PROG_ALLGEMEIN.MyTextBox Friend WithEvents Label3 As Label + Friend WithEvents Button1 As Button + Friend WithEvents Button2 As Button End Class diff --git a/SDL/USTV/frmUSTVoffeneAntraege.vb b/SDL/USTV/frmUSTVoffeneAntraege.vb index b00cfe6c..8156f535 100644 --- a/SDL/USTV/frmUSTVoffeneAntraege.vb +++ b/SDL/USTV/frmUSTVoffeneAntraege.vb @@ -107,9 +107,9 @@ .Columns.Clear() 'Exit Sub 'MsgBox(.sql) - Dim sqlstring = "Select " & top & " [rmc_kdNr], [rmc_kdName], [rmc_landKZ], [rmc_reDatum], [rmc_reNr], [rmc_waehrung], [rmc_betragMWST] FROM [tblRMCImport] + Dim sqlstring = "Select " & top & " [rmc_kdNr], [rmc_kdName], [rmc_landKZ], [rmc_reDatum], [rmc_reNr], [rmc_waehrung], [rmc_betragMWST],rmc_daid FROM [tblRMCImport] where cast(rmc_reDatum As Date) between '" & dat_Sum_Von.Value & "' And '" & dat_Sum_Bis.Value & "' And rmc_archiv <> 1 - group by rmc_reDatum, rmc_kdNr,[rmc_kdName], [rmc_landKZ],[rmc_reNr], [rmc_waehrung], [rmc_betragMWST] having [rmc_betragMWST] > 0" + group by rmc_reDatum, rmc_kdNr,[rmc_kdName], [rmc_landKZ],[rmc_reNr], [rmc_waehrung], [rmc_betragMWST], rmc_daid having [rmc_betragMWST] > 0" .SET_SQL(sqlstring, "FMZOLL") .LOAD() @@ -122,6 +122,7 @@ .Columns("rmc_reNr").HeaderText = "RE-Nr" .Columns("rmc_betragMWST").HeaderText = "MWSt" .Columns("rmc_waehrung").HeaderText = "Währung" + .Columns("rmc_daid").Visible = False .Columns("rmc_kdName").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells @@ -129,8 +130,134 @@ Dim sumMwSt As Double = 0 + Dim c As New DataGridViewImageColumn + c.Name = "clmnPDF" : c.HeaderText = "RE" + ' c.Image = Nothing + c.DefaultCellStyle.NullValue = Nothing + c.ImageLayout = DataGridViewImageCellLayout.Zoom + c.Width = 40 : c.DefaultCellStyle.Padding = New Padding(2) : c.DefaultCellStyle.BackColor = Color.White + 'c.DefaultCellStyle.Tag = "Therefore anzeigen" + + .Columns.Add(c) + For Each r As DataGridViewRow In .Rows sumMwSt += If(IsNumeric(r.Cells("rmc_betragMWST").Value), CDbl(r.Cells("rmc_betragMWST").Value), 0) + + If Not IsDBNull(r.Cells("rmc_daid").Value) AndAlso r.Cells("rmc_daid").Value > 0 Then DirectCast(r.Cells("clmnPDF"), DataGridViewImageCell).Value = My.Resources.pdf + Next + + txtAnzahl.Text = .Rows.Count + txtMWST.Text = sumMwSt + + + End With + + End Sub + + Sub initDgv_MSE(anz As Integer) + + Dim top = "" + If anz > 0 Then top = "TOP (" & anz & ")" + + With MyDatagridview1 + .Columns.Clear() + 'Exit Sub + 'MsgBox(.sql) + Dim sqlstring = "Select " & top & " customer_number, customer_name, country, invoice_date, invoice_id, sum(total_amount_euro) as total_amount_euro, sum(total_vat_amount_euro) as total_vat_amount_euro, daId FROM [VERAG].[dbo].[tblMSEInvoices] inner join [tblMSECustomers] on [customer_number] = [customer_id] + where cast(invoice_date As Date) between '" & dat_Sum_Von.Value & "' And '" & dat_Sum_Bis.Value & "' And imported <> 1 + group by invoice_date, customer_number,customer_name, country, invoice_id, daId " + + .SET_SQL(sqlstring, "FMZOLL") + .LOAD() + If .Columns.Count > 0 Then + + .Columns("customer_number").HeaderText = "KdNr" + .Columns("customer_name").HeaderText = "Kunde" + .Columns("country").HeaderText = "Land" + .Columns("invoice_date").HeaderText = "RE-Datum" + .Columns("invoice_id").HeaderText = "RE-Nr" + .Columns("total_amount_euro").HeaderText = "Gesamtsumme Euro" + .Columns("total_vat_amount_euro").HeaderText = "MWSt Euro" + .Columns("daId").Visible = False + .Columns("customer_name").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill + .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells + + End If + + Dim sumMwSt As Double = 0 + + Dim c As New DataGridViewImageColumn + c.Name = "clmnPDF" : c.HeaderText = "RE" + ' c.Image = Nothing + c.DefaultCellStyle.NullValue = Nothing + c.ImageLayout = DataGridViewImageCellLayout.Zoom + c.Width = 40 : c.DefaultCellStyle.Padding = New Padding(2) : c.DefaultCellStyle.BackColor = Color.White + 'c.DefaultCellStyle.Tag = "Therefore anzeigen" + + .Columns.Add(c) + + For Each r As DataGridViewRow In .Rows + sumMwSt += If(IsNumeric(r.Cells("total_vat_amount_euro").Value), CDbl(r.Cells("total_vat_amount_euro").Value), 0) + + If Not IsDBNull(r.Cells("daId").Value) AndAlso r.Cells("daId").Value > 0 Then DirectCast(r.Cells("clmnPDF"), DataGridViewImageCell).Value = My.Resources.pdf + + Next + + txtAnzahl.Text = .Rows.Count + txtMWST.Text = sumMwSt + + + + + End With + + End Sub + + Sub initDgv_UTA(anz As Integer) + + Dim top = "" + If anz > 0 Then top = "TOP (" & anz & ")" + + With MyDatagridview1 + .Columns.Clear() + 'Exit Sub + 'MsgBox(.sql) + Dim sqlstring = "Select " & top & " [Kundennummer], [Lieferland], [Rechnungsdatum], [Abrechnungsnummer], sum([Gesamtbetrag_Brutto_in_Darstellwährung]) as [Gesamtbetrag_Brutto_in_Darstellwährung], sum([Gesamtbetrag_Umsatzsteuer_in_Darstellwährung]) as [Gesamtbetrag_Umsatzsteuer_in_Darstellwährung], da_id FROM [tblUTAImport] + where cast([Rechnungsdatum] As Date) between '" & dat_Sum_Von.Value & "' And '" & dat_Sum_Bis.Value & "' And [archiv] <> 1 + group by [Rechnungsdatum], Kundennummer, [Lieferland], [Abrechnungsnummer], da_id " + + .SET_SQL(sqlstring, "FMZOLL") + .LOAD() + If .Columns.Count > 0 Then + + .Columns("Kundennummer").HeaderText = "KdNr" + .Columns("Lieferland").HeaderText = "Land" + .Columns("Rechnungsdatum").HeaderText = "RE-Datum" + .Columns("Abrechnungsnummer").HeaderText = "RE-Nr" + .Columns("Gesamtbetrag_Brutto_in_Darstellwährung").HeaderText = "Gesamtsumme Euro" + .Columns("Gesamtbetrag_Umsatzsteuer_in_Darstellwährung").HeaderText = "MWSt Euro" + .Columns("da_id").Visible = False + .Columns("Kundennummer").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill + .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells + + End If + + Dim sumMwSt As Double = 0 + + Dim c As New DataGridViewImageColumn + c.Name = "clmnPDF" : c.HeaderText = "RE" + ' c.Image = Nothing + c.DefaultCellStyle.NullValue = Nothing + c.ImageLayout = DataGridViewImageCellLayout.Zoom + c.Width = 40 : c.DefaultCellStyle.Padding = New Padding(2) : c.DefaultCellStyle.BackColor = Color.White + 'c.DefaultCellStyle.Tag = "Therefore anzeigen" + + .Columns.Add(c) + + + For Each r As DataGridViewRow In .Rows + sumMwSt += If(IsNumeric(r.Cells("Gesamtbetrag_Umsatzsteuer_in_Darstellwährung").Value), CDbl(r.Cells("Gesamtbetrag_Umsatzsteuer_in_Darstellwährung").Value), 0) + If Not IsDBNull(r.Cells("da_id").Value) AndAlso r.Cells("da_id").Value > 0 Then DirectCast(r.Cells("clmnPDF"), DataGridViewImageCell).Value = My.Resources.pdf Next txtAnzahl.Text = .Rows.Count @@ -145,10 +272,20 @@ Select Case LIEFERANT Case "PLOSE" : initDgv_PLOSE(txtmaxAnz.Text) Case "RMC" : initDgv_RMC(txtmaxAnz.Text) + Case "MSE" : initDgv_MSE(txtmaxAnz.Text) + Case "UTA" : initDgv_UTA(txtmaxAnz.Text) End Select End Sub Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click initLieferant("RMC", sender) End Sub + + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + initLieferant("UTA", sender) + End Sub + + Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click + initLieferant("MSE", sender) + End Sub End Class \ No newline at end of file diff --git a/SDL/kunden/usrcntlKundeBearbeitenFull.vb b/SDL/kunden/usrcntlKundeBearbeitenFull.vb index bb12e030..b86efa01 100644 --- a/SDL/kunden/usrcntlKundeBearbeitenFull.vb +++ b/SDL/kunden/usrcntlKundeBearbeitenFull.vb @@ -1338,13 +1338,13 @@ Public Class usrcntlKundeBearbeitenFull '--------------------- VERAG360---------------------------- - Case "400000-499999" : cbxFiBu.Checked = False : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") - Case "200000-299999" : cbxFiBu.Checked = False : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") - Case "160000-169999" : cbxFiBu.Checked = False : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") - Case "303000-303999" : cbxFiBu.Checked = False : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") - Case "130000-139999" : cbxFiBu.Checked = False : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") - Case "150000-159999" : cbxFiBu.Checked = False : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") - Case "140000-149999" : cbxFiBu.Checked = False : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") + Case "400000-499999" : cbxFiBu.Checked = True : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") + Case "200000-299999" : cbxFiBu.Checked = True : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") + Case "160000-169999" : cbxFiBu.Checked = True : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") + Case "303000-303999" : cbxFiBu.Checked = True : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") + Case "130000-139999" : cbxFiBu.Checked = True : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") + Case "150000-159999" : cbxFiBu.Checked = True : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") + Case "140000-149999" : cbxFiBu.Checked = True : cboFirma.changeItem("19") : cboFiliale.changeItem("8001") Case "100000-199999" diff --git a/SDL/mdm/frmMDMDatenverarbetiung.vb b/SDL/mdm/frmMDMDatenverarbetiung.vb index 84902e59..23339160 100644 --- a/SDL/mdm/frmMDMDatenverarbetiung.vb +++ b/SDL/mdm/frmMDMDatenverarbetiung.vb @@ -78,7 +78,7 @@ Public Class frmMDMDatenverarbetiung btnDatenLaden.Text = "Daten laden" Case "ASFINAG" : initDgv_ASFINAG(cbxASFINAGAbgerechnet.Checked, cbxBelegeerstellt.Checked) btnDatenLaden.Text = "Daten laden" - Case "IDS" : MsgBox("Nicht verfügbar!") + Case "IDS" 'MsgBox("Nicht verfügbar!") btnDatenLaden.Text = "Daten laden" Case "MSE" : initDgv_MSE() btnDatenLaden.Text = "Daten laden" @@ -988,7 +988,7 @@ Public Class frmMDMDatenverarbetiung Function genRGAtt_UTA() As Boolean Dim top = "" 'top = " TOP 20 " - Dim SQLStr = " SELECT " & top & " Kundennummer AS [Customer ID], KundenNr AS [Customer Nr], UTAExportCSV,Rechnungsdruck + Dim SQLStr = " SELECT Kundennummer AS [Customer ID], KundenNr AS [Customer Nr], UTAExportCSV,Rechnungsdruck FROM tblUTAFakturierwarenarten INNER JOIN (((Adressen INNER JOIN tblUTAImport ON Adressen.UTAKundenNr = tblUTAImport.Kundennummer) INNER JOIN Offertenpositionen ON Adressen.AdressenNr = Offertenpositionen.KundenNr) @@ -1106,7 +1106,7 @@ Public Class frmMDMDatenverarbetiung left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country left join adressen ON cust.[customer_id] = Adressen.MSEKundenNr - where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 1 and (trans.transaction_gross_amount <> 0 or trans.[msts_fee_amount] <> 0) + where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 0 and (trans.transaction_gross_amount <> 0 or trans.[msts_fee_amount] <> 0) order by cust.customer_id" Dim dt_Main As DataTable = SQL.loadDgvBySql_Param(SQLStr, "FMZOLL", 1200) @@ -1118,6 +1118,7 @@ Public Class frmMDMDatenverarbetiung End If Dim cnt = 0 If vbYes = MsgBox("Es wurden Daten von " & dt_Main.Rows.Count & " Kunden gefunden " & vbNewLine & " Möchten Sie die Anhänge erstellen?", vbYesNoCancel) Then + Dim dir = "F:\FMZoll\MSE\Archiv\" & IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "Test", "") & Now.ToShortDateString If Directory.Exists(dir) Then dir &= "_" & Now.ToShortTimeString.Replace(":", "") @@ -1140,9 +1141,9 @@ Public Class frmMDMDatenverarbetiung '' as [Eurovignet K-Number], '' as [LKW-Kostenstelle], trans.original_net_amount as [Original Nett Amount], trans.original_vat_amount as [Original VAT Amount], trans.original_gross_amount as [Original Amount], trans.original_currency as [Original Currency], trans.transaction_gross_amount as [Transaction Amount ( EUR )], trans.msts_fee_amount as [Admin Fee Amount ( EUR )], '' as [Fees and Costs Amount ( EUR )], trans.msts_vat_amount as [VAT Amount ( EUR )],trans.total_gross_amount as [Total Amount ( EUR )], '' as [Total Dutch VAT ( EUR )], '' as [Total Foreign VAT ( EUR )], trans.[USteuer_EUR] as [USteuer_EUR] FROM [VERAG].[dbo].[tblMSESettlements] as bills - inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] - inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id - inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country + left join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] + left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id + left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 1 and (trans.transaction_gross_amount <> 0 or [msts_fee_amount] <> 0) and cust.[customer_id] = " & csv.Item("Customer ID"), "FMZOLL") dt_CSV_selected.ParentRelations.Clear() dt_CSV_selected.ChildRelations.Clear() @@ -1201,12 +1202,13 @@ Public Class frmMDMDatenverarbetiung ' ANHÄNGE WERDEN NCIHT BENÖTIGT:: 'Alle Alangen im foglenden VZ löschen und die aktuellen kopieren - Dim dirAnhang = "F: \FMZoll\MSE\Anlagen\" & IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "Test", "") & Now.ToShortDateString + Dim dirAnhang = "F:\FMZoll\MSE\Anlagen\" & IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "Test", "") & Now.ToShortDateString If Directory.Exists(dirAnhang) Then 'Directory.Delete(dirAnhang, True) For Each f In Directory.GetFiles(dirAnhang) File.Delete(f) Next End If + If Not Directory.Exists(dirAnhang) Then Directory.CreateDirectory(dirAnhang) For Each f In Directory.GetFiles(dir) @@ -1725,7 +1727,7 @@ Public Class frmMDMDatenverarbetiung Try 'Zeitstempel - Dim SQLQuery = "INSERT INTO tblMautbericht (Datenquelle,[Customer No],[Licence Plate Number],[Transaction Date],[Transaction Country],[Product description],[Card Number],[Entry Terminal],[Exit Terminal],[Nett Amount],[VAT Amount],[Total Amount]) VALUES (@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9,@P10,@P11,@P12) " + Dim SQLQuery = "INSERT INTO tblMautbericht (Datenquelle,[Customer No],[Licence Plate Number],[Transaction Date],[Transaction Country],[Product description],[Card Number],[Entry Terminal],[Exit Terminal],[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) @@ -1736,11 +1738,9 @@ Public Class frmMDMDatenverarbetiung Command.Parameters.AddWithValue("@P5", r(4)) Command.Parameters.AddWithValue("@P6", r(5)) Command.Parameters.AddWithValue("@P7", r(6)) - Command.Parameters.AddWithValue("@P8", r(7)) - Command.Parameters.AddWithValue("@P9", r(8)) + Command.Parameters.AddWithValue("@P8", CDbl(r(7))) + Command.Parameters.AddWithValue("@P9", CDbl(r(8))) Command.Parameters.AddWithValue("@P10", CDbl(r(9))) - Command.Parameters.AddWithValue("@P11", CDbl(r(10))) - Command.Parameters.AddWithValue("@P12", CDbl(r(11))) Command.ExecuteNonQuery() Command.Dispose() @@ -1780,13 +1780,22 @@ Public Class frmMDMDatenverarbetiung End If - sqlstr = " Select adressen.AdressenNr As [Customer No],trans.license_plate_number as [Licence Plate Number],cast(trans.[purchase_datetime] as Date) as [Transaction Date], trans.transaction_country As [Transaction Country],trans.device_product_type As [Product description],trans.device_product_number as [Card Number], trans.entry_point_name as [Entry Terminal],trans.exit_point_name as [Exit Terminal], Sum(trans.transaction_gross_amount) As [Nett Amount],Sum(trans.USteuer_EUR) As [VAT Amount], Sum(trans.total_gross_amount) As [Total Amount] + sqlstr = " Select 'MSE',adressen.AdressenNr As [Customer No], + trans.license_plate_number as [Licence Plate Number], + cast(trans.[purchase_datetime] as Date) as [Transaction Date], + trans.transaction_country As [Transaction Country],trans.device_product_type As [Product description], + trans.device_product_number as [Card Number], + trans.entry_point_name as [Entry Terminal], + trans.exit_point_name as [Exit Terminal], + sum(trans.total_gross_amount) - sum(trans.USteuer_EUR) As [Nett Amount], + Sum(trans.USteuer_EUR) As [VAT Amount], + Sum(trans.total_gross_amount) As [Total Amount] From [VERAG].[dbo].[tblMSESettlements] as bills - inner Join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] - inner Join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id - inner Join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] And inv.customer_number = cust.[customer_id] And trans.transaction_country = inv.country + left Join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] + left Join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id + left Join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] And inv.customer_number = cust.[customer_id] And trans.transaction_country = inv.country Left Join adressen ON cust.[customer_id] = Adressen.MSEKundenNr - where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.chargedDatetime is null " & sqlWhere & + where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.chargedDatetime is not null " & sqlWhere & "GROUP BY Adressen.AdressenNr,trans.license_plate_number,cast(trans.[purchase_datetime] as Date), trans.transaction_country,trans.device_product_type, trans.device_product_number, trans.entry_point_name ,trans.exit_point_name order by Adressen.AdressenNr " @@ -2249,9 +2258,9 @@ Public Class frmMDMDatenverarbetiung trans.original_net_amount as [Original Nett Amount], trans.original_vat_amount as [Original VAT Amount], trans.original_gross_amount as [Original Amount], trans.original_currency as [Original Currency], trans.transaction_gross_amount as [Transaction Amount ( EUR )], trans.msts_fee_amount as [Admin Fee Amount ( EUR )], '' as [Fees and Costs Amount ( EUR )], trans.msts_vat_amount as [VAT Amount ( EUR )],trans.total_gross_amount as [Total Amount ( EUR )], '' as [Total Dutch VAT ( EUR )], '' as [Total Foreign VAT ( EUR )], trans.[USteuer_EUR] as [USteuer_EUR] FROM [VERAG].[dbo].[tblMSESettlements] as bills - inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] - inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id - inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country + left join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] + left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id + left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country where bills.invoice_date = '" & DateTimePicker2.Text & "' and (trans.transaction_gross_amount <> 0 or [msts_fee_amount] <> 0) and cust.[customer_id] = " & MSEKdNr @@ -3621,7 +3630,7 @@ Public Class frmMDMDatenverarbetiung PictureBox1.Visible = True End If Case "MSE" - If SQL.doSQL("UPDATE [tblMSETransactions] Set charged = 1 + If SQL.doSQL("UPDATE [VERAG].[dbo].[tblMSETransactions] Set charged = 1 FROM [VERAG].[dbo].[tblMSESettlements] as bills inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb index 1b73b301..dacd7eed 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb @@ -1,5 +1,6 @@ Imports System.Data.SqlClient Imports System.EnterpriseServices +Imports System.IO Imports System.Net Imports System.Reflection Imports DocumentFormat.OpenXml.InkML @@ -864,7 +865,7 @@ Public Class cMSEAPI Return CDate(o) End If End Function - Public Function getInvoices(jwt As String, dt As DataTable, startDate As Date, end_date As Date) As String + Public Function getInvoices(jwt As String, dt As DataTable, startDate As Date, end_date As Date, uploadToDs As Boolean) As String Try Dim returnText As String = "" Dim failureText As String = "" @@ -1005,8 +1006,6 @@ Public Class cMSEAPI inv.SAVE() End If - - j = j + 1 End While @@ -1017,18 +1016,24 @@ Public Class cMSEAPI '\\datenarchiv\Datenarchiv\MDM_SCHNITTSTELLEN\ECHTSYSTEM\Nachrichtendaten_ZIEL\MSE If r("url") <> "" AndAlso r("name") <> "" AndAlso r("name").contains("VAT") Then 'only VAT-Invoices - VERAG_PROG_ALLGEMEIN.cFormularManager.getPDFViaSpirePDF_FromURLStream(r("url"), r("name"), PDFRECHNUNGENPFAD, False) + Dim inv As New cMSEInvoices(r("name"), r("inv.invoice_id")) + If Not inv.imported Then 'verhindert unnötige Downloads + Dim filepath = VERAG_PROG_ALLGEMEIN.cFormularManager.getPDFViaSpirePDF_FromURLStream(r("url"), r("name"), PDFRECHNUNGENPFAD, False) + If filepath <> "" AndAlso uploadToDs Then + Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "MSE", Now.Year, Now.ToString("yyyyMMdd"), r("name")) + DS.uploadDataToDATENSERVER(filepath & "\" & r("name"),,,,,, True) + SQL.doSQL("Update [tblMSEInvoices] SET [daId]='" & DS.da_id & "', imported = 1 where [name] = '" & r("name") & "'", "FMZOLL") + End If + + End If End If + Next dt = dt.DefaultView.ToTable() End If - - - - Catch ex As WebException VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) End Try @@ -1356,6 +1361,8 @@ Public Class cMSEInvoices Property invoice_date As Object = Nothing Property customer_number As Object = Nothing Property country As Object = Nothing + Property imported As Boolean = False + Property daId As Object = Nothing Public hasEntry = False @@ -1380,6 +1387,8 @@ Public Class cMSEInvoices list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("invoice_date", invoice_date)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("customer_number", customer_number)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("country", country)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("imported", imported)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("daId", daId)) Return list End Function