diff --git a/SDL/Classes/cFiskaltrustClient.vb b/SDL/Classes/cFiskaltrustClient.vb index b0bcb3c6..a1aacac8 100644 --- a/SDL/Classes/cFiskaltrustClient.vb +++ b/SDL/Classes/cFiskaltrustClient.vb @@ -1,7 +1,9 @@ Imports System.Data.SqlClient +Imports System.Net Imports System.Net.Http Imports System.Reflection Imports System.Text +Imports System.Threading Imports Newtonsoft.Json Public Class cFiskaltrustClient @@ -46,6 +48,47 @@ Public Class cFiskaltrustClient End Function + '----- TEST + Public Async Function SignReceiptAsync_test(posSystemId As String) As Task(Of String) + + Dim LIST = New List(Of EABelegPositionen) + Dim p = New EABelegPositionen + p.Mandant = "VERA" + p.Niederlassung = "SUB" + p.Benutzer = 74 + p.BelegDat = Now + p.BelegNr = 1 + p.PreislistenNr = 1 + p.PreislistenPos = 1 + p.LeistungsNr = 300 + p.LeistungsBez = "TEST" + p.Preis = 10 + p.Anzahl = 1 + LIST.Add(p) + + Dim payload = BuildPayloadReceipt(100, CDec(0.0), LIST, "Cash", posSystemId) + Dim endpoint = GetEndpoint("payment") + + Dim requestContent As StringContent + + If _country = "AT" Then + ' Plaintext + 'Dim text As String = If(payload?.ToString(), "") + Dim json As String = JsonConvert.SerializeObject(payload) + 'requestContent = New StringContent(json, Encoding.UTF8, "text/plain") + requestContent = New StringContent(json, Encoding.UTF8, "application/json") + Else + ' JSON Objekt + + Dim json As String = JsonConvert.SerializeObject(payload) + requestContent = New StringContent(json, Encoding.UTF8, "application/json") + End If + + + Return Await SendAsync(endpoint, payload, requestContent) + + End Function + Public Async Function Echo(KassenName As String) As Task(Of String) Dim payload = KassenName & " - VERBINDUNG OK" @@ -191,7 +234,7 @@ Public Class cFiskaltrustClient endpoint &= "?type=" & type End If - Dim requestContent As StringContent + Dim requestContent As StringContent = Nothing If _country = "AT" Then ' Plaintext @@ -205,53 +248,12 @@ Public Class cFiskaltrustClient requestContent = New StringContent(json, Encoding.UTF8, "application/json") End If - Return Await SendAsync(endpoint, payload, requestContent) + Return Await SendAsync(endpoint, payload, requestContent, True) End Function - Public Async Function SignReceiptAsync_test(posSystemId As String) As Task(Of String) - - Dim LIST = New List(Of EABelegPositionen) - Dim p = New EABelegPositionen - p.Mandant = "VERA" - p.Niederlassung = "SUB" - p.Benutzer = 74 - p.BelegDat = Now - p.BelegNr = 1 - p.PreislistenNr = 1 - p.PreislistenPos = 1 - p.LeistungsNr = 300 - p.LeistungsBez = "TEST" - p.Preis = 10 - p.Anzahl = 1 - LIST.Add(p) - - Dim payload = BuildPayloadReceipt(100, 0, LIST, "Cash", posSystemId) - Dim endpoint = GetEndpoint("payment") - - Dim requestContent As StringContent - - If _country = "AT" Then - ' Plaintext - 'Dim text As String = If(payload?.ToString(), "") - Dim json As String = JsonConvert.SerializeObject(payload) - 'requestContent = New StringContent(json, Encoding.UTF8, "text/plain") - requestContent = New StringContent(json, Encoding.UTF8, "application/json") - Else - ' JSON Objekt - - Dim json As String = JsonConvert.SerializeObject(payload) - requestContent = New StringContent(json, Encoding.UTF8, "application/json") - End If - - - Return Await SendAsync(endpoint, payload, requestContent) - - End Function - - - Public Async Function CancelReceiptAsync_test(reference As String, amount As Decimal, kindOfPayment As String) As Task(Of String) + Public Async Function CancelReceiptAsync_test(reference As String, amount As Decimal, kindOfPayment As String, posSystemId As String) As Task(Of String) Dim LIST = New List(Of EABelegPositionen) @@ -273,8 +275,8 @@ Public Class cFiskaltrustClient Dim payload = New With { .ftCashBoxID = _cashboxId, - .ftPosSystemId = "POS-1", - .cbTerminalID = "T1", + .ftPosSystemId = getVersion(posSystemId), + .cbTerminalID = posSystemId, .cbReceiptReference = reference, .cbReceiptMoment = DateTime.UtcNow.ToString("o"), .ftReceiptCase = 4919338172267102210, @@ -310,7 +312,7 @@ Public Class cFiskaltrustClient End Function - Private Async Function SendAsync(endpoint As String, payload As Object, requestContent As StringContent) As Task(Of String) + Private Async Function SendAsync(endpoint As String, payload As Object, requestContent As StringContent, Optional ignorerequestContent As Boolean = False) As Task(Of String) Dim url = _baseUrl & endpoint @@ -320,6 +322,8 @@ Public Class cFiskaltrustClient Dim lastException As Exception = Nothing Dim shouldRetry As Boolean = False + ServicePointManager.Expect100Continue = False + For attempt As Integer = 1 To retries shouldRetry = False @@ -331,11 +335,19 @@ Public Class cFiskaltrustClient request.Headers.Add("cashboxid", _cashboxId) request.Headers.Add("accesstoken", _accessToken) - If requestContent IsNot Nothing Then + If Not ignorerequestContent AndAlso requestContent IsNot Nothing Then request.Content = requestContent End If - Dim response = Await _httpClient.SendAsync(request) + + Dim cts As New CancellationTokenSource(TimeSpan.FromSeconds(30)) + Debug.WriteLine("Before SendAsync") + + Dim response = Await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cts.Token) + + Debug.WriteLine("Headers received") + + Debug.WriteLine("After SendAsync") Dim result = Await response.Content.ReadAsStringAsync() Log($"[{DateTime.Now}] Response ({CInt(response.StatusCode)}): {result}") @@ -363,7 +375,9 @@ Public Class cFiskaltrustClient lastException = ex - Log($"[{DateTime.Now}] Attempt {attempt} failed: {ex.Message}") + Debug.WriteLine(ex.GetType().FullName) + Debug.WriteLine(ex.ToString()) + Throw End Try @@ -376,6 +390,7 @@ Public Class cFiskaltrustClient If lastException IsNot Nothing Then Throw lastException + MsgBox(lastException) End If Throw New Exception("Unexpected error") @@ -409,8 +424,8 @@ Public Class cFiskaltrustClient ' Payload Objekt erstellen Dim payload = New With { .ftCashBoxID = _cashboxId, - .ftPosSystemId = posSystemId, - .cbTerminalID = "T1", + .ftPosSystemId = getVersion(posSystemId), + .cbTerminalID = posSystemId, .cbReceiptReference = Guid.NewGuid().ToString(), .cbReceiptMoment = DateTime.UtcNow.ToString("o"), .cbChargeItems = chargeItems, @@ -447,8 +462,8 @@ Public Class cFiskaltrustClient Dim payload = New With { .ftCashBoxID = _cashboxId, - .ftPosSystemId = posSystemId, - .cbTerminalID = "T1", + .ftPosSystemId = getVersion(posSystemId), + .cbTerminalID = posSystemId, .cbReceiptReference = cbReceiptReference_, .cbReceiptMoment = DateTime.UtcNow.ToString("o"), .cbChargeItems = New Object() {}, @@ -476,8 +491,8 @@ Public Class cFiskaltrustClient Dim payload = New With { .ftCashBoxID = _cashboxId, - .ftPosSystemId = posSystemId, - .cbTerminalID = "T1", + .ftPosSystemId = getVersion(posSystemId), + .cbTerminalID = posSystemId, .cbReceiptReference = type & "-closing-" & DateTime.UtcNow.ToString("o"), .cbReceiptMoment = DateTime.UtcNow.ToString("o"), .cbChargeItems = New Object() {}, @@ -527,6 +542,17 @@ Public Class cFiskaltrustClient Throw New Exception("Unsupported country") End Select + ElseIf type = "storno" Then + + Select Case _country + Case "DE" + Return "/json/v1/Sign" + Case "AT" + Return "/json/Sign" + Case Else + Throw New Exception("Unsupported country") + End Select + End If @@ -545,6 +571,9 @@ Public Class cFiskaltrustClient Return False End If + + Dim saved As Boolean = False + Dim ftSig As New cFiskaltrustSignatures() Dim ftReceiptMoment As New Chilkat.CkDateTime @@ -568,7 +597,7 @@ Public Class cFiskaltrustClient .ftReceiptIdentification = json.StringOf("ftReceiptIdentification") .ftReceiptMoment = ftReceiptMoment.GetAsTimestamp(getAsLocal) .ftState = json.StringOf("ftState") - ftID = .SAVE() + saved = .SAVE() End With @@ -596,16 +625,17 @@ Public Class cFiskaltrustClient .ftData = SignObj.StringOf("Data") .ftSignatureFormat = SignObj.StringOf("ftSignatureFormat") .ftSignatureType = SignObj.StringOf("ftSignatureType") - .SAVE() - If IsNumeric(.ftSignatureType) AndAlso CInt(.ftSignatureType) = 3 Then - QR_CodeString = .ftData - End If + saved = .SAVE() + If IsNumeric(.ftSignatureType) AndAlso CInt(.ftSignatureType) = IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True, 0, 3) Then + QR_CodeString = .ftData + End If - End With + End With Next + Return saved @@ -681,6 +711,13 @@ Public Class cFiskaltrustClient + End Function + + Private Function getVersion(Terminal_ID) As String + + Return Terminal_ID & "_" & Application.ProductVersion + + End Function @@ -777,26 +814,6 @@ Public Class cFiskaltrustSignatures - 'Public Function getUpdateCmd() As String - ' Try - ' Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList() - - ' Dim str As String = "" - ' For Each i In list - ' If Not i.isPrimaryParam Then - ' str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & "," - ' End If - ' Next - ' str = str.Substring(0, str.Length - 1) 'wg. ',' - ' Return (" UPDATE [tblTABLE] SET " & str & " WHERE _BASE_id=@_BASE_id ") - - ' Catch ex As Exception - ' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) - ' End Try - ' Return "" - 'End Function - - Public Function getInsertCmd() As String Try Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList() @@ -894,28 +911,6 @@ Public Class cFiskaltrustSignaturPositions End Try End Sub - - - 'Public Function getUpdateCmd() As String - ' Try - ' Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList() - - ' Dim str As String = "" - ' For Each i In list - ' If Not i.isPrimaryParam Then - ' str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & "," - ' End If - ' Next - ' str = str.Substring(0, str.Length - 1) 'wg. ',' - ' Return (" UPDATE [tblTABLE] SET " & str & " WHERE _BASE_id=@_BASE_id ") - - ' Catch ex As Exception - ' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) - ' End Try - ' Return "" - 'End Function - - Public Function getInsertCmd() As String Try Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList() @@ -936,4 +931,6 @@ Public Class cFiskaltrustSignaturPositions Return "" End Function + + End Class \ No newline at end of file diff --git a/SDL/Classes/cFiskaltrustClient_chilkat.vb b/SDL/Classes/cFiskaltrustClient_chilkat.vb new file mode 100644 index 00000000..b1ba50ff --- /dev/null +++ b/SDL/Classes/cFiskaltrustClient_chilkat.vb @@ -0,0 +1,635 @@ + +Imports System.Data.SqlClient +Imports System.Reflection +Imports Chilkat +Imports GrapeCity.DataVisualization.Chart +Imports Newtonsoft.Json + +Public Class FtReceiptCases + + ' Normaler Verkauf + Public Const PosReceipt As Long = &H4445000000000001L + + ' Test-/Nullbeleg + Public Const ZeroReceipt As Long = &H4445000000000002L + + Public Const InitialOperation As Long = &H4445000000000003L + Public Const OutOfOperation As Long = &H4445000000000004L + + ' Tagesabschluss (Z-Bericht) + Public Const MonthlyClosing As Long = &H4445000000000005L + Public Const YearlyClosing As Long = &H4445000000000006L + Public Const DailyClosing As Long = &H4445000000000007L + + ' Flags + Public Const ImplicitTransaction As Long = &H100000000L + Public Const ReversalReceipt As Long = &H40000L + Public Const TrainingReceipt As Long = &H20000L + +End Class + +Public Class FtChargeItemCase + + Public Const RevenueNormal As Long = &H4445000000000001L ' 19 % + Public Const RevenueReduced As Long = &H4445000000000002L ' 7 % + Public Const RevenueTaxFree As Long = &H4445000000000005L ' 0 % + +End Class + +Public Class FtJournalType + + Public Const VersionInformation As Integer = 0 + Public Const ActionJournal As Integer = 1 + Public Const ReceiptJournal As Integer = 2 + Public Const QueueItemJournal As Integer = 3 + +End Class + +Public Class FtPayItemCases + + ' Barzahlung + Public Const Cash As Long = &H4445000000000001L + + ' EC-/Girokarte + Public Const DebitCard As Long = &H4445000000000004L + + ' Kreditkarte + Public Const CreditCard As Long = &H4445000000000005L + + ' Online-Zahlung (PayPal, Klarna, etc.) + Public Const OnlinePayment As Long = &H4445000000000006L + + ' Gutschein + Public Const Voucher As Long = &H444500000000000DL + +End Class + +Public Class cFiskaltrustClient_chilkat + + Private ReadOnly _baseUrl As String + Private ReadOnly _cashboxId As String + Private ReadOnly _accessToken As String + Private ReadOnly _country As String + + 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 Function SignReceipt(amount As Decimal, vat As Decimal, POS As List(Of EABelegPositionen), kindOfPayment As String, posSystemId As String) As String + + Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Verkauf", "") + + Return SendChilkat(GetEndpoint("payment"), payload.Emit()) + + End Function + + Public Function SignReceipt_test(posSystemId As String) As String + + Dim LIST = New List(Of EABelegPositionen) + Dim p = New EABelegPositionen + p.Mandant = "VERA" + p.Niederlassung = "SUB" + p.Benutzer = 74 + p.BelegDat = Now + p.BelegNr = 1 + p.PreislistenNr = 1 + p.PreislistenPos = 1 + p.LeistungsNr = 300 + p.LeistungsBez = "TEST" + p.Preis = 10 + p.Anzahl = 1 + LIST.Add(p) + + Dim amount = 100 + Dim vat = 0 + Dim POS = LIST + Dim kindOfPayment = "Cash" + + Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Verkauf", "") + + Return SendChilkat(GetEndpoint("payment"), payload.Emit()) + End Function + + + + Public Function ChancelReceipt(reference As String, amount As Decimal, vat As Decimal, POS As List(Of EABelegPositionen), kindOfPayment As String, posSystemId As String) As String + + Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Storno", reference) + + Return SendChilkat(GetEndpoint("storno"), payload.Emit()) + End Function + + Public Function ChancelReceipt_test(reference As String, posSystemId As String) As String + + Dim LIST = New List(Of EABelegPositionen) + Dim p = New EABelegPositionen + p.Mandant = "VERA" + p.Niederlassung = "SUB" + p.Benutzer = 74 + p.BelegDat = Now + p.BelegNr = 1 + p.PreislistenNr = 1 + p.PreislistenPos = 1 + p.LeistungsNr = 300 + p.LeistungsBez = "TEST" + p.Preis = 10 + p.Anzahl = 1 + LIST.Add(p) + + Dim amount = 100 + Dim vat = 0 + Dim POS = LIST + Dim kindOfPayment = "Cash" + + Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Storno", reference) + + Return SendChilkat(GetEndpoint("storno"), payload.Emit()) + End Function + + + Public Function SignNullReceipt(posSystemId As String) As String + Return SendChilkat(GetEndpoint("payment"), BuildPayloadNullReceipt(posSystemId, _country).Emit()) + End Function + + Public Function SignClosingReceipt(receiptType As String, posSystemId As String, kind As String) As String + + Return SendChilkat(GetEndpoint("payment"), BuildPayloadClosingReceipt(receiptType, posSystemId, kind).Emit()) + End Function + + Public Function Echo(kassenName As String) As String + + Dim json As New JsonObject() + json.UpdateString("Message", kassenName & " - VERBINDUNG OK") + + Return SendChilkat(GetEndpoint("test"), json.Emit()) + + End Function + + Public Function Journal(ftJournalType As Integer) As String + + Dim endpoint = GetEndpoint("journal") + + endpoint &= "?type=" & ftJournalType + + Return SendChilkat(endpoint, "") + End Function + + Private Function SendChilkat(endpoint As String, payload As String, Optional isGet As Boolean = False) As String + + Dim retries As Integer = 3 + Dim lastEx As Exception = Nothing + VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat() + Dim rest As New Chilkat.Rest + Dim failureDesc As String + rest.VerboseLogging = True + + + For i As Integer = 1 To retries + + Try + + Dim uri As New Uri(_baseUrl) + + If Not rest.Connect(uri.Host, uri.Port, uri.Scheme = "https", True) Then + + Throw New Exception(rest.LastErrorText) + failureDesc = rest.LastErrorText + Return failureDesc + + End If + + rest.AddHeader("cashboxid", _cashboxId) + rest.AddHeader("accesstoken", _accessToken) + + Dim response As String + + If isGet Then + response = rest.FullRequestNoBody("GET", uri.AbsoluteUri & endpoint) + Else + + + If _country = "AT" Then + rest.AddHeader("Content-Type", "text/plain") + response = rest.FullRequestString("POST", uri.AbsoluteUri & endpoint, payload) + Else + rest.AddHeader("Content-Type", "application/json") + response = rest.FullRequestString("POST", uri.AbsoluteUri & endpoint, payload) + End If + + + End If + + If rest.ResponseStatusCode >= 200 AndAlso rest.ResponseStatusCode < 300 Then + Return response + Else + failureDesc = rest.LastErrorText + End If + + Throw New Exception("HTTP " & rest.ResponseStatusCode & ": " & response) + + Catch ex As Exception + lastEx = ex + Threading.Thread.Sleep(500) + End Try + + Next + + Throw lastEx + + End Function + + Private Function BuildPayloadReceipt(amount As Decimal, vat As Decimal, POS As List(Of EABelegPositionen), kindOfPayment As String, posSystemId As String, _receiptCase As String, _reference As String) As JsonObject + + Dim json As New JsonObject() + + json.UpdateString("ftCashBoxID", _cashboxId) + json.UpdateString("ftPosSystemId", getVersion(posSystemId)) + json.UpdateString("cbTerminalID", posSystemId) + + If _reference <> "" Then + json.UpdateString("cbReceiptReference", _reference) + Else + json.UpdateString("cbReceiptReference", Guid.NewGuid().ToString()) + End If + + json.UpdateString("cbReceiptMoment", DateTime.UtcNow.ToString("o")) + + Dim receipCase As Long + Select Case _receiptCase + + Case "Storno" + receipCase = FtReceiptCases.PosReceipt Or FtReceiptCases.ReversalReceipt Or FtReceiptCases.ImplicitTransaction 'Storno + + Case Else + receipCase = FtReceiptCases.PosReceipt Or FtReceiptCases.ImplicitTransaction 'Verkauf + + End Select + + + json.UpdateString("ftReceiptCase", receipCase) + + + Dim chargeItems = json.AppendArray("cbChargeItems") + + For Each p In POS + + If chargeItems.AddObjectAt(-1) Then + Dim item As Chilkat.JsonObject = chargeItems.ObjectAt(chargeItems.Size - 1) + item.UpdateInt("Quantity", p.Anzahl) + item.UpdateNumber("Amount", p.Preis.ToString().Replace(",", ".")) + item.UpdateNumber("VATRate", vat.ToString().Replace(",", ".")) + item.UpdateString("Description", p.LeistungsBez) + + Dim ChargeItemCase As Long + Select Case vat + + Case 19D + ChargeItemCase = FtChargeItemCase.RevenueNormal + + Case 7D + ChargeItemCase = FtChargeItemCase.RevenueReduced + + Case 0D + ChargeItemCase = FtChargeItemCase.RevenueTaxFree + + Case Else + Throw New Exception("Unbekannter Steuersatz") + End Select + + + item.UpdateString("ftChargeItemCase", ChargeItemCase) + End If + + + Next + + Dim payItems = json.AppendArray("cbPayItems") + payItems.AddObjectAt(-1) + Dim pay As Chilkat.JsonObject = payItems.ObjectAt(payItems.Size - 1) + pay.UpdateInt("Quantity", 1) + pay.UpdateNumber("Amount", amount.ToString().Replace(",", ".")) + pay.UpdateString("Description", kindOfPayment) + + Select Case kindOfPayment + Case "Cash" + pay.UpdateString("ftPayItemCase", FtPayItemCases.Cash) + Case "Card" + pay.UpdateString("ftPayItemCase", FtPayItemCases.DebitCard) + End Select + + + Return json + + End Function + + Private Function BuildPayloadNullReceipt(posSystemId As String, country As String) As JsonObject + + Dim json As New JsonObject() + + json.UpdateString("ftCashBoxID", _cashboxId) + json.UpdateString("ftPosSystemId", getVersion(posSystemId)) + json.UpdateString("cbTerminalID", posSystemId) + json.UpdateString("cbReceiptMoment", DateTime.UtcNow.ToString("o")) + json.UpdateString("ftReceiptCase", (FtReceiptCases.ZeroReceipt Or FtReceiptCases.ImplicitTransaction).ToString()) + json.UpdateString("cbReceiptReference", "ZeroReceiptAfterFailure") + + Dim chargeItems = json.AppendArray("cbChargeItems") + Dim payItems = json.AppendArray("cbPayItems") + + Return json + End Function + + Private Function BuildPayloadInitialOperationReceipt(posSystemId As String, country As String) As JsonObject + + Dim json As New JsonObject() + + json.UpdateString("ftCashBoxID", _cashboxId) + json.UpdateString("ftPosSystemId", getVersion(posSystemId)) + json.UpdateString("cbTerminalID", posSystemId) + json.UpdateString("cbReceiptMoment", DateTime.UtcNow.ToString("o")) + json.UpdateString("ftReceiptCase", (FtReceiptCases.InitialOperation).ToString()) + json.UpdateString("cbReceiptReference", "INIT") + + json.UpdateString("cbUser", "Admin") + json.UpdateString("ftReceiptCaseData", "") + + + + Dim chargeItems = json.AppendArray("cbChargeItems") + Dim payItems = json.AppendArray("cbPayItems") + + Return json + End Function + + Private Function BuildPayloadOutOfOperationReceipt(posSystemId As String, country As String) As JsonObject + + Dim json As New JsonObject() + + json.UpdateString("ftCashBoxID", _cashboxId) + json.UpdateString("ftPosSystemId", getVersion(posSystemId)) + json.UpdateString("cbTerminalID", posSystemId) + json.UpdateString("cbReceiptMoment", DateTime.UtcNow.ToString("o")) + json.UpdateString("ftReceiptCase", (FtReceiptCases.OutOfOperation).ToString()) + json.UpdateString("cbReceiptReference", "OutOfOperation") + + json.UpdateString("cbUser", "Admin") + json.UpdateString("ftReceiptCaseData", "") + + Dim chargeItems = json.AppendArray("cbChargeItems") + Dim payItems = json.AppendArray("cbPayItems") + + Return json + End Function + + Private Function BuildPayloadClosingReceipt(receiptType As String, posSystemId As String, kind As String) As JsonObject + + Dim json As New JsonObject() + + json.UpdateString("ftCashBoxID", _cashboxId) + json.UpdateString("ftPosSystemId", getVersion(posSystemId)) + json.UpdateString("cbTerminalID", posSystemId) + json.UpdateString("cbReceiptMoment", DateTime.UtcNow.ToString("o")) + Dim chargeItems = json.AppendArray("cbChargeItems") + Dim payItems = json.AppendArray("cbPayItems") + + + + Select Case kind + Case "yearly" + + json.UpdateString("cbReceiptReference", "yearly-closing-" & DateTime.UtcNow.ToString("o")) + json.UpdateString("ftReceiptCase", (FtReceiptCases.YearlyClosing Or FtReceiptCases.ImplicitTransaction).ToString()) + + Case "monthly" + + json.UpdateString("cbReceiptReference", "monthly-closing-" & DateTime.UtcNow.ToString("o")) + json.UpdateString("ftReceiptCase", (FtReceiptCases.MonthlyClosing Or FtReceiptCases.ImplicitTransaction).ToString()) + + Case Else 'daily + json.UpdateString("cbReceiptReference", "daily-closing-" & DateTime.UtcNow.ToString("o")) + json.UpdateString("ftReceiptCase", (FtReceiptCases.DailyClosing Or FtReceiptCases.ImplicitTransaction).ToString()) + + End Select + + Return json + End Function + + Private Function GetEndpoint(type As String) As String + + Select Case type + + Case "payment" + + Select Case _country + Case "DE" : Return "/json/v1/Sign" + Case "AT" : Return "/json/Sign" + End Select + + Case "test" + + Select Case _country + Case "DE" : Return "/json/v1/Echo" + Case "AT" : Return "/json/Echo" + End Select + + Case "journal" + + Select Case _country + Case "DE" : Return "/json/v0/Journal" + Case "AT" : Return "/json/Journal" + End Select + + Case "storno" + + Select Case _country + Case "DE" : Return "/json/v1/Sign" + Case "AT" : Return "/json/Sign" + End Select + + + End Select + + Throw New Exception("Unsupported country") + + End Function + + Private Function getVersion(Terminal_ID As String) As String + Return Terminal_ID & "_" & Application.ProductVersion + End Function + + Public Function saveRKSV_FT(ByRef result_zahlung As String, ByRef QR_CodeString As String) As Boolean + + If result_zahlung <> "" Then + Dim json As New Chilkat.JsonObject + Dim success As Boolean = json.Load(result_zahlung) + If (success <> True) Then + Debug.WriteLine(json.LastErrorText) + Return False + End If + + + Dim saved As Boolean = False + + Dim ftSig As New cFiskaltrustSignatures() + + Dim ftReceiptMoment As New Chilkat.CkDateTime + Dim dt As New Chilkat.DtObj + Dim getAsLocal As Boolean = False + + Dim ftID As Integer = -1 + + success = json.DateOf("ftReceiptMoment", ftReceiptMoment) + Debug.WriteLine(ftReceiptMoment.GetAsTimestamp(getAsLocal)) + + With ftSig + + .ftCashBoxID = json.StringOf("ftCashBoxID") + .ftQueueID = json.StringOf("ftQueueID") + .ftQueueItemID = json.StringOf("ftQueueItemID") + .ftQueueRow = json.IntOf("ftQueueRow") + .cbTerminalID = json.StringOf("cbTerminalID") + .cbReceiptReference = json.StringOf("cbReceiptReference") + .ftCashBoxIdentification = json.StringOf("ftCashBoxIdentification") + .ftReceiptIdentification = json.StringOf("ftReceiptIdentification") + .ftReceiptMoment = ftReceiptMoment.GetAsTimestamp(getAsLocal) + .ftState = json.StringOf("ftState") + saved = .SAVE() + + End With + + + Dim num As Integer = json.SizeOfArray("ftSignatures") + If num = 0 Then + Return False + End If + + Dim Signatures As Chilkat.JsonArray = json.ArrayOf("ftSignatures") + If (json.LastMethodSuccess = False) Then + Return False + End If + + Dim numSignatures As Integer = Signatures.Size + + For i = 0 To numSignatures - 1 + + + Dim SignObj As Chilkat.JsonObject = Signatures.ObjectAt(i) + Dim ftSigPos As New cFiskaltrustSignaturPositions() + + With ftSigPos + .ftSignatures = ftSig.ft_id + .ftData = SignObj.StringOf("Data") + .ftSignatureFormat = SignObj.StringOf("ftSignatureFormat") + .ftSignatureType = SignObj.StringOf("ftSignatureType") + saved = .SAVE() + If IsNumeric(.ftSignatureType) AndAlso CInt(.ftSignatureType) = IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True, 0, 3) Then + 'QR_CodeString = .ftData + End If + + End With + + Next + + + Return saved + + + + End If + + + End Function + + + Public Function exportJournal(ByRef result_Journal As String) As Boolean + + If result_Journal <> "" Then + Dim jsonArr As New Chilkat.JsonArray + Dim success As Boolean = jsonArr.Load(result_Journal) + If (success <> True) Then + Debug.WriteLine(jsonArr.LastErrorText) + Return False + End If + + + Dim dt As New DataTable + + dt.Columns.Add("ftReceiptJournalId", GetType(String)) + dt.Columns.Add("ftReceiptMoment", GetType(String)) + dt.Columns.Add("ftReceiptNumber", GetType(String)) + dt.Columns.Add("ftReceiptTotal", GetType(String)) + dt.Columns.Add("ftQueueId", GetType(String)) + dt.Columns.Add("ftReceiptHash", GetType(String)) + dt.Columns.Add("ftQueueItemId", GetType(String)) + dt.Columns.Add("TimeStamp", GetType(String)) + + Dim i = 0 + Dim num As Integer = jsonArr.Size + If num = 0 Then + Return False + End If + + Dim tmstmp As New Chilkat.CkDateTime + Dim getAsLocal As Boolean = False + + + While i < num + + Dim SignObj As Chilkat.JsonObject = jsonArr.ObjectAt(i) + Dim R As DataRow = dt.NewRow + + With SignObj + + R("ftReceiptJournalId") = .StringOf("ftReceiptJournalId") + R("ftReceiptMoment") = .StringOf("ftReceiptMoment") + R("ftReceiptNumber") = .IntOf("ftReceiptNumber") + R("ftReceiptTotal") = .StringOf("ftReceiptTotal") + R("ftQueueId") = .StringOf("ftQueueId") + R("ftQueueItemId") = .StringOf("ftQueueItemId") + R("ftReceiptHash") = .StringOf("ftReceiptHash") + R("TimeStamp") = tmstmp.GetAsTimestamp(getAsLocal) + + End With + + dt.Rows.Add(R) + + i = i + 1 + End While + + If dt.Rows.Count > 0 Then + + Dim Path = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt) + + End If + + + End If + + + + End Function + + + Private Sub Log(message As String) + Console.WriteLine(message) + End Sub + + Public Function PrettyPrintJson(jsonText As String) As String + + Dim json As New Chilkat.JsonObject() + + If Not json.Load(jsonText) Then + Return jsonText + End If + + json.EmitCompact = False + + Return json.Emit() + + End Function + +End Class + diff --git a/SDL/Classes/cRKSV.vb b/SDL/Classes/cRKSV.vb index f4ced71a..c9dd04d9 100644 --- a/SDL/Classes/cRKSV.vb +++ b/SDL/Classes/cRKSV.vb @@ -92,7 +92,7 @@ Public Class cRKSV End Function - Shared Async Function insertRKSVFiskaltrustAsync(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), QR_CodeString As String, LastJWS As String) As Task(Of Boolean) + Shared Function insertRKSVFiskaltrustAsync(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), ByRef QR_CodeString As String, ByRef LastJWS As String) As Boolean Try @@ -116,8 +116,6 @@ Public Class cRKSV 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) @@ -125,18 +123,37 @@ Public Class cRKSV Dim BetragSatzBesonders = IIf(steuersatz = 0.19, summeBRUTTO, 0.0) Dim StandUmsatzzaehler = umsatzZaehler 'KASSE.rksv_Umsatzzaehler - Dim client As New cFiskaltrustClient(kasse.rksv_FT_RestServiceURL, kasse.rksv_FT_CashboxID, kasse.rksv_FT_AccessToken, kasse.rksv_FT_Country) + If False Then + 'Dim client As New cFiskaltrustClient(kasse.rksv_FT_RestServiceURL, kasse.rksv_FT_CashboxID, kasse.rksv_FT_AccessToken, kasse.rksv_FT_Country) + + 'Dim result = Await client.SignReceiptAsync(summeBRUTTO, steuersatz, POS, "Cash", kasse.rksv_id) + 'If result <> "" Then + ' Return client.saveRKSV_FT(result, QR_CodeString) + 'Else + ' Return False + 'End If + Else + Dim client As New cFiskaltrustClient_chilkat(kasse.rksv_FT_RestServiceURL, kasse.rksv_FT_CashboxID, kasse.rksv_FT_AccessToken, kasse.rksv_FT_Country) + Dim result = client.SignReceipt(summeBRUTTO, steuersatz, POS, "Cash", kasse.rksv_id) + If result <> "" Then + Return client.saveRKSV_FT(result, QR_CodeString) + Else + Return False + End If + + End If + + - Dim result = Await client.SignReceiptAsync(summeBRUTTO, steuersatz, POS, "Cash", kasse.rksv_id) - client.saveRKSV_FT(result, QR_CodeString) Catch ex As Exception MsgBox("Es ist ein Fehler bei der Signatur aufgetreten (insertRKSV): " & vbNewLine & ex.Message & ex.StackTrace) + Return False End Try - Return False + End Function diff --git a/SDL/Fakturierung/cAutomailversand.vb b/SDL/Fakturierung/cAutomailversand.vb index 2d9d9f2e..0a638ea8 100644 --- a/SDL/Fakturierung/cAutomailversand.vb +++ b/SDL/Fakturierung/cAutomailversand.vb @@ -1,10 +1,11 @@ Imports System.IO +Imports com.sun.org.apache.xpath.internal.operations Imports Microsoft.Office.Interop Imports VERAG_PROG_ALLGEMEIN Public Class cAutomailversand - Sub sendMailSammelrechnung(_Rechnungsdatum As Date, SammelrechungArt As Integer, FirmaID As Integer, Optional KundenNr As Integer = -1, Optional mailoeffnen As Boolean = False, Optional faktGruppe As String = "") + Sub sendMailSammelrechnung(_Rechnungsdatum As Date, SammelrechungArt As Integer, FirmaID As Integer, Optional KundenNr As Integer = -1, Optional mailoeffnen As Boolean = False, Optional faktGruppe As String = "", Optional datumBis As Date = Nothing) Try Dim sql As New VERAG_PROG_ALLGEMEIN.SQL @@ -16,7 +17,6 @@ Public Class cAutomailversand 'STATUS 3-_> Sammel-Rg gedruckt 'STATUS 4-_> ? irgendwas mit SR 6 Maut/Diesel?? - 'NUR STATUS 2 -> d.b. Rechnungsdatum + RechnungsNr vergeben! Dim rechnungenMailversand = "" @@ -38,7 +38,7 @@ Public Class cAutomailversand LEFT JOIN tblKundenErweitert on tblKundenErweitert.kde_KundenNr = Rechnungsausgang.RechnungsKundenNr INNER JOIN Währungstabelle on LandKz = Rechnungsausgang.RechnungsLandKz WHERE Rechnungsausgang.Status IN (2) and Rechnungsausgang.Automailversand_sent is null And Rechnungsausgang.Firma_ID = '" & FirmaID & "' And Rechnungsausgang.Sammelrechnung = '" & SammelrechungArt & "' And CONVERT(DATE,Rechnungsausgang.Rechnungsdatum,104) = '" & _Rechnungsdatum.ToShortDateString & "' - and isnull(Rechnungsausgang.Automailversand,0) = 1 and RechnungsNr > 0 and FakturierungsGruppe = '" & faktGruppe & "'" & IIf(KundenNr > 0, " AND RechnungsKundenNr = " & KundenNr, "") & " + and isnull(Rechnungsausgang.Automailversand,0) = 1 and RechnungsNr > 0 and FakturierungsGruppe = '" & faktGruppe & "'" & IIf(KundenNr > 0, " AND RechnungsKundenNr = " & KundenNr, "") & IIf(IsDate(datumBis), " AND CONVERT(DATE, Rechnungsausgang.Abfertigungsdatum, 104) <= '" & datumBis.ToShortDateString & "'", "") & " GROUP BY RechnungsNr, RechnungsKundenNr,tblKundenErweitert.kde_SR_IM_EX ORDER BY RechnungsLandKz, RechnungsKundenNr" @@ -159,8 +159,8 @@ Public Class cAutomailversand showError = mailoeffnen 'bei MailÖffnen fehler anzeigen! setEmailText(row, FirmaID, RechnungsNr, Mailsubject, HTMLMail, SammelrechungArt, dt, BelegartenNr) - If do_SR(row.Item("RechnungsKundenNr"), FirmaID, SammelrechungArt, Rechnungsdatum, RechnungsNr, DruckDatumZeit, MDMKopiedrucken, listPDFs,,,, showError, AbfertigungsNr, faktGruppe) Then - loadAndSetAnhaenge(SR_DT, ATTACHMENTS, listPDFs,,, KDE_ERW.kde_merge_pdf) + If do_SR(row.Item("RechnungsKundenNr"), FirmaID, SammelrechungArt, datumBis, Rechnungsdatum, RechnungsNr, DruckDatumZeit, MDMKopiedrucken, listPDFs,,,, showError, AbfertigungsNr, faktGruppe) Then + loadAndSetAnhaenge_new(SR_DT, ATTACHMENTS, listPDFs,,, KDE_ERW.kde_merge_pdf) If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then Mailsubject &= " TEST" @@ -249,6 +249,7 @@ Public Class cAutomailversand setEmpfaengerMail_ER(SPEDBUCH, AD, MailTo, MailtoCC, MailtoBCC, "") If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then + MailTo = "" MailtoCC = "" MailtoBCC = setAccountToSend(FirmaID) @@ -275,7 +276,7 @@ Public Class cAutomailversand Dim Mailsubject As String = "" Dim HTMLMail As String = "" setEmailText(r, FirmaID, RECHNUNG.RechnungsNr, Mailsubject, HTMLMail, RECHNUNG.Sammelrechnung, dt, RECHNUNG.BelegartenNr, SPEDBUCH, RECHNUNG) - loadAndSetAnhaenge(dt, ATTACHMENTS, listPDFs, RECHNUNG, SPEDBUCH) + loadAndSetAnhaenge_new(dt, ATTACHMENTS, listPDFs, RECHNUNG, SPEDBUCH, KDE_ERW.kde_merge_pdf) If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then Mailsubject &= " TEST" @@ -475,10 +476,15 @@ Public Class cAutomailversand End Sub - Private Function do_SR(kdNr As Integer, FirmaID As Integer, Sammelrechnungsart As Integer, Rechnungsdatum As Date, lastAktuelle_RgNr As Integer, DruckDatumZeit As Date, Kopie As Boolean, listPDFs As List(Of String), Optional EinzelAnlagen As Boolean = False, Optional Sammelbericht As Boolean = True, Optional saveInThereFore As Boolean = False, Optional showError As Boolean = True, Optional AbfertigungsArt As String = "", Optional faktGruppe As String = "") + Private Function do_SR(kdNr As Integer, FirmaID As Integer, Sammelrechnungsart As Integer, DatumBis As Date, Rechnungsdatum As Date, lastAktuelle_RgNr As Integer, DruckDatumZeit As Date, Kopie As Boolean, listPDFs As List(Of String), Optional EinzelAnlagen As Boolean = False, Optional Sammelbericht As Boolean = True, Optional saveInThereFore As Boolean = False, Optional showError As Boolean = True, Optional AbfertigungsArt As String = "", Optional faktGruppe As String = "") Dim RechnungsNrisSet As Boolean = False - RechnungsNrisSet = cFakturierung.doSAMMELRechnungsDruck(FirmaID, Sammelrechnungsart, Rechnungsdatum, Rechnungsdatum, "", EinzelAnlagen, Sammelbericht, kdNr, 4, listPDFs, "", lastAktuelle_RgNr, DruckDatumZeit,,,,,, faktGruppe, AbfertigungsArt, True, Kopie, True, saveInThereFore, showError) + + If DatumBis = Nothing Then + DatumBis = Rechnungsdatum + End If + + RechnungsNrisSet = cFakturierung.doSAMMELRechnungsDruck(FirmaID, Sammelrechnungsart, DatumBis, Rechnungsdatum, "", EinzelAnlagen, Sammelbericht, kdNr, 4, listPDFs, "", lastAktuelle_RgNr, DruckDatumZeit,,,,,, faktGruppe, AbfertigungsArt, True, Kopie, True, saveInThereFore, showError) Return RechnungsNrisSet End Function @@ -530,18 +536,124 @@ Public Class cAutomailversand End Function + Private Sub loadAndSetAnhaenge_new(SR_DT As DataTable, ATTACHMENTS As List(Of cFakt_MailATTach), listPDFs As List(Of String), Optional RECHNUNG As cRechnungsausgang = Nothing, Optional SPEDBUCH As cSpeditionsbuch = Nothing, Optional mergeAllPDFS As Boolean = False) + + Dim zielPfad_PDFZusammenfassung = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath("Anhang.pdf", ".pdf",, False, "Zusammenfassung") + + '==================================================== + ' EINZELRECHNUNG + '==================================================== + If RECHNUNG IsNot Nothing Then + + Dim mergeList As New List(Of String) + + ' Beleg + Dim belegName = If(RECHNUNG.BelegartenKz = "AR", "Rechnung.pdf", "Gutschrift.pdf") + + For Each pdf In listPDFs + ATTACHMENTS.Add(New cFakt_MailATTach(pdf, belegName)) + Next + + ' Rechnungsanhänge + RECHNUNG.LOAD_ANHAENGE() + + For Each anh In RECHNUNG.ANHAENGE + + HandlePdf(anh.dsId, anh.Bezeichnung, RECHNUNG.FilialenNr, RECHNUNG.Firma_ID, False, mergeList, ATTACHMENTS) + + Next + + ' Zoll-Unterlagen + LoadZollAttachments(SPEDBUCH, RECHNUNG.FilialenNr, RECHNUNG.Firma_ID, False, mergeList, ATTACHMENTS) + + ' Zusammenfassung erzeugen + AddMergedPdf(mergeList, zielPfad_PDFZusammenfassung, ATTACHMENTS) + + ' Beleg + Anhänge zusammenführen + If mergeAllPDFS AndAlso ATTACHMENTS.Count > 1 Then + + Dim prefix = If(RECHNUNG.BelegartenKz = "AR", "Rechnungs", "Gutschrifts") + + Dim zielPfad = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(prefix & "anhang.pdf", ".pdf",, False, "Zusammenfassung") + + Dim pdfs As New List(Of String) + pdfs = ATTACHMENTS.Select(Function(a) a.Pfad.ToString).ToList() + + If FormularManagerNEU.MergePdfFiles(pdfs, zielPfad) Then + ATTACHMENTS.Clear() + ATTACHMENTS.Add(New cFakt_MailATTach(zielPfad, "")) + + End If + + End If + + Return + + End If + + '==================================================== + ' SAMMELRECHNUNG + '==================================================== + If SR_DT Is Nothing OrElse SR_DT.Rows.Count = 0 Then Return + + Dim mergeListSR As New List(Of String)(listPDFs) + + ' Zoll-Unterlagen + For Each row As DataRow In SR_DT.Rows + + Dim spedbuchTemp As New VERAG_PROG_ALLGEMEIN.cSpeditionsbuch(row("FilialenNr"), row("AbfertigungsNr"), row("SpeditionsbuchUnterNr")) + Dim filialenNr = If(IsDBNull(row("FilialenNr")), 0, CInt(row("FilialenNr"))) + Dim firmaId = If(IsDBNull(row("Firma_ID")), 0, CInt(row("Firma_ID"))) + + LoadZollAttachments(spedbuchTemp, filialenNr, firmaId, True, mergeListSR, ATTACHMENTS) + + Next + + ' Rechnungsanhänge + For Each row As DataRow In SR_DT.Rows + + Dim filialenNr = If(IsDBNull(row("FilialenNr")), 0, CInt(row("FilialenNr"))) + + Dim firmaId = If(IsDBNull(row("Firma_ID")), 0, CInt(row("Firma_ID"))) + + Dim anhaenge = VERAG_PROG_ALLGEMEIN.cRechnungsausgang.LOAD_ANHAENGE_LIST(row("RK_ID")) + + If anhaenge Is Nothing Then Continue For + + For Each anh In anhaenge + + HandlePdf(anh.dsId, anh.Bezeichnung, filialenNr, firmaId, True, mergeListSR, ATTACHMENTS) + + Next + + Next + + ' Zusammenfassung erzeugen + AddMergedPdf(mergeListSR, zielPfad_PDFZusammenfassung, ATTACHMENTS) + + End Sub + + Private Sub loadAndSetAnhaenge(SR_DT As DataTable, ATTACHMENTS As List(Of cFakt_MailATTach), listPDFs As List(Of String), Optional RECHNUNG As cRechnungsausgang = Nothing, Optional SPEDBUCH As cSpeditionsbuch = Nothing, Optional mergeAllPDFS As Boolean = False) + '---- Zusammenfassung der PDFs in 3 Schritten: + + '1--> Beleg + '2--> Anhänge der Rechnung + '3--> Zoll-Anhänge aus SPED-BUCH + Dim zielPfadZusammenfassung = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath("Attachment.pdf", ".pdf",, False, "Zusammenfassung") Dim pdfAnhang_merge As Boolean = False '----------------------------------------------------------------- EINZELRECHNUNGEN------------------------------------------------ If RECHNUNG IsNot Nothing Then + '1--> Beleg For Each l In listPDFs ATTACHMENTS.Add(New cFakt_MailATTach(l, If(RECHNUNG.BelegartenKz = "AR", "Rechnung.pdf", "Gutschrift.pdf"))) Next + '2--> Anhänge der Rechnung Dim zsmf_ER As New List(Of String) RECHNUNG.LOAD_ANHAENGE() @@ -549,7 +661,7 @@ Public Class cAutomailversand Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(ANH.dsId) - pdfAnhang_merge = PDFS_zusammenfassen(path, RECHNUNG.FilialenNr, RECHNUNG.Firma_ID, False) + pdfAnhang_merge = mergeSinglePDFDocuments(path, RECHNUNG.FilialenNr, RECHNUNG.Firma_ID, False) If pdfAnhang_merge Then If path <> "" Then @@ -568,18 +680,60 @@ Public Class cAutomailversand Next - + '3--> Zoll-Anhänge aus SPED-BUCH If SPEDBUCH IsNot Nothing Then Dim ZOLL = IIf(SPEDBUCH.DokumentId_Mitteilung IsNot Nothing, "AT", "DE") Select Case ZOLL Case "DE" - If SPEDBUCH.DokumentId_Steuerbeleg IsNot Nothing Then ATTACHMENTS.Add(New cFakt_MailATTach(VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH.DokumentId_Steuerbeleg), "Steuerbescheid.pdf")) - If SPEDBUCH.DokumentId_VBD IsNot Nothing Then ATTACHMENTS.Add(New cFakt_MailATTach(VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH.DokumentId_VBD), "Abgabenbescheid.pdf")) + If SPEDBUCH.DokumentId_Steuerbeleg IsNot Nothing Then + Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH.DokumentId_Steuerbeleg) + pdfAnhang_merge = mergeSinglePDFDocuments(path, RECHNUNG.FilialenNr, RECHNUNG.Firma_ID, False) + If pdfAnhang_merge Then + zsmf_ER.Add(path) + Else + ATTACHMENTS.Add(New cFakt_MailATTach(path, "Steuerbescheid.pdf")) + End If + + End If + If SPEDBUCH.DokumentId_VBD IsNot Nothing Then + Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH.DokumentId_VBD) + pdfAnhang_merge = mergeSinglePDFDocuments(path, RECHNUNG.FilialenNr, RECHNUNG.Firma_ID, False) + If pdfAnhang_merge Then + zsmf_ER.Add(path) + Else + ATTACHMENTS.Add(New cFakt_MailATTach(path, "Abgabenbescheid.pdf")) + End If + + + + End If Case "AT" - If SPEDBUCH.DokumentId_Steuerbeleg IsNot Nothing Then ATTACHMENTS.Add(New cFakt_MailATTach(VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH.DokumentId_Steuerbeleg), "Verzollungsnachweis.pdf")) - If SPEDBUCH.DokumentId_Mitteilung IsNot Nothing Then ATTACHMENTS.Add(New cFakt_MailATTach(VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH.DokumentId_Mitteilung), "Versandschein.pdf")) + If SPEDBUCH.DokumentId_Steuerbeleg IsNot Nothing Then + + Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH.DokumentId_Steuerbeleg) + pdfAnhang_merge = mergeSinglePDFDocuments(path, RECHNUNG.FilialenNr, RECHNUNG.Firma_ID, False) + If pdfAnhang_merge Then + zsmf_ER.Add(path) + Else + ATTACHMENTS.Add(New cFakt_MailATTach(path, "Verzollungsnachweis.pdf")) + End If + + End If + If SPEDBUCH.DokumentId_Mitteilung IsNot Nothing Then + + + Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH.DokumentId_Mitteilung) + pdfAnhang_merge = mergeSinglePDFDocuments(path, RECHNUNG.FilialenNr, RECHNUNG.Firma_ID, False) + If pdfAnhang_merge Then + zsmf_ER.Add(path) + Else + ATTACHMENTS.Add(New cFakt_MailATTach(path, "Versandschein.pdf")) + End If + + + End If End Select @@ -588,10 +742,17 @@ Public Class cAutomailversand If zsmf_ER.Any() Then - If FormularManagerNEU.MergePdfFiles(zsmf_ER, zielPfadZusammenfassung) Then - Dim fileInfo As New FileInfo(zielPfadZusammenfassung) - ATTACHMENTS.Add(New cFakt_MailATTach(zielPfadZusammenfassung, fileInfo.Name)) + If zsmf_ER.Count = 1 Then + Dim fileInfo As New FileInfo(zsmf_ER(0)) + ATTACHMENTS.Add(New cFakt_MailATTach(zsmf_ER(0), fileInfo.Name)) + + Else + If FormularManagerNEU.MergePdfFiles(zsmf_ER, zielPfadZusammenfassung) Then + Dim fileInfo As New FileInfo(zielPfadZusammenfassung) + ATTACHMENTS.Add(New cFakt_MailATTach(zielPfadZusammenfassung, fileInfo.Name)) + End If End If + End If If mergeAllPDFS Then 'also Beleg + Anhänge in Beleg @@ -621,6 +782,78 @@ Public Class cAutomailversand 'ATTACHMENTS.Clear() Dim zsmf_SR As New List(Of String) + For Each l In listPDFs + zsmf_SR.Add(l) + Next + + + For Each r In SR_DT.Rows + Dim SPEDBUCH_TEMP As New VERAG_PROG_ALLGEMEIN.cSpeditionsbuch(r("FilialenNr"), r("AbfertigungsNr"), r("SpeditionsbuchUnterNr")) + + Dim FilialenNr = IIf(Not IsDBNull(r.Item("FilialenNr")) AndAlso IsNumeric(r.Item("FilialenNr")), CInt(r.Item("FilialenNr")), 0) + Dim FIRMA_ID = IIf(Not IsDBNull(r.Item("Firma_ID")) AndAlso IsNumeric(r.Item("Firma_ID")), CInt(r.Item("Firma_ID")), 0) + + If SPEDBUCH_TEMP IsNot Nothing Then + + Dim ZOLL = IIf(SPEDBUCH_TEMP.DokumentId_Mitteilung IsNot Nothing, "AT", "DE") + + Select Case ZOLL + Case "DE" + If SPEDBUCH_TEMP.DokumentId_Steuerbeleg IsNot Nothing Then + Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH_TEMP.DokumentId_Steuerbeleg) + pdfAnhang_merge = mergeSinglePDFDocuments(path, FilialenNr, FIRMA_ID, False) + If pdfAnhang_merge Then + zsmf_SR.Add(path) + Else + ATTACHMENTS.Add(New cFakt_MailATTach(path, "Steuerbescheid.pdf")) + End If + + End If + If SPEDBUCH_TEMP.DokumentId_VBD IsNot Nothing Then + Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH_TEMP.DokumentId_VBD) + pdfAnhang_merge = mergeSinglePDFDocuments(path, FilialenNr, FIRMA_ID, False) + If pdfAnhang_merge Then + zsmf_SR.Add(path) + Else + ATTACHMENTS.Add(New cFakt_MailATTach(path, "Abgabenbescheid.pdf")) + End If + + + + End If + Case "AT" + If SPEDBUCH_TEMP.DokumentId_Steuerbeleg IsNot Nothing Then + + Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH_TEMP.DokumentId_Steuerbeleg) + pdfAnhang_merge = mergeSinglePDFDocuments(path, FilialenNr, FIRMA_ID, False) + If pdfAnhang_merge Then + zsmf_SR.Add(path) + Else + ATTACHMENTS.Add(New cFakt_MailATTach(path, "Verzollungsnachweis.pdf")) + End If + + End If + If SPEDBUCH_TEMP.DokumentId_Mitteilung IsNot Nothing Then + + + Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(SPEDBUCH_TEMP.DokumentId_Mitteilung) + pdfAnhang_merge = mergeSinglePDFDocuments(path, FilialenNr, FIRMA_ID, False) + If pdfAnhang_merge Then + zsmf_SR.Add(path) + Else + ATTACHMENTS.Add(New cFakt_MailATTach(path, "Versandschein.pdf")) + End If + + + End If + + End Select + + End If + + Next + + For Each r As DataRow In SR_DT.Rows Dim RG_ANH = VERAG_PROG_ALLGEMEIN.cRechnungsausgang.LOAD_ANHAENGE_LIST(r("RK_ID")) If RG_ANH IsNot Nothing Then @@ -634,7 +867,7 @@ Public Class cAutomailversand Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(ANH.dsId) 'hier die LOGIK, was alles zusammengefasst werden soll! - pdfAnhang_merge = PDFS_zusammenfassen(path, FilialenNr, FIRMA_ID, True) + pdfAnhang_merge = mergeSinglePDFDocuments(path, FilialenNr, FIRMA_ID, True) If pdfAnhang_merge Then If path <> "" Then @@ -653,17 +886,27 @@ Public Class cAutomailversand Next - If zsmf_SR.Any() Then - If FormularManagerNEU.MergePdfFiles(zsmf_SR, zielPfadZusammenfassung) Then - Dim fileInfo As New FileInfo(zielPfadZusammenfassung) - ATTACHMENTS.Add(New cFakt_MailATTach(zielPfadZusammenfassung, fileInfo.Name)) - End If - End If + End If Next + If zsmf_SR.Any() Then + If zsmf_SR.Count = 1 Then + + Dim fileInfo As New FileInfo(zsmf_SR(0)) + ATTACHMENTS.Add(New cFakt_MailATTach(zsmf_SR(0), fileInfo.Name)) + + Else + + If FormularManagerNEU.MergePdfFiles(zsmf_SR, zielPfadZusammenfassung) Then + Dim fileInfo As New FileInfo(zielPfadZusammenfassung) + ATTACHMENTS.Add(New cFakt_MailATTach(zielPfadZusammenfassung, fileInfo.Name)) + End If + End If + + End If 'nicht bei SR! @@ -695,10 +938,17 @@ Public Class cAutomailversand End Sub - Private Function PDFS_zusammenfassen(path As String, Filiale As Integer, Firma As Integer, isSR As Boolean) + Private Function mergeSinglePDFDocuments(path As String, Filiale As Integer, Firma As Integer, isSR As Boolean) Dim zusammenfassen As Boolean = False + 'True + ' → mergeList + ' → später zu einer PDF zusammenführen + + 'False + ' → sofort als separates Mail-Attachment + Select Case Firma Case 19 If Filiale = 4817 Then @@ -715,9 +965,8 @@ Public Class cAutomailversand If Not isSR Then Return True Else - - 'mit Marlene sprechen! - If Not (path.ToString.ToLower.Contains("flyercbam") OrElse Not (path.ToString.ToLower.Contains("sammelrechnung"))) Then + 'laut Marlene nichts zusammenfassen (außer CBAM)! Mail am 19.06.2026 + If Not (path.ToString.ToLower.Contains("flyercbam")) Then Return True End If End If @@ -756,6 +1005,95 @@ Public Class cAutomailversand End Function + Private Sub AddToMergeList(list As List(Of String), path As String) + + If String.IsNullOrWhiteSpace(path) Then Return + + If Not list.Any(Function(p) System.IO.Path.GetFileName(p).Equals(System.IO.Path.GetFileName(path), StringComparison.OrdinalIgnoreCase)) Then + + list.Add(path) + + End If + + End Sub + + Private Sub AddAttachmentIfNotExists(attachments As List(Of cFakt_MailATTach), path As String, bezeichnung As String) + + If String.IsNullOrWhiteSpace(path) Then Return + + Dim fileName = System.IO.Path.GetFileName(path) + + If Not attachments.Any(Function(a) System.IO.Path.GetFileName(a.Pfad).Equals(fileName, StringComparison.OrdinalIgnoreCase)) Then + + attachments.Add(New cFakt_MailATTach(path, bezeichnung)) + + End If + + End Sub + + Private Sub HandlePdf(docId As Object, displayName As String, filiale As Integer, firma As Integer, isSR As Boolean, mergeList As List(Of String), attachments As List(Of cFakt_MailATTach)) + + If docId Is Nothing Then Return + + Dim path = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(docId) + + If mergeSinglePDFDocuments(path, filiale, firma, isSR) Then + AddToMergeList(mergeList, path) + Else + AddAttachmentIfNotExists(attachments, path, displayName) + End If + + End Sub + + Private Sub LoadZollAttachments(spedbuch As cSpeditionsbuch, filiale As Integer, firma As Integer, isSR As Boolean, mergeList As List(Of String), attachments As List(Of cFakt_MailATTach), Optional FiskalMail As Boolean = False) + + If spedbuch Is Nothing Then Return + + Dim isAT = spedbuch.DokumentId_Mitteilung IsNot Nothing + + If FiskalMail Then + attachments.Clear() 'liste leeren + End If + + If isAT Then + HandlePdf(spedbuch.DokumentId_Steuerbeleg, "Verzollungsnachweis.pdf", filiale, firma, isSR, mergeList, attachments) + + HandlePdf(spedbuch.DokumentId_Mitteilung, "Versandschein.pdf", filiale, firma, isSR, mergeList, attachments) + + Else + + HandlePdf(spedbuch.DokumentId_Steuerbeleg, "Steuerbescheid.pdf", filiale, firma, isSR, mergeList, attachments) + + If Not FiskalMail Then 'bei FIskal-Mail nicht mitschicken + HandlePdf(spedbuch.DokumentId_VBD, "Abgabenbescheid.pdf", filiale, firma, isSR, mergeList, attachments) + End If + + + End If + + End Sub + + Private Sub AddMergedPdf(mergeList As List(Of String), zielPfad As String, attachments As List(Of cFakt_MailATTach)) + + If Not mergeList.Any Then Return + + If mergeList.Count = 1 Then + + Dim fi As New FileInfo(mergeList(0)) + attachments.Add(New cFakt_MailATTach(mergeList(0), fi.Name)) + + Return + End If + + If FormularManagerNEU.MergePdfFiles(mergeList, zielPfad) Then + + Dim fi As New FileInfo(zielPfad) + attachments.Add(New cFakt_MailATTach(zielPfad, fi.Name)) + + End If + + End Sub + Private Function setLog(SR_DT As DataTable, row As DataRow, FirmaID As Integer, Sammelrechnungsart As Integer, Rechnungsdatum As Date, Optional ATTACHMENTS As List(Of cFakt_MailATTach) = Nothing, Optional Mailsubject As String = "", Optional Mailhtml As String = "", Optional MailTo As String = "", Optional MailtoCC As String = "", Optional MailtoBCC As String = "", Optional Mail As Microsoft.Office.Interop.Outlook.MailItem = Nothing, Optional RECHNUNG As cRechnungsausgang = Nothing, Optional FISKAL As cFiskal_Daten = Nothing, Optional SPEDBUCH As cSpeditionsbuch = Nothing) As Boolean @@ -1115,11 +1453,11 @@ Public Class cAutomailversand End If Dim AD As New cAdressen(kundenNr) - Dim KD As New cKunde(kundenNr) - Dim Sprache As String = "EN" - Dim attachList As New List(Of String) + Dim KD As New cKunde(kundenNr) + Dim Sprache As String = "EN" + Dim attachList As New List(Of String) - Subject = "Meldung innergemeinschaftlicher Erwerb - " & AD.Ordnungsbegriff + Subject = "Meldung innergemeinschaftlicher Erwerb - " & AD.Ordnungsbegriff Select Case RechnungsLandKz Case "A", "AT", "D", "DE", "CH" : Sprache = "DE" @@ -1172,54 +1510,62 @@ Public Class cAutomailversand - If showMail Then + If showMail Then - Dim outl As New Outlook.Application - Dim Mail_StbFA As Microsoft.Office.Interop.Outlook.MailItem - Mail_StbFA = outl.CreateItem(0) - Mail_StbFA.Subject = Subject + Dim outl As New Outlook.Application + Dim Mail_StbFA As Microsoft.Office.Interop.Outlook.MailItem + Mail_StbFA = outl.CreateItem(0) + Mail_StbFA.Subject = Subject - If FirmaID = 24 Then Mail_StbFA.SentOnBehalfOfName = SDL.cFakturierung.getDefaultMail("AMBAR",, True) + If FirmaID = 24 Then Mail_StbFA.SentOnBehalfOfName = SDL.cFakturierung.getDefaultMail("AMBAR",, True) - TextHTML &= cFakturierung.getSignature(AD.LandKz, FirmaID,,,, "") - TextHTML &= "" + TextHTML &= cFakturierung.getSignature(AD.LandKz, FirmaID,,,, "") + TextHTML &= "" - Mail_StbFA.HTMLBody = TextHTML + Mail_StbFA.HTMLBody = TextHTML - Mail_StbFA.To = MailTo - Mail_StbFA.CC = MailCC + Mail_StbFA.To = MailTo + Mail_StbFA.CC = MailCC - ''----------------------------------------------------------------- - ''Steuerbescheid anfügen - ''----------------------------------------------------------------- - 'getAnhaenge(False) + ''----------------------------------------------------------------- + ''Steuerbescheid anfügen + ''----------------------------------------------------------------- + 'getAnhaenge(False) - ''Anhang an Mail anfügen - ''----------------------------------------------------------------- - 'addAttachments(Mail_StbFA, RechnungsNr, cbxMergePDF.Checked) - ''----------------------------------------------------------------- + ''Anhang an Mail anfügen + ''----------------------------------------------------------------- + 'addAttachments(Mail_StbFA, RechnungsNr, cbxMergePDF.Checked) + ''----------------------------------------------------------------- + + LoadZollAttachments(SPEDBUCH, SPEDBUCH.FilialenNr, FirmaID, False, attachList, Nothing, True) + + For Each att In attachList + Mail_StbFA.Attachments.Add(att, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue) + Next + + Mail_StbFA.Display() + + Else + + LoadZollAttachments(SPEDBUCH, SPEDBUCH.FilialenNr, FirmaID, False, attachList, Nothing, True) + + Dim accountToSend = setAccountToSend(FirmaID) + VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(MailTo, Subject, TextHTML, accountToSend, False, False, MailCC, accountToSend, attachList,, IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "d.breimaier@verag.ag", accountToSend)) + + ''----------------------------------------------------------------- + ''Steuerbescheid anfügen + ''----------------------------------------------------------------- + 'getAnhaenge(False) + + ''Anhang an Mail anfügen + ''----------------------------------------------------------------- + 'addAttachments(Mail_StbFA, RechnungsNr, cbxMergePDF.Checked) + ''----------------------------------------------------------------- - Mail_StbFA.Display() - - Else - Dim accountToSend = setAccountToSend(FirmaID) - VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(MailTo, Subject, TextHTML, accountToSend, False, False, MailCC, accountToSend, attachList,, IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "d.breimaier@verag.ag", accountToSend)) - - ''----------------------------------------------------------------- - ''Steuerbescheid anfügen - ''----------------------------------------------------------------- - 'getAnhaenge(False) - - ''Anhang an Mail anfügen - ''----------------------------------------------------------------- - 'addAttachments(Mail_StbFA, RechnungsNr, cbxMergePDF.Checked) - ''----------------------------------------------------------------- - - - End If + End If diff --git a/SDL/Fakturierung/cFakturierung.vb b/SDL/Fakturierung/cFakturierung.vb index 96e3fc82..d8db3648 100644 --- a/SDL/Fakturierung/cFakturierung.vb +++ b/SDL/Fakturierung/cFakturierung.vb @@ -1873,6 +1873,7 @@ Public Class cFakturierung If PrinterName <> "" Then rpt.Document.Printer.PrinterName = PrinterName End If + rpt.Document.Printer.PaperSize = rpt.Document.Printer.PrinterSettings.DefaultPageSettings.PaperSize 'Immer Exportieren, da in Therefore speichern diff --git a/SDL/Fakturierung/frmAbrechnungsMaske.vb b/SDL/Fakturierung/frmAbrechnungsMaske.vb index 5d09ace0..e439ad09 100644 --- a/SDL/Fakturierung/frmAbrechnungsMaske.vb +++ b/SDL/Fakturierung/frmAbrechnungsMaske.vb @@ -999,7 +999,14 @@ Public Class frmAbrechnungsMaske Select Case cboSort._value Case "EZ" - selectedRows = selectedRows.OrderBy(Function(r) CDate(r.Cells("ReErfZeitstempel").Value)) + selectedRows = selectedRows.OrderBy( + Function(r) + Dim value = r.Cells("ReErfZeitstempel").Value + Return If(value Is Nothing OrElse IsDBNull(value), + DateTime.MinValue, + Convert.ToDateTime(value)) + End Function + ) Case Else selectedRows = selectedRows _ diff --git a/SDL/Fakturierung/frmFaktEmail.vb b/SDL/Fakturierung/frmFaktEmail.vb index 4acc7e90..8d49e16b 100644 --- a/SDL/Fakturierung/frmFaktEmail.vb +++ b/SDL/Fakturierung/frmFaktEmail.vb @@ -535,7 +535,7 @@ Public Class frmFaktEmail Mail = outl.CreateItem(0) Mail.Subject = txtSubject.Text - If Firma_ID = 24 OrElse Firma_ID = 19 OrElse Firma_ID = 1 OrElse Firma_ID = 7 Then + If Firma_ID = 24 OrElse Firma_ID = 19 OrElse Firma_ID = 1 OrElse Firma_ID = 7 OrElse Firma_ID = 26 OrElse Firma_ID = 20 Then Try Dim oAccount As Outlook.Account Dim accountToSent = "" @@ -547,6 +547,8 @@ Public Class frmFaktEmail accountToSent = "mmdabrechnung@verag.ag" 'bewusst falsch geschrieben!!!! Case 7 accountToSent = "rechnung@atilla-spedition.com" + Case 20 + accountToSent = "finanz@imex-group.at" Case 26 accountToSent = "Invoice@verag-unisped.uk" Case Else @@ -554,25 +556,25 @@ Public Class frmFaktEmail End Select If accountToSent <> "" Then - If outl.Session.Accounts.Count > 0 Then - For Each oAccount In outl.Session.Accounts - If oAccount.SmtpAddress.ToLower = accountToSent.ToLower Then - Mail.SendUsingAccount = oAccount - Exit For - End If - Next + If outl.Session.Accounts.Count > 0 Then + For Each oAccount In outl.Session.Accounts + If oAccount.SmtpAddress.ToLower = accountToSent.ToLower Then + Mail.SendUsingAccount = oAccount + Exit For End If - End If - - Catch ex As Exception - VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("Fehler beim Ermitteln des Mail-Accounts." & ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) - End Try - + Next + End If End If - 'Mail-Adressen eintragen - '----------------------------------------------------------------- - For Each r In dgvEmail.Rows + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("Fehler beim Ermitteln des Mail-Accounts." & ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + End If + + 'Mail-Adressen eintragen + '----------------------------------------------------------------- + For Each r In dgvEmail.Rows If r.cells(0).value <> "" Then Mail.To &= r.cells(0).value & ";" Next For Each r In dgvEmailCC.Rows @@ -677,7 +679,7 @@ Public Class frmFaktEmail Dim Mail As Microsoft.Office.Interop.Outlook.MailItem Mail = outl.CreateItem(0) - If Firma_ID = 24 OrElse Firma_ID = 19 OrElse Firma_ID = 1 OrElse Firma_ID = 7 Then + If Firma_ID = 24 OrElse Firma_ID = 19 OrElse Firma_ID = 1 OrElse Firma_ID = 7 OrElse Firma_ID = 26 OrElse Firma_ID = 20 Then Try Dim oAccount As Outlook.Account Dim accountToSent = "" @@ -691,6 +693,8 @@ Public Class frmFaktEmail accountToSent = "rechnung@atilla-spedition.com" Case 26 accountToSent = "Invoice@verag-unisped.uk" + Case 20 + accountToSent = "finanz@imex-group.at" Case Else accountToSent = "rechnungsversand@verag.ag" diff --git a/SDL/Fakturierung/frmFaktSammelRgDrucken.Designer.vb b/SDL/Fakturierung/frmFaktSammelRgDrucken.Designer.vb index 6017197e..c0245d52 100644 --- a/SDL/Fakturierung/frmFaktSammelRgDrucken.Designer.vb +++ b/SDL/Fakturierung/frmFaktSammelRgDrucken.Designer.vb @@ -462,6 +462,7 @@ Partial Class frmFaktSammelRgDrucken 'Button6 ' Me.Button6.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Button6.Enabled = False Me.Button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button6.Image = Global.SDL.My.Resources.Resources.rechnung1 Me.Button6.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft diff --git a/SDL/Fakturierung/frmFaktSammelRgDrucken.vb b/SDL/Fakturierung/frmFaktSammelRgDrucken.vb index a4daa1e8..efb47e24 100644 --- a/SDL/Fakturierung/frmFaktSammelRgDrucken.vb +++ b/SDL/Fakturierung/frmFaktSammelRgDrucken.vb @@ -140,7 +140,7 @@ Public Class frmFaktSammelRgDrucken Dim SQLAUTOMAIL_RECHNUNGSDATuM = "" If cbxAUTOMail.Checked Then - SQLAUTOMAIL_RECHNUNGSDATuM = "AND Rechnungsausgang.Status IN (2) AND CONVERT(DATE, Rechnungsausgang.Rechnungsdatum, 104) = '" & txtRechnungsdatum._value & "'" + SQLAUTOMAIL_RECHNUNGSDATuM = "AND Rechnungsausgang.Status IN (2) AND CONVERT(DATE, Rechnungsausgang.Rechnungsdatum, 104) = '" & txtRechnungsdatum._value & "' AND CONVERT(DATE, Rechnungsausgang.Abfertigungsdatum, 104) <= '" & txtZeitraumBis._value & "'" Else SQLAUTOMAIL_RECHNUNGSDATuM = " AND Rechnungsausgang.Status IN (0,2) AND CONVERT(DATE, Rechnungsausgang.Abfertigungsdatum, 104) <= '" & txtZeitraumBis._value & "'" End If @@ -979,7 +979,7 @@ Public Class frmFaktSammelRgDrucken For Each r In MyDatagridview1.SelectedRows Dim fun As New cAutomailversand - fun.sendMailSammelrechnung(CDate(txtRechnungsdatum.Text), Sammelrechung, Firma, r.Cells("RechnungsKundenNr").Value, cbxMailoeffnen.Checked) + fun.sendMailSammelrechnung(CDate(txtRechnungsdatum.Text), Sammelrechung, Firma, r.Cells("RechnungsKundenNr").Value, cbxMailoeffnen.Checked,, CDate(txtZeitraumBis.Text)) Next initDGV() diff --git a/SDL/Fakturierung/usrCntlFaktAbrechnung.Designer.vb b/SDL/Fakturierung/usrCntlFaktAbrechnung.Designer.vb index fcc48cfd..0c3c7a8e 100644 --- a/SDL/Fakturierung/usrCntlFaktAbrechnung.Designer.vb +++ b/SDL/Fakturierung/usrCntlFaktAbrechnung.Designer.vb @@ -23,27 +23,27 @@ Partial Class usrCntlFaktAbrechnung Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Dim DataGridViewCellStyle22 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle25 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle26 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle23 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle24 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle27 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle32 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle33 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle28 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle29 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle30 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle31 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle34 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle35 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle36 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle37 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle38 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle39 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle40 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle41 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle42 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle5 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle6 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle11 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle12 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle7 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle8 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle9 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle10 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle13 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle14 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle15 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle16 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle17 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle18 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle19 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle20 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle21 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(usrCntlFaktAbrechnung)) Me.Label9 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() @@ -82,6 +82,7 @@ Partial Class usrCntlFaktAbrechnung Me.lblRechnungsDatum = New System.Windows.Forms.Label() Me.lblRechnungsNummer = New System.Windows.Forms.Label() Me.Panel1 = New System.Windows.Forms.Panel() + Me.cbxAUTOMailversand = New System.Windows.Forms.CheckBox() Me.Button17 = New System.Windows.Forms.Button() Me.ContextMenuStrip3 = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.AbsenderToolStripMenuItem2 = New System.Windows.Forms.ToolStripMenuItem() @@ -245,7 +246,6 @@ Partial Class usrCntlFaktAbrechnung Me.lblEUR_4 = New System.Windows.Forms.Label() Me.Label55 = New System.Windows.Forms.Label() Me.cboSteuerschlüssel = New VERAG_PROG_ALLGEMEIN.MyComboBox() - Me.rtbAbf_Besonderheiten = New SDL.usrCntlKundenBesonderheiten() Me.cbxOriginalPrint = New System.Windows.Forms.CheckBox() Me.Label46 = New System.Windows.Forms.Label() Me.Button9 = New System.Windows.Forms.Button() @@ -288,7 +288,8 @@ Partial Class usrCntlFaktAbrechnung Me.GutschriftAnVeragToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.VeragAGToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.VeragCSToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.cbxAUTOMailversand = New System.Windows.Forms.CheckBox() + Me.Button18 = New System.Windows.Forms.Button() + Me.rtbAbf_Besonderheiten = New SDL.usrCntlKundenBesonderheiten() Me.pnlTop.SuspendLayout() Me.Panel3.SuspendLayout() Me.Panel1.SuspendLayout() @@ -861,6 +862,17 @@ Partial Class usrCntlFaktAbrechnung Me.Panel1.Size = New System.Drawing.Size(830, 1142) Me.Panel1.TabIndex = 1 ' + 'cbxAUTOMailversand + ' + Me.cbxAUTOMailversand.AutoSize = True + Me.cbxAUTOMailversand.Location = New System.Drawing.Point(697, 142) + Me.cbxAUTOMailversand.Name = "cbxAUTOMailversand" + Me.cbxAUTOMailversand.Size = New System.Drawing.Size(116, 17) + Me.cbxAUTOMailversand.TabIndex = 241 + Me.cbxAUTOMailversand.Text = "AUTO Mailversand" + Me.cbxAUTOMailversand.UseVisualStyleBackColor = True + Me.cbxAUTOMailversand.Visible = False + ' 'Button17 ' Me.Button17.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None @@ -926,36 +938,36 @@ Partial Class usrCntlFaktAbrechnung Me.dgvAnhaenge.AllowUserToResizeColumns = False Me.dgvAnhaenge.AllowUserToResizeRows = False Me.dgvAnhaenge.BackgroundColor = System.Drawing.Color.White - DataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle22.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle22.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle22.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle22.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle22.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle22.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.dgvAnhaenge.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle22 + DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dgvAnhaenge.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1 Me.dgvAnhaenge.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvAnhaenge.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.optAnhSel, Me.DataGridViewTextBoxColumn2, Me.clmnBezeichnung, Me.clmnDsId, Me.clmnAnhId}) - DataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle25.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle25.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle25.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle25.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle25.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle25.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.dgvAnhaenge.DefaultCellStyle = DataGridViewCellStyle25 + DataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.dgvAnhaenge.DefaultCellStyle = DataGridViewCellStyle4 Me.dgvAnhaenge.Location = New System.Drawing.Point(493, 911) Me.dgvAnhaenge.MultiSelect = False Me.dgvAnhaenge.Name = "dgvAnhaenge" Me.dgvAnhaenge.ReadOnly = True - DataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle26.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle26.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle26.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle26.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle26.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.dgvAnhaenge.RowHeadersDefaultCellStyle = DataGridViewCellStyle26 + DataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dgvAnhaenge.RowHeadersDefaultCellStyle = DataGridViewCellStyle5 Me.dgvAnhaenge.RowHeadersVisible = False Me.dgvAnhaenge.RowHeadersWidth = 62 Me.dgvAnhaenge.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect @@ -977,10 +989,10 @@ Partial Class usrCntlFaktAbrechnung ' 'DataGridViewTextBoxColumn2 ' - DataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight - DataGridViewCellStyle23.Format = "N0" - DataGridViewCellStyle23.NullValue = Nothing - Me.DataGridViewTextBoxColumn2.DefaultCellStyle = DataGridViewCellStyle23 + DataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight + DataGridViewCellStyle2.Format = "N0" + DataGridViewCellStyle2.NullValue = Nothing + Me.DataGridViewTextBoxColumn2.DefaultCellStyle = DataGridViewCellStyle2 Me.DataGridViewTextBoxColumn2.HeaderText = "Art" Me.DataGridViewTextBoxColumn2.MinimumWidth = 8 Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2" @@ -990,9 +1002,9 @@ Partial Class usrCntlFaktAbrechnung 'clmnBezeichnung ' Me.clmnBezeichnung.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill - DataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle24.Format = "c2" - Me.clmnBezeichnung.DefaultCellStyle = DataGridViewCellStyle24 + DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle3.Format = "c2" + Me.clmnBezeichnung.DefaultCellStyle = DataGridViewCellStyle3 Me.clmnBezeichnung.FillWeight = 121.2598! Me.clmnBezeichnung.HeaderText = "Bezeichnung" Me.clmnBezeichnung.MinimumWidth = 8 @@ -2024,6 +2036,7 @@ Partial Class usrCntlFaktAbrechnung ' Me.pnlRechnungAn.BackColor = System.Drawing.Color.PapayaWhip Me.pnlRechnungAn.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.pnlRechnungAn.Controls.Add(Me.Button18) Me.pnlRechnungAn.Controls.Add(Me.cboRgArt) Me.pnlRechnungAn.Controls.Add(Me.Label57) Me.pnlRechnungAn.Controls.Add(Me.cboVorauskasse) @@ -2131,9 +2144,9 @@ Partial Class usrCntlFaktAbrechnung ' Me.Button15.Enabled = False Me.Button15.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.Button15.Location = New System.Drawing.Point(518, 85) + Me.Button15.Location = New System.Drawing.Point(494, 85) Me.Button15.Name = "Button15" - Me.Button15.Size = New System.Drawing.Size(57, 23) + Me.Button15.Size = New System.Drawing.Size(45, 23) Me.Button15.TabIndex = 241 Me.Button15.Text = "Post" Me.Button15.UseVisualStyleBackColor = True @@ -2227,9 +2240,9 @@ Partial Class usrCntlFaktAbrechnung ' Me.Button6.Enabled = False Me.Button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.Button6.Location = New System.Drawing.Point(434, 85) + Me.Button6.Location = New System.Drawing.Point(421, 85) Me.Button6.Name = "Button6" - Me.Button6.Size = New System.Drawing.Size(85, 23) + Me.Button6.Size = New System.Drawing.Size(72, 23) Me.Button6.TabIndex = 15 Me.Button6.Text = "UID prüfen" Me.Button6.UseVisualStyleBackColor = True @@ -2997,35 +3010,35 @@ Partial Class usrCntlFaktAbrechnung Me.dgvRechnungenPositionen.AllowUserToResizeColumns = False Me.dgvRechnungenPositionen.AllowUserToResizeRows = False Me.dgvRechnungenPositionen.BackgroundColor = System.Drawing.Color.White - DataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle27.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle27.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle27.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle27.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle27.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle27.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.dgvRechnungenPositionen.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle27 + DataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle6.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dgvRechnungenPositionen.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle6 Me.dgvRechnungenPositionen.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvRechnungenPositionen.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.Leistung, Me.Anzahl, Me.Preis, Me.SteuerpflichtigerBetrag, Me.SteuerfreierBetrag, Me.Aufschubkonto}) - DataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle32.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle32.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle32.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle32.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle32.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.dgvRechnungenPositionen.DefaultCellStyle = DataGridViewCellStyle32 + DataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle11.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.dgvRechnungenPositionen.DefaultCellStyle = DataGridViewCellStyle11 Me.dgvRechnungenPositionen.Location = New System.Drawing.Point(10, 258) Me.dgvRechnungenPositionen.Name = "dgvRechnungenPositionen" Me.dgvRechnungenPositionen.ReadOnly = True - DataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle33.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle33.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle33.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle33.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle33.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle33.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.dgvRechnungenPositionen.RowHeadersDefaultCellStyle = DataGridViewCellStyle33 + DataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle12.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dgvRechnungenPositionen.RowHeadersDefaultCellStyle = DataGridViewCellStyle12 Me.dgvRechnungenPositionen.RowHeadersVisible = False Me.dgvRechnungenPositionen.RowHeadersWidth = 62 Me.dgvRechnungenPositionen.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect @@ -3043,10 +3056,10 @@ Partial Class usrCntlFaktAbrechnung ' 'Anzahl ' - DataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight - DataGridViewCellStyle28.Format = "N0" - DataGridViewCellStyle28.NullValue = Nothing - Me.Anzahl.DefaultCellStyle = DataGridViewCellStyle28 + DataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight + DataGridViewCellStyle7.Format = "N0" + DataGridViewCellStyle7.NullValue = Nothing + Me.Anzahl.DefaultCellStyle = DataGridViewCellStyle7 Me.Anzahl.HeaderText = "Anzahl" Me.Anzahl.MinimumWidth = 8 Me.Anzahl.Name = "Anzahl" @@ -3055,9 +3068,9 @@ Partial Class usrCntlFaktAbrechnung ' 'Preis ' - DataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight - DataGridViewCellStyle29.Format = "c2" - Me.Preis.DefaultCellStyle = DataGridViewCellStyle29 + DataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight + DataGridViewCellStyle8.Format = "c2" + Me.Preis.DefaultCellStyle = DataGridViewCellStyle8 Me.Preis.HeaderText = "Preis" Me.Preis.MinimumWidth = 8 Me.Preis.Name = "Preis" @@ -3066,9 +3079,9 @@ Partial Class usrCntlFaktAbrechnung ' 'SteuerpflichtigerBetrag ' - DataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight - DataGridViewCellStyle30.Format = "c2" - Me.SteuerpflichtigerBetrag.DefaultCellStyle = DataGridViewCellStyle30 + DataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight + DataGridViewCellStyle9.Format = "c2" + Me.SteuerpflichtigerBetrag.DefaultCellStyle = DataGridViewCellStyle9 Me.SteuerpflichtigerBetrag.HeaderText = "Steuerpfl." Me.SteuerpflichtigerBetrag.MinimumWidth = 8 Me.SteuerpflichtigerBetrag.Name = "SteuerpflichtigerBetrag" @@ -3077,10 +3090,10 @@ Partial Class usrCntlFaktAbrechnung ' 'SteuerfreierBetrag ' - DataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight - DataGridViewCellStyle31.Format = "C2" - DataGridViewCellStyle31.NullValue = Nothing - Me.SteuerfreierBetrag.DefaultCellStyle = DataGridViewCellStyle31 + DataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight + DataGridViewCellStyle10.Format = "C2" + DataGridViewCellStyle10.NullValue = Nothing + Me.SteuerfreierBetrag.DefaultCellStyle = DataGridViewCellStyle10 Me.SteuerfreierBetrag.HeaderText = "Steuerfrei" Me.SteuerfreierBetrag.MinimumWidth = 8 Me.SteuerfreierBetrag.Name = "SteuerfreierBetrag" @@ -3103,41 +3116,41 @@ Partial Class usrCntlFaktAbrechnung Me.dgvOffertenSperrliste.AllowUserToResizeRows = False Me.dgvOffertenSperrliste.BackgroundColor = System.Drawing.Color.White Me.dgvOffertenSperrliste.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D - DataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle34.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle34.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle34.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle34.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle34.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle34.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.dgvOffertenSperrliste.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle34 + DataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle13.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dgvOffertenSperrliste.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle13 Me.dgvOffertenSperrliste.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - DataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle35.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle35.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle35.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle35.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle35.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle35.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.dgvOffertenSperrliste.DefaultCellStyle = DataGridViewCellStyle35 + DataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle14.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.dgvOffertenSperrliste.DefaultCellStyle = DataGridViewCellStyle14 Me.dgvOffertenSperrliste.Location = New System.Drawing.Point(11, 29) Me.dgvOffertenSperrliste.MultiSelect = False Me.dgvOffertenSperrliste.Name = "dgvOffertenSperrliste" Me.dgvOffertenSperrliste.ReadOnly = True - DataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle36.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle36.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle36.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle36.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle36.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle36.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.dgvOffertenSperrliste.RowHeadersDefaultCellStyle = DataGridViewCellStyle36 + DataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle15.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dgvOffertenSperrliste.RowHeadersDefaultCellStyle = DataGridViewCellStyle15 Me.dgvOffertenSperrliste.RowHeadersVisible = False Me.dgvOffertenSperrliste.RowHeadersWidth = 62 - DataGridViewCellStyle37.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle37.SelectionBackColor = System.Drawing.Color.PapayaWhip - DataGridViewCellStyle37.SelectionForeColor = System.Drawing.Color.Black - Me.dgvOffertenSperrliste.RowsDefaultCellStyle = DataGridViewCellStyle37 + DataGridViewCellStyle16.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.PapayaWhip + DataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.Black + Me.dgvOffertenSperrliste.RowsDefaultCellStyle = DataGridViewCellStyle16 Me.dgvOffertenSperrliste.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect Me.dgvOffertenSperrliste.Size = New System.Drawing.Size(204, 201) Me.dgvOffertenSperrliste.TabIndex = 2 @@ -3150,44 +3163,44 @@ Partial Class usrCntlFaktAbrechnung Me.dgvOfferteDetailsUebersicht.AllowUserToDeleteRows = False Me.dgvOfferteDetailsUebersicht.AllowUserToOrderColumns = True Me.dgvOfferteDetailsUebersicht.AllowUserToResizeRows = False - DataGridViewCellStyle38.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvOfferteDetailsUebersicht.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle38 + DataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvOfferteDetailsUebersicht.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle17 Me.dgvOfferteDetailsUebersicht.BackgroundColor = System.Drawing.Color.White Me.dgvOfferteDetailsUebersicht.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D - DataGridViewCellStyle39.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle39.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle39.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle39.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle39.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle39.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle39.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.dgvOfferteDetailsUebersicht.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle39 + DataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle18.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dgvOfferteDetailsUebersicht.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle18 Me.dgvOfferteDetailsUebersicht.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - DataGridViewCellStyle40.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle40.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle40.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle40.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle40.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle40.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle40.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.dgvOfferteDetailsUebersicht.DefaultCellStyle = DataGridViewCellStyle40 + DataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle19.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle19.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle19.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.dgvOfferteDetailsUebersicht.DefaultCellStyle = DataGridViewCellStyle19 Me.dgvOfferteDetailsUebersicht.Location = New System.Drawing.Point(220, 29) Me.dgvOfferteDetailsUebersicht.MultiSelect = False Me.dgvOfferteDetailsUebersicht.Name = "dgvOfferteDetailsUebersicht" - DataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle41.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle41.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle41.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle41.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle41.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle41.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.dgvOfferteDetailsUebersicht.RowHeadersDefaultCellStyle = DataGridViewCellStyle41 + DataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle20.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle20.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle20.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle20.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle20.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dgvOfferteDetailsUebersicht.RowHeadersDefaultCellStyle = DataGridViewCellStyle20 Me.dgvOfferteDetailsUebersicht.RowHeadersVisible = False Me.dgvOfferteDetailsUebersicht.RowHeadersWidth = 62 - DataGridViewCellStyle42.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle42.SelectionBackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer)) - DataGridViewCellStyle42.SelectionForeColor = System.Drawing.Color.Black - Me.dgvOfferteDetailsUebersicht.RowsDefaultCellStyle = DataGridViewCellStyle42 + DataGridViewCellStyle21.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle21.SelectionBackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer)) + DataGridViewCellStyle21.SelectionForeColor = System.Drawing.Color.Black + Me.dgvOfferteDetailsUebersicht.RowsDefaultCellStyle = DataGridViewCellStyle21 Me.dgvOfferteDetailsUebersicht.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect Me.dgvOfferteDetailsUebersicht.Size = New System.Drawing.Size(601, 201) Me.dgvOfferteDetailsUebersicht.TabIndex = 3 @@ -3574,17 +3587,6 @@ Partial Class usrCntlFaktAbrechnung Me.cboSteuerschlüssel.Size = New System.Drawing.Size(145, 21) Me.cboSteuerschlüssel.TabIndex = 3 ' - 'rtbAbf_Besonderheiten - ' - Me.rtbAbf_Besonderheiten.BackColor = System.Drawing.Color.White - Me.rtbAbf_Besonderheiten.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.rtbAbf_Besonderheiten.Location = New System.Drawing.Point(10, 19) - Me.rtbAbf_Besonderheiten.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.rtbAbf_Besonderheiten.Name = "rtbAbf_Besonderheiten" - Me.rtbAbf_Besonderheiten.Size = New System.Drawing.Size(107, 133) - Me.rtbAbf_Besonderheiten.TabIndex = 235 - Me.rtbAbf_Besonderheiten.Visible = False - ' 'cbxOriginalPrint ' Me.cbxOriginalPrint.AutoSize = True @@ -4059,16 +4061,26 @@ Partial Class usrCntlFaktAbrechnung Me.VeragCSToolStripMenuItem.Size = New System.Drawing.Size(122, 22) Me.VeragCSToolStripMenuItem.Text = "Verag CS" ' - 'cbxAUTOMailversand + 'Button18 ' - Me.cbxAUTOMailversand.AutoSize = True - Me.cbxAUTOMailversand.Location = New System.Drawing.Point(697, 142) - Me.cbxAUTOMailversand.Name = "cbxAUTOMailversand" - Me.cbxAUTOMailversand.Size = New System.Drawing.Size(116, 17) - Me.cbxAUTOMailversand.TabIndex = 241 - Me.cbxAUTOMailversand.Text = "AUTO Mailversand" - Me.cbxAUTOMailversand.UseVisualStyleBackColor = True - Me.cbxAUTOMailversand.Visible = False + Me.Button18.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button18.Location = New System.Drawing.Point(540, 85) + Me.Button18.Name = "Button18" + Me.Button18.Size = New System.Drawing.Size(32, 23) + Me.Button18.TabIndex = 247 + Me.Button18.Text = "AT" + Me.Button18.UseVisualStyleBackColor = True + ' + 'rtbAbf_Besonderheiten + ' + Me.rtbAbf_Besonderheiten.BackColor = System.Drawing.Color.White + Me.rtbAbf_Besonderheiten.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.rtbAbf_Besonderheiten.Location = New System.Drawing.Point(10, 19) + Me.rtbAbf_Besonderheiten.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.rtbAbf_Besonderheiten.Name = "rtbAbf_Besonderheiten" + Me.rtbAbf_Besonderheiten.Size = New System.Drawing.Size(107, 133) + Me.rtbAbf_Besonderheiten.TabIndex = 235 + Me.rtbAbf_Besonderheiten.Visible = False ' 'usrCntlFaktAbrechnung ' @@ -4365,4 +4377,5 @@ Partial Class usrCntlFaktAbrechnung Friend WithEvents cboRgArt As VERAG_PROG_ALLGEMEIN.MyComboBox Friend WithEvents Label57 As Label Friend WithEvents cbxAUTOMailversand As CheckBox + Friend WithEvents Button18 As Button End Class diff --git a/SDL/Fakturierung/usrCntlFaktAbrechnung.vb b/SDL/Fakturierung/usrCntlFaktAbrechnung.vb index 805345f5..dbf8427e 100644 --- a/SDL/Fakturierung/usrCntlFaktAbrechnung.vb +++ b/SDL/Fakturierung/usrCntlFaktAbrechnung.vb @@ -24,6 +24,7 @@ Public Class usrCntlFaktAbrechnung Dim nachstehende_RK_ID = 0 Dim veragKunde As Integer = -1 Public isVZ As Boolean = False + Dim FormularArt = "" ' Public VALUE_CHANGED = True ' Eigenschaft, ob das Formular gespeichert ist oder verändert wurde @@ -1624,7 +1625,7 @@ Public Class usrCntlFaktAbrechnung Catch ex As Exception : End Try 'End If - RECHNUNG.POSITIONEN.Add(POS) 'ALLE HINENLADEN! --> Sonst Proglem mit SVS/VP/KA + RECHNUNG.POSITIONEN.Add(POS) 'ALLE HINENLADEN! --> Sonst Problem mit SVS/VP/KA Next Catch ex As Exception @@ -1915,18 +1916,27 @@ Public Class usrCntlFaktAbrechnung For Each RG_AH In RECHNUNG.ANHAENGE For Each r As DataGridViewRow In .Rows If r.Cells("clmnDsId").Value = RG_AH.dsId Or r.Cells("clmnAnhId").Value = 0 Then 'anh_id = 0 --> Anhang ohne AVISO-Bezug - DirectCast(r.Cells("optAnhSel"), DataGridViewCheckBoxCell).Value = -1 + DirectCast(r.Cells("optAnhSel"), DataGridViewCheckBoxCell).Value = False End If - If r.Cells("clmnBezeichnung").Value.ToString.ToLower.Contains("handelsrechnung") AndAlso kdFirmaRechnungAn.KdData_KUNDE_ERW IsNot Nothing AndAlso kdFirmaRechnungAn.KdData_KUNDE_ERW.kde_autoselect_handelsrechnung Then 'anh_id = 0 --> Anhang ohne AVISO-Bezug - DirectCast(r.Cells("optAnhSel"), DataGridViewCheckBoxCell).Value = 1 + If r.Cells("clmnBezeichnung").Value.ToString.ToLower.Contains("handelsrechnung") AndAlso kdFirmaRechnungAn.KdData_KUNDE_ERW IsNot Nothing AndAlso kdFirmaRechnungAn.KdData_KUNDE_ERW.kde_autoselect_handelsrechnung Then + DirectCast(r.Cells("optAnhSel"), DataGridViewCheckBoxCell).Value = True End If Next Next '----------------------------- + If RECHNUNG.ANHAENGE.Count = 0 Then + For Each rowTemp In .Rows + If rowTemp.Cells("clmnBezeichnung").Value.ToString.ToLower.Contains("handelsrechnung") AndAlso kdFirmaRechnungAn.KdData_KUNDE_ERW IsNot Nothing AndAlso kdFirmaRechnungAn.KdData_KUNDE_ERW.kde_autoselect_handelsrechnung Then + DirectCast(rowTemp.Cells("optAnhSel"), DataGridViewCheckBoxCell).Value = True + End If + Next + End If End If + + 'Anhänge aus USTVA -> SPED-BUCH + Excel Pos-Liste If SPEDBUCH IsNot Nothing Then If FIRMA IsNot Nothing Then @@ -4599,12 +4609,33 @@ Nächste_Textzeile_lesen: Private Sub dbgAnhaenge_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvAnhaenge.CellClick 'dbgAnhaenge.CellContentClick, Try - ' DirectCast(r.Cells("optAnhSel"), DataGridViewCheckBoxCell).Value = 1 + + 'If dgvAnhaenge.Columns(e.ColumnIndex).Name = "optAnhSel" Then + ' Select Case dgvAnhaenge.Rows(e.RowIndex).Cells(e.ColumnIndex).Value + ' Case 1, -1 + ' dgvAnhaenge.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = Not DirectCast(dgvAnhaenge.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewCheckBoxCell).Value + ' Case Else + ' dgvAnhaenge.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = -1 + ' End Select + + 'End If + + If e.RowIndex < 0 OrElse e.ColumnIndex < 0 Then Exit Sub + If dgvAnhaenge.Columns(e.ColumnIndex).Name = "optAnhSel" Then - ' MsgBox(DirectCast(dgvAnhaenge.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewCheckBoxCell).Value) - dgvAnhaenge.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = Not DirectCast(dgvAnhaenge.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewCheckBoxCell).Value + + Dim cell = dgvAnhaenge.Rows(e.RowIndex).Cells(e.ColumnIndex) + + If CInt(If(cell.Value, 0)) = -1 Then + cell.Value = 0 + Else + cell.Value = -1 + End If + End If + dgvAnhaenge.ClearSelection() + Catch ex As Exception MsgBox(ex.Message & ex.StackTrace) End Try @@ -4660,6 +4691,14 @@ Nächste_Textzeile_lesen: End Sub Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click + + FormularArt = SDL.FormularManagerArten.Verzollungsunterlagen + ContextMenuStrip1.Show(Cursor.Position) + End Sub + + Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click + + FormularArt = SDL.FormularManagerArten.VerzollungsunterlagenBAR ContextMenuStrip1.Show(Cursor.Position) End Sub @@ -4692,22 +4731,38 @@ Nächste_Textzeile_lesen: FirmaFrm = (RECHNUNG.Avisierer) kdnrFrm = RECHNUNG.AvisiererKundenNr End Select + If SPEDBUCH IsNot Nothing Then Dim SENDUNG As New VERAG_PROG_ALLGEMEIN.cSendungen(SPEDBUCH.SendungID) Dim AVISODAL As New VERAG_PROG_ALLGEMEIN.cAvisoDAL Dim AVISO = AVISODAL.LesenAviso(SPEDBUCH.AvisoID, "") - SDL.FormularManagerNEU.OPEN_FORM(SDL.FormularManagerArten.Verzollungsunterlagen, kdnrFrm, {kdnrFrm, FirmaFrm, SENDUNG, AVISO, ROLLE, -1, True}) + + Select Case FormularArt + + Case SDL.FormularManagerArten.Verzollungsunterlagen + + SDL.FormularManagerNEU.OPEN_FORM(SDL.FormularManagerArten.Verzollungsunterlagen, kdnrFrm, {kdnrFrm, FirmaFrm, SENDUNG, AVISO, ROLLE, -1, True}) + + Case SDL.FormularManagerArten.VerzollungsunterlagenBAR + SDL.FormularManagerNEU.OPEN_FORM(SDL.FormularManagerArten.VerzollungsunterlagenBAR, kdnrFrm, {kdnrFrm, SPEDBUCH, AVISO, sender.text.ToString.Substring(0, 1)}) + + End Select Else MsgBox("Speditionsbuch Eintrag nicht gefunden.") End If + + + + + Catch ex As Exception VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) End Try End Sub Private Sub SeperateRechnungFürEUSTToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SeperateRechnungFürEUSTToolStripMenuItem.Click - If vbYes = MsgBox("Soll aus der Rechnung wirklich eine seperate EUST Rechnung erstellt werden?", vbYesNoCancel) Then + If vbYes = MsgBox("Soll aus der Rechnung wirklich eine separate EUST Rechnung erstellt werden?", vbYesNoCancel) Then saveMe() Dim RECHNUNG_TMP_RKID = RECHNUNG.RK_ID @@ -5655,5 +5710,4 @@ mwst: End Function - End Class \ No newline at end of file diff --git a/SDL/Formulare/KDFormulare/FormulareBaukasten/usrcntlVerzollungsunterlagen_BAR.vb b/SDL/Formulare/KDFormulare/FormulareBaukasten/usrcntlVerzollungsunterlagen_BAR.vb index a336336c..d53b998a 100644 --- a/SDL/Formulare/KDFormulare/FormulareBaukasten/usrcntlVerzollungsunterlagen_BAR.vb +++ b/SDL/Formulare/KDFormulare/FormulareBaukasten/usrcntlVerzollungsunterlagen_BAR.vb @@ -7,6 +7,11 @@ Public Event MOVE_UP(c As Control) Public Event MOVE_DOWN(c As Control) + + Public AVISO As VERAG_PROG_ALLGEMEIN.cAviso = Nothing + Public RechnungAn As String + + Public KdNR As Integer = -1 Public Sub ChangeKDNr(kdnr As Integer) _ Implements FormualrInterface.ChangeKDNr @@ -35,6 +40,25 @@ End Sub + Sub New() + + ' Dieser Aufruf ist für den Designer erforderlich. + InitializeComponent() + + End Sub + + Sub New(param() As Object) + + ' Dieser Aufruf ist für den Designer erforderlich. + InitializeComponent() + + If param.Length > 0 AndAlso param(0) IsNot Nothing Then KdNR = param(0) + If param.Length > 1 AndAlso param(1) IsNot Nothing Then SPEDBUCH = param(1) + If param.Length > 2 AndAlso param(2) IsNot Nothing Then AVISO = param(2) + If param.Length > 3 AndAlso param(3) IsNot Nothing Then RechnungAn = param(3) + + End Sub + @@ -104,6 +128,28 @@ End If End If + If AVISO IsNot Nothing Then + txtLKWContainer.Text = If(AVISO.LKW_Nr, "") + End If + + If SPEDBUCH IsNot Nothing Then + cboFiliale.changeItem(SPEDBUCH.FilialenNr) + txtAbfertigungsnummer.Text = SPEDBUCH.AbfertigungsNr + cboSpedBuchUnterNr.changeItem(SPEDBUCH.UnterNr) + End If + + + If RechnungAn <> "" Then + cboRechnungAn.changeItem(RechnungAn) + End If + + + If cboFiliale._value <> "" AndAlso txtAbfertigungsnummer.Text <> "" AndAlso cboSpedBuchUnterNr._value <> "" Then + Button1.PerformClick() + End If + + + loaded = True End Sub diff --git a/SDL/Formulare/KDFormulare/frmFormulare.vb b/SDL/Formulare/KDFormulare/frmFormulare.vb index 922cc118..573396c6 100644 --- a/SDL/Formulare/KDFormulare/frmFormulare.vb +++ b/SDL/Formulare/KDFormulare/frmFormulare.vb @@ -1,12 +1,13 @@ -Imports iTextSharp.text.pdf -Imports System.IO -Imports Microsoft.Office.Interop +Imports System.IO Imports System.Net -Imports GrapeCity.ActiveReports Imports System.Net.Mail Imports System.Reflection Imports System.Text.RegularExpressions Imports System.Windows.Documents +Imports com.sun.tools.internal.ws.wsdl.document.mime +Imports GrapeCity.ActiveReports +Imports itextsharp.text.pdf +Imports Microsoft.Office.Interop Imports VERAG_PROG_ALLGEMEIN @@ -238,7 +239,7 @@ Public Class frmFormulare MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("DE Vollmacht (indirekt)", FormularManagerArten.DE_Vollmacht_indirekt)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("DE Fiskal-Vollmacht", FormularManagerArten.DE_Fiskal)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Vollmacht", FormularManagerArten.AT_Vollmacht)) - MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Vollmacht 4200 EV", FormularManagerArten.AT_Vollmacht_EV)) + MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Vollmacht EV", FormularManagerArten.AT_Vollmacht_EV)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Fiskal-Vollmacht", FormularManagerArten.AT_Fiskal)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Export Vollmacht", FormularManagerArten.VERAG_EXPORT)) @@ -309,7 +310,7 @@ Public Class frmFormulare MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("DE Vollmacht (indirekt)", FormularManagerArten.DE_Vollmacht_indirekt)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("DE Fiskal-Vollmacht", FormularManagerArten.DE_Fiskal)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Vollmacht", FormularManagerArten.AT_Vollmacht)) - MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Vollmacht 4200 EV", FormularManagerArten.AT_Vollmacht_EV)) + MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Vollmacht EV", FormularManagerArten.AT_Vollmacht_EV)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Fiskal-Vollmacht", FormularManagerArten.AT_Fiskal)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("GB Vollmacht Import/Export", FormularManagerArten.GB_Vollmacht_IE)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("GB Vollmacht indirekt", FormularManagerArten.GB_Vollmacht_indirekt)) @@ -359,7 +360,7 @@ Public Class frmFormulare MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("DE Fiskal-Vollmacht", FormularManagerArten.DE_Fiskal)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("DE/AT Vollmacht (indirekt)", FormularManagerArten.DE_Vollmacht_indirekt)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Vollmacht", FormularManagerArten.AT_Vollmacht)) - MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Vollmacht 4200 EV", FormularManagerArten.AT_Vollmacht_EV)) + MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Vollmacht EV", FormularManagerArten.AT_Vollmacht_EV)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AT Fiskal-Vollmacht", FormularManagerArten.AT_Fiskal)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("GB Vollmacht Import/Export", FormularManagerArten.GB_Vollmacht_IE)) MyListBox1.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("GB Vollmacht indirekt", FormularManagerArten.GB_Vollmacht_indirekt)) @@ -823,8 +824,14 @@ Public Class frmFormulare AddHandler c.MOVE_DOWN, AddressOf ControlMoveDown MyFlowLayoutPanel1.Controls.Add(c) Case FormularManagerArten.VerzollungsunterlagenBAR - ' If param Is Nothing Then Exit Sub + Dim c As New usrcntlVerzollungsunterlagen_BAR() + If param Is Nothing Then + c = New usrcntlVerzollungsunterlagen_BAR() + Else + c = New usrcntlVerzollungsunterlagen_BAR(param) + End If + c.Width = MyFlowLayoutPanel1.Width - 6 c.KdNR = KdNr AddHandler c.DELETE, AddressOf ControlDELETE @@ -7146,7 +7153,8 @@ Public Class FormularManagerNEU If reader.NumberOfPages > 0 Then document.Open() - addAttachmentToCurrentPDF(reader, pdf) + + addOnlyFirstAttachmentToCurrentPDF(reader, pdf) pdf.AddDocument(reader) reader.Close() @@ -7194,6 +7202,7 @@ Public Class FormularManagerNEU For i As Integer = 0 To filespecs.Size - 1 Step 2 ' Get the attachment's file specification + Dim fileArray As PdfDictionary = filespecs.GetAsDict(i + 1) Dim file As PdfDictionary = fileArray.GetAsDict(PdfName.EF) @@ -7207,12 +7216,77 @@ Public Class FormularManagerNEU ' Add the attachment to the new PDF Dim fileSpec As PdfFileSpecification = PdfFileSpecification.FileEmbedded(copy, Nothing, fileName, fileContent) copy.AddFileAttachment(fileName, fileSpec) + Exit For + Next Next End If End If + End Function + + Public Shared Function addOnlyFirstAttachmentToCurrentPDF(reader As PdfReader, copy As PdfCopy) As Boolean + + Dim catalog As PdfDictionary = reader.Catalog + Dim names As PdfDictionary = CType(PdfReader.GetPdfObject(catalog.Get(PdfName.NAMES)), PdfDictionary) + + If names IsNot Nothing Then + Dim embeddedFiles As PdfDictionary = CType(PdfReader.GetPdfObject(names.Get(PdfName.EMBEDDEDFILES)), PdfDictionary) + + If embeddedFiles IsNot Nothing Then + Dim filespecs As PdfArray = embeddedFiles.GetAsArray(PdfName.NAMES) + + If filespecs Is Nothing Then Return False + + For i As Integer = 0 To filespecs.Size - 1 Step 2 + + Dim fileArray As PdfDictionary = filespecs.GetAsDict(i + 1) + Dim file As PdfDictionary = fileArray.GetAsDict(PdfName.EF) + + For Each key As PdfName In file.Keys + + Dim stream As PRStream = + CType(PdfReader.GetPdfObject(file.GetAsIndirectObject(key)), PRStream) + + Dim fileName As String = fileArray.GetAsString(key).ToString() + Dim fileContent As Byte() = PdfReader.GetStreamBytes(stream) + + Dim fileSpec As PdfFileSpecification = + PdfFileSpecification.FileEmbedded(copy, Nothing, fileName, fileContent) + + copy.AddFileAttachment(fileName, fileSpec) + + Return True ' only one attachment ever gets copied + + Next + Next + End If + End If + + Return False + + End Function + + + + Private Shared Function HasAnyAttachment(reader As PdfReader) As Boolean + + Dim catalog As PdfDictionary = reader.Catalog + + Dim names As PdfDictionary = + TryCast(PdfReader.GetPdfObject(catalog.Get(PdfName.NAMES)), PdfDictionary) + + If names Is Nothing Then Return True + + Dim embeddedFiles As PdfDictionary = + TryCast(PdfReader.GetPdfObject(names.Get(PdfName.EMBEDDEDFILES)), PdfDictionary) + + If embeddedFiles Is Nothing Then Return False + + Dim filespecs As PdfArray = embeddedFiles.GetAsArray(PdfName.NAMES) + + Return filespecs IsNot Nothing AndAlso filespecs.Size > 2 End Function diff --git a/SDL/My Project/AssemblyInfo.vb b/SDL/My Project/AssemblyInfo.vb index d690090a..e7fa788b 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/My Project/Resources.Designer.vb b/SDL/My Project/Resources.Designer.vb index 22f5e90c..067d6a67 100644 --- a/SDL/My Project/Resources.Designer.vb +++ b/SDL/My Project/Resources.Designer.vb @@ -2591,6 +2591,26 @@ Namespace My.Resources End Get End Property + ''' + ''' Sucht eine lokalisierte Ressource vom Typ System.Byte[]. + ''' + Friend ReadOnly Property Ustveu_Rechnungsanlagen_BE() As Byte() + Get + Dim obj As Object = ResourceManager.GetObject("Ustveu_Rechnungsanlagen_BE", resourceCulture) + Return CType(obj,Byte()) + End Get + End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ System.Byte[]. + ''' + Friend ReadOnly Property Ustveu_Rechnungsanlagen_DE() As Byte() + Get + Dim obj As Object = ResourceManager.GetObject("Ustveu_Rechnungsanlagen_DE", resourceCulture) + Return CType(obj,Byte()) + End Get + End Property + ''' ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. ''' diff --git a/SDL/My Project/Resources.resx b/SDL/My Project/Resources.resx index 8808797a..acabd60d 100644 --- a/SDL/My Project/Resources.resx +++ b/SDL/My Project/Resources.resx @@ -991,4 +991,10 @@ ..\Resources\auto_mailversand_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Ustveu-Rechnungsanlagen-DE.xls;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ustveu_Rechnungsanlagen_BE.xlsx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/SDL/Resources/Ustveu-Rechnungsanlagen-DE.xls b/SDL/Resources/Ustveu-Rechnungsanlagen-DE.xls new file mode 100644 index 00000000..2c6dc12d Binary files /dev/null and b/SDL/Resources/Ustveu-Rechnungsanlagen-DE.xls differ diff --git a/SDL/Resources/Ustveu_Rechnungsanlagen_BE.xlsx b/SDL/Resources/Ustveu_Rechnungsanlagen_BE.xlsx new file mode 100644 index 00000000..4638ee60 Binary files /dev/null and b/SDL/Resources/Ustveu_Rechnungsanlagen_BE.xlsx differ diff --git a/SDL/SDL.vbproj b/SDL/SDL.vbproj index facb9532..33db9b92 100644 --- a/SDL/SDL.vbproj +++ b/SDL/SDL.vbproj @@ -796,6 +796,7 @@ + @@ -1411,7 +1412,8 @@ Component - + + usrCntlUSTV.vb @@ -5062,6 +5064,8 @@ + + Always diff --git a/SDL/USTV/VATRefund_HR.vb b/SDL/USTV/VATRefund_HR.vb new file mode 100644 index 00000000..35983ac7 --- /dev/null +++ b/SDL/USTV/VATRefund_HR.vb @@ -0,0 +1,277 @@ + + +Public Class GlobalVATRefundApplication_HR + + Public Property Applicant As Applicant_ + Public Property Representative As Representative_ + Public Property RefundPeriod As RefundPeriod_ + Public Property BankAccount As BankAccount_ + Public Property RefundRequest As RefundRequest_ + Public Property BusinessDescription As BusinessDescription_ + + Public Function ToXml() As Chilkat.Xml + + Dim xml As New Chilkat.Xml + + ' ========================================================= + ' 🔥 CRITICAL FIX: Encoding exakt wie Portal erwartet + ' ========================================================= + xml.Encoding = "UTF-8" + xml.EmitBom = False + + ' ========================================================= + ' ROOT (NICHT ÄNDERN – entspricht funktionierendem XML) + ' ========================================================= + xml.Tag = "p:GlobalVATRefundApplication" + + xml.AddAttribute("xsi:type", "p:GlobalVATRefundApplication") + xml.AddAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") + xml.AddAttribute("xmlns:p", "http://VATRefund/") + + ' --------------------------- + ' Applicant + ' --------------------------- + xml.UpdateChildContent("applicant|nameType", Applicant.NameType) + xml.UpdateChildContent("applicant|nameFree", Applicant.NameFree) + xml.UpdateChildContent("applicant|addressFree", Applicant.AddressFree) + xml.UpdateChildContent("applicant|telephone", Applicant.Telephone) + + xml.UpdateChildContent("applicant|country|countryISOCode", Applicant.CountryISOCode) + xml.UpdateChildContent("applicant|country|memberStatePreferences|countryMSCode", Applicant.CountryISOCode) + + xml.UpdateChildContent("applicant|identification|VATId", Applicant.VATId) + xml.UpdateChildContent("applicant|identification|identificationCountry|countryISOCode", Applicant.CountryISOCode) + xml.UpdateChildContent("applicant|identification|identificationCountry|memberStatePreferences|countryMSCode", Applicant.CountryISOCode) + + xml.UpdateChildContent("applicant|email", Applicant.Email) + + ' --------------------------- + ' Representative + ' --------------------------- + xml.UpdateChildContent("representative|nameFree", Representative.Name) + xml.UpdateChildContent("representative|addressFree", Representative.Address) + xml.UpdateChildContent("representative|telephone", Representative.Telephone) + + xml.UpdateChildContent("representative|country|countryISOCode", Representative.CountryISOCode) + + xml.UpdateChildContent("representative|identification|identificationType", Representative.IdentificationType) + xml.UpdateChildContent("representative|identification|identificationNumber", Representative.IdentificationNumber) + xml.UpdateChildContent("representative|identification|identificationCountry|countryISOCode", Representative.CountryISOCode) + + xml.UpdateChildContent("representative|email", Representative.Email) + + ' --------------------------- + ' RefundPeriod + ' --------------------------- + xml.UpdateChildContent("refundPeriod|fromDate", RefundPeriod.FromDate) + xml.UpdateChildContent("refundPeriod|toDate", RefundPeriod.ToDate) + + ' --------------------------- + ' BusinessDescription + ' --------------------------- + xml.UpdateChildContent("businessDescription|businessActivity|code", BusinessDescription.code.ToString()) + xml.UpdateChildContent("businessDescription|businessActivity|names|name", BusinessDescription.name) + + ' --------------------------- + ' BankAccount + ' --------------------------- + xml.UpdateChildContent("defaultBankAccount|IBAN", BankAccount.IBAN) + xml.UpdateChildContent("defaultBankAccount|BIC", BankAccount.BIC) + xml.UpdateChildContent("defaultBankAccount|ownerName", BankAccount.OwnerName) + xml.UpdateChildContent("defaultBankAccount|details|ownerType", BankAccount.OwnerType) + xml.UpdateChildContent("defaultBankAccount|details|currency|currencyISO", BankAccount.CurrencyISO) + + ' --------------------------- + ' Version + ' --------------------------- + xml.UpdateChildContent("version", + DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ")) + + ' --------------------------- + ' RefundRequest + ' --------------------------- + xml.UpdateChildContent("refundRequest|refundMemberState|countryISOCode", + RefundRequest.RefundMemberState) + + For i As Integer = 0 To RefundRequest.PurchaseInformation.Count - 1 + + Dim p = RefundRequest.PurchaseInformation(i) + Dim path = $"refundRequest|purchaseInformation[{i}]" + + xml.UpdateChildContent(path & "|sequence", p.Sequence.ToString()) + xml.UpdateChildContent(path & "|simplifiedInvoice", p.SimplifiedInvoice.ToString().ToLower()) + xml.UpdateChildContent(path & "|referenceNumber", p.ReferenceNumber) + xml.UpdateChildContent(path & "|issuingDate", p.IssuingDate) + + xml.UpdateChildContent(path & "|transactionDescription|taxableAmount|amount", + p.TransactionDescription.TaxableAmount.Amount.ToString(Globalization.CultureInfo.InvariantCulture)) + + xml.UpdateChildContent(path & "|transactionDescription|taxableAmount|currency|currencyISO", + p.TransactionDescription.TaxableAmount.CurrencyISO) + + xml.UpdateChildContent(path & "|transactionDescription|VATAmount|amount", + p.TransactionDescription.VATAmount.Amount.ToString(Globalization.CultureInfo.InvariantCulture)) + + xml.UpdateChildContent(path & "|transactionDescription|VATAmount|currency|currencyISO", + p.TransactionDescription.VATAmount.CurrencyISO) + + xml.UpdateChildContent(path & "|deduction|deductibleAmount|amount", + p.Deduction.DeductibleAmount.Amount.ToString(Globalization.CultureInfo.InvariantCulture)) + + xml.UpdateChildContent(path & "|deduction|deductibleAmount|currency|currencyISO", + p.Deduction.DeductibleAmount.CurrencyISO) + + xml.UpdateChildContent(path & "|goodsDescription|code", p.GoodsDescription.Code) + + If p.GoodsDescription.Subcode <> "" Then xml.UpdateChildContent(path & "|goodsDescription|subcode", p.GoodsDescription.Subcode) + + xml.UpdateChildContent(path & "|EUSupplier|nameFree", p.EUSupplier.NameFree) + xml.UpdateChildContent(path & "|EUSupplier|addressFree", p.EUSupplier.AddressFree) + xml.UpdateChildContent(path & "|EUSupplier|country|countryISOCode", p.EUSupplier.CountryISOCode) + + xml.UpdateChildContent(path & "|EUSupplier|identification|VATId", p.EUSupplier.VATId) + xml.UpdateChildContent(path & "|EUSupplier|identification|identificationCountry|countryISOCode", p.EUSupplier.CountryISOCode) + + xml.UpdateChildContent(path & "|state", "N") + + Next + + ' --------------------------- + ' DocumentCopy + ' --------------------------- + For i As Integer = 0 To RefundRequest.DocumentCopy.Count - 1 + + Dim d = RefundRequest.DocumentCopy(i) + Dim path = $"refundRequest|documentCopy[{i}]" + + If d.FileName <> "" Then xml.UpdateChildContent(path & "|filename", d.FileName) + If d.FileType <> "" Then xml.UpdateChildContent(path & "|fileType", d.FileType.ToUpper()) ' optional safer + If d.Description <> "" Then xml.UpdateChildContent(path & "|description", d.Description) + + ' ========================================= + ' BASE64 FILE CONTENT (WICHTIG) + ' ========================================= + If d.Base64Content <> "" Then xml.UpdateChildContent(path & "|file", d.Base64Content) + 'xml.UpdateChildContent(path & "|file|file", d.Base64Content) + + Next + + xml.UpdateChildContent("refundRequest|state", "N") + xml.UpdateChildContent("submittedLocale", "de") + + Return xml + + End Function + +End Class + +Public Class Applicant_ + Public Property NameType As String + Public Property NameFree As String + Public Property AddressFree As String + Public Property Telephone As String + Public Property CountryISOCode As String + Public Property VATId As String + Public Property Email As String +End Class + +Public Class Representative_ + Public Property Name As String + Public Property Address As String + Public Property Telephone As String + Public Property CountryISOCode As String + Public Property IdentificationType As String + Public Property IdentificationNumber As String + Public Property Email As String +End Class + +Public Class RefundPeriod_ + Public Property FromDate As String + Public Property ToDate As String +End Class + +Public Class BankAccount_ + Public Property IBAN As String + Public Property BIC As String + Public Property OwnerName As String + Public Property OwnerType As String + Public Property CurrencyISO As String +End Class + +Public Class Purchase_ + + Public Property Sequence As Integer + Public Property SimplifiedInvoice As Boolean + Public Property ReferenceNumber As String + Public Property IssuingDate As String + Public Property TransactionDescription As TransactionDescription_ + Public Property Deduction As Deduction_ + Public Property GoodsDescription As GoodsDescription_ + Public Property EUSupplier As EUSupplier_ + Public Property State As String = "N" + +End Class + +Public Class DocumentCopy_ + + Public Property FileType As String + Public Property FileName As String + Public Property Description As String + Public Property Base64Content As String + +End Class + +Public Class RefundRequest_ + + Public Property RefundMemberState As String + Public Property PurchaseInformation As New List(Of Purchase_) + Public Property DocumentCopy As New List(Of DocumentCopy_) + Public Property State As String = "N" + +End Class + +Public Class TransactionDescription_ + + Public Property TaxableAmount As MoneyAmount_ + Public Property VATAmount As MoneyAmount_ + +End Class + +Public Class Deduction_ + + Public Property DeductibleAmount As MoneyAmount_ + +End Class + +Public Class MoneyAmount_ + + Public Property Amount As Decimal + Public Property CurrencyISO As String = "EUR" + +End Class + +Public Class GoodsDescription_ + + Public Property Code As String + + Public Property Subcode As String + +End Class + +Public Class EUSupplier_ + + Public Property NameFree As String + Public Property AddressFree As String + Public Property CountryISOCode As String + Public Property VATId As String + +End Class + +Public Class BusinessDescription_ + Public Property code As Integer + Public Property name As String +End Class + + + + diff --git a/SDL/USTV/VATRefund.vb b/SDL/USTV/VATRefund_RO.vb similarity index 98% rename from SDL/USTV/VATRefund.vb rename to SDL/USTV/VATRefund_RO.vb index 86c6b66e..1c9909e8 100644 --- a/SDL/USTV/VATRefund.vb +++ b/SDL/USTV/VATRefund_RO.vb @@ -1,9 +1,6 @@ Imports Chilkat -'========================= -' HAUFENKLASSEN -'========================= -Public Class VATRefundApplication +Public Class VATRefundApplication_RO Public Property CodF1 As FormInfo Public Property RefundPeriod As Period Public Property ApplicationReference As ApplicationReference @@ -24,9 +21,6 @@ Public Class VATRefundApplication ImportInformation = New ImportInformation() End Sub - '========================= - ' Methode um das XML zu erzeugen - '========================= Public Function ToXml() As Xml Dim xml As New Xml xml.Tag = "VATRefundApplication" diff --git a/SDL/USTV/frmMDM_USTVAntrag.vb b/SDL/USTV/frmMDM_USTVAntrag.vb index 8cd6e33b..2c4f98b2 100644 --- a/SDL/USTV/frmMDM_USTVAntrag.vb +++ b/SDL/USTV/frmMDM_USTVAntrag.vb @@ -1,7 +1,10 @@ -Imports System.IO +Imports System.Globalization +Imports System.IO Imports System.Reflection Imports System.Windows.Documents +Imports com.sun.xml.internal.ws.api.pipe Imports itextsharp.text.pdf +Imports java.rmi.server Imports Microsoft.Office.Interop Imports VERAG_PROG_ALLGEMEIN @@ -78,7 +81,7 @@ Public Class frmMDM_USTVAntrag ' left join [tblUStVLeistender] as leist on leist.UStV_Leistender = [tblUStVPositionen].[UStVPo_Leistender] ' where UStVAn_ID='" & UStVAn_ID & "' ORDER BY UStVPo_ID", "FMZOLL") - .SET_SQL("SELECT [UStVAn_ID] ,[UStVPo_ID] " & IIf(cbxInterneNr.Checked, ",[UStVPo_interneNr] as intNr", "") & " ,[UStVPo_ReDat],[UStVPo_ReNr],[UStVPo_Leistungsbezeichnung],[UStVPo_Nettobetrag],[UStVPo_NettobetragEUR],[UStVPo_Leistender],leist.[UstV_Leistender_Strasse] + ' ' + leist.[UstV_Leistender_StrasseNr] as [UstV_Leistender_Strasse],leist.[UstV_Leistender_PLZ],leist.[UstV_Leistender_Stadt],leist.[UstV_Leistender_Land],leist.[UstV_Leistender_UstNr],[UStVPo_USteuerbetrag],[UStVPo_Schnittstelle],[UStVPo_SchnittstellenNr],[UStVPo_Umrechnungskurs],[UStVPo_USteuerbetragEUR],[UStVPo_Sachbearbeiter], [UStVPo_daId], [UStVPo_daId_loeschbar] ,[UStVPo_VZ],[UStVPo_VZ_RKID] ,cast(case when isnull([UStVPo_VZ_RKID],0) = 0 then 0 else 1 end as bit) as VZabrechnet + .SET_SQL("SELECT [UStVAn_ID] ,[UStVPo_ID] " & IIf(cbxInterneNr.Checked, ",[UStVPo_interneNr] as intNr", "") & " ,[UStVPo_ReDat],[UStVPo_ReNr],[UStVPo_Leistungsbezeichnung],[UStVPo_Nettobetrag],[UStVPo_NettobetragEUR],[UStVPo_Leistender],leist.[UstV_Leistender_Strasse] + ' ' + leist.[UstV_Leistender_StrasseNr] as [UstV_Leistender_Strasse],leist.[UstV_Leistender_Strasse] as StrasseOnly,leist.[UstV_Leistender_StrasseNr] as StrassenNrOnly,leist.[UstV_Leistender_PLZ],leist.[UstV_Leistender_Stadt],leist.[UstV_Leistender_Land],leist.[UstV_Leistender_UstNr],[UStVPo_USteuerbetrag],[UStVPo_Schnittstelle],[UStVPo_SchnittstellenNr],[UStVPo_Umrechnungskurs],[UStVPo_USteuerbetragEUR],[UStVPo_Sachbearbeiter], [UStVPo_daId], [UStVPo_daId_loeschbar] ,[UStVPo_VZ],[UStVPo_VZ_RKID] ,cast(case when isnull([UStVPo_VZ_RKID],0) = 0 then 0 else 1 end as bit) as VZabrechnet FROM [tblUStVPositionen] LEFT JOIN [tblUStVLeistender] as leist ON ([tblUStVPositionen].[UStVPo_LeistenderId] > 0 @@ -97,6 +100,10 @@ Public Class frmMDM_USTVAntrag If .Columns.Count > 0 Then .Columns("UStVAn_ID").Visible = False + + .Columns("StrassenNrOnly").Visible = False + .Columns("StrasseOnly").Visible = False + .Columns("UStVPo_ID").HeaderText = "Pos" .Columns("UStVPo_ID").Width = 40 @@ -4147,30 +4154,345 @@ Public Class frmMDM_USTVAntrag Dim BANK_IBAN As String = "" Dim BANK_BIC As String = "" - If IsDBNull(ADR.UstIdNr) OrElse ADR.UstIdNr Is Nothing Then - MsgBox("UID-Nr ist nicht im Kunden hinterlegt!") - End If - Dim filePath As String = "" - Dim fileName As String = USTV_ANTRAG.UStVAn_KuNr & "_" & Antrag_LandKz & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatVon).Month & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatBis).Year & "_VATRefund.xml" + Dim fileName As String = USTV_ANTRAG.UStVAn_KuNr & "_" & Antrag_LandKz & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatVon).Month & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatBis).Year & "_VATRefund" - Dim saveDialog As New SaveFileDialog() With { - .Title = "XML-Datei speichern", - .Filter = "XML-Dateien (*.xml)|*.xml|Alle Dateien (*.*)|*.*", - .DefaultExt = "xml", - .AddExtension = True, - .FileName = fileName, - .OverwritePrompt = True - } + dTLANDEU = (New SQL).loadDgvBySql("select LandKz, MitgliedslandEU from Währungstabelle where LandKz is not null", "FMZOLL") + Dim isEU As Boolean = dTLANDEU.AsEnumerable().Where(Function(res) res.Field(Of String)("LandKz") = USTV_ANTRAG.UStVAn_LandKz).Select(Function(res) res.Field(Of Boolean)("MitgliedslandEU")).FirstOrDefault() + + If isEU Then + Dim UIDNr As Boolean = True + If IsDBNull(ADR.UstIdNr) OrElse ADR.UstIdNr Is Nothing Then + + Select Case MsgBox("UID-Nr ist nicht im Kunden hinterlegt!" & vbNewLine & "Fortfahren?", vbYesNo) + Case vbYes : UIDNr = False + Case vbNo : Exit Sub + End Select + + + MsgBox("UID-Nr ist nicht im Kunden hinterlegt!") + End If + + + Select Case ADR.LandKz + Case "RO", "R" : fileName = fileName & ".xml" : createXMLforRO(ADR, KUNDE, KUNDE_ERW, FIRMA, BANK_OWNER, BANK_IBAN, BANK_BIC, fileName, filePath) + Case "DE", "D" : fileName = fileName & ".csv" : createCSVforDE(ADR, KUNDE, KUNDE_ERW, FIRMA, BANK_OWNER, BANK_IBAN, BANK_BIC, fileName, filePath) 'ALTERNATIVE: ELMA5-Massendatenschnittstelle allerdings um einiges aufwendiger! + Case "HR" : fileName = fileName & ".xml" : createXMLforHR(ADR, KUNDE, KUNDE_ERW, FIRMA, BANK_OWNER, BANK_IBAN, BANK_BIC, fileName, filePath) + Case Else + MsgBox("Für das Kundenland " & ADR.LandKz & " wurde kein Export definiert") + End Select - If saveDialog.ShowDialog() = DialogResult.OK Then - filePath = saveDialog.FileName Else - Me.Cursor = Cursors.Default - Exit Sub + Select Case Antrag_LandKz + Case "BE" : fileName = fileName & ".xlsx" : createCSVforBE(ADR, KUNDE, KUNDE_ERW, FIRMA, BANK_OWNER, BANK_IBAN, BANK_BIC, fileName, filePath) + Case Else + MsgBox("Für das Antragsland " & Antrag_LandKz & " wurde kein Export definiert") + End Select + End If + + Me.Cursor = Cursors.Default + + + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + Me.Cursor = Cursors.Default + End Try + + End Sub + + Private Function createXMLforRO(ADR As cAdressen, KUNDE As cKunde, KUNDE_ERW As cKundenErweitert, FIRMA As cFirmen, BANK_OWNER As String, BANK_IBAN As String, BANK_BIC As String, filename As String, filePath As String) + Dim saveDialog As New SaveFileDialog() With { + .Title = "XML-Datei speichern", + .Filter = "XML-Dateien (*.xml)|*.xml|Alle Dateien (*.*)|*.*", + .DefaultExt = "xml", + .AddExtension = True, + .FileName = filename, + .OverwritePrompt = True + } + + If saveDialog.ShowDialog() = DialogResult.OK Then + filePath = saveDialog.FileName + Else + Me.Cursor = Cursors.Default + Return False + End If + + + Dim fullFilePath As String = saveDialog.FileName + Dim directoryPath As String = Path.GetDirectoryName(fullFilePath) + + If Not Directory.Exists(directoryPath) Then + Directory.CreateDirectory(directoryPath) + End If + + + Select Case Antrag_LandKz + Case "AT", "DE", "CZ", "BE", "SI" + BANK_OWNER = FIRMA.Firma_Bez + BANK_IBAN = FIRMA.Firma_IBAN1 + BANK_BIC = FIRMA.Firma_BIC1 + + If BANK_BIC.ToString.Contains("BIC:") Then + BANK_BIC = BANK_BIC.ToString.Replace("BIC:", "") + BANK_BIC = BANK_BIC.Trim() + BANK_BIC = BANK_BIC.ToString.Replace(" ", "") + End If + + If BANK_IBAN.ToString.Contains("IBAN:") Then + BANK_IBAN = BANK_IBAN.ToString.Replace("IBAN:", "") + BANK_IBAN = BANK_IBAN.Trim() + BANK_IBAN = BANK_IBAN.ToString.Replace(" ", "") + End If + + 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 isnull(bnk_archiv,0) = 0 and bnk_KundenNr = " & KUNDE.KundenNr, "FMZOLL") + + If dtBank.Rows.Count > 0 Then + BANK_OWNER = ADR.Name_1 + BANK_IBAN = dtBank.Rows(0).Item("bnk_iban") + BANK_BIC = dtBank.Rows(0).Item("bnk_bic") + End If + 'wenn nicht hinterlegt, dann leer lassen! + + End Select + + + Dim app As New VATRefundApplication_RO() With { + .CodF1 = New FormInfo With {.FormType = "D318", .FormId = 318, .UniversalCode = "D318_A1.0.0"}, + .RefundPeriod = New Period With {.StartDate = CDate(USTV_ANTRAG.UStVAn_ReDatVon).Month, .EndDate = CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month}, + .ApplicationReference = New ApplicationReference With { + .Year = CDate(USTV_ANTRAG.UStVAn_ReDatBis).Year, + .RefundingCountryCode = Antrag_LandKz, + .Language = "DE", + .Currency = USTV_ANTRAG.UStVAn_Währungscode, + .ApplicationType = 1, + .ReferenceNumber = "", + .Annual = IIf(CDate(USTV_ANTRAG.UStVAn_ReDatVon).Month = 1 And CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month = 12, 1, 0), + .an_r = CDate(USTV_ANTRAG.UStVAn_ReDatBis).Year, + .d_rec = 0, + .luna_r = CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month, + .cif = IIf(Not IsDBNull(ADR.UstIdNr) AndAlso ADR.UstIdNr IsNot Nothing, ADR.UstIdNr, 0), + .totalPlata_A = 0 + }, + .ProrateAdjustment = New ProrateAdjustment With {.Year = "", .FinalProrate = ""}, + .Applicant = New Party With { + .NameFree = ADR.Name_1, + .VATIdentificationNumber = IIf(Not IsDBNull(ADR.UstIdNr) AndAlso ADR.UstIdNr IsNot Nothing, ADR.UstIdNr, 0), + .AddressFree = ADR.Straße.ToString & vbCrLf & ADR.LandKz.ToString & " - " & ADR.PLZ.ToString & " -" & ADR.Ort.ToString, '"RO - 550270 - MUN. SIBIU", + .PostCode = "", .Phone = "", .EmailAddress = "juricevic@verag.ag" + }, + .BusinessDescription = New BusinessDescription With { + .d_caen = 2, .CAEN = "4941--Transp.rutiere de marfuri", .BusinessActivity = 4941 + }, + .Representative = New Party With { + .NameFree = "VERAG 360 GMBH", + .RepresentativeID = "ATU76165837", + .AddressFree = "SUBEN NR. 100, AT-4975 SUBEN", + .PostCode = "4975", + .Phone = "00437711277719", + .EmailAddress = "juricevic@verag.ag", + .CountryCode = "AT", + .IdentificationType = "TIN" + }, + .DetailedBankAccount = New BankAccount With { + .Total = txtSummeEUR._value.ToString.Replace(",", "."), + .Currency = USTV_ANTRAG.UStVAn_Währungscode, + .OwnerType = 1, + .OwnerName = BANK_OWNER, + .IBAN = BANK_IBAN, + .BIC = BANK_BIC + }, + .NumberOfDocuments = New NumberOfDocuments With {.AtachatedFiles = 0, .PurchaseOrders = dgvUSTVPositionen.SelectedRows.Count, .ImportOrders = 0}, + .ApplicantSignature = New Signature With {.NameFree = "LUXBAUER BRIGITTE", .Position = "IMPUTERNICIT"} + } + + Dim counter As Integer = 1 + + + For Each row As DataGridViewRow In dgvUSTVPositionen.SelectedRows.Cast(Of DataGridViewRow)().OrderBy(Function(dgvr) dgvr.Index) + + Dim UIDNrLeistender = "" + Dim LeistenderName As String = "" + + Dim listOfLeistungstyp As New List(Of String) + + + If Not IsDBNull(row.Cells("UstV_Leistender_UstNr").Value) AndAlso row.Cells("UstV_Leistender_UstNr").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_UstNr").Value <> "" IsNot Nothing Then + UIDNrLeistender = row.Cells("UstV_Leistender_UstNr").Value + UIDNrLeistender = UIDNrLeistender.ToString.Replace(Antrag_LandKz, "") + End If + + LeistenderName = row.Cells("UStVPo_Leistender").Value + LeistenderName = LeistenderName.ToString.Replace(Antrag_LandKz, "") + + Dim Nettobetrag As Double = 0 + If Not IsDBNull(row.Cells("UStVPo_Nettobetrag").Value) AndAlso IsNumeric(row.Cells("UStVPo_Nettobetrag").Value) Then Nettobetrag = CDbl(row.Cells("UStVPo_Nettobetrag").Value) + + If Not IsDBNull(row.Cells("UStVPo_Leistungsbezeichnung").Value) AndAlso row.Cells("UStVPo_Leistungsbezeichnung").Value IsNot Nothing Then + + listOfLeistungstyp = getLeistungsTyp(row.Cells("UStVPo_Leistungsbezeichnung").Value, CInt(row.Cells("UStVPo_SchnittstellenNr").Value)) + + End If + + + + Dim code As Integer = 0 + Dim Subcode = "" + If listOfLeistungstyp.Count > 0 Then + getCode(Antrag_LandKz, listOfLeistungstyp(0), code, Subcode, "RO") + End If + + Dim goods As New GoodsDescription With {.GoodsItem = New List(Of GoodsItem)} + goods.GoodsItem.Add(New GoodsItem With {.Code = code, .SubCode = Subcode, .FreeText = ""}) + + + + + app.PurchaseInformation.Invoices.Add(New Invoice With { + .SequenceNumber = counter, + .SimplifiedInvoice = 0, + .ReferenceNumber = row.Cells("UStVPo_ReNr").Value, ' "25/000616354/987", + .IssuingDate = CDate(row.Cells("UStVPo_ReDat").Value).ToString("yyyy-MM-dd"),'"2025-11-30", + .GoodsDescription = goods, + .TransactionDescription = New TransactionDescription With {.TaxableAmount = Nothing, .VATAmount = row.Cells("UStVPo_USteuerbetrag").Value.ToString.Replace(",", ".")}, + .Deduction = New Deduction With {.ProRataRate = "", .DeductibleVATAmount = row.Cells("UStVPo_USteuerbetrag").Value.ToString.Replace(",", ".")}, + .EUSupplier = New Party With { + .NameFree = LeistenderName,'"DKV EURO SERVICE GMBH + CO KG", + .AddressFree = row.Cells("UstV_Leistender_Strasse").Value & " " & row.Cells("UstV_Leistender_Land").Value & " " & row.Cells("UstV_Leistender_PLZ").Value & " " & row.Cells("UstV_Leistender_Stadt").Value,'"BALCKE DÜRR ALLEE 3 DE 40882 RATINGEN", + .VATIdentificationNumber = UIDNrLeistender, + .CountryCode = Antrag_LandKz + } + }) + + + + counter += 1 + + Next + + + Dim list As New List(Of String) + Dim pdfPathfinished As String = "" + + If dgvUSTVPositionen.SelectedRows.Count > 0 Then + Dim nummerierung As Boolean = False + + Select Case MsgBox("Soll eine Nummerierung auf den PDF Dokumenten angegeben werden?", vbYesNoCancel) + Case vbYes : nummerierung = True + Case vbNo : nummerierung = False + Case Else : Return False + End Select + + For Each row As DataGridViewRow In dgvUSTVPositionen.SelectedRows.Cast(Of DataGridViewRow)().OrderBy(Function(dgvr) dgvr.Index) + + Dim pdf As String = "" + pdf = func.getPDF(row.Cells("UStVPo_SchnittstellenNr").Value, row.Cells("UStVPo_ReNr").Value, row.Cells("UStVPo_ReDat").Value, row.Cells("UStVPo_daId").Value, IIf(nummerierung, row.Cells("UStVPo_ID").Value, -1), True, Antrag_LandKz, USTV_ANTRAG, New cFakturierung, False) + + If pdf <> "" Then list.Add(pdf) + + Next + End If + + If list.Count > 0 Then + + If list.Count > 1 Then + Dim pathPDF = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath("RG_" & Now.ToString("ddMMyyyyHHmmss") & ".pdf", ".pdf", False, False) + If FormularManagerNEU.MergePdfFiles(list, pathPDF) Then + pdfPathfinished = pathPDF + End If + Else + + pdfPathfinished = list(0) + + End If + + Dim fileNamePDFAttZIP As String = "RG_" & Antrag_LandKz & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatVon).Month & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatBis).Year & ".zip" + + fileNamePDFAttZIP = directoryPath & "\" & fileNamePDFAttZIP + + + Dim fileZipped As Boolean = True + If pdfPathfinished <> "" Then + + ' Falls ZIP schon existiert → löschen + If File.Exists(fileNamePDFAttZIP) Then + File.Delete(fileNamePDFAttZIP) + End If + + Dim zipFile As New Chilkat.Zip() + + + Dim success = zipFile.NewZip(fileNamePDFAttZIP) + If (success = False) Then + Debug.WriteLine(zipFile.LastErrorText) + Return False + End If + Dim saveExtraPath As Boolean = False + success = zipFile.AppendFiles(pdfPathfinished, saveExtraPath) + If (success = False) Then + fileZipped = False + End If + + + success = zipFile.WriteZipAndClose() + If (success = False) Then + fileZipped = False + End If + + If fileZipped Then + ' app.DocumentCopy.Add(New DocumentCopy With { + '.Bifa_atasament = 1, + '.Document = New DocumentFile With { + ' .FileName = fileNamePDFAttZIP, + ' .FileType = "application/zip", + ' .FileDescription = "INVOICES/POA" + '} + '}) + End If + + End If + + + End If + + ' ========================= + ' 5️⃣ XML erzeugen + ' ========================= + Dim xml As Chilkat.Xml = app.ToXml() + Dim xmlString As String = xml.GetXml() + Console.WriteLine(xmlString) + System.IO.File.WriteAllText(filePath, xmlString) + + End Function + + + Private Function createXMLforHR(ADR As cAdressen, KUNDE As cKunde, KUNDE_ERW As cKundenErweitert, FIRMA As cFirmen, BANK_OWNER As String, BANK_IBAN As String, BANK_BIC As String, filename As String, filePath As String) + Dim saveDialog As New SaveFileDialog() With { + .Title = "XML-Datei speichern", + .Filter = "XML-Dateien (*.xml)|*.xml|Alle Dateien (*.*)|*.*", + .DefaultExt = "xml", + .AddExtension = True, + .FileName = filename, + .OverwritePrompt = True + } + + If saveDialog.ShowDialog() = DialogResult.OK Then + filePath = saveDialog.FileName + Else + Me.Cursor = Cursors.Default + Return False + End If + + Try + + Dim list As New List(Of String) + Dim fullFilePath As String = saveDialog.FileName Dim directoryPath As String = Path.GetDirectoryName(fullFilePath) @@ -4178,13 +4500,13 @@ Public Class frmMDM_USTVAntrag Directory.CreateDirectory(directoryPath) End If - + Dim BankOwnerType = "" Select Case Antrag_LandKz Case "AT", "DE", "CZ", "BE", "SI" BANK_OWNER = FIRMA.Firma_Bez BANK_IBAN = FIRMA.Firma_IBAN1 BANK_BIC = FIRMA.Firma_BIC1 - + BankOwnerType = "applicant" If BANK_BIC.ToString.Contains("BIC:") Then BANK_BIC = BANK_BIC.ToString.Replace("BIC:", "") BANK_BIC = BANK_BIC.Trim() @@ -4208,72 +4530,69 @@ Public Class frmMDM_USTVAntrag BANK_BIC = dtBank.Rows(0).Item("bnk_bic") End If 'wenn nicht hinterlegt, dann leer lassen! - + BankOwnerType = "representative" End Select - - Dim app As New VATRefundApplication() With { - .CodF1 = New FormInfo With {.FormType = "D318", .FormId = 318, .UniversalCode = "D318_A1.0.0"}, - .RefundPeriod = New Period With {.StartDate = CDate(USTV_ANTRAG.UStVAn_ReDatVon).Month, .EndDate = CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month}, - .ApplicationReference = New ApplicationReference With { - .Year = CDate(USTV_ANTRAG.UStVAn_ReDatBis).Year, - .RefundingCountryCode = Antrag_LandKz, - .Language = "DE", - .Currency = USTV_ANTRAG.UStVAn_Währungscode, - .ApplicationType = 1, - .ReferenceNumber = "", - .Annual = IIf(CDate(USTV_ANTRAG.UStVAn_ReDatVon).Month = 1 And CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month = 12, 1, 0), - .an_r = CDate(USTV_ANTRAG.UStVAn_ReDatBis).Year, - .d_rec = 0, - .luna_r = CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month, - .cif = IIf(Not IsDBNull(ADR.UstIdNr) AndAlso ADR.UstIdNr IsNot Nothing, ADR.UstIdNr, 0), - .totalPlata_A = 0 - }, - .ProrateAdjustment = New ProrateAdjustment With {.Year = "", .FinalProrate = ""}, - .Applicant = New Party With { + Dim app As New GlobalVATRefundApplication_HR() With { + .RefundPeriod = New RefundPeriod_ With {.FromDate = CDate(USTV_ANTRAG.UStVAn_ReDatVon).ToString("yyyy-MM-dd"), .ToDate = CDate(USTV_ANTRAG.UStVAn_ReDatBis).ToString("yyyy-MM-dd")}, + .Applicant = New Applicant_ With { + .NameType = "legal", .NameFree = ADR.Name_1, - .VATIdentificationNumber = IIf(Not IsDBNull(ADR.UstIdNr) AndAlso ADR.UstIdNr IsNot Nothing, ADR.UstIdNr, 0), - .AddressFree = ADR.Straße.ToString & vbCrLf & ADR.LandKz.ToString & " - " & ADR.PLZ.ToString & " -" & ADR.Ort.ToString, '"RO - 550270 - MUN. SIBIU", - .PostCode = "", .Phone = "", .EmailAddress = "juricevic@verag.ag" + .VATId = IIf(Not IsDBNull(ADR.UstIdNr) AndAlso ADR.UstIdNr IsNot Nothing, ADR.UstIdNr, 0), + .AddressFree = ADR.Straße.ToString & ", " & ADR.PLZ.ToString & ", " & ADR.Ort.ToString, '"RO - 550270 - MUN. SIBIU", + .CountryISOCode = ADR.LandKz, + .Telephone = "00", + .Email = "juricevic@verag.ag" }, - .BusinessDescription = New BusinessDescription With { - .d_caen = 2, .CAEN = "4941--Transp.rutiere de marfuri", .BusinessActivity = 4941 + .BusinessDescription = New BusinessDescription_ With { + .code = 4941, .name = "Freight transport by road" }, - .Representative = New Party With { - .NameFree = "VERAG 360 GMBH", - .RepresentativeID = "ATU76165837", - .AddressFree = "SUBEN NR. 100, AT-4975 SUBEN", - .PostCode = "4975", - .Phone = "00437711277719", - .EmailAddress = "juricevic@verag.ag", - .CountryCode = "AT", - .IdentificationType = "TIN" + .Representative = New Representative_ With { + .Name = "VERAG 360 GMBH", + .IdentificationNumber = "AT U76165837", + .Address = "Suben 100, 4975 Suben", + .Telephone = "00437711277719", + .Email = "juricevic@verag.ag", + .CountryISOCode = "AT", + .IdentificationType = "NVAT" }, - .DetailedBankAccount = New BankAccount With { - .Total = txtSummeEUR._value.ToString.Replace(",", "."), - .Currency = USTV_ANTRAG.UStVAn_Währungscode, - .OwnerType = 1, + .BankAccount = New BankAccount_ With { + .CurrencyISO = USTV_ANTRAG.UStVAn_Währungscode, + .OwnerType = BankOwnerType, .OwnerName = BANK_OWNER, .IBAN = BANK_IBAN, .BIC = BANK_BIC - }, - .NumberOfDocuments = New NumberOfDocuments With {.AtachatedFiles = 0, .PurchaseOrders = dgvUSTVPositionen.SelectedRows.Count, .ImportOrders = 0}, - .ApplicantSignature = New Signature With {.NameFree = "LUXBAUER BRIGITTE", .Position = "IMPUTERNICIT"} - } + } + } + + + + Dim counter As Integer = 1 + Dim nummerierung As Boolean = False + Dim PDFExportInXML As Boolean = False + + Select Case MsgBox("Soll eine Nummerierung auf den PDF Dokumenten angegeben werden?", vbYesNoCancel) + Case vbYes : nummerierung = True + Case vbNo : nummerierung = False + Case Else : Return False + End Select + + + + app.RefundRequest = New RefundRequest_ With { + .RefundMemberState = Antrag_LandKz, + .State = "N" ' steht für New + } + For Each row As DataGridViewRow In dgvUSTVPositionen.SelectedRows.Cast(Of DataGridViewRow)().OrderBy(Function(dgvr) dgvr.Index) Dim UIDNrLeistender = "" Dim LeistenderName As String = "" - - Dim maut As Boolean = False - Dim diesel As Boolean = False - Dim parkplatz As Boolean = False - Dim zubeh As Boolean = False - Dim uebernachtung As Boolean = False + Dim listOfLeistungstyp As New List(Of String) If Not IsDBNull(row.Cells("UstV_Leistender_UstNr").Value) AndAlso row.Cells("UstV_Leistender_UstNr").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_UstNr").Value <> "" IsNot Nothing Then @@ -4289,179 +4608,96 @@ Public Class frmMDM_USTVAntrag If Not IsDBNull(row.Cells("UStVPo_Leistungsbezeichnung").Value) AndAlso row.Cells("UStVPo_Leistungsbezeichnung").Value IsNot Nothing Then - Dim Bez As String = row.Cells("UStVPo_Leistungsbezeichnung").Value - Bez = Bez.ToLower + listOfLeistungstyp = getLeistungsTyp(row.Cells("UStVPo_Leistungsbezeichnung").Value, CInt(row.Cells("UStVPo_SchnittstellenNr").Value)) - If row.Cells("UStVPo_SchnittstellenNr").Value = 10 Then - 'UTA überspringen - ElseIf row.Cells("UStVPo_SchnittstellenNr").Value = 9 Then - maut = True 'MSE immer MAUT - Else - If Bez.Contains("maut") Or Bez.Contains("toll") Then maut = True - If Bez.Contains("diesel") Or Bez.Contains("fuel") Then diesel = True - If Bez.Contains("parkplatz") Then parkplatz = True - If Bez.Contains("zubeh") Then zubeh = True - If Bez.Contains("übern") Then uebernachtung = True + End If + + Dim p As New Purchase_ + p.Sequence = counter + p.SimplifiedInvoice = False + p.ReferenceNumber = row.Cells("UStVPo_ReNr").Value + p.IssuingDate = CDate(row.Cells("UStVPo_ReDat").Value).ToString("yyyy-MM-dd") + + p.TransactionDescription = New TransactionDescription_ With { + .TaxableAmount = New MoneyAmount_ With { + .Amount = Math.Round(Nettobetrag, 2), + .CurrencyISO = USTV_ANTRAG.UStVAn_Währungscode + }, + .VATAmount = New MoneyAmount_ With { + .Amount = Math.Round(row.Cells("UStVPo_USteuerbetrag").Value, 2), + .CurrencyISO = USTV_ANTRAG.UStVAn_Währungscode + } + } + + p.Deduction = New Deduction_ With { + .DeductibleAmount = New MoneyAmount_ With { + .Amount = Math.Round(row.Cells("UStVPo_USteuerbetrag").Value, 2), + .CurrencyISO = USTV_ANTRAG.UStVAn_Währungscode + } + } + + Dim code As Integer = 0 + Dim Subcode = "" + If listOfLeistungstyp.Count > 0 Then + getCode(Antrag_LandKz, listOfLeistungstyp(0), code, Subcode) + End If + + p.GoodsDescription = New GoodsDescription_ With {.Code = code, .Subcode = Subcode} + + + Dim UstV_Leistender_Strasse = "" + If Not IsDBNull(row.Cells("UstV_Leistender_Strasse").Value) AndAlso row.Cells("UstV_Leistender_Strasse").Value IsNot Nothing Then UstV_Leistender_Strasse = row.Cells("UstV_Leistender_Strasse").Value + + Dim UstV_Leistender_Land = "" + If Not IsDBNull(row.Cells("UstV_Leistender_Land").Value) AndAlso row.Cells("UstV_Leistender_Land").Value IsNot Nothing Then UstV_Leistender_Land = row.Cells("UstV_Leistender_Land").Value + + + Dim UstV_Leistender_Stadt = "" + If Not IsDBNull(row.Cells("UstV_Leistender_Stadt").Value) AndAlso row.Cells("UstV_Leistender_Stadt").Value IsNot Nothing Then UstV_Leistender_Stadt = row.Cells("UstV_Leistender_Stadt").Value + + Dim UstV_Leistender_PLZ = "" + If Not IsDBNull(row.Cells("UstV_Leistender_PLZ").Value) AndAlso row.Cells("UstV_Leistender_PLZ").Value IsNot Nothing Then UstV_Leistender_PLZ = row.Cells("UstV_Leistender_PLZ").Value + + p.EUSupplier = New EUSupplier_ With { + .NameFree = LeistenderName, + .AddressFree = UstV_Leistender_Strasse & " " & UstV_Leistender_Land & " " & UstV_Leistender_PLZ & " " & UstV_Leistender_Stadt, + .CountryISOCode = Antrag_LandKz, + .VATId = UIDNrLeistender + } + + app.RefundRequest.PurchaseInformation.Add(p) + + Dim pdf As String = "" + pdf = func.getPDF(row.Cells("UStVPo_SchnittstellenNr").Value, row.Cells("UStVPo_ReNr").Value, row.Cells("UStVPo_ReDat").Value, row.Cells("UStVPo_daId").Value, IIf(nummerierung, row.Cells("UStVPo_ID").Value, -1), True, Antrag_LandKz, USTV_ANTRAG, New cFakturierung, False) + If pdf <> "" Then list.Add(pdf) + + + + + If pdf <> "" And PDFExportInXML Then + Dim dc As New DocumentCopy_ + dc.Description = row.Cells("UStVPo_ReNr").Value + + Dim pdfName As New FileInfo(pdf) + dc.FileType = pdfName.Extension.ToUpper.ToString.Replace(".", "") + dc.FileName = pdfName.Name + + Dim bd As New Chilkat.BinData + If bd.LoadFile(pdf) Then + dc.Base64Content = bd.GetEncoded("base64") + dc.Base64Content = dc.Base64Content.Replace(vbCr, "").Replace(vbLf, "").Replace(" ", "") End If - + app.RefundRequest.DocumentCopy.Add(dc) End If - Dim goods As New GoodsDescription With {.GoodsItem = New List(Of GoodsItem)} - - If diesel Then - goods.GoodsItem.Add(New GoodsItem With {.Code = 1, .SubCode = "1.1.2", .FreeText = ""}) - End If - - If maut Then - goods.GoodsItem.Add(New GoodsItem With {.Code = 4, .SubCode = "4.1", .FreeText = ""}) - End If - - If zubeh Then - goods.GoodsItem.Add(New GoodsItem With {.Code = 3, .SubCode = "3.1.5", .FreeText = ""}) - End If - - If parkplatz Then - goods.GoodsItem.Add(New GoodsItem With {.Code = 3, .SubCode = "3.1.4", .FreeText = ""}) - End If - - If uebernachtung Then - goods.GoodsItem.Add(New GoodsItem With {.Code = 6, .SubCode = "6.5", .FreeText = ""}) - End If - - Select Case Antrag_LandKz - Case "DE", "CZ", "LU" - For Each good In goods.GoodsItem - good.SubCode = "" 'SUbcodes leeren - Next - End Select - app.PurchaseInformation.Invoices.Add(New Invoice With { - .SequenceNumber = counter, - .SimplifiedInvoice = 0, - .ReferenceNumber = row.Cells("UStVPo_ReNr").Value, ' "25/000616354/987", - .IssuingDate = CDate(row.Cells("UStVPo_ReDat").Value).ToString("yyyy-MM-dd"),'"2025-11-30", - .GoodsDescription = goods, - .TransactionDescription = New TransactionDescription With {.TaxableAmount = Nothing, .VATAmount = row.Cells("UStVPo_USteuerbetrag").Value.ToString.Replace(",", ".")}, - .Deduction = New Deduction With {.ProRataRate = "", .DeductibleVATAmount = row.Cells("UStVPo_USteuerbetrag").Value.ToString.Replace(",", ".")}, - .EUSupplier = New Party With { - .NameFree = LeistenderName,'"DKV EURO SERVICE GMBH + CO KG", - .AddressFree = row.Cells("UstV_Leistender_Strasse").Value & " " & row.Cells("UstV_Leistender_Land").Value & " " & row.Cells("UstV_Leistender_PLZ").Value & " " & row.Cells("UstV_Leistender_Stadt").Value,'"BALCKE DÜRR ALLEE 3 DE 40882 RATINGEN", - .VATIdentificationNumber = UIDNrLeistender, - .CountryCode = Antrag_LandKz - } - }) - - '[UStVAn_ID] , [UStVPo_ID], [UStVPo_ReDat], [UStVPo_ReNr], [UStVPo_Leistungsbezeichnung], [UStVPo_Leistender], leist.[UstV_Leistender_Strasse] + ' ' + leist.[UstV_Leistender_StrasseNr] as [UstV_Leistender_Strasse],leist.[UstV_Leistender_PLZ],leist.[UstV_Leistender_Stadt],leist.[UstV_Leistender_Land],leist.[UstV_Leistender_UstNr],[UStVPo_USteuerbetrag],[UStVPo_Schnittstelle],[UStVPo_SchnittstellenNr],[UStVPo_Umrechnungskurs],[UStVPo_USteuerbetragEUR],[UStVPo_Sachbearbeiter], [UStVPo_daId], [UStVPo_daId_loeschbar] ,[UStVPo_VZ],[UStVPo_VZ_RKID] - - ' ========================= - ' 3️⃣ ImportInformation hinzufügen (wenn vorhanden - OPTIONAL) - ' ========================= - ' app.ImportInformation._Imports.Add(New Invoice With { - ' .SequenceNumber = 17, - ' .ReferenceNumber = "", - ' .IssuingDate = "", - ' .GoodsDescription = New GoodsDescription With {.GoodsItem = New GoodsItem With {.FreeText = "", .Code = 0, .SubCode = ""}}, - ' .Deduction = New Deduction With {.DeductibleVATAmount = "0.00", .ProRataRate = ""} - '}) - - counter = +1 + counter += 1 Next - - - ' ========================= - ' 4️⃣ Dokumente hinzufügen - ' ========================= - - - Dim list As New List(Of String) - Dim pdfPathfinished As String = "" - - If dgvUSTVPositionen.SelectedRows.Count > 0 Then - Dim nummerierung As Boolean = False - - Select Case MsgBox("Soll eine Nummerierung auf den PDF Dokumenten angegeben werden?", vbYesNoCancel) - Case vbYes : nummerierung = True - Case vbNo : nummerierung = False - Case Else : Exit Sub - End Select - - For Each row As DataGridViewRow In dgvUSTVPositionen.SelectedRows.Cast(Of DataGridViewRow)().OrderBy(Function(dgvr) dgvr.Index) - - Dim pdf As String = "" - pdf = func.getPDF(row.Cells("UStVPo_SchnittstellenNr").Value, row.Cells("UStVPo_ReNr").Value, row.Cells("UStVPo_ReDat").Value, row.Cells("UStVPo_daId").Value, IIf(nummerierung, row.Cells("UStVPo_ID").Value, -1), True, Antrag_LandKz, USTV_ANTRAG, New cFakturierung, False) - - If pdf <> "" Then list.Add(pdf) - - Next - End If - - If list.Count > 0 Then - - If list.Count > 1 Then - Dim pathPDF = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath("RG_" & Now.ToString("ddMMyyyyHHmmss") & ".pdf", ".pdf", False, False) - If FormularManagerNEU.MergePdfFiles(list, pathPDF) Then - pdfPathfinished = pathPDF - End If - Else - - pdfPathfinished = list(0) - - End If - - Dim fileNamePDFAttZIP As String = "RG_" & Antrag_LandKz & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatVon).Month & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatBis).Month & "_" & CDate(USTV_ANTRAG.UStVAn_ReDatBis).Year & ".zip" - - fileNamePDFAttZIP = directoryPath & "\" & fileNamePDFAttZIP - - - Dim fileZipped As Boolean = True - If pdfPathfinished <> "" Then - - ' Falls ZIP schon existiert → löschen - If File.Exists(fileNamePDFAttZIP) Then - File.Delete(fileNamePDFAttZIP) - End If - - Dim zipFile As New Chilkat.Zip() - - - Dim success = zipFile.NewZip(fileNamePDFAttZIP) - If (success = False) Then - Debug.WriteLine(zipFile.LastErrorText) - Exit Sub - End If - Dim saveExtraPath As Boolean = False - success = zipFile.AppendFiles(pdfPathfinished, saveExtraPath) - If (success = False) Then - fileZipped = False - End If - - - success = zipFile.WriteZipAndClose() - If (success = False) Then - fileZipped = False - End If - - If fileZipped Then - ' app.DocumentCopy.Add(New DocumentCopy With { - '.Bifa_atasament = 1, - '.Document = New DocumentFile With { - ' .FileName = fileNamePDFAttZIP, - ' .FileType = "application/zip", - ' .FileDescription = "INVOICES/POA" - '} - '}) - End If - - End If - - - End If - ' ========================= ' 5️⃣ XML erzeugen ' ========================= @@ -4470,17 +4706,557 @@ Public Class frmMDM_USTVAntrag Console.WriteLine(xmlString) System.IO.File.WriteAllText(filePath, xmlString) - Me.Cursor = Cursors.Default + Dim pdfFileName = fullFilePath.Replace(".xml", ".pdf") + If File.Exists(pdfFileName) Then + File.Delete(pdfFileName) + End If + + + If list.Count > 1 Then + + If FormularManagerNEU.MergePdfFiles(list, pdfFileName) Then + Process.Start(pdfFileName) + End If + ElseIf list.Count = 1 Then + Dim PDFFile As String = list(0) + System.IO.File.Move(PDFFile, pdfFileName) + + End If Catch ex As Exception VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) - Me.Cursor = Cursors.Default End Try + End Function + + Private Function getLeistungsTyp(LeistungsBez As String, SchnittstellenNr As Integer) As List(Of String) + + Dim list As New List(Of String) + + + LeistungsBez = LeistungsBez.ToLower + + If SchnittstellenNr = 10 Then + 'UTA überspringen + ElseIf SchnittstellenNr = 9 Then + LeistungsBez = "maut" 'MSE immer MAUT + Else + If LeistungsBez.Contains("maut") Or LeistungsBez.Contains("toll") Then + list.Add("maut") + End If + If LeistungsBez.Contains("diesel") Or LeistungsBez.Contains("fuel") Then + list.Add("diesel") + End If + If LeistungsBez.Contains("parkplatz") Then + list.Add("parkplatz") + End If + If LeistungsBez.Contains("zubeh") Then + list.Add("zubehör") + End If + If LeistungsBez.Contains("übern") Then + list.Add("übernachtung") + End If + + End If + + Return list + + End Function + + Private Sub getCode(ByRef AntragLand As String, ByRef typ As String, ByRef Code As Integer, ByRef SubCode As String, Optional Portal As String = "") + + If Portal = "RO" Then + Select Case typ + Case "diesel" + Code = 1 + SubCode = "1.1.2" + + Case "maut" + Code = 4 + SubCode = "4.1" + Case "zubehör" + Code = 3 + SubCode = "3.1.5" + Case "parkplatz" + Code = 3 + SubCode = "3.1.4" + Case "übernachtung" + Code = 6 + SubCode = "6.5" + End Select + Exit Sub + End If + + + If Portal = "DE" Then + Select Case typ + Case "diesel" + Code = 1 + SubCode = "1.1.2" + Case "maut" + Code = 4 + SubCode = "4.1" + Case "zubehör" + Code = 3 + SubCode = "3.1.3" + Case "parkplatz" + Code = 3 + SubCode = "3.1.4" + Case "übernachtung" + Code = 6 + SubCode = "6.1" + End Select + Exit Sub + End If + + + Select Case AntragLand + + Case "AT" + If typ = "diesel" Then + Code = 1 + SubCode = "1.2.7" + End If + If typ = "maut" Then + Code = 4 + SubCode = "4.1" + End If + If typ = "parken" Then + Code = 3 + SubCode = "3.1" + End If + If typ = "zubehör" Then + Code = 3 + SubCode = "1.3" + End If + + Case "BE" + If typ = "diesel" Then + Code = 1 + SubCode = "1.13" + End If + If typ = "maut" Then + Code = 4 + SubCode = "" + End If + + If typ = "rest" Then + Code = 3 + SubCode = "3.13" + End If + + Case "ES" + If typ = "diesel" Then + Code = 1 + SubCode = "1.14" + End If + If typ = "maut" Then + Code = 4 + SubCode = "" + End If + + Case "SI" + If typ = "diesel" Then + Code = 1 + SubCode = "1.1" + End If + If typ = "maut" Then + Code = 4 + SubCode = "4.1" + End If + + Case "PL" + If typ = "diesel" Then + Code = 1 + SubCode = "1.1.2" + End If + If typ = "maut" Then + Code = 4 + SubCode = "4.2.2" + End If + + Case "FR", "IT" + If typ = "diesel" Then + Code = 1 + SubCode = "1.1.2" + End If + If typ = "maut" Then + Code = 4 + SubCode = "" + End If + + Case "HU" + If typ = "diesel" Then + Code = 1 + SubCode = "1.1.2" + End If + If typ = "maut" Then + Code = 4 + SubCode = "4.1" + End If + + Case "DK" + If typ = "diesel" Then + Code = 1 + SubCode = "1.1" + End If + If typ = "maut" Then + Code = 4 + SubCode = "" + End If + + Case "SE" + If typ = "diesel" Then + Code = 1 + SubCode = "" + End If + If typ = "maut" Then + Code = 4 + SubCode = "5" + End If + + Case "DE", "CZ", "LU" + If typ = "diesel" Then + Code = 1 + SubCode = "" + End If + If typ = "maut" Then + Code = 4 + SubCode = "" + End If + + Case "BG", "IE", "PT" + If typ = "diesel" Then + Code = 1 + SubCode = "1.1.2" + End If + If typ = "maut" Then + Code = 4 + SubCode = "4.1" + End If + + Case Else + + If typ = "diesel" Then + Code = 1 + SubCode = "" + End If + If typ = "maut" Then + Code = 4 + SubCode = "" + End If + + End Select + + + End Sub + + Private Function createCSVforDE(ADR As cAdressen, KUNDE As cKunde, KUNDE_ERW As cKundenErweitert, FIRMA As cFirmen, BANK_OWNER As String, BANK_IBAN As String, BANK_BIC As String, filename As String, filePath As String) + + Try + + + Dim sPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\VERAG\SDL\tmp\" + If Not My.Computer.FileSystem.DirectoryExists(sPath) Then + My.Computer.FileSystem.CreateDirectory(sPath) + End If + + + Dim exclApp As Object 'as Application + Dim Datei As Object 'as WorkBook + Dim Blatt As Object 'Microsoft.Office.Interop.Excel.Worksheet 'As Object 'as Worksheet + exclApp = CreateObject("Excel.Application") + + With exclApp + .Visible = False + + Try + filePath = sPath & filename + + 'If File.Exists(filePath) Then + ' File.Delete(filePath) + 'End If + + My.Computer.FileSystem.WriteAllBytes(filePath, My.Resources.Ustveu_Rechnungsanlagen_DE, False) + + Catch ex As System.Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + Me.Cursor = Cursors.Default + Return False + + End Try + + Datei = .Workbooks.Open(filePath) 'Anpassen + Blatt = Datei.Worksheets(1) 'Anpassen + + + Dim counter As Integer = 1 + Dim counterLeistungen As Integer = 1 + + For Each row As DataGridViewRow In dgvUSTVPositionen.SelectedRows.Cast(Of DataGridViewRow)().OrderBy(Function(dgvr) dgvr.Index) + + Dim UIDNrLeistender = "" + Dim LeistenderName As String = "" + Dim listOfLeistungstyp As New List(Of String) + + Dim Strasse As String = "" + If Not IsDBNull(row.Cells("UstV_Leistender_Strasse").Value) AndAlso row.Cells("UstV_Leistender_Strasse").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_Strasse").Value <> "" Then Strasse = row.Cells("UstV_Leistender_Strasse").Value + + Dim Ort As String = "" + If Not IsDBNull(row.Cells("UstV_Leistender_Stadt").Value) AndAlso row.Cells("UstV_Leistender_Stadt").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_Stadt").Value <> "" Then Ort = row.Cells("UstV_Leistender_Stadt").Value + + Dim PLZ As String = "" + If Not IsDBNull(row.Cells("UstV_Leistender_PLZ").Value) AndAlso row.Cells("UstV_Leistender_PLZ").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_PLZ").Value <> "" Then PLZ = row.Cells("UstV_Leistender_PLZ").Value + + If Not IsDBNull(row.Cells("UstV_Leistender_UstNr").Value) AndAlso row.Cells("UstV_Leistender_UstNr").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_UstNr").Value <> "" Then + UIDNrLeistender = row.Cells("UstV_Leistender_UstNr").Value + 'UIDNrLeistender = UIDNrLeistender.ToString.Replace(Antrag_LandKz, "") DEU wollen das Land dabei! + End If + + LeistenderName = row.Cells("UStVPo_Leistender").Value + LeistenderName = LeistenderName.ToString.Replace(Antrag_LandKz, "") + + Dim Nettobetrag As Double = 0 + If Not IsDBNull(row.Cells("UStVPo_Nettobetrag").Value) AndAlso IsNumeric(row.Cells("UStVPo_Nettobetrag").Value) Then Nettobetrag = CDbl(row.Cells("UStVPo_Nettobetrag").Value) + + Dim Steuerbetrag As Double = 0 + If Not IsDBNull(row.Cells("UStVPo_USteuerbetrag").Value) AndAlso IsNumeric(row.Cells("UStVPo_USteuerbetrag").Value) Then Steuerbetrag = CDbl(row.Cells("UStVPo_USteuerbetrag").Value) + + Dim land = row.Cells("UstV_Leistender_Land").Value + Dim iso2Land = "" + + If land.Length = 2 Then + iso2Land = land + ElseIf land.Length = 3 Then + iso2Land = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromISO3Land(land) + ElseIf land.Length = 1 Then + iso2Land = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromISO1Land(land) + End If + + + + + Blatt.Range("A" & counter + 1).Value = counter + Blatt.Range("B" & counter + 1).Value = CDate(row.Cells("UStVPo_ReDat").Value).ToString("dd.MM.yyyy") + Blatt.Range("C" & counter + 1).Value = row.Cells("UStVPo_ReNr").Value + Blatt.Range("D" & counter + 1).Value = Nettobetrag.ToString("0.00", CultureInfo.InvariantCulture) + Blatt.Range("E" & counter + 1).Value = Steuerbetrag.ToString("0.00", CultureInfo.InvariantCulture) + Blatt.Range("F" & counter + 1).Value = Steuerbetrag.ToString("0.00", CultureInfo.InvariantCulture) + Blatt.Range("H" & counter + 1).Value = "false" + Blatt.Range("I" & counter + 1).Value = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(LeistenderName) + Blatt.Range("J" & counter + 1).Value = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(Strasse) + Blatt.Range("M" & counter + 1).Value = PLZ + Blatt.Range("N" & counter + 1).Value = Ort + Blatt.Range("O" & counter + 1).Value = iso2Land + Blatt.Range("P" & counter + 1).Value = UIDNrLeistender + + Datei.Save + + Blatt = Datei.Worksheets(2) + + If Not IsDBNull(row.Cells("UStVPo_Leistungsbezeichnung").Value) AndAlso row.Cells("UStVPo_Leistungsbezeichnung").Value IsNot Nothing Then + + + + listOfLeistungstyp = getLeistungsTyp(row.Cells("UStVPo_Leistungsbezeichnung").Value, row.Cells("UStVPo_SchnittstellenNr").Value) + If listOfLeistungstyp.Count > 0 Then + For Each listEntry In listOfLeistungstyp + + Dim code As Integer = 0 + Dim Subcode = "" + getCode(Antrag_LandKz, listEntry, code, Subcode, "DE") + + Blatt.Range("A" & counterLeistungen + 1).Value = counter + Blatt.Range("B" & counterLeistungen + 1).Value = Subcode 'nur Subcodes! + counterLeistungen += 1 + + Next + End If + + + End If + + + Datei.Save + + + Blatt = Datei.Worksheets(1) + + + counter += 1 + + Next + + Datei.Save + + .Visible = True + + + End With + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Me.Cursor = Cursors.Default + + + End Function + + + Private Function createCSVforBE(ADR As cAdressen, KUNDE As cKunde, KUNDE_ERW As cKundenErweitert, FIRMA As cFirmen, BANK_OWNER As String, BANK_IBAN As String, BANK_BIC As String, filename As String, filePath As String) + + Try + + + Dim sPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\VERAG\SDL\tmp\" + If Not My.Computer.FileSystem.DirectoryExists(sPath) Then + My.Computer.FileSystem.CreateDirectory(sPath) + End If + + + Dim exclApp As Object 'as Application + Dim Datei As Object 'as WorkBook + Dim Blatt As Object 'Microsoft.Office.Interop.Excel.Worksheet 'As Object 'as Worksheet + exclApp = CreateObject("Excel.Application") + + With exclApp + .Visible = False + + Try + filePath = sPath & filename + + 'If File.Exists(filePath) Then + ' File.Delete(filePath) + 'End If + + My.Computer.FileSystem.WriteAllBytes(filePath, My.Resources.Ustveu_Rechnungsanlagen_BE, False) + + Catch ex As System.Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + Me.Cursor = Cursors.Default + Return False + + End Try + + Datei = .Workbooks.Open(filePath) 'Anpassen + Blatt = Datei.Worksheets(1) 'Anpassen + + + Dim counter As Integer = 1 + Dim zeile As Integer = 3 + Dim counterLeistungen As Integer = 1 + + For Each row As DataGridViewRow In dgvUSTVPositionen.SelectedRows.Cast(Of DataGridViewRow)().OrderBy(Function(dgvr) dgvr.Index) + + Dim UIDNrLeistender = "" + Dim LeistenderName As String = "" + Dim listOfLeistungstyp As New List(Of String) + + Dim Strasse As String = "" + If Not IsDBNull(row.Cells("StrasseOnly").Value) AndAlso row.Cells("StrasseOnly").Value IsNot Nothing AndAlso row.Cells("StrasseOnly").Value <> "" Then Strasse = row.Cells("StrasseOnly").Value + + Dim StrasseNR As String = "" + If Not IsDBNull(row.Cells("StrassenNrOnly").Value) AndAlso row.Cells("StrassenNrOnly").Value IsNot Nothing AndAlso row.Cells("StrassenNrOnly").Value <> "" Then StrasseNR = row.Cells("StrassenNrOnly").Value + + Dim Ort As String = "" + If Not IsDBNull(row.Cells("UstV_Leistender_Stadt").Value) AndAlso row.Cells("UstV_Leistender_Stadt").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_Stadt").Value <> "" Then Ort = row.Cells("UstV_Leistender_Stadt").Value + + Dim PLZ As String = "" + If Not IsDBNull(row.Cells("UstV_Leistender_PLZ").Value) AndAlso row.Cells("UstV_Leistender_PLZ").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_PLZ").Value <> "" Then PLZ = row.Cells("UstV_Leistender_PLZ").Value + + If Not IsDBNull(row.Cells("UstV_Leistender_UstNr").Value) AndAlso row.Cells("UstV_Leistender_UstNr").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_UstNr").Value <> "" Then + UIDNrLeistender = row.Cells("UstV_Leistender_UstNr").Value + 'UIDNrLeistender = UIDNrLeistender.ToString.Replace(Antrag_LandKz, "") DEU wollen das Land dabei! + End If + + LeistenderName = row.Cells("UStVPo_Leistender").Value + LeistenderName = LeistenderName.ToString.Replace(Antrag_LandKz, "") + + Dim Nettobetrag As Double = 0 + If Not IsDBNull(row.Cells("UStVPo_Nettobetrag").Value) AndAlso IsNumeric(row.Cells("UStVPo_Nettobetrag").Value) Then Nettobetrag = CDbl(row.Cells("UStVPo_Nettobetrag").Value) + + Dim Steuerbetrag As Double = 0 + If Not IsDBNull(row.Cells("UStVPo_USteuerbetrag").Value) AndAlso IsNumeric(row.Cells("UStVPo_USteuerbetrag").Value) Then Steuerbetrag = CDbl(row.Cells("UStVPo_USteuerbetrag").Value) + + Dim land = "" + Dim iso2Land = "" + If Not IsDBNull(row.Cells("UstV_Leistender_Land").Value) AndAlso row.Cells("UstV_Leistender_Land").Value IsNot Nothing AndAlso row.Cells("UstV_Leistender_Land").Value <> "" Then land = row.Cells("UstV_Leistender_Land").Value + + If land.Length = 2 Then + iso2Land = land + ElseIf land.Length = 3 Then + iso2Land = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromISO3Land(land) + ElseIf land.Length = 1 Then + iso2Land = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromISO1Land(land) + End If + + + Blatt.Range("A" & zeile).Value = counter + Blatt.Range("C" & zeile).Value = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(LeistenderName) + Blatt.Range("D" & zeile).Value = UIDNrLeistender + Blatt.Range("E" & zeile).Value = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(Strasse) + Blatt.Range("F" & zeile).Value = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(StrasseNR) + Blatt.Range("G" & zeile).Value = PLZ + Blatt.Range("H" & zeile).Value = Ort + Blatt.Range("I" & zeile).Value = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getLandEnglFromISO2Land(iso2Land) 'Funktion der das Land auf englisch zurückgibt + Blatt.Range("J" & zeile).Value = "Purchase" + Blatt.Range("K" & zeile).Value = "Normal" + Blatt.Range("L" & zeile).Value = CDate(row.Cells("UStVPo_ReDat").Value).ToString("dd.MM.yyyy") + Blatt.Range("M" & zeile).Value = row.Cells("UStVPo_ReNr").Value + Blatt.Range("N" & zeile).Value = Nettobetrag.ToString("0.00", CultureInfo.InvariantCulture) + Blatt.Range("O" & zeile).Value = Steuerbetrag.ToString("0.00", CultureInfo.InvariantCulture) + Blatt.Range("P" & zeile).Value = Steuerbetrag.ToString("0.00", CultureInfo.InvariantCulture) + + If Not IsDBNull(row.Cells("UStVPo_Leistungsbezeichnung").Value) AndAlso row.Cells("UStVPo_Leistungsbezeichnung").Value IsNot Nothing Then + + listOfLeistungstyp = getLeistungsTyp(row.Cells("UStVPo_Leistungsbezeichnung").Value, row.Cells("UStVPo_SchnittstellenNr").Value) + + Dim typeOfGoodsAndService As String = "" + If listOfLeistungstyp.Count > 0 Then + Select Case listOfLeistungstyp(0) + Case "maut" : typeOfGoodsAndService = "Road tolls and road user charge" + Case "diesel" : typeOfGoodsAndService = "Fuel" + Case "rest" : typeOfGoodsAndService = "Other" + Case "übernachtung" : typeOfGoodsAndService = "Accommodation" + Case "zubehör" : typeOfGoodsAndService = "Other" + Case "parkplatz" : typeOfGoodsAndService = "Travel expenses, such as taxi fares, public transport fares" + End Select + End If + + + Blatt.Range("B" & zeile).Value = typeOfGoodsAndService + + End If + + Datei.Save + + + counter += 1 + zeile += 1 + + Next + + Datei.Save + + .Visible = True + + + End With + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Me.Cursor = Cursors.Default + + + End Function + Private Function PDFInvoicesPath(ByRef posId As String) As String diff --git a/SDL/USTV/usrCntlUSTV.Designer.vb b/SDL/USTV/usrCntlUSTV.Designer.vb index d623e959..9b96f204 100644 --- a/SDL/USTV/usrCntlUSTV.Designer.vb +++ b/SDL/USTV/usrCntlUSTV.Designer.vb @@ -23,12 +23,13 @@ Partial Class usrCntlUSTV Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(usrCntlUSTV)) Me.pnlFilter = New System.Windows.Forms.Panel() Me.dgvUSTV = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components) Me.Label1 = New System.Windows.Forms.Label() Me.Panel1 = New System.Windows.Forms.Panel() + Me.btnoffeneAntraege = New System.Windows.Forms.Button() Me.txtSucheID = New System.Windows.Forms.TextBox() Me.MyComboBox1 = New VERAG_PROG_ALLGEMEIN.MyComboBox() Me.Label12 = New System.Windows.Forms.Label() @@ -84,7 +85,7 @@ Partial Class usrCntlUSTV Me.ContextMenuStrip2 = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ContextMenuStrip3 = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ContextMenuStrip4 = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.btnoffeneAntraege = New System.Windows.Forms.Button() + Me.btn_Zahlungen_importieren = New System.Windows.Forms.Button() CType(Me.dgvUSTV, System.ComponentModel.ISupportInitialize).BeginInit() Me.Panel1.SuspendLayout() Me.Panel2.SuspendLayout() @@ -106,8 +107,8 @@ Partial Class usrCntlUSTV Me.dgvUSTV.AKTUALISIERUNGS_INTERVALL = -1 Me.dgvUSTV.AllowUserToAddRows = False Me.dgvUSTV.AllowUserToDeleteRows = False - DataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvUSTV.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle3 + DataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvUSTV.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle2 Me.dgvUSTV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvUSTV.Dock = System.Windows.Forms.DockStyle.Fill Me.dgvUSTV.Location = New System.Drawing.Point(0, 108) @@ -178,6 +179,18 @@ Partial Class usrCntlUSTV Me.Panel1.Size = New System.Drawing.Size(1737, 108) Me.Panel1.TabIndex = 0 ' + 'btnoffeneAntraege + ' + Me.btnoffeneAntraege.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnoffeneAntraege.ForeColor = System.Drawing.Color.Black + Me.btnoffeneAntraege.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft + Me.btnoffeneAntraege.Location = New System.Drawing.Point(806, 24) + Me.btnoffeneAntraege.Name = "btnoffeneAntraege" + Me.btnoffeneAntraege.Size = New System.Drawing.Size(83, 40) + Me.btnoffeneAntraege.TabIndex = 79 + Me.btnoffeneAntraege.Text = "offene Anträge" + Me.btnoffeneAntraege.UseVisualStyleBackColor = True + ' 'txtSucheID ' Me.txtSucheID.Location = New System.Drawing.Point(554, 36) @@ -780,6 +793,7 @@ Partial Class usrCntlUSTV 'Panel3 ' Me.Panel3.AutoSize = True + Me.Panel3.Controls.Add(Me.btn_Zahlungen_importieren) Me.Panel3.Controls.Add(Me.btn3470) Me.Panel3.Controls.Add(Me.Button4) Me.Panel3.Controls.Add(Me.btnVZ) @@ -940,17 +954,20 @@ Partial Class usrCntlUSTV Me.ContextMenuStrip4.Name = "ContextMenuStrip1" Me.ContextMenuStrip4.Size = New System.Drawing.Size(61, 4) ' - 'btnoffeneAntraege + 'btn_Zahlungen_importieren ' - Me.btnoffeneAntraege.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.btnoffeneAntraege.ForeColor = System.Drawing.Color.Black - Me.btnoffeneAntraege.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.btnoffeneAntraege.Location = New System.Drawing.Point(806, 24) - Me.btnoffeneAntraege.Name = "btnoffeneAntraege" - Me.btnoffeneAntraege.Size = New System.Drawing.Size(83, 40) - Me.btnoffeneAntraege.TabIndex = 79 - Me.btnoffeneAntraege.Text = "offene Anträge" - Me.btnoffeneAntraege.UseVisualStyleBackColor = True + Me.btn_Zahlungen_importieren.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btn_Zahlungen_importieren.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!) + Me.btn_Zahlungen_importieren.ForeColor = System.Drawing.Color.Black + Me.btn_Zahlungen_importieren.Image = Global.SDL.My.Resources.Resources.Excel_logo + Me.btn_Zahlungen_importieren.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft + Me.btn_Zahlungen_importieren.Location = New System.Drawing.Point(665, 6) + Me.btn_Zahlungen_importieren.Name = "btn_Zahlungen_importieren" + Me.btn_Zahlungen_importieren.Size = New System.Drawing.Size(132, 40) + Me.btn_Zahlungen_importieren.TabIndex = 31 + Me.btn_Zahlungen_importieren.Text = "Erstattungspos. importieren" + Me.btn_Zahlungen_importieren.TextAlign = System.Drawing.ContentAlignment.MiddleRight + Me.btn_Zahlungen_importieren.UseVisualStyleBackColor = True ' 'usrCntlUSTV ' @@ -1030,4 +1047,5 @@ Partial Class usrCntlUSTV Friend WithEvents btn3470 As Button Friend WithEvents ContextMenuStrip4 As ContextMenuStrip Friend WithEvents btnoffeneAntraege As Button + Friend WithEvents btn_Zahlungen_importieren As Button End Class diff --git a/SDL/USTV/usrCntlUSTV.vb b/SDL/USTV/usrCntlUSTV.vb index 558945ef..d0c00a26 100644 --- a/SDL/USTV/usrCntlUSTV.vb +++ b/SDL/USTV/usrCntlUSTV.vb @@ -1,4 +1,7 @@ Imports System.ComponentModel +Imports System.Linq.Expressions +Imports System.Text +Imports GrapeCity.DataVisualization.TypeScript Imports Microsoft.Office.Interop Imports VERAG_PROG_ALLGEMEIN @@ -729,10 +732,10 @@ Public Class usrCntlUSTV MsgBox("Funktion nicht implementiert!") - End If - End If + End If + End Sub @@ -1745,4 +1748,273 @@ Public Class usrCntlUSTV cbxDifferenzbetrag.CheckState = CheckState.Checked init(,,, True) End Sub + + Private Sub btn_Zahlungen_importieren_Click(sender As Object, e As EventArgs) Handles btn_Zahlungen_importieren.Click + Dim sql As New VERAG_PROG_ALLGEMEIN.SQL + + Try + + Dim fd As New OpenFileDialog + fd.InitialDirectory = "\\share01.verag.ost.dmn\F\19 VERAG 360 - MDM\MWST Eingänge\" + fd.Filter = "Excel Dateien (*.xlsx)|*.xlsx" + + If fd.ShowDialog() <> DialogResult.OK Then Exit Sub + + If Not fd.FileName.ToUpper().EndsWith(".XLSX") Then + MessageBox.Show("Bitte eine XLSX-Datei auswählen.") + Exit Sub + End If + + Dim exclApp As Object = Nothing + Dim Datei As Object = Nothing + Dim Blatt As Object = Nothing + + Dim dt As New DataTable + + If dt IsNot Nothing And Not dt.Columns.Contains("name") Then + + dt.Columns.Add("AntragID", GetType(String)) + dt.Columns.Add("Steuerbetrag", GetType(Double)) + dt.Columns.Add("Bank", GetType(String)) + dt.Columns.Add("BelegNr", GetType(String)) + dt.Columns.Add("GS", GetType(String)) + dt.Columns.Add("RZVZ", GetType(String)) + dt.Columns.Add("Info", GetType(String)) + dt.Columns.Add("3470", GetType(String)) + + End If + + + Try + + exclApp = CreateObject("Excel.Application") + exclApp.DisplayAlerts = False + exclApp.CutCopyMode = False + + Datei = exclApp.Workbooks.Open(fd.FileName) + Blatt = Datei.Worksheets(1) + + ' Header einlesen + Dim headerMap As New Dictionary(Of String, Integer)(StringComparer.OrdinalIgnoreCase) + + For col As Integer = 1 To Blatt.UsedRange.Columns.Count + + Dim header As String = Convert.ToString(Blatt.Cells(3, col).Value).Trim() + + If header <> "" AndAlso Not headerMap.ContainsKey(header) Then + headerMap.Add(header, col) + End If + + Next + + ' Pflichtspalten prüfen + Dim requiredHeaders As String() = { + "ID", + "Steuerbetrag", + "BANK", + "BelNr", + "GS", + "RZVZ", + "3470", + "INFO" + } + + For Each h As String In requiredHeaders + + If Not headerMap.ContainsKey(h) Then + MsgBox("Pflichtspalte nicht gefunden: " & h) + Exit Sub + End If + + Next + + Dim letzteZeile As Integer = Blatt.UsedRange.Rows.Count + + For row As Integer = 4 To letzteZeile + + Dim USTAV_ID As String = + getTrimedString(Convert.ToString(Blatt.Cells(row, headerMap("ID")).Value), 6) + + Dim Zahlungsbetrag As String = + Convert.ToString(Blatt.Cells(row, headerMap("Steuerbetrag")).Value) + + Dim Kuerzel As String = + getTrimedString(Convert.ToString(Blatt.Cells(row, headerMap("Spalte1")).Value), 6) + + Dim Bank As String = + Convert.ToString(Blatt.Cells(row, headerMap("BANK")).Value) + + Dim GS As String = + Convert.ToString(Blatt.Cells(row, headerMap("GS")).Value) + + Dim RZVZ As String = + Convert.ToString(Blatt.Cells(row, headerMap("RZVZ")).Value) + + Dim INFO As String = + Convert.ToString(Blatt.Cells(row, headerMap("INFO")).Value) + + Dim _3470 As String = + Convert.ToString(Blatt.Cells(row, headerMap("3470")).Value) + + If String.IsNullOrWhiteSpace(USTAV_ID) Then + Continue For + End If + + If IsNumeric(USTAV_ID) AndAlso Bank <> "" AndAlso IsNumeric(Bank) AndAlso GS <> "" Then + + + Dim R As DataRow = dt.NewRow + R("AntragID") = USTAV_ID + R("Steuerbetrag") = Zahlungsbetrag + R("Bank") = Bank + R("BelegNr") = Kuerzel + R("GS") = GS + R("RZVZ") = RZVZ + R("Info") = INFO + + dt.Rows.Add(R) + End If + + + Next + + If dt.Rows.Count > 0 Then + + If vbYes = MsgBox("Es wurden " & dt.Rows.Count & " Datensätze erkannt. " & vbNewLine & "Sollen diese eingearbeitet werden?", vbYesNoCancel) Then + + For Each r As DataRow In dt.Rows + + Dim USTV_ANTRAG = New VERAG_PROG_ALLGEMEIN.cUSTVAntrag(r.Item("AntragID")) + + If USTV_ANTRAG.hasEntry Then + + Select Case r.Item("3470").ToString.ToLower + Case "ja" + If Not USTV_ANTRAG.UStVAn_3470 Then + USTV_ANTRAG.UStVAn_3470 = True + USTV_ANTRAG.SAVE() + End If + + 'Case "nein" + ' If USTV_ANTRAG.UStVAn_3470 Then + ' USTV_ANTRAG.UStVAn_3470 = False + ' USTV_ANTRAG.SAVE() + ' End If + + End Select + + + + Dim UStV_ERS = New VERAG_PROG_ALLGEMEIN.cUStVErstattungPositionen() + UStV_ERS.UStVEr_ID = USTV_ANTRAG.getMaxPosNrErst() + UStV_ERS.UStVEr_interneNr = USTV_ANTRAG.getMaxinternePosNrErst() + + End If + + Next + + Else + Exit Sub + + End If + End If + + + Finally + + If Datei IsNot Nothing Then + Datei.Close(False) + End If + + If exclApp IsNot Nothing Then + exclApp.Quit() + End If + + If Blatt IsNot Nothing Then + Runtime.InteropServices.Marshal.ReleaseComObject(Blatt) + End If + + If Datei IsNot Nothing Then + Runtime.InteropServices.Marshal.ReleaseComObject(Datei) + End If + + If exclApp IsNot Nothing Then + Runtime.InteropServices.Marshal.ReleaseComObject(exclApp) + End If + + Blatt = Nothing + Datei = Nothing + exclApp = Nothing + + GC.Collect() + GC.WaitForPendingFinalizers() + + End Try + + Catch ex As Exception + + MessageBox.Show(ex.Message & Environment.NewLine & ex.StackTrace) + + End Try + + Me.Refresh() + + + + End Sub + + Function getTrimedString(s As String, l As Integer) As String + Try + If s Is Nothing Then Return "" + If s.ToString.Length > l Then + Return s.Substring(0, l) + End If + Return s.ToString + + Catch ex As Exception + MsgBox("getTrimedString: " & ex.Message & ex.StackTrace) + End Try + Return "" + End Function + Function getTrimedStringACCES(s As Object, l As Integer) As String + + Try + If s Is Nothing Then Return "" + If s Is DBNull.Value Then Return "" + If s.ToString.Length > l Then + Return s.Substring(0, l) + End If + Return s + + Catch ex As Exception + MsgBox("getTrimedString: " & ex.Message & ex.StackTrace) + End Try + Return "" + End Function + Function getTrimedStringACCESEUR(s As Object, l As Integer) As String + + Try + If s Is Nothing Then Return "" + If s Is DBNull.Value Then Return "" + If s.ToString.Length > l Then + Return s.Substring(0, l) + End If + + If IsNumeric(s) Then + Return CDbl(s).ToString("C2") + End If + + Return s + + Catch ex As Exception + MsgBox("getTrimedString: " & ex.Message & ex.StackTrace) + End Try + Return "" + End Function + + Function isleernothing(s) As Object + If s Is DBNull.Value Then Return Nothing + If s.ToString.Trim = "" Then Return Nothing + Return s.trim + End Function End Class diff --git a/SDL/ZOLLSYSTEM/DAKOSY/ATLAS/Verwahrung/usrCntlATLAS_AnkunftsAnzeige.vb b/SDL/ZOLLSYSTEM/DAKOSY/ATLAS/Verwahrung/usrCntlATLAS_AnkunftsAnzeige.vb index 7a4cafb3..cd9d4f34 100644 --- a/SDL/ZOLLSYSTEM/DAKOSY/ATLAS/Verwahrung/usrCntlATLAS_AnkunftsAnzeige.vb +++ b/SDL/ZOLLSYSTEM/DAKOSY/ATLAS/Verwahrung/usrCntlATLAS_AnkunftsAnzeige.vb @@ -389,7 +389,7 @@ Public Class usrCntlATLAS_AnkunftsAnzeige If valueREF <> "" Then Dim DAKOSY_REF As New cDakosy_Stammreferenzen(valueREF) - If DAKOSY_REF IsNot Nothing Then + If DAKOSY_REF IsNot Nothing AndAlso DAKOSY_REF.dySr_WarenortID IsNot Nothing AndAlso IsNumeric(DAKOSY_REF.dySr_WarenortID) Then txtWO_ID.Text = DAKOSY_REF.dySr_WarenortID.ToString If DAKOSY_REF.dySr_WarenortID > 0 Then txtWarenort.Text = (New SQL).getValueTxtBySql("SELECT [wo_warenort] from [tblWarenorte] where [wo_id] = " & DAKOSY_REF.dySr_WarenortID, "AVISO") @@ -397,6 +397,7 @@ Public Class usrCntlATLAS_AnkunftsAnzeige End If Else txtWarenort.Text = "" + txtWO_ID.Text = "" End If diff --git a/SDL/buchhaltung/frmBU_Mahnlauf.vb b/SDL/buchhaltung/frmBU_Mahnlauf.vb index 558247f5..d430cb13 100644 --- a/SDL/buchhaltung/frmBU_Mahnlauf.vb +++ b/SDL/buchhaltung/frmBU_Mahnlauf.vb @@ -1708,7 +1708,7 @@ Public Class frmBU_Mahnlauf 'noch keine Unterscheidung der Abteilungen bei MDM, daher hardcodiert. Dim MautVertrMail = "z.batinic@verag.ag;alex@verag.ag;maut.ro@verag.ag;ma@verag.ag;n.ljubas@verag.ag;s.vidovic@verag.ag;" - Dim MautFaktMail = "s.kriegner@verag.ag;" + Dim MautFaktMail = "s.kriegner@verag.ag;mmdabrechnung@verag.ag;" Select Case cbxKontotyp._value Case "A" : Mail.To = MautVertrMail & MautFaktMail diff --git a/SDL/cProgramFunctions.vb b/SDL/cProgramFunctions.vb index 902baf7b..1ce05d53 100644 --- a/SDL/cProgramFunctions.vb +++ b/SDL/cProgramFunctions.vb @@ -1,4 +1,5 @@ Imports System.ComponentModel +Imports System.Data.SqlClient Imports System.Reflection Imports System.Text.RegularExpressions Imports System.Threading @@ -317,7 +318,7 @@ Public Class cProgramFunctions Case 1, 7 : Return openThereforeNavigatorZollvollmachten_DE(KundenNr) Case 2, 8 : Return openThereforeNavigatorFiskalVM_DE(KundenNr) Case 4, 9 : Return openThereforeNavigatorFiskalVM_AT(KundenNr) - Case 12, 13 : Return openThereforeNavigatorVM_AT(KundenNr) + 'Case 12, 13 : Return openThereforeNavigatorVM_AT(KundenNr) End Select Return False End Function @@ -395,28 +396,74 @@ Public Class cProgramFunctions End Function - Shared Function openThereforeNavigatorVM_AT(KundenNr As String) - Try - Dim srch = KundenNr & "%" - Dim docid As String = "" - docid = SQL_VERAG.getValueTxtBySql("SELECT TOP 1 isnull([DocNo],-1) FROM [Therefore].[dbo].[TheCat76] WHERE [String] LIKE '" & srch & "' ORDER BY [Eingabedatum] DESC", "SCANCANON") + Public Shared Function ValidateSQLFieldLengths(parameters As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable), tableName As String, Info As String, Optional conn_art As String = "FMZOLL", Optional showError As Boolean = True) As Boolean + + Try + + Dim sql As String = + "SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" & tableName & "' AND DATA_TYPE IN ('varchar','nvarchar','char','nchar')" + + Dim dt As DataTable = + (New SQL).loadDgvBySql(sql, conn_art) + + If dt Is Nothing Then Return False + + Dim fieldLengths As New Dictionary(Of String, Integer)(StringComparer.OrdinalIgnoreCase) + + For Each r As DataRow In dt.Rows + + fieldLengths(r!COLUMN_NAME.ToString) = + CInt(r!CHARACTER_MAXIMUM_LENGTH) + + Next + + Dim errors As New List(Of String) + + For Each p As SQLVariable In parameters + + If p Is Nothing Then Continue For + If p.Value() Is Nothing Then Continue For + If p.Text() Is Nothing Then Continue For + + Dim fieldName As String = p.Text().TrimStart("@"c) + + If Not fieldLengths.ContainsKey(fieldName) Then Continue For + + Dim maxLen As Integer = fieldLengths(fieldName) + + ' varchar(max) / nvarchar(max) + If maxLen = -1 Then Continue For + + Dim value As String = p.Value().ToString + + If value.Length > maxLen Then + + errors.Add(fieldName & " -> " & value.Length & "/" & maxLen) + + End If + + Next + + If errors.Count > 0 Then + Info = "Folgende SQL-Felder sind zu lang:" & vbCrLf & vbCrLf & String.Join(vbCrLf, errors) + If showError Then + MsgBox(Info, MsgBoxStyle.Exclamation) + End If + + Return False + + End If + + Return True - If IsNumeric(docid) AndAlso docid > 0 Then - ' Process.Start("theviewer.exe -" & docid) - ' Process.Start("C:\Program Files (x86)\Therefore\theviewer.exe -" & docid) - Try - Shell("C:\Program Files (x86)\Therefore\theviewer.exe -d" & docid) - Catch ex As Exception - Shell("C:\Program Files\Therefore\theviewer.exe -d" & docid) - End Try - Else - MsgBox("Das Dokument konnte nicht gefunden werden.") - End If - Return True Catch ex As Exception - MsgBox("Fehler beim Öffnen!" & vbNewLine & ex.Message & ex.StackTrace) + + MsgBox("ValidateSQLFieldLengths:" & vbCrLf & ex.Message) + + Return False + End Try - Return False + End Function Shared Function openThereforeNavigatorFiskalVM_AT(KundenNr As String) diff --git a/SDL/kassenbuch/frmBelegNeu.Designer.vb b/SDL/kassenbuch/frmBelegNeu.Designer.vb index 5a6be92f..22caeabb 100644 --- a/SDL/kassenbuch/frmBelegNeu.Designer.vb +++ b/SDL/kassenbuch/frmBelegNeu.Designer.vb @@ -1782,7 +1782,7 @@ Partial Class frmBelegNeu 'cm_FT ' Me.cm_FT.Name = "ContextMenuStrip1" - Me.cm_FT.Size = New System.Drawing.Size(61, 4) + Me.cm_FT.Size = New System.Drawing.Size(181, 26) ' 'frmBelegNeu ' diff --git a/SDL/kassenbuch/frmBelegNeu.vb b/SDL/kassenbuch/frmBelegNeu.vb index b17b04eb..5894d4b7 100644 --- a/SDL/kassenbuch/frmBelegNeu.vb +++ b/SDL/kassenbuch/frmBelegNeu.vb @@ -1705,7 +1705,8 @@ Public Class frmBelegNeu Dim verarbeitet As Boolean = False If KASSE.rksv_FT_RestServiceURL <> "" Then Dim result = cRKSV.insertRKSVFiskaltrustAsync(KASSE, KASSE.rksv_CompanyGUID, KASSE.rksv_Umsatzzaehler, BELEG.BelegDat, BELEG.Steuerschlüssel, RKSV_Beleg_Id, If(EA = "E", summeBRUTTO, summeBRUTTO * -1), TESTBUCHUNG, BELEG.POS, QR_CodeString, LastJWS) - verarbeitet = result.Result + 'result.Wait() + verarbeitet = result 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 @@ -1940,8 +1941,26 @@ Public Class frmBelegNeu cm_FT.Items.Add(ids) End If - If Not cm_FT.Items.ContainsKey("journal") Then - Dim ids = New ToolStripMenuItem() With {.Text = "Journal", .Name = "journal", .Font = New Font(Me.Font.FontFamily, Me.Font.Size)} + If Not cm_FT.Items.ContainsKey("version") Then + Dim ids = New ToolStripMenuItem() With {.Text = "Journal - Version", .Name = "version", .Font = New Font(Me.Font.FontFamily, Me.Font.Size)} + AddHandler ids.Click, AddressOf mnuItemAuftrauege_Clicked + cm_FT.Items.Add(ids) + End If + + If Not cm_FT.Items.ContainsKey("signatures") Then + Dim ids = New ToolStripMenuItem() With {.Text = "Journal - Signaturen", .Name = "signatures", .Font = New Font(Me.Font.FontFamily, Me.Font.Size)} + AddHandler ids.Click, AddressOf mnuItemAuftrauege_Clicked + cm_FT.Items.Add(ids) + End If + + If Not cm_FT.Items.ContainsKey("action") Then + Dim ids = New ToolStripMenuItem() With {.Text = "Journal - Action", .Name = "action", .Font = New Font(Me.Font.FontFamily, Me.Font.Size)} + AddHandler ids.Click, AddressOf mnuItemAuftrauege_Clicked + cm_FT.Items.Add(ids) + End If + + If Not cm_FT.Items.ContainsKey("queueitem") Then + Dim ids = New ToolStripMenuItem() With {.Text = "Journal - Queue", .Name = "queueitem", .Font = New Font(Me.Font.FontFamily, Me.Font.Size)} AddHandler ids.Click, AddressOf mnuItemAuftrauege_Clicked cm_FT.Items.Add(ids) End If @@ -1960,40 +1979,90 @@ Public Class frmBelegNeu KASSE.LOAD(cboKassen._value) - Dim client As New cFiskaltrustClient(KASSE.rksv_FT_RestServiceURL, KASSE.rksv_FT_CashboxID, KASSE.rksv_FT_AccessToken, KASSE.rksv_FT_Country) + 'Dim client As New cFiskaltrustClient(KASSE.rksv_FT_RestServiceURL, KASSE.rksv_FT_CashboxID, KASSE.rksv_FT_AccessToken, KASSE.rksv_FT_Country) + Dim client_chilkat As New cFiskaltrustClient_chilkat(KASSE.rksv_FT_RestServiceURL, KASSE.rksv_FT_CashboxID, KASSE.rksv_FT_AccessToken, KASSE.rksv_FT_Country) If item.Name = "null" Then 'beide - Dim result As String = Await client.SignNullReceiptAsync(KASSE.rksv_id) - MsgBox(result) + 'Dim result As String = Await client.SignNullReceiptAsync(KASSE.rksv_id) + + Dim result As String = client_chilkat.SignNullReceipt(KASSE.rksv_id) + + + If result <> "" Then + + MsgBox(client_chilkat.PrettyPrintJson(result)) + + End If ElseIf item.Name = "test" Then 'beide - Dim result As String = Await client.Echo(KASSE.rksv_bez & " " & KASSE.rksv_FT_Country & " - ") - MsgBox(result) + 'Dim result As String = Await client.Echo(KASSE.rksv_bez & " " & KASSE.rksv_FT_Country & " - ") + Dim result As String = client_chilkat.Echo(KASSE.rksv_bez & " " & KASSE.rksv_FT_Country & " - ") + + If result <> "" Then + + MsgBox(client_chilkat.PrettyPrintJson(result)) + + End If ElseIf item.Name = "storno" Then 'beide - Dim result As String = Await client.CancelReceiptAsync_test("-1", 100, "Cash") - MsgBox(result) + 'Dim result As String = Await client.CancelReceiptAsync_test("-1", 100, "Cash", KASSE.rksv_id) + Dim result As String = client_chilkat.ChancelReceipt_test("-1", KASSE.rksv_id) + + If result <> "" Then + + MsgBox(client_chilkat.PrettyPrintJson(result)) + + End If ElseIf item.Name = "bar" Then 'beide - Dim result As String = Await client.SignReceiptAsync_test(KASSE.rksv_id) - MsgBox(result) + 'Dim result As String = Await client.SignReceiptAsync_test(KASSE.rksv_id) + Dim result As String = client_chilkat.SignReceipt_test(KASSE.rksv_id) + + If result <> "" Then + + If vbYes = MsgBox(result & vbNewLine & vbNewLine & "Testdaten in DB speichern?", vbYesNoCancel) Then + Dim QR_CodeString As String = "" + client_chilkat.saveRKSV_FT(result, QR_CodeString) + End If + Else + Return False + End If + + + If result <> "" Then + + MsgBox(client_chilkat.PrettyPrintJson(result)) + + End If ElseIf item.Name = "monthly" Then 'beide - Dim result As String = Await client.SignClosinglReceiptAsync(item.Name, KASSE.rksv_id) - MsgBox(result) + 'Dim result As String = Await client.SignClosinglReceiptAsync(item.Name, KASSE.rksv_id) + Dim result As String = client_chilkat.SignClosingReceipt(item.Name, KASSE.rksv_id, item.Name) + + If result <> "" Then + + MsgBox(client_chilkat.PrettyPrintJson(result)) + + End If ElseIf item.Name = "daily" Then 'Nur DE If KASSE.rksv_FT_Country = "DE" Then - Dim result As String = Await client.SignClosinglReceiptAsync(item.Name, KASSE.rksv_id) - MsgBox(result) + 'Dim result As String = Await client.SignClosinglReceiptAsync(item.Name, KASSE.rksv_id) + Dim result As String = client_chilkat.SignClosingReceipt(item.Name, KASSE.rksv_id, item.Name) + + If result <> "" Then + + MsgBox(client_chilkat.PrettyPrintJson(result)) + + End If Else MsgBox("nicht für AT-Kassen möglich!") End If @@ -2001,13 +2070,31 @@ Public Class frmBelegNeu ElseIf item.Name = "yearly" Then - Dim result As String = Await client.SignClosinglReceiptAsync(item.Name, KASSE.rksv_id) - MsgBox(result) + ' Dim result As String = Await client.SignClosinglReceiptAsync(item.Name, KASSE.rksv_id) + Dim result As String = client_chilkat.SignClosingReceipt(item.Name, KASSE.rksv_id, item.Name) + If result <> "" Then - ElseIf item.Name = "journal" Then + MsgBox(client_chilkat.PrettyPrintJson(result)) - Dim result As String = Await client.Journal(2) - MsgBox(result) + End If + + ElseIf (item.Name = "version" Or item.Name = "action" Or item.Name = "signatures" Or item.Name = "queueitem") Then + + 'Dim result As String = Await client.Journal(2) + + Dim result As String = "" + Select Case item.Name + Case "version" : result = client_chilkat.Journal(FtJournalType.VersionInformation) + Case "action" : result = client_chilkat.Journal(FtJournalType.ActionJournal) + Case "signatures" : result = client_chilkat.Journal(FtJournalType.ReceiptJournal) + Case "queueitem" : result = client_chilkat.Journal(FtJournalType.QueueItemJournal) + End Select + + If result <> "" Then + + MsgBox(client_chilkat.PrettyPrintJson(result)) + + End If @@ -2019,6 +2106,8 @@ Public Class frmBelegNeu End Function + + End Class Class TestRKSVW diff --git a/SDL/kunden/frmKundenKontakteDetails.vb b/SDL/kunden/frmKundenKontakteDetails.vb index 8b316341..2ff2c3b1 100644 --- a/SDL/kunden/frmKundenKontakteDetails.vb +++ b/SDL/kunden/frmKundenKontakteDetails.vb @@ -68,13 +68,13 @@ txtPLZ.Text = If(KD_KONTAKT.kkd_PLZ, "") txtKorrAdd.Text = If(KD_KONTAKT.kkd_Firmenname, "") - Dim mailfalse = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(lblEmail.Text) + Dim mailfalse = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(lblEmail.Text) If mailfalse <> "" Then lblEmail.ForeColor = Color.Red - Dim mailfalsecc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(lblEmailCC.Text) + Dim mailfalsecc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(lblEmailCC.Text) If mailfalsecc <> "" Then lblEmail.ForeColor = Color.Red - Dim mailfalsebcc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(lblEmailBCC.Text) + Dim mailfalsebcc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(lblEmailBCC.Text) If mailfalsebcc <> "" Then lblEmail.ForeColor = Color.Red txtGebDatum.Text = IIf(Not IsDBNull(KD_KONTAKT.kkd_GebDatum) AndAlso IsDate(KD_KONTAKT.kkd_GebDatum), CDate(KD_KONTAKT.kkd_GebDatum), "") @@ -125,7 +125,7 @@ - Dim mailfalse = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(KD_KONTAKT.kkd_Email) + Dim mailfalse = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(KD_KONTAKT.kkd_Email) If mailfalse <> "" Then lblEmail.ForeColor = Color.Red MsgBox("Mailadresse: " & mailfalse & " fehlerhaft!") @@ -136,7 +136,7 @@ lblEmail.ForeColor = Color.Black End If - Dim mailfalsecc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(KD_KONTAKT.kkd_EmailCC) + Dim mailfalsecc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(KD_KONTAKT.kkd_EmailCC) If mailfalsecc <> "" Then lblEmailCC.ForeColor = Color.Red MsgBox("Mailadresse: " & mailfalsecc & " fehlerhaft!") @@ -146,7 +146,7 @@ lblEmailCC.ForeColor = Color.Black End If - Dim mailfalsebcc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(KD_KONTAKT.kkd_EmailBCC) + Dim mailfalsebcc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(KD_KONTAKT.kkd_EmailBCC) If mailfalsebcc <> "" Then lblEmailBCC.ForeColor = Color.Red MsgBox("Mailadresse: " & mailfalsebcc & " fehlerhaft!") diff --git a/SDL/kunden/usrCntlKundenKontakte.vb b/SDL/kunden/usrCntlKundenKontakte.vb index c5b739d0..1e16347a 100644 --- a/SDL/kunden/usrCntlKundenKontakte.vb +++ b/SDL/kunden/usrCntlKundenKontakte.vb @@ -45,9 +45,9 @@ Dim rowIndex As Integer = dgvAufschub.Rows.Add(r("kkd_id"), r("kkd_kkaBez"), r("kkd_Tel"), r("kkd_Email"), anspr, r("kkd_Fax")) - Dim mail As String = IIf(Not IsDBNull(r("kkd_email")), VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(r("kkd_email")), "") - Dim mailcc As String = IIf(Not IsDBNull(r("kkd_emailcc")), VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(r("kkd_emailcc")), "") - Dim mailbcc As String = IIf(Not IsDBNull(r("kkd_emailbcc")), VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(r("kkd_emailbcc")), "") + Dim mail As String = IIf(Not IsDBNull(r("kkd_email")), VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(r("kkd_email")), "") + Dim mailcc As String = IIf(Not IsDBNull(r("kkd_emailcc")), VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(r("kkd_emailcc")), "") + Dim mailbcc As String = IIf(Not IsDBNull(r("kkd_emailbcc")), VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(r("kkd_emailbcc")), "") If mail <> "" Or mailcc <> "" Or mailbcc <> "" Then Dim dgvRow As DataGridViewRow = dgvAufschub.Rows(rowIndex) diff --git a/SDL/kunden/usrCntlKundenuebersicht.vb b/SDL/kunden/usrCntlKundenuebersicht.vb index d70a6b9e..afd1c611 100644 --- a/SDL/kunden/usrCntlKundenuebersicht.vb +++ b/SDL/kunden/usrCntlKundenuebersicht.vb @@ -1691,7 +1691,7 @@ Public Class usrCntlKundenuebersicht ' AUFSCHUB = VERAG_PROG_ALLGEMEIN.cKundenAufschubkonten.LOAD_ListAufschubKTOByKdNr(kdNr) dgvAufschub.Rows.Clear() - If AUFSCHUB IsNot Nothing Then + If AUFSCHUB IsNot Nothing AndAlso AUFSCHUB.Count > 0 Then For Each AB In AUFSCHUB Dim art = "" Select Case AB.kdAkto_art diff --git a/SDL/kunden/usrcntlKundeBearbeitenFull.vb b/SDL/kunden/usrcntlKundeBearbeitenFull.vb index acb6e345..9937fd44 100644 --- a/SDL/kunden/usrcntlKundeBearbeitenFull.vb +++ b/SDL/kunden/usrcntlKundeBearbeitenFull.vb @@ -902,12 +902,12 @@ Public Class usrcntlKundeBearbeitenFull txtERROR.Text = err : Exit Sub End If - Dim Email1 As String = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(txtEmail.Text) + Dim Email1 As String = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(txtEmail.Text) If Email1 <> "" Then txtERROR.Text = Email1 & " ist keine gültige Email!" : Exit Sub End If - Dim Email2 As String = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK(txtEmail2.Text) + Dim Email2 As String = VERAG_PROG_ALLGEMEIN.cProgramFunctions.checkifMailisOK_better(txtEmail2.Text) If Email2 <> "" Then txtERROR.Text = Email2 & " ist keine gültige Email!" : Exit Sub End If diff --git a/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb b/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb index c66e8885..daf4027c 100644 --- a/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb +++ b/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb @@ -25,6 +25,7 @@ Partial Class frmMDMDatenverarbetiung Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMDMDatenverarbetiung)) Me.pnl = New System.Windows.Forms.Panel() + Me.pb_importOK = New System.Windows.Forms.PictureBox() Me.cbxIDSmitVerag = New System.Windows.Forms.CheckBox() Me.Panel5 = New System.Windows.Forms.Panel() Me.Label5 = New System.Windows.Forms.Label() @@ -34,7 +35,6 @@ Partial Class frmMDMDatenverarbetiung Me.cbxASFINAGAbgerechnet = New System.Windows.Forms.CheckBox() Me.cbxTestdaten = New System.Windows.Forms.CheckBox() Me.Panel4 = New System.Windows.Forms.Panel() - Me.pb_importOK = New System.Windows.Forms.PictureBox() Me.Label46 = New System.Windows.Forms.Label() Me.dat_Sum_Bis = New System.Windows.Forms.DateTimePicker() Me.Label45 = New System.Windows.Forms.Label() @@ -85,11 +85,12 @@ Partial Class frmMDMDatenverarbetiung Me.Button2 = New System.Windows.Forms.Button() Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.MyDatagridview1 = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components) + Me.btnImportdet = New System.Windows.Forms.Button() Me.pnl.SuspendLayout() + CType(Me.pb_importOK, System.ComponentModel.ISupportInitialize).BeginInit() Me.Panel5.SuspendLayout() CType(Me.PictureBox5, System.ComponentModel.ISupportInitialize).BeginInit() Me.Panel4.SuspendLayout() - CType(Me.pb_importOK, System.ComponentModel.ISupportInitialize).BeginInit() Me.FlowLayoutPanel.SuspendLayout() Me.Panel1.SuspendLayout() Me.pnlAsfinag.SuspendLayout() @@ -103,6 +104,7 @@ Partial Class frmMDMDatenverarbetiung ' 'pnl ' + Me.pnl.Controls.Add(Me.btnImportdet) Me.pnl.Controls.Add(Me.pb_importOK) Me.pnl.Controls.Add(Me.cbxIDSmitVerag) Me.pnl.Controls.Add(Me.Panel5) @@ -122,6 +124,17 @@ Partial Class frmMDMDatenverarbetiung Me.pnl.Size = New System.Drawing.Size(1163, 100) Me.pnl.TabIndex = 1 ' + 'pb_importOK + ' + Me.pb_importOK.BackgroundImage = Global.SDL.My.Resources.Resources.ok + Me.pb_importOK.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom + Me.pb_importOK.Location = New System.Drawing.Point(81, 42) + Me.pb_importOK.Name = "pb_importOK" + Me.pb_importOK.Size = New System.Drawing.Size(23, 19) + Me.pb_importOK.TabIndex = 53 + Me.pb_importOK.TabStop = False + Me.pb_importOK.Visible = False + ' 'cbxIDSmitVerag ' Me.cbxIDSmitVerag.AutoSize = True @@ -220,17 +233,6 @@ Partial Class frmMDMDatenverarbetiung Me.Panel4.Size = New System.Drawing.Size(417, 33) Me.Panel4.TabIndex = 28 ' - 'pb_importOK - ' - Me.pb_importOK.BackgroundImage = Global.SDL.My.Resources.Resources.ok - Me.pb_importOK.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom - Me.pb_importOK.Location = New System.Drawing.Point(81, 42) - Me.pb_importOK.Name = "pb_importOK" - Me.pb_importOK.Size = New System.Drawing.Size(23, 19) - Me.pb_importOK.TabIndex = 53 - Me.pb_importOK.TabStop = False - Me.pb_importOK.Visible = False - ' 'Label46 ' Me.Label46.AutoSize = True @@ -824,6 +826,17 @@ Partial Class frmMDMDatenverarbetiung Me.MyDatagridview1.Size = New System.Drawing.Size(1163, 547) Me.MyDatagridview1.TabIndex = 0 ' + 'btnImportdet + ' + Me.btnImportdet.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnImportdet.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnImportdet.Location = New System.Drawing.Point(985, 8) + Me.btnImportdet.Name = "btnImportdet" + Me.btnImportdet.Size = New System.Drawing.Size(166, 23) + Me.btnImportdet.TabIndex = 132 + Me.btnImportdet.Text = "Einarbeitungsdetails" + Me.btnImportdet.UseVisualStyleBackColor = True + ' 'frmMDMDatenverarbetiung ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -839,12 +852,12 @@ Partial Class frmMDMDatenverarbetiung Me.Text = "Datenverarbeitung" Me.pnl.ResumeLayout(False) Me.pnl.PerformLayout() + CType(Me.pb_importOK, System.ComponentModel.ISupportInitialize).EndInit() Me.Panel5.ResumeLayout(False) Me.Panel5.PerformLayout() CType(Me.PictureBox5, System.ComponentModel.ISupportInitialize).EndInit() Me.Panel4.ResumeLayout(False) Me.Panel4.PerformLayout() - CType(Me.pb_importOK, System.ComponentModel.ISupportInitialize).EndInit() Me.FlowLayoutPanel.ResumeLayout(False) Me.Panel1.ResumeLayout(False) Me.Panel1.PerformLayout() @@ -921,4 +934,5 @@ Partial Class frmMDMDatenverarbetiung Friend WithEvents cbxKopie As CheckBox Friend WithEvents cbxIDSmitVerag As CheckBox Friend WithEvents pb_importOK As PictureBox + Friend WithEvents btnImportdet As Button End Class diff --git a/SDL/mdm/frmMDMDatenverarbetiung.vb b/SDL/mdm/frmMDMDatenverarbetiung.vb index 0d6bcdad..9d3f34c6 100644 --- a/SDL/mdm/frmMDMDatenverarbetiung.vb +++ b/SDL/mdm/frmMDMDatenverarbetiung.vb @@ -4916,7 +4916,7 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land End Sub Sub setBillingDateCompleted(Lieferant_ As String, date_ As Date) - SQL.doSQL("UPDATE tblMDMEinarbeitung SET cast(billingdate as Date)='" & date_.ToShortDateString & "' WHERE supplier = " & Lieferant_ & " AND billingdate is null ", "FMZOLL") + SQL.doSQL("UPDATE tblMDMEinarbeitung SET billingdate ='" & date_.ToShortDateString & "' WHERE supplier = '" & Lieferant_ & "' AND billingdate is null ", "FMZOLL") End Sub @@ -5541,6 +5541,7 @@ RabattBerechnen: initDgv_IDS() End Sub + Private Sub btnImportdet_Click(sender As Object, e As EventArgs) Handles btnImportdet.Click - + End Sub End Class diff --git a/SDL/zoll/usrCntlAuswertungenAufschub_AbgabenKontrolleTRIER.vb b/SDL/zoll/usrCntlAuswertungenAufschub_AbgabenKontrolleTRIER.vb index c3e9aa71..dfa18a0d 100644 --- a/SDL/zoll/usrCntlAuswertungenAufschub_AbgabenKontrolleTRIER.vb +++ b/SDL/zoll/usrCntlAuswertungenAufschub_AbgabenKontrolleTRIER.vb @@ -71,20 +71,32 @@ Public Class usrCntlAuswertungenAufschub_AbgabenKontrolleTRIER End If - If line.Length = "79" And line.Contains("ATC") Then + If line.Length = "79" AndAlso (line.Contains("ATC") Or line.Substring(30, 2).Trim.Contains("DE")) Then Dim zollamt As String = line.Substring(0, 28).Trim - Dim atc As String = line.Substring(28, 25).Trim + Dim atc As String = "" + Dim mrn As String = "" + Dim sqlStringWhere = "" + If line.Contains("ATC") Then + atc = line.Substring(28, 25).Trim + sqlStringWhere = "[Status]<>0 and DruckDatumZeit is not null and (left([RechnungsausgangPositionen].Belegdaten,21)='" & atc & "' or [RechnungsausgangPositionen].[Weitere_Reg_Nr] ='" & atc & "' ) AND [AufschubkontoNr]='" & AKTO & "'" + ElseIf line.Substring(30, 2).Trim.Contains("DE") Then + mrn = line.Substring(28, 25).Trim + sqlStringWhere = "[Status]<>0 and DruckDatumZeit is not null and left([RechnungsausgangPositionen].Belegdaten,21)='" & mrn & "' AND [AufschubkontoNr]='" & AKTO & "'" + End If + Dim datum As Date = CDate(line.Substring(53, 10).Trim) Dim betrag As Double = CDbl(line.Substring(63, 16).Trim) - ' Dim fakturiert = CDbl(SQL.DLookup("Betrag", "Zkteing", "[Status]='F' AND [Registriernummer]='" & atc & "' AND [AKTO]=" & AKTONr & "", "FMZOLL", "0")) - Dim fakturiert = CDbl(SQL.DLookup("sum(Preis)", "Rechnungsausgang inner join [RechnungsausgangPositionen] On Rechnungsausgang.RK_ID=[RechnungsausgangPositionen].RK_ID", " [Status]<>0 and DruckDatumZeit is not null and (left([RechnungsausgangPositionen].Belegdaten,21)='" & atc & "' or [RechnungsausgangPositionen].[Weitere_Reg_Nr] ='" & atc & "' )AND [AufschubkontoNr]='" & AKTO & "'", "FMZOLL", "0")) + + + Dim fakturiert = CDbl(SQL.DLookup("sum(Preis)", "Rechnungsausgang inner join [RechnungsausgangPositionen] On Rechnungsausgang.RK_ID=[RechnungsausgangPositionen].RK_ID", sqlStringWhere, "FMZOLL", "0")) Dim differenz = fakturiert - betrag If Not cbx.Checked OrElse differenz <> 0 Then - erg &= zollamt & " - " & atc & ": " & betrag & " | " & differenz & vbNewLine - dt.Rows.Add({AKTO, Faelligkeit, atc, datum, zollamt, betrag, fakturiert, differenz}) + + erg &= zollamt & " - " & IIf(atc <> "", atc, mrn) & ": " & betrag & " | " & differenz & vbNewLine + dt.Rows.Add({AKTO, Faelligkeit, IIf(atc <> "", atc, mrn), datum, zollamt, betrag, fakturiert, differenz}) End If End If diff --git a/SDL/zoll/usrCntlZOLLAuswertungen.vb b/SDL/zoll/usrCntlZOLLAuswertungen.vb index 2fd79690..f769b24b 100644 --- a/SDL/zoll/usrCntlZOLLAuswertungen.vb +++ b/SDL/zoll/usrCntlZOLLAuswertungen.vb @@ -1032,13 +1032,6 @@ Public Class usrCntlZOLLAuswertungen End Select End Sub - Private Sub UsrCntlAuswertungenAufschub_AbgabenKontrolleTRIER1_Load(sender As Object, e As EventArgs) Handles UsrCntlAuswertungenAufschub_AbgabenKontrolleTRIER1.Load - - End Sub - - Private Sub UsrCntlAuswertungenEV_Veranlagungen1_Load(sender As Object, e As EventArgs) Handles UsrCntlAuswertungenEV_Veranlagungen1.Load - - End Sub Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles excelCbam.Click diff --git a/VERAG_PROG_ALLGEMEIN/Classes/USTV/cUSTVAntrag.vb b/VERAG_PROG_ALLGEMEIN/Classes/USTV/cUSTVAntrag.vb index 817809ed..e8fc63a3 100644 --- a/VERAG_PROG_ALLGEMEIN/Classes/USTV/cUSTVAntrag.vb +++ b/VERAG_PROG_ALLGEMEIN/Classes/USTV/cUSTVAntrag.vb @@ -449,6 +449,12 @@ Public Class cUStVPositionen Public Function SAVE() As Boolean Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList() + + If VERAG_PROG_ALLGEMEIN.cProgramFunctions.ValidateSQLFieldLengths(list, "tblUStVPositionen", "", "FMZOLL") Then + Return False + End If + + Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblUStVPositionen WHERE UStVAn_ID=@UStVAn_ID AND UStVPo_ID=@UStVPo_ID) " & " BEGIN " & getUpdateCmd() & " END " & " Else " & diff --git a/VERAG_PROG_ALLGEMEIN/Classes/cOfferte.vb b/VERAG_PROG_ALLGEMEIN/Classes/cOfferte.vb index d42abc61..69d997fb 100644 --- a/VERAG_PROG_ALLGEMEIN/Classes/cOfferte.vb +++ b/VERAG_PROG_ALLGEMEIN/Classes/cOfferte.vb @@ -960,10 +960,8 @@ Public Class cStandardofferten Property BGebMinBetrag As Object = Nothing Property BerechnungsartPosInkludiert As Object = Nothing Property BerechnungsartNr As Object = Nothing - Property LeistungsBez_EN As Object = Nothing Property LeistungsBez_RO As Object = Nothing - Property LeistungsBez_TR As Object = Nothing Public hasEntry = False diff --git a/VERAG_PROG_ALLGEMEIN/DATENSERVER/cDATENSERVER.vb b/VERAG_PROG_ALLGEMEIN/DATENSERVER/cDATENSERVER.vb index 3fb34d41..39c8dfb3 100644 --- a/VERAG_PROG_ALLGEMEIN/DATENSERVER/cDATENSERVER.vb +++ b/VERAG_PROG_ALLGEMEIN/DATENSERVER/cDATENSERVER.vb @@ -2458,9 +2458,15 @@ Public Class DATENVERVER_OPTIONS Using pdf As New iText.Kernel.Pdf.PdfDocument(New iText.Kernel.Pdf.PdfReader(pdfPath), New iText.Kernel.Pdf.PdfWriter(tempFile)) + + Dim xmlBytes = File.ReadAllBytes(xmlPath) Dim fileName As String = "factur-x.xml" + If HasAttachment(pdf, fileName) Then + Return pdfPath + End If + Dim fs = PdfFileSpec.CreateEmbeddedFileSpec( pdf, xmlBytes, @@ -2490,6 +2496,32 @@ Public Class DATENVERVER_OPTIONS End Function + Private Shared Function HasAttachment(pdf As iText.Kernel.Pdf.PdfDocument, fileName As String) As Boolean + + Dim catalog = pdf.GetCatalog().GetPdfObject() + Dim afObj = catalog.Get(iText.Kernel.Pdf.PdfName.AF) + + If afObj Is Nothing Then Return False + + Dim afArray = TryCast(afObj, iText.Kernel.Pdf.PdfArray) + If afArray Is Nothing Then Return False + + For i As Integer = 0 To afArray.Size() - 1 + Dim fsObj = afArray.Get(i) + Dim fsDict = TryCast(fsObj, iText.Kernel.Pdf.PdfDictionary) + + If fsDict Is Nothing Then Continue For + + Dim fName = fsDict.GetAsString(iText.Kernel.Pdf.PdfName.F) + + If fName IsNot Nothing AndAlso fName.ToString().Equals(fileName, StringComparison.OrdinalIgnoreCase) Then + Return True + End If + Next + + Return False + End Function + Public Shared Function ConvertToPdfA3(inputPdf As String) As String diff --git a/VERAG_PROG_ALLGEMEIN/My Project/Settings.Designer.vb b/VERAG_PROG_ALLGEMEIN/My Project/Settings.Designer.vb index e6caa8af..e9ddc492 100644 --- a/VERAG_PROG_ALLGEMEIN/My Project/Settings.Designer.vb +++ b/VERAG_PROG_ALLGEMEIN/My Project/Settings.Designer.vb @@ -195,9 +195,9 @@ Namespace My _ + Global.System.Configuration.DefaultSettingValueAttribute("Data Source=192.168.0.90\DEVSQL;Initial Catalog=AVISO;Integrated Security=false;U"& _ + "ser ID=AppUser;Password=yp/THDd?xM+pZ$;Pooling=true;Min Pool Size=20;Max Pool Si"& _ + "ze=250")> _ Public ReadOnly Property AVISOConnectionStringTEST() As String Get Return CType(Me("AVISOConnectionStringTEST"),String) diff --git a/VERAG_PROG_ALLGEMEIN/My Project/Settings.settings b/VERAG_PROG_ALLGEMEIN/My Project/Settings.settings index 570b9dd8..26c5f16b 100644 --- a/VERAG_PROG_ALLGEMEIN/My Project/Settings.settings +++ b/VERAG_PROG_ALLGEMEIN/My Project/Settings.settings @@ -65,9 +65,9 @@ <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <ConnectionString>Data Source=192.168.0.90\DEVSQL;Initial Catalog=AVISO_new;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;Pooling=true;Min Pool Size=20;Max Pool Size=250</ConnectionString> + <ConnectionString>Data Source=192.168.0.90\DEVSQL;Initial Catalog=AVISO;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;Pooling=true;Min Pool Size=20;Max Pool Size=250</ConnectionString> </SerializableConnectionString> - Data Source=192.168.0.90\DEVSQL;Initial Catalog=AVISO_new;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;Pooling=true;Min Pool Size=20;Max Pool Size=250 + Data Source=192.168.0.90\DEVSQL;Initial Catalog=AVISO;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;Pooling=true;Min Pool Size=20;Max Pool Size=250 <?xml version="1.0" encoding="utf-16"?> diff --git a/VERAG_PROG_ALLGEMEIN/cProgramFunktions.vb b/VERAG_PROG_ALLGEMEIN/cProgramFunktions.vb index 64a40e0f..5217279a 100644 --- a/VERAG_PROG_ALLGEMEIN/cProgramFunktions.vb +++ b/VERAG_PROG_ALLGEMEIN/cProgramFunktions.vb @@ -1,4 +1,5 @@ Imports System.Drawing +Imports System.Globalization Imports System.IO Imports System.IO.Pipes Imports System.Net.Mail @@ -365,6 +366,123 @@ Public Class cProgramFunctions End If End Sub + Public Shared Function ValidateSQLFieldLengths(parameters As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable), tableName As String, Info As String, Optional conn_art As String = "FMZOLL", Optional showError As Boolean = True) As Boolean + Try + Dim sql As String = + "SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = '" & tableName & "' + AND DATA_TYPE IN ('varchar','nvarchar','char','nchar','decimal','numeric','float','real')" + + Dim dt As DataTable = + (New SQL).loadDgvBySql(sql, conn_art) + + If dt Is Nothing Then Return False + + ' Struktur für Feldinfos + Dim fieldInfo As New Dictionary(Of String, DataRow)(StringComparer.OrdinalIgnoreCase) + + For Each r As DataRow In dt.Rows + fieldInfo(r!COLUMN_NAME.ToString) = r + Next + + Dim errors As New List(Of String) + + For Each p As SQLVariable In parameters + + If p Is Nothing Then Continue For + If p.Value() Is Nothing Then Continue For + If p.Text() Is Nothing Then Continue For + + Dim fieldName As String = p.Text().TrimStart("@"c) + + If Not fieldInfo.ContainsKey(fieldName) Then Continue For + + Dim row As DataRow = fieldInfo(fieldName) + Dim dataType As String = row!DATA_TYPE.ToString.ToLower + + Dim valueObj As Object = p.Value() + Dim valueStr As String = valueObj.ToString + + ' ------------------------- + ' 1) TEXTFELDER + ' ------------------------- + If dataType.Contains("char") Then + + Dim maxLen As Integer = If(IsDBNull(row!CHARACTER_MAXIMUM_LENGTH), -1, CInt(row!CHARACTER_MAXIMUM_LENGTH)) + + If maxLen = -1 Then Continue For ' varchar(max) + + If valueStr.Length > maxLen Then + errors.Add(fieldName & " -> " & valueStr.Length & "/" & maxLen) + End If + + End If + + ' ------------------------- + ' 2) NUMERISCHE FELDER + ' ------------------------- + If dataType = "decimal" OrElse dataType = "numeric" OrElse dataType = "float" OrElse dataType = "real" Then + + Dim decValue As Decimal + + If Not Decimal.TryParse(valueStr, Globalization.NumberStyles.Any, + Globalization.CultureInfo.InvariantCulture, decValue) Then + + errors.Add(fieldName & " -> Ungültiger numerischer Wert: " & valueStr) + Continue For + End If + + ' decimal / numeric prüfen (Precision/Scale) + If dataType = "decimal" OrElse dataType = "numeric" Then + + Dim precision As Integer = If(IsDBNull(row!NUMERIC_PRECISION), 0, CInt(row!NUMERIC_PRECISION)) + Dim scale As Integer = If(IsDBNull(row!NUMERIC_SCALE), 0, CInt(row!NUMERIC_SCALE)) + + Dim parts = decValue.ToString(Globalization.CultureInfo.InvariantCulture).Split("."c) + + Dim digitsBefore As Integer = parts(0).Replace("-", "").Length + Dim digitsAfter As Integer = If(parts.Length > 1, parts(1).Length, 0) + + If digitsBefore + digitsAfter > precision OrElse digitsAfter > scale Then + errors.Add(fieldName & " -> " & decValue & + " überschreitet precision/scale (" & precision & "," & scale & ")") + End If + End If + + ' float/real -> Catch Overflow ähnlich SQL Server Verhalten + If dataType = "float" OrElse dataType = "real" Then + Try + Dim test As Double = CDbl(decValue) + Catch + errors.Add(fieldName & " -> Float/Real Überlauf: " & valueStr) + End Try + End If + + End If + + Next + + If errors.Count > 0 Then + Info = "Folgende SQL-Felder sind ungültig:" & vbCrLf & vbCrLf & + String.Join(vbCrLf, errors) + + If showError Then + MsgBox(Info, MsgBoxStyle.Exclamation) + End If + + Return False + End If + + Return True + + Catch ex As Exception + MsgBox("ValidateSQLFieldLengths:" & vbCrLf & ex.Message) + Return False + End Try + + End Function + Public Shared Function fktEuro(varBetrag As Object, varVonWährung As Object, varNachWährung As Object) As Object '(FixeTaxe, "ATS", RECHNUNG.Währungscode) 'Dim varVonWährung As Object @@ -947,11 +1065,19 @@ BindingFlags.Instance Or BindingFlags.NonPublic, Nothing, [Control], New Object( Return SQL.getValueTxtBySql(sqlstr, "FMZOLL") End Function - Shared Function getISO1Land(LandKz As String) - Dim sqlstr = "SELECT TOP 1 isnull(Währungstabelle.LandKz,'') AS LandKzISO1 FROM [Länderverzeichnis für die Außenhandelsstatistik] LEFT JOIN Währungstabelle ON [Länderverzeichnis für die Außenhandelsstatistik].LandNr = Währungstabelle.Währungsschlüssel WHERE [Länderverzeichnis für die Außenhandelsstatistik].LandKz='" & LandKz & "' " + Shared Function getLandEnglFromISO2Land(Iso2Land As String) + Dim sqlstr = "SELECT TOP 1 isnull(Land_EN,'') AS LandBez FROM [Währungstabelle] LEFT JOIN [Länderverzeichnis für die Außenhandelsstatistik] ON [Länderverzeichnis für die Außenhandelsstatistik].LandNr = Währungstabelle.Währungsschlüssel WHERE [Länderverzeichnis für die Außenhandelsstatistik].LandKz='" & Iso2Land & "' " Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Return SQL.getValueTxtBySql(sqlstr, "FMZOLL") End Function + + Shared Function getISO1Land(LandKz As String) + Dim sqlstr = "SELECT TOP 1 isnull(Währungstabelle.Land_EN,'') AS LandBez FROM [Länderverzeichnis für die Außenhandelsstatistik] LEFT JOIN Währungstabelle ON [Länderverzeichnis für die Außenhandelsstatistik].LandNr = Währungstabelle.Währungsschlüssel WHERE [Länderverzeichnis für die Außenhandelsstatistik].LandKz='" & LandKz & "' " + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Return SQL.getValueTxtBySql(sqlstr, "FMZOLL") + End Function + + Shared Function convertToIso(s) As String Return s @@ -1080,46 +1206,106 @@ BindingFlags.Instance Or BindingFlags.NonPublic, Nothing, [Control], New Object( End Function - Shared Function checkifMailisOK(emailList As String) As String + Shared Function checkifMailisOK_better(emailList As String) As String - Dim invalid As New List(Of String) If String.IsNullOrWhiteSpace(emailList) Then Return "" - Dim emails = emailList.Split(";"c, ","c) + Dim invalid As New List(Of String) + Dim idn As New IdnMapping() + + For Each email As String In emailList.Split(";"c, ","c) + + Dim e As String = email.Trim() - For Each email In emails - Dim e = email.Trim() If e = "" Then Continue For Try - Dim addr As New System.Net.Mail.MailAddress(e) - If Not addr.Host.Contains(".") Then + + ' Genau ein @ + Dim atPos As Integer = e.LastIndexOf("@"c) + + If atPos <= 0 OrElse atPos <> e.IndexOf("@"c) Then + invalid.Add(e) + Continue For + End If + + Dim localPart As String = e.Substring(0, atPos) + Dim domainPart As String = e.Substring(atPos + 1) + + ' RFC-Grenzen + If localPart.Length = 0 OrElse localPart.Length > 64 Then + invalid.Add(e) + Continue For + End If + + If localPart.Any(Function(c) AscW(c) > 127) Then + invalid.Add(e) + Continue For + End If + + If e.Length > 320 Then + invalid.Add(e) + Continue For + End If + + ' Keine führenden/abschließenden Punkte + If localPart.StartsWith(".") OrElse localPart.EndsWith(".") Then + invalid.Add(e) + Continue For + End If + + ' Keine doppelten Punkte + If localPart.Contains("..") Then + invalid.Add(e) + Continue For + End If + + ' Internationale Domain nach ASCII wandeln + Dim domainAscii As String = idn.GetAscii(domainPart) + + ' Domain muss einen Punkt enthalten + If Not domainAscii.Contains("."c) Then + invalid.Add(e) + Continue For + End If + + ' Domainlabels prüfen + For Each label As String In domainAscii.Split("."c) + + If label.Length = 0 OrElse label.Length > 63 Then + invalid.Add(e) + GoTo NextMail + End If + + If label.StartsWith("-") OrElse label.EndsWith("-") Then + invalid.Add(e) + GoTo NextMail + End If + + Next + + ' .NET-Prüfung + Dim normalizedEmail As String = localPart & "@" & domainAscii + Dim addr As New MailAddress(normalizedEmail) + + If addr.Address <> normalizedEmail Then invalid.Add(e) End If + Catch invalid.Add(e) End Try + +NextMail: Next - If invalid.Count = 0 Then - Return "" - Else - Dim StringLIst As String = "" - For i = 1 To invalid.Count - StringLIst = StringLIst & invalid(i - 1) - Next i - - Return StringLIst - - End If - - - + Return String.Join(";", invalid) End Function + Shared Function checkLKWNr(lkwNr As String) As List(Of String) Dim ListOfLKWNr As New List(Of String)