diff --git a/SDL/Classes/cFiskaltrustClient.vb b/SDL/Classes/cFiskaltrustClient.vb new file mode 100644 index 00000000..1c0245bf --- /dev/null +++ b/SDL/Classes/cFiskaltrustClient.vb @@ -0,0 +1,181 @@ +Imports System.Net.Http +Imports System.Text +Imports Newtonsoft.Json +Imports System.Threading + +Public Class cFiskaltrustClient + + + Private ReadOnly _baseUrl As String + Private ReadOnly _cashboxId As String + Private ReadOnly _accessToken As String + Private ReadOnly _country As String + + Private Shared ReadOnly _httpClient As New HttpClient() + + Public Sub New(baseUrl As String, cashboxId As String, accessToken As String, country As String) + _baseUrl = baseUrl.TrimEnd("/"c) + _cashboxId = cashboxId + _accessToken = accessToken + _country = country + End Sub + + ' ================================ + ' PUBLIC API + ' ================================ + Public Async Function SignReceiptAsync(amount As Double, vat As Double, POS As List(Of EABelegPositionen)) As Task(Of String) + + Dim payload = BuildPayload(amount, vat, POS) + Dim endpoint = GetEndpoint() + + Return Await SendAsync(endpoint, payload) + + End Function + + ' Optional: Storno Beispiel + Public Async Function CancelReceiptAsync(reference As String) As Task(Of String) + + Dim payload = New With { + .ftCashBoxID = _cashboxId, + .ftPosSystemId = "POS-1", + .cbTerminalID = "T1", + .cbReceiptReference = reference, + .cbReceiptMoment = DateTime.UtcNow.ToString("o"), + .ftReceiptCase = 4919338172267102210 ' Storno + } + + Return Await SendAsync(GetEndpoint(), payload) + + End Function + + ' ================================ + ' CORE HTTP LOGIC (RETRY!) + ' ================================ + Private Async Function SendAsync(endpoint As String, payload As Object) As Task(Of String) + + Dim exToThrow As Exception = Nothing + + Dim json As String = JsonConvert.SerializeObject(payload) + Dim url = _baseUrl & endpoint + + Dim retries As Integer = 3 + Dim delayMs As Integer = 500 + + For attempt = 1 To retries + + Try + Using request As New HttpRequestMessage(HttpMethod.Post, url) + + request.Headers.Add("cashboxid", _cashboxId) + request.Headers.Add("accesstoken", _accessToken) + + request.Content = New StringContent(json, Encoding.UTF8, "application/json") + + Dim response = Await _httpClient.SendAsync(request) + Dim result = Await response.Content.ReadAsStringAsync() + + ' Logging Hook + Log($"[{DateTime.Now}] Response ({response.StatusCode}): {result}") + + If response.IsSuccessStatusCode Then + Return result + End If + + ' Retry only on transient errors + If CType(response.StatusCode, Integer) >= 500 Then + Throw New Exception("Server error: " & result) + Else + ' Client error → no retry + Throw New Exception("Client error: " & result) + End If + + End Using + + Catch ex As Exception + + Log($"[{DateTime.Now}] Attempt {attempt} failed: {ex.Message}") + + If attempt = retries Then + exToThrow = ex + End If + + End Try + + If exToThrow IsNot Nothing Then + Await Task.Delay(1000) ' ✅ jetzt OK + Throw exToThrow + End If + + Next + + Throw New Exception("Unexpected error") + + End Function + + ' ================================ + ' PAYLOAD BUILDER + ' ================================ + Private Function BuildPayload(amount As Double, vat As Double, POS As List(Of EABelegPositionen)) As Object + + ' ChargeItems Liste vorbereiten + Dim chargeItems = New List(Of Object) + + For Each p In POS + chargeItems.Add(New With { + .Quantity = p.Anzahl, + .Amount = p.Preis, + .VATRate = vat, + .Description = p.LeistungsBez, + .ftChargeItemCase = 4919338167972134929 + }) + Next + + ' Payload Objekt erstellen + Dim payload = New With { + .ftCashBoxID = _cashboxId, + .ftPosSystemId = "POS-1", + .cbTerminalID = "T1", + .cbReceiptReference = Guid.NewGuid().ToString(), + .cbReceiptMoment = DateTime.UtcNow.ToString("o"), + .cbChargeItems = chargeItems, + .cbPayItems = New Object() { + New With { + .Quantity = 1.0, + .Amount = amount, + .Description = "Cash", + .ftPayItemCase = 4919338167972134913 + } + }, + .ftReceiptCase = 4919338172267102209 + } + + Return payload + + End Function + + ' ================================ + ' ENDPOINT SWITCH + ' ================================ + Private Function GetEndpoint() As String + Select Case _country + Case "DE" + Return "/json/v1/Sign" + Case "AT" + Return "/json/Sign" + Case Else + Throw New Exception("Unsupported country") + End Select + End Function + + ' ================================ + ' LOGGING (REPLACE IN PROD!) + ' ================================ + Private Sub Log(message As String) + ' 👉 Hier anschließen: + ' - Datei + ' - Datenbank + ' - Serilog / NLog + Console.WriteLine(message) + End Sub + +End Class \ No newline at end of file diff --git a/SDL/Classes/cRKSV.vb b/SDL/Classes/cRKSV.vb index 77c8f400..9042c38f 100644 --- a/SDL/Classes/cRKSV.vb +++ b/SDL/Classes/cRKSV.vb @@ -1,6 +1,8 @@ -Imports System.Globalization +Imports System.Net.Http +Imports System.Text Imports GrapeCity.ActiveReports -Imports GrapeCity.DataVisualization.TypeScript +Imports GrapeCity.DataVisualization.Options +Imports Newtonsoft.json Imports SDL.RKSVServer Imports VERAG_PROG_ALLGEMEIN.DSFinVKService @@ -89,6 +91,54 @@ Public Class cRKSV Return False End Function + + Shared Function insertRKSVFiskaltrust(ByVal kasse As cRKSV_Kasse, CompanyGUID As String, ByVal umsatzZaehler As Double, ByVal belegDat As DateTime, ByVal steuerSchluessel As Integer, ByVal RKSV_Beleg_Id As Integer, ByVal summeBRUTTO As Double, TEST As Boolean, POS As List(Of EABelegPositionen)) As Boolean + Try + + + Dim credentials As New SDL.RKSVServer.DBUserCredentials + + credentials.Database = "RKSVWcfDB" + credentials.Server = "AVISO\SQLEXPRESS" + credentials.Username = "Admin" + credentials.Password = "verag#2" + credentials.CashboxID = kasse.rksv_FT_CashboxID + credentials.CompanyGUID = CompanyGUID + Dim AccessToken As String = kasse.rksv_FT_AccessToken + + Dim jws As String = String.Empty + Dim qr As String = String.Empty + Dim ocra As String = String.Empty + 'Dim answer As String = String.Empty + + Dim Belegnummer = RKSV_Beleg_Id + Dim BelegDatumUhrzeit = belegDat ' BELEG.BelegDat + + Dim steuersatz As Double = SQL.getValueTxtBySql("SELECT isnull(tblSteuersätze.Steuersatz,0) FROM tblSteuersätze WHERE tblSteuersätze.Nr='" & steuerSchluessel & "' ", "FMZOLL") + + + + Dim BetragSatzNormal = IIf(steuersatz = 0.2, summeBRUTTO, 0.0) 'summe + Dim BetragSatzErm1 = IIf(steuersatz = 0.1, summeBRUTTO, 0.0) + Dim BetragSatzErm2 = IIf(steuersatz = 0.13, summeBRUTTO, 0.0) + Dim BetragSatzNull = IIf(steuersatz = 0.0, summeBRUTTO, 0.0) + Dim BetragSatzBesonders = IIf(steuersatz = 0.19, summeBRUTTO, 0.0) + Dim StandUmsatzzaehler = umsatzZaehler 'KASSE.rksv_Umsatzzaehler + + Dim countryID As String + + Dim client As New cFiskaltrustClient(kasse.rksv_FT_RestServiceURL, kasse.rksv_FT_CashboxID, kasse.rksv_FT_AccessToken, kasse.rksv_FT_Country) + + Dim result = client.SignReceiptAsync(summeBRUTTO, steuersatz, POS) + + + Catch ex As Exception + MsgBox("Es ist ein Fehler bei der Signatur aufgetreten (insertRKSV): " & vbNewLine & ex.Message & ex.StackTrace) + End Try + Return False + End Function + + Shared Function getKB(BELEG As EABeleg, PERSONAL As cPersonal, ByRef KBEntry As cKassenbuch, ByRef KBEntryGB As cKassenbuch, Firma As String) As Boolean Dim j1 = SQL.getValueTxtBySql("SELECT [JournalNr] FROM [tblKassenbuch] " & " WHERE [Mandant]='" & PERSONAL.Mandant & "' AND [Niederlassung]='" & PERSONAL.Niederlassung & "' AND [Benutzer]='" & PERSONAL.ID & "' AND [Geschäftsjahr]='" & cRKSV.getGJ_FIRMA(BELEG.BelegDat, Firma) & "' AND [BelegNr] ='" & BELEG.BelegNr & "' and Steuer <=0 AND Soll <> 0", "FMZOLL") @@ -2354,7 +2404,7 @@ Public Class cRKSV End If Dim Buchungstext As String = "Umb.BK / KASSA" - if BELEG.ECZahlungsNr IsNot Nothing AndAlso BELEG.ECZahlungsNr <> "" Then + If BELEG.ECZahlungsNr IsNot Nothing AndAlso BELEG.ECZahlungsNr <> "" Then Buchungstext &= " " & BELEG.ECZahlungsNr End If @@ -2478,7 +2528,7 @@ Public Class cRKSV End If - End Sub + End Sub Private Shared Sub getDEBDaten(ByRef Mandant As String, ByRef DebKonto As Integer, ByRef c_sprache As String, ByRef c_ustidnr As String, ByRef c_zahlziel As String, ByRef si_tage As Integer, ByRef dec_skonto As Integer, ByRef si_ntage As Integer, ByRef SkontoDatum As Date, ByRef Nettodatum As Date) diff --git a/SDL/Classes/cRKSV_Kasse.vb b/SDL/Classes/cRKSV_Kasse.vb index c786ad68..f76d0f02 100644 --- a/SDL/Classes/cRKSV_Kasse.vb +++ b/SDL/Classes/cRKSV_Kasse.vb @@ -25,6 +25,10 @@ Public Class cRKSV_Kasse Property rksv_DE_apiToken As Object = Nothing Property rksv_DE_license As Object = Nothing Property rksv_StornoIncreaseBelegCnt As Object = Nothing + Property rksv_FT_CashboxID As Object = Nothing + Property rksv_FT_AccessToken As Object = Nothing + Property rksv_FT_RestServiceURL As Object = Nothing + Property rksv_FT_Country As Object = Nothing Dim SQL As New SQL @@ -224,6 +228,10 @@ Public Class cRKSV_Kasse Me.rksv_DE_apiToken = cSqlDb.checkNullReturnValue(dr.Item("rksv_DE_apiToken"), Nothing) Me.rksv_DE_license = cSqlDb.checkNullReturnValue(dr.Item("rksv_DE_license"), Nothing) Me.rksv_StornoIncreaseBelegCnt = cSqlDb.checkNullBool(dr.Item("rksv_StornoIncreaseBelegCnt")) + Me.rksv_FT_CashboxID = cSqlDb.checkNullReturnValue(dr.Item("rksv_FT_CashboxID"), Nothing) + Me.rksv_FT_AccessToken = cSqlDb.checkNullReturnValue(dr.Item("rksv_FT_AccessToken"), Nothing) + Me.rksv_FT_RestServiceURL = cSqlDb.checkNullReturnValue(dr.Item("rksv_FT_RestServiceURL"), Nothing) + Me.rksv_FT_Country = cSqlDb.checkNullReturnValue(dr.Item("rksv_FT_Country"), Nothing) End If dr.Close() @@ -261,6 +269,10 @@ Public Class cRKSV_Kasse list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("rksv_DE_apiToken", rksv_DE_apiToken)) list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("rksv_DE_license", rksv_DE_license)) list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("rksv_StornoIncreaseBelegCnt", rksv_StornoIncreaseBelegCnt)) + list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("rksv_FT_CashboxID", rksv_FT_CashboxID)) + list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("rksv_FT_AccessToken", rksv_FT_AccessToken)) + list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("rksv_FT_RestServiceURL", rksv_FT_RestServiceURL)) + list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("rksv_FT_Country", rksv_FT_Country)) Return list diff --git a/SDL/My Project/AssemblyInfo.vb b/SDL/My Project/AssemblyInfo.vb index 5edcb0c8..a3e6ccc3 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/SDL.vbproj b/SDL/SDL.vbproj index 1e8bd8ae..00e785ef 100644 --- a/SDL/SDL.vbproj +++ b/SDL/SDL.vbproj @@ -408,6 +408,9 @@ True + + ..\..\..\Aviso\AVISO\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll + ..\..\..\dll\NumericBox.dll @@ -442,6 +445,11 @@ + + ..\..\..\Aviso\AVISO\packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + True + ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll True @@ -451,9 +459,39 @@ ..\packages\System.IO.Packaging.4.5.0\lib\net46\System.IO.Packaging.dll + + ..\..\..\Aviso\AVISO\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + True + True + + + ..\..\..\Aviso\AVISO\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + True + True + + + ..\..\..\Aviso\AVISO\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll + True + True + + + ..\..\..\Aviso\AVISO\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + + + ..\..\..\Aviso\AVISO\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + True + True + + + ..\..\..\Aviso\AVISO\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + True + True + @@ -684,6 +722,7 @@ + diff --git a/SDL/USTV/frmMDM_USTVAntrag.vb b/SDL/USTV/frmMDM_USTVAntrag.vb index 8fd7cb2f..19d1ff40 100644 --- a/SDL/USTV/frmMDM_USTVAntrag.vb +++ b/SDL/USTV/frmMDM_USTVAntrag.vb @@ -267,6 +267,13 @@ Public Class frmMDM_USTVAntrag pnlHeader.BackColor = Color.FromArgb(0, 54, 128) End If + If USTV_ANTRAG.UStVAn_AntragEingereichtAm IsNot Nothing AndAlso IsDate(USTV_ANTRAG.UStVAn_AntragEingereichtAm) Then + looked = True + Else + looked = False + End If + + lookFields(looked) If KUNDE_ERW IsNot Nothing Then @@ -543,13 +550,13 @@ Public Class frmMDM_USTVAntrag btnRMCQuartal.Visible = False End If - If USTV_ANTRAG.UStVAn_AntragEingereichtAm IsNot Nothing AndAlso IsDate(USTV_ANTRAG.UStVAn_AntragEingereichtAm) Then - looked = True - Else - looked = False - End If + 'If USTV_ANTRAG.UStVAn_AntragEingereichtAm IsNot Nothing AndAlso IsDate(USTV_ANTRAG.UStVAn_AntragEingereichtAm) Then + ' looked = True + 'Else + ' looked = False + 'End If - lookFields(looked) + 'lookFields(looked) Else @@ -1806,7 +1813,7 @@ Public Class frmMDM_USTVAntrag For Each row In dgvUSTVPositionen.Rows averageUmrechnungskurs += row.Cells("UStVPo_Umrechnungskurs").Value - Dim reDat As Date = IIf(Not IsDBNull(row.Cells("invoice_date").Value) AndAlso IsDate(row.Cells("invoice_date").Value), row.Cells("invoice_date").Value, Nothing) + Dim reDat As Date = IIf(Not IsDBNull(row.Cells("UStVPo_ReDat").Value) AndAlso IsDate(row.Cells("UStVPo_ReDat").Value), row.Cells("UStVPo_ReDat").Value, Nothing) If reDat > USTV_ANTRAG.UStVAn_ReDatBis Or reDat < USTV_ANTRAG.UStVAn_ReDatVon Then invoicedateOK = False @@ -4178,7 +4185,7 @@ Public Class frmMDM_USTVAntrag Case Else 'Bank aus Kunden! Dim dtBank As New DataTable - dtBank = SQL.loadDgvBySql("SELECT isnull(bnk_name,'') as bnk_name ,bnk_anschrift,ISNULL(bnk_iban,'') as bnk_iban,ISNULL(bnk_bic,'') as bnk_bic FROM [tblBankverbindungen] WHERE isnull(bnk_hauptkonto,0) = 0 and bnk_archiv = 0 and bnk_KundenNr = " & KUNDE.KundenNr, "FMZOLL") + dtBank = SQL.loadDgvBySql("SELECT isnull(bnk_name,'') as bnk_name ,bnk_anschrift,ISNULL(bnk_iban,'') as bnk_iban,ISNULL(bnk_bic,'') as bnk_bic FROM [tblBankverbindungen] WHERE isnull(bnk_hauptkonto,0) = 0 and isnull(bnk_archiv,0) = 0 and bnk_KundenNr = " & KUNDE.KundenNr, "FMZOLL") If dtBank.Rows.Count > 0 Then BANK_OWNER = ADR.Name_1 @@ -4535,8 +4542,7 @@ Public Class frmMDM_USTVAntrag Private Function lookFields(look As Boolean) For Each c As Control In Panel8.Controls - - If c.Name <> "cbxWahrung" AndAlso c.Name <> "txtEingereichtAm" AndAlso c.Name <> "cbxInterneNr" Then + If c.Name <> "cbxWahrung" AndAlso c.Name <> "txtEingereichtAm" AndAlso c.Name <> "cbxInterneNr" AndAlso c.Name <> "cbxSicherheit" AndAlso c.Name <> "txt3470" AndAlso c.Name <> "txtVZam" AndAlso c.Name <> "txtRZam" AndAlso c.Name <> "txtRZ" AndAlso c.Name <> "txtVZ" AndAlso c.Name <> "Label1" AndAlso c.Name <> "Label15" AndAlso c.Name <> "Label16" AndAlso c.Name <> "Label17" AndAlso c.Name <> "Label9" Then c.Enabled = Not look End If Next diff --git a/SDL/USTV/frmUSTVoffeneAntraege.vb b/SDL/USTV/frmUSTVoffeneAntraege.vb index da9a85dd..29f3695f 100644 --- a/SDL/USTV/frmUSTVoffeneAntraege.vb +++ b/SDL/USTV/frmUSTVoffeneAntraege.vb @@ -1093,33 +1093,35 @@ Public Class frmUSTVoffeneAntraege Dim dtfehlendePDF As New DataTable Dim dtPartInvoicesIDS As New DataTable + Dim fehlendePDFS As Integer = 0 + Dim fehlendePDFSPartInvoicesIDS As Integer = 0 Select Case LIEFERANT.ToString.ToLower Case "plose" Dim LIEFERANT As cPLOSE_Inv_Data - dtfehlendePDF = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + fehlendePDFS = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value, dtfehlendePDF) Case "rmc" Dim LIEFERANT As cRMC - dtfehlendePDF = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + fehlendePDFS = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value, dtfehlendePDF) Case "mse" Dim LIEFERANT As cMSEAPI - dtfehlendePDF = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + fehlendePDFS = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value, dtfehlendePDF) Case "uta" Dim LIEFERANT As cUTA - dtfehlendePDF = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + fehlendePDFS = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value, dtfehlendePDF) Case "ids" Dim LIEFERANT As cIDS - dtfehlendePDF = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) - dtPartInvoicesIDS = LIEFERANT.checkPartInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + fehlendePDFS = LIEFERANT.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value, dtfehlendePDF) + fehlendePDFSPartInvoicesIDS = LIEFERANT.checkPartInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value, dtPartInvoicesIDS) Case "verag" @@ -1135,9 +1137,8 @@ Public Class frmUSTVoffeneAntraege End Select - Dim fehlendePDFs As Integer = 0 - MsgBox("Anzahl fehlende PDFs: " & dtfehlendePDF.Rows.Count & IIf(CDate(dat_Sum_Von.Value).Year <= 2024 OrElse CDate(dat_Sum_Bis.Value).Year <= 2024, vbNewLine & "PDF-Rechnungen vor 2025 wurden tlw. nicht importiert!", "")) + MsgBox("Anzahl fehlende PDFs: " & fehlendePDFS & IIf(CDate(dat_Sum_Von.Value).Year <= 2024 OrElse CDate(dat_Sum_Bis.Value).Year <= 2024, vbNewLine & "PDF-Rechnungen vor 2025 wurden tlw. nicht importiert!", "")) If dtfehlendePDF.Rows.Count > 0 Then If vbYes = MsgBox("Details der fehlenden PDF-Rechnungen anzeigen?", vbYesNo) Then @@ -1149,9 +1150,9 @@ Public Class frmUSTVoffeneAntraege 'extra bei IDS ->Prüft ob es zur Gesamtrechnung Teilrechnungen gibt!! If LIEFERANT.ToString.ToLower = "ids" Then - If dtPartInvoicesIDS.Rows.Count > 0 Then + If fehlendePDFSPartInvoicesIDS > 0 Then - If vbYes = MsgBox("Es fehlen " & dtPartInvoicesIDS.Rows.Count & " Teilrechnungen" & vbNewLine & "Details der fehlenden Teilrechnungen anzeigen?", vbYesNo) Then + If vbYes = MsgBox("Es fehlen " & fehlendePDFSPartInvoicesIDS & " Teilrechnungen" & vbNewLine & "Details der fehlenden Teilrechnungen anzeigen?", vbYesNo) Then cProgramFunctions.genExcelFromDT_NEW(dtPartInvoicesIDS,,, "Fehlende PDF-Teilrechnungen inkl. Datensatz " & dat_Sum_Von.Value.ToShortDateString & " - " & dat_Sum_Bis.Value.ToShortDateString) End If diff --git a/SDL/kassenbuch/frmBelegNeu.vb b/SDL/kassenbuch/frmBelegNeu.vb index d1d7d8f6..3aa13fc6 100644 --- a/SDL/kassenbuch/frmBelegNeu.vb +++ b/SDL/kassenbuch/frmBelegNeu.vb @@ -1590,7 +1590,9 @@ Public Class frmBelegNeu Me.Cursor = Cursors.WaitCursor If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then - KASSE.LOAD(6) 'Laden der Kasse anhand der Auswahlbox + 'KASSE.LOAD(6) 'AT-Kasse + KASSE.LOAD(12) 'DE-kasse + 'Laden der Kasse anhand der Auswahlbox Else KASSE.LOAD(cboKassen._value) 'Laden der Kasse anhand der Auswahlbox End If @@ -1686,9 +1688,17 @@ Public Class frmBelegNeu Dim QR_CodeString As String = "" Dim LastJWS As String = "" - If KASSE.rksv_aktiv Then ' WENN für die Kasse die RKSV ÖSTERREICH gilt + If KASSE.rksv_aktiv Then ' WENN für die Kasse die RKSV Dim answer = "" - If Not cRKSV.insertRKSV(KASSE, KASSE.rksv_CompanyGUID, KASSE.rksv_Umsatzzaehler, BELEG.BelegDat, BELEG.Steuerschlüssel, RKSV_Beleg_Id, If(EA = "E", summeBRUTTO, summeBRUTTO * -1), QR_CodeString, LastJWS, TESTBUCHUNG, answer) Then 'Digitale Signierung und Erfassung in die RKSV-Datenbank mittels ITG-Service + + Dim verarbeitet As Boolean = False + If KASSE.rksv_FT_RestServiceURL <> "" Then + verarbeitet = cRKSV.insertRKSVFiskaltrust(KASSE, KASSE.rksv_CompanyGUID, KASSE.rksv_Umsatzzaehler, BELEG.BelegDat, BELEG.Steuerschlüssel, RKSV_Beleg_Id, If(EA = "E", summeBRUTTO, summeBRUTTO * -1), TESTBUCHUNG, BELEG.POS) + Else + verarbeitet = cRKSV.insertRKSV(KASSE, KASSE.rksv_CompanyGUID, KASSE.rksv_Umsatzzaehler, BELEG.BelegDat, BELEG.Steuerschlüssel, RKSV_Beleg_Id, If(EA = "E", summeBRUTTO, summeBRUTTO * -1), QR_CodeString, LastJWS, TESTBUCHUNG, answer) 'Digitale Signierung und Erfassung in die RKSV-Datenbank mittels ITG-Service + End If + + If Not verarbeitet Then If Not TESTBUCHUNG Then KASSE.DECREASE_BELEG_UMSATZ(oldBelegZaehler, If(EA = "E", summeBRUTTO * -1, summeBRUTTO)) cRKSV.DELETE(BELEG, KASSE.rksv_firma) @@ -1699,7 +1709,9 @@ Public Class frmBelegNeu Me.Cursor = Cursors.Default : warnClose = False : Me.Close() : Exit Sub End If KASSE.SET_LAST_QR_JWS(LastJWS, QR_CodeString) - End If + + End If + 'If Not cRKSV_DE.insertRKSV_DE(PERSONAL, BELEG, KASSE, RKSV_Beleg_Id, 0, QR_CodeString, LastJWS, TESTBUCHUNG, answer) Then 'Digitale Signierung und Erfassung in die RKSV-Datenbank mittels ITG-Service ' If Not TESTBUCHUNG Then diff --git a/SDL/mdm/usrcntlFremdrechnungen.Designer.vb b/SDL/mdm/usrcntlFremdrechnungen.Designer.vb index c8e0f446..a0990917 100644 --- a/SDL/mdm/usrcntlFremdrechnungen.Designer.vb +++ b/SDL/mdm/usrcntlFremdrechnungen.Designer.vb @@ -23,8 +23,8 @@ Partial Class usrcntlFremdrechnungen Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Me.DetailsAnzeigenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.FlowLayoutPanel = New System.Windows.Forms.FlowLayoutPanel() Me.btnSDL_Alle = New System.Windows.Forms.Button() @@ -37,7 +37,12 @@ Partial Class usrcntlFremdrechnungen Me.btnSDL_PLOSE = New System.Windows.Forms.Button() Me.btnSDL_RMC = New System.Windows.Forms.Button() Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.PDFLöschenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.Panel1 = New System.Windows.Forms.Panel() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label9 = New System.Windows.Forms.Label() + Me.Label8 = New System.Windows.Forms.Label() + Me.lblCountOrigRechnungen = New System.Windows.Forms.Label() Me.cbxTest = New System.Windows.Forms.CheckBox() Me.Label7 = New System.Windows.Forms.Label() Me.txtKundenNrbis = New VERAG_PROG_ALLGEMEIN.MyTextBox() @@ -49,8 +54,6 @@ Partial Class usrcntlFremdrechnungen Me.cbxPDFhinterlegt = New System.Windows.Forms.CheckBox() Me.cbx = New System.Windows.Forms.CheckBox() Me.Label4 = New System.Windows.Forms.Label() - Me.Label2 = New System.Windows.Forms.Label() - Me.Label1 = New System.Windows.Forms.Label() Me.dat_Sum_Bis = New System.Windows.Forms.DateTimePicker() Me.dat_Sum_Von = New System.Windows.Forms.DateTimePicker() Me.Button1 = New System.Windows.Forms.Button() @@ -65,7 +68,8 @@ Partial Class usrcntlFremdrechnungen Me.dgvLFRechnung = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components) Me.dgvDetails = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components) Me.Panel4 = New System.Windows.Forms.Panel() - Me.PDFLöschenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.Label1 = New System.Windows.Forms.Label() + Me.lblCountMissingInvoices = New System.Windows.Forms.Label() Me.FlowLayoutPanel.SuspendLayout() Me.ContextMenuStrip1.SuspendLayout() Me.Panel1.SuspendLayout() @@ -268,11 +272,24 @@ Partial Class usrcntlFremdrechnungen Me.ContextMenuStrip1.Name = "ContextMenuStrip1" Me.ContextMenuStrip1.Size = New System.Drawing.Size(155, 48) ' + 'PDFLöschenToolStripMenuItem + ' + Me.PDFLöschenToolStripMenuItem.Image = Global.SDL.My.Resources.Resources.del + Me.PDFLöschenToolStripMenuItem.Name = "PDFLöschenToolStripMenuItem" + Me.PDFLöschenToolStripMenuItem.Size = New System.Drawing.Size(154, 22) + Me.PDFLöschenToolStripMenuItem.Text = "PDF löschen" + ' 'Panel1 ' Me.Panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.Panel1.BackColor = System.Drawing.SystemColors.ControlLightLight Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.Panel1.Controls.Add(Me.lblCountMissingInvoices) + Me.Panel1.Controls.Add(Me.Label1) + Me.Panel1.Controls.Add(Me.Label2) + Me.Panel1.Controls.Add(Me.Label9) + Me.Panel1.Controls.Add(Me.Label8) + Me.Panel1.Controls.Add(Me.lblCountOrigRechnungen) Me.Panel1.Controls.Add(Me.cbxTest) Me.Panel1.Controls.Add(Me.Label7) Me.Panel1.Controls.Add(Me.txtKundenNrbis) @@ -284,8 +301,6 @@ Partial Class usrcntlFremdrechnungen Me.Panel1.Controls.Add(Me.cbxPDFhinterlegt) Me.Panel1.Controls.Add(Me.cbx) Me.Panel1.Controls.Add(Me.Label4) - Me.Panel1.Controls.Add(Me.Label2) - Me.Panel1.Controls.Add(Me.Label1) Me.Panel1.Controls.Add(Me.dat_Sum_Bis) Me.Panel1.Controls.Add(Me.dat_Sum_Von) Me.Panel1.Controls.Add(Me.Button1) @@ -301,10 +316,49 @@ Partial Class usrcntlFremdrechnungen Me.Panel1.Size = New System.Drawing.Size(260, 907) Me.Panel1.TabIndex = 23 ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(124, 151) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(10, 13) + Me.Label2.TabIndex = 65 + Me.Label2.Text = "-" + ' + 'Label9 + ' + Me.Label9.AutoSize = True + Me.Label9.Location = New System.Drawing.Point(2, 3) + Me.Label9.Name = "Label9" + Me.Label9.Size = New System.Drawing.Size(42, 13) + Me.Label9.TabIndex = 64 + Me.Label9.Text = "Anzahl:" + ' + 'Label8 + ' + Me.Label8.AutoSize = True + Me.Label8.Location = New System.Drawing.Point(2, 45) + Me.Label8.Name = "Label8" + Me.Label8.Size = New System.Drawing.Size(90, 13) + Me.Label8.TabIndex = 63 + Me.Label8.Text = "ITC nicht gesetzt:" + ' + 'lblCountOrigRechnungen + ' + Me.lblCountOrigRechnungen.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.lblCountOrigRechnungen.BackColor = System.Drawing.Color.White + Me.lblCountOrigRechnungen.Location = New System.Drawing.Point(173, 45) + Me.lblCountOrigRechnungen.Name = "lblCountOrigRechnungen" + Me.lblCountOrigRechnungen.RightToLeft = System.Windows.Forms.RightToLeft.Yes + Me.lblCountOrigRechnungen.Size = New System.Drawing.Size(74, 13) + Me.lblCountOrigRechnungen.TabIndex = 62 + Me.lblCountOrigRechnungen.Text = "0" + Me.lblCountOrigRechnungen.TextAlign = System.Drawing.ContentAlignment.TopRight + ' 'cbxTest ' Me.cbxTest.AutoSize = True - Me.cbxTest.Location = New System.Drawing.Point(146, 214) + Me.cbxTest.Location = New System.Drawing.Point(146, 274) Me.cbxTest.Name = "cbxTest" Me.cbxTest.Size = New System.Drawing.Size(61, 17) Me.cbxTest.TabIndex = 61 @@ -315,7 +369,7 @@ Partial Class usrcntlFremdrechnungen 'Label7 ' Me.Label7.AutoSize = True - Me.Label7.Location = New System.Drawing.Point(121, 126) + Me.Label7.Location = New System.Drawing.Point(121, 193) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(10, 13) Me.Label7.TabIndex = 60 @@ -336,7 +390,7 @@ Partial Class usrcntlFremdrechnungen Me.txtKundenNrbis._Waehrung = False Me.txtKundenNrbis._WaehrungZeichen = False Me.txtKundenNrbis.ForeColor = System.Drawing.Color.Black - Me.txtKundenNrbis.Location = New System.Drawing.Point(146, 123) + Me.txtKundenNrbis.Location = New System.Drawing.Point(146, 190) Me.txtKundenNrbis.MaxLineLength = -1 Me.txtKundenNrbis.MaxLines_Warning = "" Me.txtKundenNrbis.MaxLines_Warning_Label = Nothing @@ -359,7 +413,7 @@ Partial Class usrcntlFremdrechnungen Me.txtKundenNrvon._Waehrung = False Me.txtKundenNrvon._WaehrungZeichen = False Me.txtKundenNrvon.ForeColor = System.Drawing.Color.Black - Me.txtKundenNrvon.Location = New System.Drawing.Point(11, 123) + Me.txtKundenNrvon.Location = New System.Drawing.Point(11, 190) Me.txtKundenNrvon.MaxLineLength = -1 Me.txtKundenNrvon.MaxLines_Warning = "" Me.txtKundenNrvon.MaxLines_Warning_Label = Nothing @@ -370,26 +424,28 @@ Partial Class usrcntlFremdrechnungen 'Label6 ' Me.Label6.AutoSize = True - Me.Label6.Location = New System.Drawing.Point(8, 107) + Me.Label6.Location = New System.Drawing.Point(8, 174) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(58, 13) Me.Label6.TabIndex = 57 - Me.Label6.Text = "KundenNr." + Me.Label6.Text = "KundenNr:" ' 'lblSumBto ' - Me.lblSumBto.AutoSize = True + Me.lblSumBto.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.lblSumBto.BackColor = System.Drawing.Color.White - Me.lblSumBto.Location = New System.Drawing.Point(190, 20) + Me.lblSumBto.Location = New System.Drawing.Point(173, 24) Me.lblSumBto.Name = "lblSumBto" - Me.lblSumBto.Size = New System.Drawing.Size(13, 13) + Me.lblSumBto.RightToLeft = System.Windows.Forms.RightToLeft.Yes + Me.lblSumBto.Size = New System.Drawing.Size(74, 13) Me.lblSumBto.TabIndex = 56 Me.lblSumBto.Text = "0" + Me.lblSumBto.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'Label5 ' Me.Label5.AutoSize = True - Me.Label5.Location = New System.Drawing.Point(3, 20) + Me.Label5.Location = New System.Drawing.Point(2, 24) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(76, 13) Me.Label5.TabIndex = 55 @@ -400,7 +456,7 @@ Partial Class usrcntlFremdrechnungen Me.cbxMailoeffnen.AutoSize = True Me.cbxMailoeffnen.Checked = True Me.cbxMailoeffnen.CheckState = System.Windows.Forms.CheckState.Checked - Me.cbxMailoeffnen.Location = New System.Drawing.Point(146, 237) + Me.cbxMailoeffnen.Location = New System.Drawing.Point(146, 297) Me.cbxMailoeffnen.Name = "cbxMailoeffnen" Me.cbxMailoeffnen.Size = New System.Drawing.Size(91, 17) Me.cbxMailoeffnen.TabIndex = 54 @@ -412,7 +468,7 @@ Partial Class usrcntlFremdrechnungen Me.cbxPDFhinterlegt.AutoSize = True Me.cbxPDFhinterlegt.Checked = True Me.cbxPDFhinterlegt.CheckState = System.Windows.Forms.CheckState.Indeterminate - Me.cbxPDFhinterlegt.Location = New System.Drawing.Point(8, 179) + Me.cbxPDFhinterlegt.Location = New System.Drawing.Point(8, 239) Me.cbxPDFhinterlegt.Name = "cbxPDFhinterlegt" Me.cbxPDFhinterlegt.Size = New System.Drawing.Size(101, 17) Me.cbxPDFhinterlegt.TabIndex = 53 @@ -423,7 +479,7 @@ Partial Class usrcntlFremdrechnungen 'cbx ' Me.cbx.AutoSize = True - Me.cbx.Location = New System.Drawing.Point(8, 161) + Me.cbx.Location = New System.Drawing.Point(8, 221) Me.cbx.Name = "cbx" Me.cbx.Size = New System.Drawing.Size(169, 17) Me.cbx.TabIndex = 52 @@ -433,44 +489,26 @@ Partial Class usrcntlFremdrechnungen 'Label4 ' Me.Label4.AutoSize = True - Me.Label4.Location = New System.Drawing.Point(2, 35) + Me.Label4.Location = New System.Drawing.Point(8, 132) Me.Label4.Name = "Label4" - Me.Label4.Size = New System.Drawing.Size(91, 13) + Me.Label4.Size = New System.Drawing.Size(94, 13) Me.Label4.TabIndex = 51 - Me.Label4.Text = "Rechnungsdatum" - ' - 'Label2 - ' - Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(5, 83) - Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(20, 13) - Me.Label2.TabIndex = 50 - Me.Label2.Text = "bis" - ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(5, 57) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(28, 13) - Me.Label1.TabIndex = 49 - Me.Label1.Text = "von:" + Me.Label4.Text = "Rechnungsdatum:" ' 'dat_Sum_Bis ' Me.dat_Sum_Bis.Format = System.Windows.Forms.DateTimePickerFormat.[Short] - Me.dat_Sum_Bis.Location = New System.Drawing.Point(60, 77) + Me.dat_Sum_Bis.Location = New System.Drawing.Point(146, 148) Me.dat_Sum_Bis.Name = "dat_Sum_Bis" - Me.dat_Sum_Bis.Size = New System.Drawing.Size(103, 20) + Me.dat_Sum_Bis.Size = New System.Drawing.Size(98, 20) Me.dat_Sum_Bis.TabIndex = 48 ' 'dat_Sum_Von ' Me.dat_Sum_Von.Format = System.Windows.Forms.DateTimePickerFormat.[Short] - Me.dat_Sum_Von.Location = New System.Drawing.Point(60, 51) + Me.dat_Sum_Von.Location = New System.Drawing.Point(11, 148) Me.dat_Sum_Von.Name = "dat_Sum_Von" - Me.dat_Sum_Von.Size = New System.Drawing.Size(103, 20) + Me.dat_Sum_Von.Size = New System.Drawing.Size(98, 20) Me.dat_Sum_Von.TabIndex = 46 ' 'Button1 @@ -479,7 +517,7 @@ Partial Class usrcntlFremdrechnungen Me.Button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.Button1.Location = New System.Drawing.Point(11, 322) + Me.Button1.Location = New System.Drawing.Point(11, 382) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(50, 44) Me.Button1.TabIndex = 45 @@ -491,7 +529,7 @@ Partial Class usrcntlFremdrechnungen Me.cbxMax1000Eintrage.AutoSize = True Me.cbxMax1000Eintrage.Checked = True Me.cbxMax1000Eintrage.CheckState = System.Windows.Forms.CheckState.Checked - Me.cbxMax1000Eintrage.Location = New System.Drawing.Point(8, 199) + Me.cbxMax1000Eintrage.Location = New System.Drawing.Point(8, 259) Me.cbxMax1000Eintrage.Name = "cbxMax1000Eintrage" Me.cbxMax1000Eintrage.Size = New System.Drawing.Size(117, 17) Me.cbxMax1000Eintrage.TabIndex = 41 @@ -500,20 +538,22 @@ Partial Class usrcntlFremdrechnungen ' 'lblEinträge ' - Me.lblEinträge.AutoSize = True + Me.lblEinträge.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.lblEinträge.BackColor = System.Drawing.Color.White - Me.lblEinträge.Location = New System.Drawing.Point(190, 3) + Me.lblEinträge.Location = New System.Drawing.Point(173, 3) Me.lblEinträge.Name = "lblEinträge" - Me.lblEinträge.Size = New System.Drawing.Size(58, 13) + Me.lblEinträge.RightToLeft = System.Windows.Forms.RightToLeft.Yes + Me.lblEinträge.Size = New System.Drawing.Size(74, 13) Me.lblEinträge.TabIndex = 40 - Me.lblEinträge.Text = "0 Einträge " + Me.lblEinträge.Text = "0" + Me.lblEinträge.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'Button4 ' Me.Button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button4.Image = Global.SDL.My.Resources.Resources.checklist Me.Button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.Button4.Location = New System.Drawing.Point(8, 272) + Me.Button4.Location = New System.Drawing.Point(8, 332) Me.Button4.Name = "Button4" Me.Button4.Size = New System.Drawing.Size(118, 44) Me.Button4.TabIndex = 21 @@ -526,7 +566,7 @@ Partial Class usrcntlFremdrechnungen Me.Button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button5.Image = Global.SDL.My.Resources.Resources.email_big1 Me.Button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.Button5.Location = New System.Drawing.Point(8, 222) + Me.Button5.Location = New System.Drawing.Point(8, 282) Me.Button5.Name = "Button5" Me.Button5.Size = New System.Drawing.Size(118, 44) Me.Button5.TabIndex = 22 @@ -537,9 +577,10 @@ Partial Class usrcntlFremdrechnungen 'Label3 ' Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(3, 3) + Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label3.Location = New System.Drawing.Point(8, 107) Me.Label3.Name = "Label3" - Me.Label3.Size = New System.Drawing.Size(32, 13) + Me.Label3.Size = New System.Drawing.Size(39, 13) Me.Label3.TabIndex = 25 Me.Label3.Text = "Filter:" ' @@ -548,7 +589,7 @@ Partial Class usrcntlFremdrechnungen Me.Button8.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button8.Image = Global.SDL.My.Resources.Resources.Excel_logo Me.Button8.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.Button8.Location = New System.Drawing.Point(132, 272) + Me.Button8.Location = New System.Drawing.Point(132, 332) Me.Button8.Name = "Button8" Me.Button8.Size = New System.Drawing.Size(118, 44) Me.Button8.TabIndex = 31 @@ -596,8 +637,8 @@ Partial Class usrcntlFremdrechnungen Me.dgvLFRechnung.AllowUserToDeleteRows = False Me.dgvLFRechnung.AllowUserToResizeColumns = False Me.dgvLFRechnung.AllowUserToResizeRows = False - DataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvLFRechnung.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle3 + DataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvLFRechnung.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle1 Me.dgvLFRechnung.BackgroundColor = System.Drawing.Color.White Me.dgvLFRechnung.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvLFRechnung.Location = New System.Drawing.Point(4, 3) @@ -614,8 +655,8 @@ Partial Class usrcntlFremdrechnungen Me.dgvDetails.AllowUserToDeleteRows = False Me.dgvDetails.AllowUserToResizeColumns = False Me.dgvDetails.AllowUserToResizeRows = False - DataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvDetails.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle4 + DataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvDetails.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle2 Me.dgvDetails.BackgroundColor = System.Drawing.Color.White Me.dgvDetails.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvDetails.Location = New System.Drawing.Point(-1, 3) @@ -634,12 +675,26 @@ Partial Class usrcntlFremdrechnungen Me.Panel4.Size = New System.Drawing.Size(1356, 108) Me.Panel4.TabIndex = 11 ' - 'PDFLöschenToolStripMenuItem + 'Label1 ' - Me.PDFLöschenToolStripMenuItem.Image = Global.SDL.My.Resources.Resources.del - Me.PDFLöschenToolStripMenuItem.Name = "PDFLöschenToolStripMenuItem" - Me.PDFLöschenToolStripMenuItem.Size = New System.Drawing.Size(154, 22) - Me.PDFLöschenToolStripMenuItem.Text = "PDF löschen" + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(3, 66) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(116, 13) + Me.Label1.TabIndex = 66 + Me.Label1.Text = "fehlende Rechnungen:" + ' + 'lblCountMissingInvoices + ' + Me.lblCountMissingInvoices.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.lblCountMissingInvoices.BackColor = System.Drawing.Color.White + Me.lblCountMissingInvoices.Location = New System.Drawing.Point(173, 66) + Me.lblCountMissingInvoices.Name = "lblCountMissingInvoices" + Me.lblCountMissingInvoices.RightToLeft = System.Windows.Forms.RightToLeft.Yes + Me.lblCountMissingInvoices.Size = New System.Drawing.Size(74, 13) + Me.lblCountMissingInvoices.TabIndex = 67 + Me.lblCountMissingInvoices.Text = "0" + Me.lblCountMissingInvoices.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'usrcntlFremdrechnungen ' @@ -690,10 +745,7 @@ Partial Class usrcntlFremdrechnungen Friend WithEvents btnSDL_RMC As Button Friend WithEvents dgvLFRechnung As VERAG_PROG_ALLGEMEIN.MyDatagridview Friend WithEvents Label4 As Label - Friend WithEvents Label2 As Label - Friend WithEvents Label1 As Label Friend WithEvents cbx As CheckBox - Friend WithEvents dat_Sum_Bis As DateTimePicker Friend WithEvents dat_Sum_Von As DateTimePicker Friend WithEvents dgvDetails As VERAG_PROG_ALLGEMEIN.MyDatagridview Friend WithEvents cbxPDFhinterlegt As CheckBox @@ -706,4 +758,11 @@ Partial Class usrcntlFremdrechnungen Friend WithEvents Label6 As Label Friend WithEvents cbxTest As CheckBox Friend WithEvents PDFLöschenToolStripMenuItem As ToolStripMenuItem + Friend WithEvents lblCountOrigRechnungen As Label + Friend WithEvents Label8 As Label + Friend WithEvents Label2 As Label + Friend WithEvents Label9 As Label + Friend WithEvents dat_Sum_Bis As DateTimePicker + Friend WithEvents lblCountMissingInvoices As Label + Friend WithEvents Label1 As Label End Class diff --git a/SDL/mdm/usrcntlFremdrechnungen.vb b/SDL/mdm/usrcntlFremdrechnungen.vb index 8886d7b0..7e926887 100644 --- a/SDL/mdm/usrcntlFremdrechnungen.vb +++ b/SDL/mdm/usrcntlFremdrechnungen.vb @@ -2,6 +2,7 @@ Imports System.Reflection Imports com.sun.tools.corba.se.idl Imports DocumentFormat.OpenXml.VariantTypes +Imports MDM_Worker Imports Microsoft.Office.Interop Imports VERAG_PROG_ALLGEMEIN @@ -19,6 +20,8 @@ Public Class usrcntlFremdrechnungen Dim dtkeineMWST As DataTable Dim dtKundeMWST As DataTable + Dim countbtcNotSet As Integer = 0 + Dim countMissingInvoices As Integer = 0 Private Sub usrCntlDaten_Load(sender As Object, e As EventArgs) Handles Me.Load @@ -56,6 +59,14 @@ Public Class usrcntlFremdrechnungen txtKundenNrvon.Enabled = kdNr <= 0 txtKundenNrbis.Enabled = kdNr <= 0 + If kdNr > 0 Then + txtKundenNrvon.Text = kdNr + txtKundenNrbis.Text = kdNr + End If + + + + If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("ADMINFUNCTIONS", "SDL") Then cbxTest.Visible = True End If @@ -612,9 +623,6 @@ Public Class usrcntlFremdrechnungen End Function - - - Function getSDLNrButton(SDLNrTmp) As Object Select Case SDLNrTmp Case "IDS" : Return btnSDL_IDS @@ -629,42 +637,97 @@ Public Class usrcntlFremdrechnungen End Select End Function Private Sub btnSDL_Alle_Click(sender As Object, e As EventArgs) Handles btnSDL_Alle.Click + 'SET_SDL("ALLE") + Dim btcNotSet As Integer = 0 + + Dim uta As cUTA + Dim ids As cIDS + Dim rmc As cRMC + Dim ploseRE As cPLOSE_Inv_Data + Dim mse As cMSEAPI + + + If txtKundenNrvon.Text <> "" AndAlso txtKundenNrvon.Text.Length = 6 AndAlso IsNumeric(txtKundenNrvon.Text) AndAlso txtKundenNrbis.Text <> "" AndAlso txtKundenNrbis.Text.Length = 6 AndAlso IsNumeric(txtKundenNrbis.Text) Then SET_SDL("ALLE", txtKundenNrvon.Text, txtKundenNrbis.Text) + btcNotSet += ids.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + btcNotSet += uta.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + btcNotSet += rmc.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + btcNotSet += ploseRE.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + btcNotSet += mse.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet ElseIf txtKundenNrvon.Text = "" AndAlso txtKundenNrbis.Text = "" Then - SET_SDL("ALLE") + btcNotSet += ids.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + btcNotSet += uta.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + btcNotSet += rmc.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + btcNotSet += ploseRE.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + btcNotSet += mse.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + End If End Sub Private Sub btnSDL_IDS_Click(sender As Object, e As EventArgs) Handles btnSDL_IDS.Click 'SET_SDL("IDS") + Dim ids As New cIDS If txtKundenNrvon.Text <> "" AndAlso txtKundenNrvon.Text.Length = 6 AndAlso IsNumeric(txtKundenNrvon.Text) AndAlso txtKundenNrbis.Text <> "" AndAlso txtKundenNrbis.Text.Length = 6 AndAlso IsNumeric(txtKundenNrbis.Text) Then SET_SDL("IDS", txtKundenNrvon.Text, txtKundenNrbis.Text) + Dim btcNotSet As Integer = ids.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + + Dim missingInvoices As Integer = ids.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value,, txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices ElseIf txtKundenNrvon.Text = "" AndAlso txtKundenNrbis.Text = "" Then SET_SDL("IDS") + Dim btcNotSet As Integer = ids.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + Dim missingInvoices As Integer = ids.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices End If + End Sub Private Sub btnSDL_UTA_Click(sender As Object, e As EventArgs) Handles btnSDL_UTA.Click 'SET_SDL("UTA") + Dim uta As cUTA If txtKundenNrvon.Text <> "" AndAlso txtKundenNrvon.Text.Length = 6 AndAlso IsNumeric(txtKundenNrvon.Text) AndAlso txtKundenNrbis.Text <> "" AndAlso txtKundenNrbis.Text.Length = 6 AndAlso IsNumeric(txtKundenNrbis.Text) Then SET_SDL("UTA", txtKundenNrvon.Text, txtKundenNrbis.Text) + Dim btcNotSet As Integer = uta.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + + Dim missingInvoices As Integer = uta.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value, , txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices ElseIf txtKundenNrvon.Text = "" AndAlso txtKundenNrbis.Text = "" Then SET_SDL("UTA") + Dim btcNotSet As Integer = uta.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + + Dim missingInvoices As Integer = uta.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices End If End Sub @@ -686,14 +749,29 @@ Public Class usrcntlFremdrechnungen Private Sub btnSDL_PLOSE_Click(sender As Object, e As EventArgs) Handles btnSDL_PLOSE.Click 'SET_SDL("PLOSE") - + Dim ploseRE As cPLOSE_Inv_Data If txtKundenNrvon.Text <> "" AndAlso txtKundenNrvon.Text.Length = 6 AndAlso IsNumeric(txtKundenNrvon.Text) AndAlso txtKundenNrbis.Text <> "" AndAlso txtKundenNrbis.Text.Length = 6 AndAlso IsNumeric(txtKundenNrbis.Text) Then SET_SDL("PLOSE", txtKundenNrvon.Text, txtKundenNrbis.Text) - ElseIf txtKundenNrvon.Text = "" AndAlso txtKundenNrbis.Text = "" Then + Dim btcNotSet As Integer = ploseRE.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + Dim missingInvoices As Integer = ploseRE.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value,, txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices + + ElseIf txtKundenNrvon.Text = "" AndAlso txtKundenNrbis.Text = "" Then SET_SDL("PLOSE") + Dim btcNotSet As Integer = ploseRE.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + + Dim missingInvoices As Integer = ploseRE.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices + End If End Sub @@ -701,13 +779,28 @@ Public Class usrcntlFremdrechnungen Private Sub btnSDL_MautMSE_Click(sender As Object, e As EventArgs) Handles btnSDL_MautMSE.Click 'SET_SDL("MSE") + Dim MSE As cMSEAPI If txtKundenNrvon.Text <> "" AndAlso txtKundenNrvon.Text.Length = 6 AndAlso IsNumeric(txtKundenNrvon.Text) AndAlso txtKundenNrbis.Text <> "" AndAlso txtKundenNrbis.Text.Length = 6 AndAlso IsNumeric(txtKundenNrbis.Text) Then SET_SDL("MSE", txtKundenNrvon.Text, txtKundenNrbis.Text) + Dim btcNotSet As Integer = MSE.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + + Dim missingInvoices As Integer = MSE.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value, , txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices ElseIf txtKundenNrvon.Text = "" AndAlso txtKundenNrbis.Text = "" Then SET_SDL("MSE") + Dim btcNotSet As Integer = MSE.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + + Dim missingInvoices As Integer = MSE.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices End If End Sub @@ -755,12 +848,28 @@ Public Class usrcntlFremdrechnungen Private Sub btnSDL_RMC_Click(sender As Object, e As EventArgs) Handles btnSDL_RMC.Click + Dim rmc As cRMC If txtKundenNrvon.Text <> "" AndAlso txtKundenNrvon.Text.Length = 6 AndAlso IsNumeric(txtKundenNrvon.Text) AndAlso txtKundenNrbis.Text <> "" AndAlso txtKundenNrbis.Text.Length = 6 AndAlso IsNumeric(txtKundenNrbis.Text) Then SET_SDL("RMC", txtKundenNrvon.Text, txtKundenNrbis.Text) + Dim btcNotSet As Integer = rmc.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL, txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + + Dim missingInvoices As Integer = rmc.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value,, txtKundenNrvon.Text, txtKundenNrbis.Text) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices + ElseIf txtKundenNrvon.Text = "" AndAlso txtKundenNrbis.Text = "" Then SET_SDL("RMC") + Dim btcNotSet As Integer = rmc.countBackToCustomerNotSet(New VERAG_PROG_ALLGEMEIN.SQL) + lblCountOrigRechnungen.Text = btcNotSet + countbtcNotSet = btcNotSet + + Dim missingInvoices As Integer = rmc.checkPDFInvoices(dat_Sum_Von.Value, dat_Sum_Bis.Value) + lblCountMissingInvoices.Text = missingInvoices + countMissingInvoices = missingInvoices End If @@ -880,6 +989,11 @@ Public Class usrcntlFremdrechnungen Exit Sub End If + If countbtcNotSet > 0 Then + MsgBox("ACHTUNG!" & vbNewLine & "es wurden bei " & countbtcNotSet & " Rechnungen die Werte für das Rücksenden der Originalrechnung nicht gesetzt!" & vbNewLine & "Bitte an Administrator wenden") + Exit Sub + End If + If groups.Count > 0 Then @@ -1638,4 +1752,6 @@ Public Class usrcntlFremdrechnungen End Sub + + End Class diff --git a/SDL/packages.config b/SDL/packages.config index 2e6bbac4..5d05f257 100644 --- a/SDL/packages.config +++ b/SDL/packages.config @@ -53,10 +53,17 @@ - + + + + + + + + diff --git a/VERAG_PROG_ALLGEMEIN/Classes/cIDS.vb b/VERAG_PROG_ALLGEMEIN/Classes/cIDS.vb index fb210b0b..99b8b7f0 100644 --- a/VERAG_PROG_ALLGEMEIN/Classes/cIDS.vb +++ b/VERAG_PROG_ALLGEMEIN/Classes/cIDS.vb @@ -634,7 +634,11 @@ Public Class cIDS End Function Public Shared Function countBackToCustomerNotSet(SQL As SQL) As Integer - Return SQL.getValueTxtBySql("SELECT count(InvToCustomer) FROM [tblIDSInvoicesNewSplittedByCountry] where InvToCustomer Is null ", "FMZOLL",,, -1) + Return SQL.getValueTxtBySql("SELECT count(*) FROM [tblIDSInvoicesNewSplittedByCountry] where InvToCustomer Is null ", "FMZOLL",,, -1) + End Function + + Public Shared Function countBackToCustomerNotSet(SQL As SQL, AdressenNrVon As Integer, AdressenNrBis As Integer) As Integer + Return SQL.getValueTxtBySql("SELECT count(*) FROM [tblIDSInvoicesNewSplittedByCountry] Inner join [tbl_IDS_Kunden] on [tbl_IDS_Kunden].CustomerCode =[tblIDSInvoicesNewSplittedByCountry].CustomerCode and isnull([tbl_IDS_Kunden].KdNrAlt, 1) = 0 Inner join Adressen on Adressen.AdressenNr = [tbl_IDS_Kunden].KdNrVERAG INNER JOIN tblKundenErweitert on Adressen.AdressenNr = kde_KundenNr where InvToCustomer Is null and Adressen.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis, "FMZOLL",,, -1) End Function Public Shared Function UPDATE_ARCHIV(reDat As Date, reNr As String, ids_kdNr As Integer, country As String, UStVAn_ID As Integer) As Boolean @@ -663,21 +667,35 @@ Public Class cIDS Return "" End Function - Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing) As DataTable + Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing, Optional dt As DataTable = Nothing, Optional AdressenNrVon As Integer = -1, Optional AdressenNrBis As Integer = -1) As Integer Try Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Dim sqlTime As String = "" + Dim sqlAdressenNr As String = "" If IsDate(reDatVon) AndAlso CDate(reDatVon) > "01.01.2020" AndAlso IsDate(reDatBis) AndAlso CDate(reDatBis) > "01.01.2020" Then sqlTime = " And cast(YearMonthDay as Date) between '" & reDatVon.ToShortDateString & "' and '" & reDatBis.ToShortDateString & "'" End If - Dim SQLstr = "select Invoicenumber as RechnungsNr,YearMonthDay as Rechnungsdatum, Adressen.AdressenNr as KundenNr,Adressen.[Name 1] as Kunde, kde_keineMWSt from tblIDSInvoicesNew Inner join [tbl_IDS_Kunden] on [tbl_IDS_Kunden].CustomerCode =tblIDSInvoicesNew.CustomerCode and isnull([tbl_IDS_Kunden].KdNrAlt, 1) = 0 Inner join Adressen on Adressen.AdressenNr = [tbl_IDS_Kunden].KdNrVERAG INNER JOIN tblKundenErweitert on Adressen.AdressenNr = kde_KundenNr where DocumentName is null " & sqlTime & " group by Invoicenumber, Adressen.AdressenNr, Adressen.[Name 1], YearMonthDay, kde_keineMWSt" + If AdressenNrVon > 0 AndAlso AdressenNrBis > 0 Then + sqlAdressenNr = " AND Adressen.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis + End If + + If dt IsNot Nothing Then + Dim SQLstr = "select Invoicenumber as RechnungsNr,YearMonthDay as Rechnungsdatum, Adressen.AdressenNr as KundenNr,Adressen.[Name 1] as Kunde, kde_keineMWSt from tblIDSInvoicesNew Inner join [tbl_IDS_Kunden] on [tbl_IDS_Kunden].CustomerCode =tblIDSInvoicesNew.CustomerCode and isnull([tbl_IDS_Kunden].KdNrAlt, 1) = 0 Inner join Adressen on Adressen.AdressenNr = [tbl_IDS_Kunden].KdNrVERAG INNER JOIN tblKundenErweitert on Adressen.AdressenNr = kde_KundenNr where DocumentName is null " & sqlTime & sqlAdressenNr & " group by Invoicenumber, Adressen.AdressenNr, Adressen.[Name 1], YearMonthDay, kde_keineMWSt" + dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL") + Return dt.Rows.Count + Else + + Dim SQLstr = "select count(*) from tblIDSInvoicesNew Inner join [tbl_IDS_Kunden] on [tbl_IDS_Kunden].CustomerCode =tblIDSInvoicesNew.CustomerCode and isnull([tbl_IDS_Kunden].KdNrAlt, 1) = 0 Inner join Adressen on Adressen.AdressenNr = [tbl_IDS_Kunden].KdNrVERAG INNER JOIN tblKundenErweitert on Adressen.AdressenNr = kde_KundenNr where DocumentName is null " & sqlTime & sqlAdressenNr + Return SQL.getValueTxtBySql(SQLstr, "FMZOLL",,, 0) + + End If + + - Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL") - Return dt Catch ex As Exception @@ -688,22 +706,37 @@ Public Class cIDS End Function - Public Shared Function checkPartInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing) As DataTable + Public Shared Function checkPartInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing, Optional dt As DataTable = Nothing, Optional AdressenNrVon As Integer = -1, Optional AdressenNrBis As Integer = -1) As Integer Try 'Prüft, ob es zu Gesamtrechnungen Teilrechnungen gibt! Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Dim SQLstrForDT = " " Dim SQLstr = " " + Dim sqlAdressenNr As String = "" - If IsDate(reDatVon) AndAlso CDate(reDatVon) > "01.01.2020" AndAlso IsDate(reDatBis) AndAlso CDate(reDatBis) > "01.01.2020" Then - SQLstr &= "select Invoicenumber as RechnungsNr ,YearMonthDay as Rechnungsdatum, Adressen.AdressenNr as KundenNr,Adressen.[Name 1] as Kunde, kde_keineMWSt,daId from tblIDSInvoicesNew Inner join [tbl_IDS_Kunden] on [tbl_IDS_Kunden].CustomerCode =tblIDSInvoicesNew.CustomerCode and isnull([tbl_IDS_Kunden].KdNrAlt, 1) = 0 Inner join Adressen on Adressen.AdressenNr = [tbl_IDS_Kunden].KdNrVERAG INNER JOIN tblKundenErweitert on Adressen.AdressenNr = kde_KundenNr where invoice_id not in (select TotalInvoiceId from tblIDSInvoicesNewSplittedByCountry) AND YearMonthDay >= '" & reDatVon.ToShortDateString & "' and YearMonthDay < '" & reDatBis.ToShortDateString & "'" - Else - SQLstr &= "select * from tblIDSInvoicesNew where invoice_id not in (select TotalInvoiceId from tblIDSInvoicesNewSplittedByCountry) AND Year(YearMonthDay) >= 2025" + If AdressenNrVon > 0 AndAlso AdressenNrBis > 0 Then + sqlAdressenNr = " AND Adressen.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis End If - Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL") + If IsDate(reDatVon) AndAlso CDate(reDatVon) > "01.01.2020" AndAlso IsDate(reDatBis) AndAlso CDate(reDatBis) > "01.01.2020" Then + SQLstrForDT &= "select Invoicenumber as RechnungsNr ,YearMonthDay as Rechnungsdatum, Adressen.AdressenNr as KundenNr,Adressen.[Name 1] as Kunde, kde_keineMWSt,daId from tblIDSInvoicesNew Inner join [tbl_IDS_Kunden] on [tbl_IDS_Kunden].CustomerCode =tblIDSInvoicesNew.CustomerCode and isnull([tbl_IDS_Kunden].KdNrAlt, 1) = 0 Inner join Adressen on Adressen.AdressenNr = [tbl_IDS_Kunden].KdNrVERAG INNER JOIN tblKundenErweitert on Adressen.AdressenNr = kde_KundenNr where invoice_id not in (select TotalInvoiceId from tblIDSInvoicesNewSplittedByCountry) AND YearMonthDay >= '" & reDatVon.ToShortDateString & "' and YearMonthDay < '" & reDatBis.ToShortDateString & "'" & sqlAdressenNr + SQLstr &= "select count(*) from tblIDSInvoicesNew Inner join [tbl_IDS_Kunden] on [tbl_IDS_Kunden].CustomerCode =tblIDSInvoicesNew.CustomerCode and isnull([tbl_IDS_Kunden].KdNrAlt, 1) = 0 Inner join Adressen on Adressen.AdressenNr = [tbl_IDS_Kunden].KdNrVERAG INNER JOIN tblKundenErweitert on Adressen.AdressenNr = kde_KundenNr where invoice_id not in (select TotalInvoiceId from tblIDSInvoicesNewSplittedByCountry) AND YearMonthDay >= '" & reDatVon.ToShortDateString & "' and YearMonthDay < '" & reDatBis.ToShortDateString & "'" & sqlAdressenNr + Else + SQLstrForDT &= "select * from tblIDSInvoicesNew where invoice_id not in (select TotalInvoiceId from tblIDSInvoicesNewSplittedByCountry) AND Year(YearMonthDay) >= 2025" + SQLstr &= "select count(*) from tblIDSInvoicesNew where invoice_id not in (select TotalInvoiceId from tblIDSInvoicesNewSplittedByCountry) AND Year(YearMonthDay) >= 2025" + End If + + + If dt IsNot Nothing Then + dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstrForDT, "FMZOLL") + Return dt.Rows.Count + Else + + Return SQL.getValueTxtBySql(SQLstr, "FMZOLL",,, -1) + + End If - Return dt Catch ex As Exception diff --git a/VERAG_PROG_ALLGEMEIN/Classes/cRMC.vb b/VERAG_PROG_ALLGEMEIN/Classes/cRMC.vb index 709163ab..a548e9c6 100644 --- a/VERAG_PROG_ALLGEMEIN/Classes/cRMC.vb +++ b/VERAG_PROG_ALLGEMEIN/Classes/cRMC.vb @@ -285,6 +285,10 @@ Public Class cRMC Return SQL.getValueTxtBySql("SELECT count(InvToCustomer) FROM [tblRMCImport] where InvToCustomer Is null ", "FMZOLL",,, -1) End Function + Public Shared Function countBackToCustomerNotSet(SQL As SQL, AdressenNrVon As Integer, AdressenNrBis As Integer) As Integer + Return SQL.getValueTxtBySql("SELECT count(InvToCustomer) FROM [tblRMCImport] INNER JOIN Adressen On WölflKundenNr=[rmc_kdNr] Or weitereWölflKundenNr=[rmc_kdNr] where InvToCustomer Is null and Adressen.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis, "FMZOLL",,, -1) + End Function + Public Shared Function getRMCQuartalsAbrechnungen(SQL As SQL, quartal As Integer, jahr As Integer, LeistungsNr As String, Optional USTV_ANTRAG As cUSTVAntrag = Nothing, Optional LANDKZ As String = "", Optional nurUnter50anzeigen As Boolean = True) As DataTable @@ -365,21 +369,34 @@ Public Class cRMC End Function - Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing) As DataTable + Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing, Optional dt As DataTable = Nothing, Optional AdressenNrVon As Integer = -1, Optional AdressenNrBis As Integer = -1) As Integer Try Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Dim sqlTime As String = "" + Dim sqlAdressenNr As String = "" If IsDate(reDatVon) AndAlso CDate(reDatVon) > "01.01.2020" AndAlso IsDate(reDatBis) AndAlso CDate(reDatBis) > "01.01.2020" Then sqlTime = " And cast([rmc_reDatum] As Date) between '" & reDatVon.ToShortDateString & "' and '" & reDatBis.ToShortDateString & "'" End If - Dim SQLstr = "Select rmc_reNr As RechnungsNr,rmc_reDatum As Rechnungsdatum, Adressen.AdressenNr As KundenNr,Adressen.[Name 1] As Kunde, kde_keineMWSt As keineMWST from [tblRMCImport] INNER JOIN Adressen On WölflKundenNr=[rmc_kdNr] Or weitereWölflKundenNr=[rmc_kdNr] INNER JOIN tblKundenErweitert On AdressenNr = kde_KundenNr where rmc_daId Is null " & sqlTime & " group by rmc_reNr, Adressen.AdressenNr, Adressen.[Name 1],rmc_reDatum, kde_keineMWSt" + If AdressenNrVon > 0 AndAlso AdressenNrBis > 0 Then + sqlAdressenNr = " AND Adressen.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis + End If + + If dt IsNot Nothing Then + Dim SQLstr = "Select rmc_reNr As RechnungsNr,rmc_reDatum As Rechnungsdatum, Adressen.AdressenNr As KundenNr,Adressen.[Name 1] As Kunde, kde_keineMWSt As keineMWST from [tblRMCImport] INNER JOIN Adressen On WölflKundenNr=[rmc_kdNr] Or weitereWölflKundenNr=[rmc_kdNr] INNER JOIN tblKundenErweitert On AdressenNr = kde_KundenNr where rmc_daId Is null " & sqlTime & sqlAdressenNr & " group by rmc_reNr, Adressen.AdressenNr, Adressen.[Name 1],rmc_reDatum, kde_keineMWSt" + dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL") + Return dt.Rows.Count + Else + + Dim SQLstr = "Select count(*) from [tblRMCImport] INNER JOIN Adressen On WölflKundenNr=[rmc_kdNr] Or weitereWölflKundenNr=[rmc_kdNr] INNER JOIN tblKundenErweitert On AdressenNr = kde_KundenNr where rmc_daId Is null " & sqlTime & sqlAdressenNr + Return SQL.getValueTxtBySql(SQLstr, "FMZOLL",,, 0) + + + End If - Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL") - Return dt Catch ex As Exception diff --git a/VERAG_PROG_ALLGEMEIN/Classes/cUTA.vb b/VERAG_PROG_ALLGEMEIN/Classes/cUTA.vb index 97b5ddb1..76accc02 100644 --- a/VERAG_PROG_ALLGEMEIN/Classes/cUTA.vb +++ b/VERAG_PROG_ALLGEMEIN/Classes/cUTA.vb @@ -1,7 +1,6 @@ Imports System.Data.SqlClient Imports System.IO Imports System.Reflection -Imports System.Web.Configuration Public Class cUTA @@ -42,24 +41,42 @@ Public Class cUTA End Function Public Shared Function countBackToCustomerNotSet(SQL As SQL) As Integer - Return SQL.getValueTxtBySql("SELECT count(InvToCustomer) FROM [tblUTAImportNew] where InvToCustomer Is null ", "FMZOLL",,, -1) + Return SQL.getValueTxtBySql("SELECT count(*) FROM [tblUTAImportNew] where InvToCustomer Is null ", "FMZOLL",,, -1) End Function - Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing) As DataTable + Public Shared Function countBackToCustomerNotSet(SQL As SQL, Optional AdressenNrVon As Integer = -1, Optional AdressenNrBis As Integer = -1) As Integer + Return SQL.getValueTxtBySql(" SELECT count(*) FROM [tblUTAImportNew] U INNER JOIN Adressen A On A.UTAKundenNr = U.Kundennummer where U.InvToCustomer Is null AND A.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis, "FMZOLL",,, -1) + End Function + + Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing, Optional dt As DataTable = Nothing, Optional AdressenNrVon As Integer = -1, Optional AdressenNrBis As Integer = -1) As Integer Try Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Dim sqlTime As String = "" + Dim sqlAdressenNr As String = "" If IsDate(reDatVon) AndAlso CDate(reDatVon) > "01.01.2020" AndAlso IsDate(reDatBis) AndAlso CDate(reDatBis) > "01.01.2020" Then sqlTime = " And CAST(U.Rechnungsdatum As Date) BETWEEN '" & reDatVon.ToShortDateString & "' and '" & reDatBis.ToShortDateString & "'" End If - Dim SQLstr = "Select U.Abrechnungsnummer As Abrechnungsnummer,U.Rechnungsnummer_pro_Lieferland,U.Lieferland,CAST(U.Rechnungsdatum As Date) As Rechnungsdatum,A.AdressenNr As KundenNr,A.UTAKundenNr As UTAKundenNr,A.[Name 1] As Kunde,A.LandKz, kde_keineMWSt As keineMWST FROM tblUTAImportNew U INNER JOIN Adressen A On A.UTAKundenNr = U.Kundennummer INNER JOIN tblKundenErweitert On A.AdressenNr = kde_KundenNr WHERE U.daId Is NULL " & sqlTime & " AND NOT (A.LandKz = 'RO' AND U.Lieferland = 'ROM') GROUP BY U.Abrechnungsnummer,U.Rechnungsnummer_pro_Lieferland,U.Lieferland,U.Rechnungsdatum,A.AdressenNr,A.UTAKundenNr ,A.[Name 1],A.LandKz, kde_keineMWSt ORDER BY U.Rechnungsdatum" + If AdressenNrVon > 0 AndAlso AdressenNrBis > 0 Then + sqlAdressenNr = " AND A.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis + End If + + If dt IsNot Nothing Then + Dim SQLstr = "Select U.Abrechnungsnummer As Abrechnungsnummer,U.Rechnungsnummer_pro_Lieferland,U.Lieferland,CAST(U.Rechnungsdatum As Date) As Rechnungsdatum,A.AdressenNr As KundenNr,A.UTAKundenNr As UTAKundenNr,A.[Name 1] As Kunde,A.LandKz, kde_keineMWSt As keineMWST FROM tblUTAImportNew U INNER JOIN Adressen A On A.UTAKundenNr = U.Kundennummer INNER JOIN tblKundenErweitert On A.AdressenNr = kde_KundenNr WHERE U.daId Is NULL " & sqlTime & sqlAdressenNr & " AND NOT (A.LandKz = 'RO' AND U.Lieferland = 'ROM') GROUP BY U.Abrechnungsnummer,U.Rechnungsnummer_pro_Lieferland,U.Lieferland,U.Rechnungsdatum,A.AdressenNr,A.UTAKundenNr ,A.[Name 1],A.LandKz, kde_keineMWSt ORDER BY U.Rechnungsdatum" + dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL") + Return dt.Rows.Count + Else + + Dim SQLstr = "Select count(*) FROM tblUTAImportNew U INNER JOIN Adressen A On A.UTAKundenNr = U.Kundennummer INNER JOIN tblKundenErweitert On A.AdressenNr = kde_KundenNr WHERE U.daId Is NULL " & sqlTime & sqlAdressenNr & " AND NOT (A.LandKz = 'RO' AND U.Lieferland = 'ROM')" + Return SQL.getValueTxtBySql(SQLstr, "FMZOLL",,, 0) + + + End If + - Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL") - Return dt Catch ex As Exception diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/ATEZ/RELAYHUB/cRelayHub.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/ATEZ/RELAYHUB/cRelayHub.vb index 950438ea..db22a378 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/ATEZ/RELAYHUB/cRelayHub.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/ATEZ/RELAYHUB/cRelayHub.vb @@ -275,7 +275,7 @@ Public Class cRelayHub Case "Ursprungszeugnis", "CoO" : fileType = "origin" Case "Lieferschein" : fileType = "delivery_note" Case "Packliste" : fileType = "packaging_list" - Case "FFFFFFFFFFFFFFFFFF" : fileType = "ftz" + Case "Freihandelszone", "FTZ" : fileType = "ftz" Case Else : fileType = "other" End Select diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb index f6401477..b270b35b 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb @@ -81,24 +81,40 @@ Public Class cMSEAPI End Function Public Shared Function countBackToCustomerNotSet(SQL As SQL) As Integer - Return SQL.getValueTxtBySql("SELECT count(InvToCustomer) FROM [tblMSEInvoices] where InvToCustomer Is null ", "FMZOLL",,, -1) + Return SQL.getValueTxtBySql("SELECT count(*) FROM [tblMSEInvoices] where InvToCustomer Is null ", "FMZOLL",,, -1) End Function - Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing) As DataTable + Public Shared Function countBackToCustomerNotSet(SQL As SQL, AdressenNrVon As Integer, AdressenNrBis As Integer) As Integer + Return SQL.getValueTxtBySql("SELECT count(*) FROM [tblMSEInvoices] inner join [tblMSECustomers] On [customer_number] = [customer_id] INNER JOIN Adressen On Adressen.MSEKundenNr = [customer_number] where InvToCustomer Is null AND Adressen.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis, "FMZOLL",,, -1) + End Function + + Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing, Optional dt As DataTable = Nothing, Optional AdressenNrVon As Integer = -1, Optional AdressenNrBis As Integer = -1) As Integer Try Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Dim sqlTime As String = "" + Dim sqlAdressenNr As String = "" If IsDate(reDatVon) AndAlso CDate(reDatVon) > "01.01.2020" AndAlso IsDate(reDatBis) AndAlso CDate(reDatBis) > "01.01.2020" Then sqlTime = " And cast(invoice_date As Date) between '" & reDatVon.ToShortDateString & "' and '" & reDatBis.ToShortDateString & "'" End If - Dim SQLstr = "Select invoice_id As RechnungsNr,[invoice_date] As Rechnungsdatum, Adressen.AdressenNr As KundenNr,Adressen.[Name 1] As Kunde, kde_keineMWSt As keineMWST from tblMSEInvoices inner join [tblMSECustomers] On [customer_number] = [customer_id] INNER JOIN Adressen On Adressen.MSEKundenNr = [customer_number] INNER JOIN tblKundenErweitert On AdressenNr = kde_KundenNr where daId Is null " & sqlTime & " group by invoice_id, Adressen.AdressenNr, Adressen.[Name 1], invoice_date, kde_keineMWSt" + If AdressenNrVon > 0 AndAlso AdressenNrBis > 0 Then + sqlAdressenNr = " AND Adressen.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis + End If + + + If dt IsNot Nothing Then + Dim SQLstr = "Select invoice_id As RechnungsNr,[invoice_date] As Rechnungsdatum, Adressen.AdressenNr As KundenNr,Adressen.[Name 1] As Kunde, kde_keineMWSt As keineMWST from tblMSEInvoices inner join [tblMSECustomers] On [customer_number] = [customer_id] INNER JOIN Adressen On Adressen.MSEKundenNr = [customer_number] INNER JOIN tblKundenErweitert On AdressenNr = kde_KundenNr where daId Is null " & sqlTime & sqlAdressenNr & " group by invoice_id, Adressen.AdressenNr, Adressen.[Name 1], invoice_date, kde_keineMWSt" + dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL") + Return dt.Rows.Count + Else + Dim SQLstr = "Select count(*) from tblMSEInvoices inner join [tblMSECustomers] On [customer_number] = [customer_id] INNER JOIN Adressen On Adressen.MSEKundenNr = [customer_number] INNER JOIN tblKundenErweitert On AdressenNr = kde_KundenNr where daId Is null " & sqlTime & sqlAdressenNr + Return SQL.getValueTxtBySql(SQLstr, "FMZOLL",,, 0) + End If + - Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL") - Return dt Catch ex As Exception