diff --git a/AVISO_CHECKIN/App.config b/AVISO_CHECKIN/App.config
index 8ccef15..ea2760e 100644
--- a/AVISO_CHECKIN/App.config
+++ b/AVISO_CHECKIN/App.config
@@ -1,6 +1,34 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aviso/App.config b/Aviso/App.config
index ed050e9..512e467 100644
--- a/Aviso/App.config
+++ b/Aviso/App.config
@@ -6,8 +6,7 @@
-
+
@@ -62,7 +61,11 @@
-
+
+
+
+
+
diff --git a/Aviso/Aviso.vbproj b/Aviso/Aviso.vbproj
index be0b804..f92db65 100644
--- a/Aviso/Aviso.vbproj
+++ b/Aviso/Aviso.vbproj
@@ -113,8 +113,9 @@
False
C:\Program Files (x86)\GrapeCity\ActiveReports 15\Tools\BouncyCastle.Crypto.dll
-
- ..\..\..\dll\HMRC\ChilkatDotNet47.dll
+
+ False
+ ..\..\..\dll\ChillKat64\ChilkatDotNet47.dll
..\packages\esendex-dotnet-sdk.3.8.0\lib\net35\com.esendex.sdk.dll
@@ -125,9 +126,8 @@
..\packages\Common.Logging.Core.3.4.1\lib\net40\Common.Logging.Core.dll
-
- False
- C:\Program Files (x86)\GrapeCity\ActiveReports 15\Tools\DocumentFormat.OpenXml.dll
+
+ ..\packages\DocumentFormat.OpenXml.2.7.2\lib\net46\DocumentFormat.OpenXml.dll
C:\Program Files (x86)\GrapeCity\ActiveReports 15\Tools\GrapeCity.ActiveReports.dll
@@ -272,6 +272,14 @@
+
+ ..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll
+ True
+ True
+
+
+ ..\packages\System.IO.Packaging.4.0.0\lib\net46\System.IO.Packaging.dll
+
..\packages\System.Memory.4.5.0\lib\netstandard2.0\System.Memory.dll
diff --git a/Aviso/CHMRC.vb b/Aviso/CHMRC.vb
index 481f821..1a4f5c9 100644
--- a/Aviso/CHMRC.vb
+++ b/Aviso/CHMRC.vb
@@ -8,6 +8,9 @@ Imports Microsoft.AspNetCore.Http
Imports Microsoft.Extensions.Configuration
Imports Microsoft.Extensions.DependencyInjection
Imports Microsoft.Extensions.Hosting
+Imports System.Collections.Specialized
+Imports System.Text
+Imports System.IO
'Public Class Startup
' Public Sub New(ByVal configuration As IConfiguration)
@@ -70,30 +73,181 @@ Imports Microsoft.Extensions.Hosting
+Public Class VATResponse
+ Public Class Address
+ Public Property line1 As String
+ Public Property postcode As String
+ Public Property countryCode As String
+ End Class
+
+ Public Class Target
+ Public Property name As String
+ Public Property vatNumber As String
+ Public Property address As Address
+ End Class
+
+ Public Class Root
+ Public Property target As Target
+ Public Property processingDate As DateTime
+ End Class
+
+End Class
+
+Public Class cHMRC
+
+ Shared API_STRING = "https://test-api.service.hmrc.gov.uk"
+ 'Shared API_STRING As String = "https://api.service.hmrc.gov.uk"
+
+ Shared Sub hmrcTEST2()
+ 'Dim rClient As RestClient = New RestClient()
+ 'rClient.endPoint = "https://test-api.service.hmrc.gov.uk/hello/user"
+ 'Dim strResponse As String = String.Empty
+ 'strResponse = rClient.makeRequest(_accessToken)
+
+ Dim rest As New Chilkat.Rest
+
+ ' Connect to the REST server.
+ Dim bTls As Boolean = True
+ Dim port As Integer = 443
+ Dim bAutoReconnect As Boolean = True
+ Dim success As Boolean = rest.Connect("https://test-api.service.hmrc.gov.uk", port, bTls, bAutoReconnect)
+ '389356931 -> VERAG-UNISPED
+ 'Dim responseJson As String = rest.FullRequestNoBody("GET", "/organisations/vat/check-vat-number/lookup/553557881")
+ 'Dim responseJson As String = rest.FullRequestNoBody("GET", "/organisations/vat/check-vat-number/lookup/553552881") 'falsch
+ Dim responseJson As String = rest.FullRequestNoBody("GET", "/organisations/vat/check-vat-number/lookup/5535532881") 'falsch
+ If (rest.LastMethodSuccess <> True) Then
+ Console.WriteLine(rest.LastErrorText)
+ Exit Sub
+ End If
+
+ Try
+
+ Dim read = Newtonsoft.Json.Linq.JObject.Parse(responseJson)
+
+ If read.Item("code") IsNot Nothing Then
+ Dim VAT_Message = read.Item("message").ToString
+ Dim VAT_code = read.Item("code").ToString
+ MsgBox("ERROR: " & VAT_Message, MsgBoxStyle.OkOnly, VAT_code)
+ Else
+ ' Dim json As String = "{""name"":""Rap God"",""statistics"":{""likeCount"":""122255"",""dislikeCount"":""4472""}}"
+ Dim VAT_Name = read.Item("target")("name").ToString
+ Dim VAT_processingDate = read.Item("processingDate").ToString
+ Dim VAT_Strasse = read.Item("target")("address")("line1").ToString
+ Dim VAT_PLZ = read.Item("target")("address")("postcode").ToString
+ Dim VAT_countryCode = read.Item("target")("address")("countryCode").ToString
+
+ MsgBox(VAT_Name)
+ MsgBox(VAT_processingDate)
+ End If
+ Catch ex As Exception
+ MsgBox(ex.Message & ex.StackTrace)
+ End Try
-Public Class CHMRC
+ 'Console.WriteLine(responseJson)
+ 'Console.WriteLine("----")
+
+ '' We can alternatively do this:
+ 'rest.ClearAllQueryParams()
+ '' rest.AddQueryParam("consumer_key", "YOUR_CONSUMER_KEY")
+ '' rest.AddQueryParam("consumer_secret", "YOUR_CONSUMER_SECRET")
+ 'responseJson = rest.FullRequestNoBody("GET", "/wp-json/wc/v1/products")
+ 'If (rest.LastMethodSuccess <> True) Then
+ ' Console.WriteLine(rest.LastErrorText)
+ ' Exit Sub
+ 'End If
+
+
+ Console.WriteLine(responseJson)
+
+ End Sub
+
Shared Sub hmrcTEST()
- 'Dim client As HttpClient = HttpClientBuilder.create().build()
- 'Dim request As HttpGet = New HttpGet("https://test-api.service.hmrc.gov.uk/hello/world")
- 'request.addHeader("Accept", "application/vnd.hmrc.1.0+json")
- 'Dim response As HttpResponse = client.execute(request)
- 'Dim statusCode As Integer = response.getStatusLine().getStatusCode()
- 'Dim responseBody As String = EntityUtils.toString(response.getEntity())
+ UnlockCilkat()
+ Dim AccessToken = ""
+ grantAccess(AccessToken, "write:goods-movement-system")
+ 'getHMRC_Token(AccessToken, "write:goods-movement-system")
+ MsgBox(AccessToken)
+ If AccessToken <> "" Then
+
+ Dim Notification_Box_Id = ""
+ Dim Notification_Message_Id = ""
+ If genGVMS_GMR(AccessToken, Notification_Box_Id, Notification_Message_Id) Then
+
+
+ Dim AccessTokenNotTEST = ""
+ ' getHMRC_Token(AccessTokenNotTEST, "read:pull-notifications")
+ grantAccess(AccessTokenNotTEST, "read:pull-notifications")
+ If AccessTokenNotTEST <> "" Then
+ getGVMS_Notifications(AccessTokenNotTEST, Notification_Box_Id)
+ End If
+ End If
+ End If
+
+ Exit Sub
+ 'UnlockCilkat()
+
+ 'Dim AccessTokenNotTEST = ""
+ 'grantAccess(AccessTokenNotTEST, "read:pull-notifications")
+ 'If AccessTokenNotTEST <> "" Then
+ ' getGVMS_Notifications(AccessTokenNotTEST, "877b619c-33c1-4ab6-a34f-8bd7542e0596")
+
+ 'End If
+ Exit Sub
+
+ 'Dim AccessToken = ""
+ 'grantAccess(AccessToken, "write:goods-movement-system")
+ 'If AccessToken <> "" Then
+
+ ' Dim Notification_Box_Id = ""
+ ' Dim Notification_Message_Id = ""
+ ' genGVMS_GMR(AccessToken, Notification_Box_Id, Notification_Message_Id)
+
+ ' Dim AccessTokenNot = ""
+ ' grantAccess(AccessTokenNot, "read:pull-notifications")
+ ' If AccessTokenNot <> "" Then
+ ' getGVMS_Notifications(AccessTokenNot, Notification_Box_Id)
+
+ ' End If
+ 'End If
+
Exit Sub
+ getGVMS_RefData()
+
+ Exit Sub
+
+
+
+ Exit Sub
+ 'genGVMS_GMR("TEST")
+
+ 'Exit Sub
+ 'Dim AccessToken = ""
+ 'grantAccess(AccessToken)
+ 'If AccessToken <> "" Then
+ ' genGVMS_GMR(AccessToken)
+ 'End If
+ End Sub
+ Shared Sub grantAccess(ByRef AccessToken, scope)
+
+ UnlockCilkat()
Debug.WriteLine("HMRC Start")
Dim oauth2 As Chilkat.OAuth2 = New Chilkat.OAuth2()
Dim success As Boolean
+
oauth2.ListenPort = 3017
- oauth2.AuthorizationEndpoint = "https://test-api.service.hmrc.gov.uk/oauth/authorize"
- oauth2.TokenEndpoint = "https://test-api.service.hmrc.gov.uk/oauth/token"
+ 'oauth2.AuthorizationEndpoint = "https://test-api.service.hmrc.gov.uk/oauth/authorize"
+ 'oauth2.TokenEndpoint = "https://test-api.service.hmrc.gov.uk/oauth/token"
+ oauth2.AuthorizationEndpoint = API_STRING & "/oauth/authorize"
+ oauth2.TokenEndpoint = API_STRING & "/oauth/token"
oauth2.ClientId = "xybTOMaQWcuifeW5xnGggojlACWC"
oauth2.ClientSecret = "bf1cfb6e-1bcb-4282-b7a0-3d3ccb2b1dc1"
- oauth2.Scope = "read:vat write:vat"
+ 'oauth2.Scope = "read:vat write:vat" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ oauth2.Scope = scope '"write:goods-movement-system"
Dim url As String = oauth2.StartAuth()
If oauth2.LastMethodSuccess <> True Then
@@ -103,106 +257,156 @@ Public Class CHMRC
Dim http As Chilkat.Http = New Chilkat.Http()
- System.Diagnostics.Process.Start(url)
+ ' System.Diagnostics.Process.Start(url)
+
+ Dim f As New Form
+ f.Size = New Size(800, 1400)
+ Dim wb As New WebBrowser
+ f.Controls.Add(wb)
+ f.StartPosition = FormStartPosition.CenterScreen
+ wb.Dock = DockStyle.Fill
+ wb.Navigate(url)
+ Dim done = False
- Dim numMsWaited As Integer = 0
+ 'AddHandler wb.DocumentCompleted, Sub()
+ ' If Not done Then
+
+ ' If wb.Url.AbsolutePath = "/api-test-login/sign-in" Then
+ ' Try
+ ' Dim txtInput As HtmlElement = wb.Document.Forms(0).GetElementsByTagName("input").GetElementsByName("userId")(0)
+ ' txtInput.InnerText = "224015321897"
+ ' Dim txtInputPwd As HtmlElement = wb.Document.Forms(0).GetElementsByTagName("input").GetElementsByName("password")(0)
+ ' txtInputPwd.InnerText = "ry1cspz0nsvj"
+ ' done = True
+ ' Catch
+ ' End Try
+ ' End If
+ ' End If
+ ' MsgBox(wb.Url.AbsolutePath)
+ ' End Sub
+
+ If f.ShowDialog() Then
- While (numMsWaited < 120000) AndAlso (oauth2.AuthFlowState < 3)
- oauth2.SleepMs(100)
- numMsWaited = numMsWaited + 100
- End While
- ' If there was no response from the browser within 30 seconds, then
- ' the AuthFlowState will be equal to 1 Or 2.
- ' 1: Waiting for Redirect. The OAuth2 background thread Is waiting to receive the redirect HTTP request from the browser.
- ' 2: Waiting for Final Response. The OAuth2 background thread Is waiting for the final access token response.
- ' In that case, cancel the background task started in the call to StartAuth.
- If oauth2.AuthFlowState < 3 Then
- oauth2.Cancel()
- Debug.WriteLine("No response from the browser!")
- Exit Sub
+ Dim numMsWaited As Integer = 0
+
+
+ 'While (numMsWaited < 120000) AndAlso (oauth2.AuthFlowState < 3)
+ ' oauth2.SleepMs(100)
+ ' numMsWaited = numMsWaited + 100
+ 'End While
+ ' If there was no response from the browser within 30 seconds, then
+ ' the AuthFlowState will be equal to 1 Or 2.
+ ' 1: Waiting for Redirect. The OAuth2 background thread Is waiting to receive the redirect HTTP request from the browser.
+ ' 2: Waiting for Final Response. The OAuth2 background thread Is waiting for the final access token response.
+ ' In that case, cancel the background task started in the call to StartAuth.
+
+ If oauth2.AuthFlowState < 3 Then
+ oauth2.Cancel()
+ Debug.WriteLine("No response from the browser!")
+ Exit Sub
+ End If
+
+ Debug.WriteLine("HMRC here")
+
+
+ ' Check the AuthFlowState to see if authorization was granted, denied, Or if some error occurred
+ ' The possible AuthFlowState values are:
+ ' 3 Completed with Success. The OAuth2 flow has completed, the background thread exited, And the successful JSON response Is available in AccessTokenResponse property.
+ ' 4: Completed with Access Denied. The OAuth2 flow has completed, the background thread exited, And the error JSON Is available in AccessTokenResponse property.
+ ' 5: Failed Prior To Completion. The OAuth2 flow failed To complete, the background thread exited, And the error information Is available in the FailureInfo property.
+
+ If oauth2.AuthFlowState = 5 Then
+ Debug.WriteLine("OAuth2 failed to complete.")
+ Debug.WriteLine(oauth2.FailureInfo)
+ Exit Sub
+ End If
+
+ If oauth2.AuthFlowState = 4 Then
+ Debug.WriteLine("OAuth2 authorization was denied.")
+ Debug.WriteLine(oauth2.AccessTokenResponse)
+ Exit Sub
+ End If
+
+ If oauth2.AuthFlowState <> 3 Then
+ Debug.WriteLine("Unexpected AuthFlowState:" & Convert.ToString(oauth2.AuthFlowState))
+ Exit Sub
+ End If
+ MsgBox("OAuth2 authorization granted!")
+ Debug.WriteLine("OAuth2 authorization granted!")
+ Debug.WriteLine("Access Token = " & oauth2.AccessToken)
+ Dim json As Chilkat.JsonObject = New Chilkat.JsonObject()
+ json.Load(oauth2.AccessTokenResponse)
+ json.EmitCompact = False
+ Debug.WriteLine(json.Emit())
+ MsgBox(json.Emit())
+
+ ' The JSON response looks Like this
+
+ ' {
+ ' "token_type": "Bearer",
+ ' "scope": "user_impersonation",
+ ' "expires_in": "3599",
+ ' "ext_expires_in": "0",
+ ' "expires_on": "1524783438",
+ ' "not_before": "1524779538",
+ ' "resource": "https://mydomain.api.crm.dynamics.com",
+ ' "access_token": "...",
+ ' "refresh_token": "...",
+ ' "id_token": "..."
+ ' }
+
+ ' If an "expires_on" member does Not exist, then add the JSON member by
+ ' getting the current system date/time And adding the "expires_in" seconds.
+ ' This way we'll know when the token expires.
+
+ If json.HasMember("expires_on") <> True Then
+ Dim dtExpire As Chilkat.CkDateTime = New Chilkat.CkDateTime()
+ dtExpire.SetFromCurrentSystemTime()
+ dtExpire.AddSeconds(json.IntOf("expires_in"))
+ json.AppendString("expires_on", dtExpire.GetAsUnixTimeStr(False))
+ End If
+
+ Debug.WriteLine(json.Emit())
+ Dim fac As Chilkat.FileAccess = New Chilkat.FileAccess()
+ 'fac.WriteEntireTextFile("qa_data/tokens/hmrc.json", json.Emit(), "utf-8", False)
+ fac.WriteEntireTextFile("C:\Users\DEVELOPER1\Desktop\hmrc.json", json.Emit(), "utf-8", False)
+ AccessToken = oauth2.AccessToken
+ End If
+ End Sub
+ Private Shared Sub UnlockCilkat()
+ Dim glob As Chilkat.[Global] = New Chilkat.[Global]()
+ Dim success As Boolean = glob.UnlockBundle("VERAGS.CB1122022_JJ6kgS2zoR0g")
+
+ If success <> True Then
+ Debug.WriteLine(glob.LastErrorText)
+ Return
End If
- Debug.WriteLine("HMRC here")
+ Dim status As Integer = glob.UnlockStatus
-
- ' Check the AuthFlowState to see if authorization was granted, denied, Or if some error occurred
- ' The possible AuthFlowState values are:
- ' 3 Completed with Success. The OAuth2 flow has completed, the background thread exited, And the successful JSON response Is available in AccessTokenResponse property.
- ' 4: Completed with Access Denied. The OAuth2 flow has completed, the background thread exited, And the error JSON Is available in AccessTokenResponse property.
- ' 5: Failed Prior To Completion. The OAuth2 flow failed To complete, the background thread exited, And the error information Is available in the FailureInfo property.
-
- If oauth2.AuthFlowState = 5 Then
- Debug.WriteLine("OAuth2 failed to complete.")
- Debug.WriteLine(oauth2.FailureInfo)
- Exit Sub
+ If status = 2 Then
+ Debug.WriteLine("Unlocked using purchased unlock code.")
+ Else
+ Debug.WriteLine("Unlocked in trial mode.")
End If
- If oauth2.AuthFlowState = 4 Then
- Debug.WriteLine("OAuth2 authorization was denied.")
- Debug.WriteLine(oauth2.AccessTokenResponse)
- Exit Sub
- End If
-
- If oauth2.AuthFlowState <> 3 Then
- Debug.WriteLine("Unexpected AuthFlowState:" & Convert.ToString(oauth2.AuthFlowState))
- Exit Sub
- End If
-
- Debug.WriteLine("OAuth2 authorization granted!")
- Debug.WriteLine("Access Token = " & oauth2.AccessToken)
- Dim json As Chilkat.JsonObject = New Chilkat.JsonObject()
- json.Load(oauth2.AccessTokenResponse)
- json.EmitCompact = False
- Debug.WriteLine(json.Emit())
-
-
- ' The JSON response looks Like this
-
- ' {
- ' "token_type": "Bearer",
- ' "scope": "user_impersonation",
- ' "expires_in": "3599",
- ' "ext_expires_in": "0",
- ' "expires_on": "1524783438",
- ' "not_before": "1524779538",
- ' "resource": "https://mydomain.api.crm.dynamics.com",
- ' "access_token": "...",
- ' "refresh_token": "...",
- ' "id_token": "..."
- ' }
-
- ' If an "expires_on" member does Not exist, then add the JSON member by
- ' getting the current system date/time And adding the "expires_in" seconds.
- ' This way we'll know when the token expires.
-
- If json.HasMember("expires_on") <> True Then
- Dim dtExpire As Chilkat.CkDateTime = New Chilkat.CkDateTime()
- dtExpire.SetFromCurrentSystemTime()
- dtExpire.AddSeconds(json.IntOf("expires_in"))
- json.AppendString("expires_on", dtExpire.GetAsUnixTimeStr(False))
- End If
-
- Debug.WriteLine(json.Emit())
- Dim fac As Chilkat.FileAccess = New Chilkat.FileAccess()
- 'fac.WriteEntireTextFile("qa_data/tokens/hmrc.json", json.Emit(), "utf-8", False)
- fac.WriteEntireTextFile("C:\Users\DEVELOPER1\Desktop\hmrc.json", json.Emit(), "utf-8", False)
+ Debug.WriteLine(glob.LastErrorText)
End Sub
-
Shared Sub VATTEST(hmrc_app_server_token)
Dim rest As New Chilkat.Rest
Dim success As Boolean
- ' URL: https://test-api.service.hmrc.gov.uk/organisations/vat/123456789/returns
+
Dim bTls As Boolean = True
Dim port As Integer = 443
Dim bAutoReconnect As Boolean = True
- success = rest.Connect("test-api.service.hmrc.gov.uk", port, bTls, bAutoReconnect)
+ success = rest.Connect(API_STRING, port, bTls, bAutoReconnect)
If (success <> True) Then
Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
Debug.WriteLine(rest.LastErrorText)
@@ -224,6 +428,7 @@ Public Class CHMRC
json.UpdateNumber("totalAcquisitionsExVAT", "500")
json.UpdateBool("finalised", True)
+
rest.AddHeader("Content-Type", "application/json")
rest.AddHeader("Authorization", "Bearer " & hmrc_app_server_token)
rest.AddHeader("Accept", "application/vnd.hmrc.1.0+json")
@@ -249,4 +454,392 @@ Public Class CHMRC
End Sub
+
+ Shared Sub getGVMS_RefData()
+
+ Dim rest As New Chilkat.Rest
+ Dim success As Boolean
+
+ Dim bTls As Boolean = True
+ Dim port As Integer = 443
+ Dim bAutoReconnect As Boolean = True
+
+ success = rest.Connect(API_STRING, port, bTls, bAutoReconnect)
+ If (success <> True) Then
+ Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
+ Debug.WriteLine(rest.LastErrorText)
+
+ Exit Sub
+ End If
+
+ Dim json As New Chilkat.JsonObject
+
+ 'rest.AddHeader("Content-Type", "application/json")
+ 'rest.AddHeader("Authorization", "Bearer " & hmrc_app_server_token)
+ rest.AddHeader("Accept", "application/vnd.hmrc.1.0+json")
+
+ Dim sbRequestBody As New Chilkat.StringBuilder
+ json.EmitSb(sbRequestBody)
+
+ MsgBox("BODY: " & sbRequestBody.ToString)
+
+ Dim sbResponseBody As New Chilkat.StringBuilder
+ success = rest.FullRequestSb("GET", "/customs/goods-movement-system/reference-data", sbRequestBody, sbResponseBody)
+ MsgBox("1")
+ If (success <> True) Then
+ Debug.WriteLine(rest.LastErrorText)
+ MsgBox(rest.LastErrorText)
+ Exit Sub
+ End If
+ Dim respStatusCode As Integer = rest.ResponseStatusCode
+ MsgBox("NO:" & respStatusCode)
+ If (respStatusCode >= 200) Then
+ MsgBox(sbResponseBody.GetAsString())
+
+ IO.File.WriteAllText("C:\Users\DEVELOPER1\Desktop\hmrc4.json", sbResponseBody.GetAsString())
+
+
+
+ Debug.WriteLine("Response Status Code = " & respStatusCode)
+ Debug.WriteLine("Response Header:")
+ Debug.WriteLine(rest.ResponseHeader)
+ Debug.WriteLine("Response Body:")
+ Debug.WriteLine(sbResponseBody.GetAsString())
+ MsgBox("Response Body:")
+ MsgBox(sbResponseBody.GetAsString())
+ Exit Sub
+ End If
+
+
+ End Sub
+ Shared Function genGVMS_GMR(hmrc_app_server_token As String, Notification_Box_Id As String, Notification_Message_Id As String) As Boolean
+
+ Dim rest As New Chilkat.Rest
+ Dim success As Boolean
+
+
+ Dim bTls As Boolean = True
+ Dim port As Integer = 443
+ Dim bAutoReconnect As Boolean = True
+ success = rest.Connect(API_STRING, port, bTls, bAutoReconnect)
+ If (success <> True) Then
+ Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
+ Debug.WriteLine(rest.LastErrorText)
+ MsgBox(rest.LastErrorText)
+ Return False
+ End If
+
+ '"UK_INBOUND",
+ ' "UK_OUTBOUND",
+ ' "GB_TO_NI",
+ ' "NI_TO_GB"
+
+ ' See the Online Tool for Generating JSON Creation Code
+ Dim json As New Chilkat.JsonObject
+ json.UpdateString("direction", "UK_INBOUND")
+ json.UpdateBool("isUnaccompanied", False)
+ json.UpdateString("vehicleRegNum", "SD123TEST") 'LKW
+ Dim array As New Chilkat.JsonObject
+ ' json.UpdateNewArray(array) 'Empty array
+
+
+ json.UpdateString("plannedCrossing.routeId", "20") '--> Calais - Dover - DFDS
+ json.UpdateString("plannedCrossing.localDateTimeOfDeparture", "2021-08-11T10:58")
+
+ Dim cnt = 0
+
+ json.UpdateString("customsDeclarations[" & cnt & "].customsDeclarationId", "0GB689223596000-SE119404")
+ json.UpdateString("customsDeclarations[" & cnt & "].sAndSMasterRefNum", "20GB01I0XLM976S001")
+
+ cnt = 0
+
+ 'json.UpdateString("transitDeclarations[" & cnt & "].transitDeclarationId", "10GB00002910B75BE5")
+ ''json.UpdateString("transitDeclarations[" & cnt & "].sAndSMasterRefNum", "20GB01I0XLM976S004")
+ 'json.UpdateBool("transitDeclarations[" & cnt & "].isTSAD", True)
+
+ 'Dim o As New Chilkat.JsonObject
+
+ ' json.UpdateNewObject("vehicleRegNum", o) '"SD 123TEST") 'LKW
+
+ 'plannedCrossing
+ 'json.UpdateNumber("vatDueSales", "100.00")
+ 'json.UpdateNumber("vatDueAcquisitions", "100.00")
+ 'json.UpdateNumber("totalVatDue", "200")
+ 'json.UpdateNumber("vatReclaimedCurrPeriod", "100.00")
+ 'json.UpdateNumber("netVatDue", "100")
+ 'json.UpdateNumber("totalValueSalesExVAT", "500")
+ 'json.UpdateNumber("totalValuePurchasesExVAT", "500")
+ 'json.UpdateNumber("totalValueGoodsSuppliedExVAT", "500")
+ 'json.UpdateNumber("totalAcquisitionsExVAT", "500")
+ 'json.UpdateBool("finalised", True)
+
+
+ rest.AddHeader("Content-Type", "application/json")
+ rest.AddHeader("Authorization", "Bearer " & hmrc_app_server_token)
+ rest.AddHeader("Accept", "application/vnd.hmrc.1.0+json")
+
+ Dim sbRequestBody As New Chilkat.StringBuilder
+ json.EmitSb(sbRequestBody)
+
+ ' MsgBox(sbRequestBody.ToString)
+
+ Dim sbResponseBody As New Chilkat.StringBuilder
+ success = rest.FullRequestSb("POST", "/customs/goods-movement-system/movements", sbRequestBody, sbResponseBody)
+ If (success <> True) Then
+ Debug.WriteLine(rest.LastErrorText)
+ Return False
+ End If
+ Dim respStatusCode As Integer = rest.ResponseStatusCode
+
+ 'MsgBox(respStatusCode)
+
+ If (respStatusCode >= 200) Then
+
+
+ ' MsgBox(sbResponseBody.GetAsString())
+
+
+ 'Dim res = Chilkat.HttpResponse()
+ 'res.GetHeaderField
+ 'rest.ResponseHeader.
+ ' "Notification_Box_Id"
+ IO.File.WriteAllText("C:\Users\DEVELOPER1\Desktop\hmrc5.json", rest.ResponseHeader.ToString())
+ ' MsgBox(rest.ResponseHeader.ToString())
+
+ ' MsgBox(sbResponseBody.GetAsString())
+ For Each rh In rest.ResponseHeader.Split(vbNewLine)
+ If (rh.Contains("Notification-Box-Id: ")) Then
+ Notification_Box_Id = rh.Replace("Notification-Box-Id: ", "")
+ MsgBox(Notification_Box_Id)
+ End If
+ If (rh.Contains("Notification-Message-Id: ")) Then
+ Notification_Message_Id = rh.Replace("Notification-Message-Id: ", "")
+ MsgBox(Notification_Message_Id)
+ End If
+ Next
+ Debug.WriteLine("Response Status Code = " & respStatusCode)
+ Debug.WriteLine("Response Header:")
+ Debug.WriteLine(rest.ResponseHeader)
+ Debug.WriteLine("Response Body:")
+ Debug.WriteLine(sbResponseBody.GetAsString())
+ Return True
+ End If
+ Return False
+
+ End Function
+
+
+ Shared Sub getGVMS_Notifications(hmrc_app_server_token As String, Notification_Box_Id As String)
+
+ Dim rest As New Chilkat.Rest
+ Dim success As Boolean
+
+ Dim bTls As Boolean = True
+ Dim port As Integer = 443
+ Dim bAutoReconnect As Boolean = True
+ success = rest.Connect(API_STRING, port, bTls, bAutoReconnect)
+ If (success <> True) Then
+ Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
+ Debug.WriteLine(rest.LastErrorText)
+
+ Exit Sub
+ End If
+
+ '"UK_INBOUND",
+ ' "UK_OUTBOUND",
+ ' "GB_TO_NI",
+ ' "NI_TO_GB"
+
+ ' See the Online Tool for Generating JSON Creation Code
+ Dim json As New Chilkat.JsonObject
+ ' json.UpdateString("boxId", Notification_Box_Id)
+ json.UpdateString("status", "PENDING")
+ json.UpdateString("fromDate", "2020-06-03T14:20:54.987")
+ json.UpdateString("toDate", "2020-06-03T14:20:54.987")
+
+
+ rest.AddHeader("Content-Type", "application/json")
+ rest.AddHeader("Authorization", "Bearer " & hmrc_app_server_token)
+ rest.AddHeader("Accept", "application/vnd.hmrc.1.0+json")
+
+
+ Dim sbRequestBody As New Chilkat.StringBuilder
+ json.EmitSb(sbRequestBody)
+
+ MsgBox(sbRequestBody.ToString)
+
+ Dim sbResponseBody As New Chilkat.StringBuilder
+ success = rest.FullRequestSb("GET", "/misc/push-pull-notification/box/" & Notification_Box_Id & "/notifications", sbRequestBody, sbResponseBody)
+ If (success <> True) Then
+ Debug.WriteLine(rest.LastErrorText)
+ Exit Sub
+ End If
+ Dim respStatusCode As Integer = rest.ResponseStatusCode
+
+ MsgBox(respStatusCode)
+
+ If (respStatusCode >= 200) Then
+ IO.File.WriteAllText("C:\Users\DEVELOPER1\Desktop\hmrc3.json", rest.ResponseHeader.ToString())
+ MsgBox(rest.ResponseHeader.ToString())
+
+ MsgBox(sbResponseBody.GetAsString())
+
+ Debug.WriteLine("Response Status Code = " & respStatusCode)
+ Debug.WriteLine("Response Header:")
+ Debug.WriteLine(rest.ResponseHeader)
+ Debug.WriteLine("Response Body:")
+ Debug.WriteLine(sbResponseBody.GetAsString())
+ Exit Sub
+ End If
+
+
+ End Sub
+
+
+ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+ '''
+ 'Shared Sub testToken2()
+ ' Dim refresh_token As String
+ ' Dim token As String
+
+ ' ' construct the request for access token
+ ' Dim client = New RestClient(API_STRING & "/oauth/token")
+ ' Dim request = New RestRequest("dfe/application-info", Method.POST)
+ ' request.AddHeader("content-type", "application/x-www-form-urlencoded")
+ ' request.AddParameter("grant_type", "client_credentials")
+ ' request.AddParameter("client_id", "")
+ ' request.AddParameter("client_secret", "")
+
+ ' ' make call to get token
+ ' Dim response As IRestResponse = client.Execute(request)
+
+ ' ' Extract token
+ ' token = JObject.Parse(response.Content).SelectToken("$..access_token").ToString()
+ ' refresh_token = JObject.Parse(response.Content).SelectToken("$..refresh_token").ToString()
+ 'End Sub
+ Shared Sub getHMRC_Token(ByRef AccessToken, scope)
+ 'oauth2.ListenPort = 3017
+ ''oauth2.AuthorizationEndpoint = "https://test-api.service.hmrc.gov.uk/oauth/authorize"
+ ''oauth2.TokenEndpoint = "https://test-api.service.hmrc.gov.uk/oauth/token"
+ 'oauth2.AuthorizationEndpoint = API_STRING & "/oauth/authorize"
+ 'oauth2.TokenEndpoint = API_STRING & "/oauth/token"
+ 'oauth2.ClientId = "xybTOMaQWcuifeW5xnGggojlACWC"
+ 'oauth2.ClientSecret = "bf1cfb6e-1bcb-4282-b7a0-3d3ccb2b1dc1"
+ ''oauth2.Scope = "read:vat write:vat" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ 'oauth2.Scope = scope '"write:goods-movement-system"
+ 'Dim url As String = oauth2.StartAuth()
+
+
+ ' Refer to the documentation for more information on how to get the client id/secret
+ Dim clientId As String = "xybTOMaQWcuifeW5xnGggojlACWC"
+ Dim clientSecret As String = "bf1cfb6e-1bcb-4282-b7a0-3d3ccb2b1dc1"
+ ' Refer to the documentation for more information on how to get the tokens
+ 'Dim accessToken As String = "" '"OaOXXXXTaSucp8XXcgXXH"
+ ' Dim refreshToken As String = "kE4HXXXXXXXhxvtUHlboSF"
+
+ ' -- Refresh the access token
+ Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(API_STRING & "/oauth/token")
+ 'oauth2.AuthorizationEndpoint = API_STRING & "/oauth/authorize"
+ ' oauth2.TokenEndpoint = API_STRING & "/oauth/token"
+ request.Method = "POST"
+ request.ContentType = "application/x-www-form-urlencoded"
+ 'request.ContentType = "application/json"
+
+ Dim outgoingQueryString As NameValueCollection = HttpUtility.ParseQueryString(String.Empty)
+ outgoingQueryString.Add("grant_type", "client_credentials")
+ ' outgoingQueryString.Add("refresh_token", refreshToken)
+ outgoingQueryString.Add("client_id", clientId)
+ outgoingQueryString.Add("client_secret", clientSecret)
+ outgoingQueryString.Add("scope", scope) '"write:goods-movement-system")
+ Dim postBytes As Byte() = New ASCIIEncoding().GetBytes(outgoingQueryString.ToString())
+
+ Dim postStream As Stream = request.GetRequestStream()
+ postStream.Write(postBytes, 0, postBytes.Length)
+ postStream.Flush()
+ postStream.Close()
+ Try
+
+ Using response As System.Net.WebResponse = request.GetResponse()
+ Using streamReader As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
+ ' Parse the JSON the way you prefer
+ Dim jsonResult As RefreshTokenResultJSON = New System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(streamReader.ReadToEnd(), GetType(RefreshTokenResultJSON))
+ AccessToken = jsonResult.access_token
+
+
+ ' For more information, refer to the documentation
+ End Using
+ End Using
+
+ Catch ex As Exception
+ MsgBox(ex.Message & ex.StackTrace)
+ End Try
+ '' -- Get current user profile
+ 'request = System.Net.HttpWebRequest.Create("https://api.clicdata.com/profile/user")
+ 'request.Method = "GET"
+ 'request.Headers.Add("Authorization", "Bearer " & accessToken)
+ 'Using response As System.Net.WebResponse = request.GetResponse()
+ ' Using streamReader As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
+ ' Dim jsonResponseText = streamReader.ReadToEnd()
+ ' ' Parse the JSON the way you prefer
+ ' ' In this example the JSON will be something Like:
+ ' ' {"email_address" "john.smith@clicdata.com", "first_name": "John", "last_login_date": "2016−04−26T14:24:58+00:00", "last_name": "Smith", ...
+ ' ' For more information, refer to the documentation
+ ' End Using
+ 'End Using
+
+ '' -- List the current data
+ 'request = System.Net.HttpWebRequest.Create("https://api.clicdata.com/data/")
+ 'request.Method = "GET"
+ 'request.Headers.Add("Authorization", "Bearer " & accessToken)
+ 'Using response As System.Net.WebResponse = request.GetResponse()
+ ' Using streamReader As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
+ ' Dim jsonResponseText = streamReader.ReadToEnd()
+ ' ' Parse the JSON the way you prefer
+ ' ' In this example the JSON will be something Like:
+ ' ' { "count" 265, "data": [{ "description": "","source": "merge", "creation_date": "2015−06−10T12:47:32+02:00", "last_data_update_date": "2015−06−10T12:47:49+02:00", ...
+ ' ' For more information, refer to the documentation
+ ' End Using
+ 'End Using
+
+ '' -- Create some new data
+ 'Dim dataId As Integer = 0
+ 'request = System.Net.HttpWebRequest.Create("https://api.clicdata.com/data/")
+ 'request.Method = "POST"
+ 'request.ContentType = "application/json"
+ 'request.Headers.Add("Authorization", "Bearer " & accessToken)
+ 'Using tStreamWriter As System.IO.StreamWriter = New System.IO.StreamWriter(request.GetRequestStream())
+ ' tStreamWriter.Write(New System.Web.Script.Serialization.JavaScriptSerializer().Serialize(New With {Key .name = "my test data " & Guid.NewGuid().ToString(), Key .description = "some description for my test data", Key .columns = {New With {Key .name = "column 1", Key .data_type = "text"}, New With {Key .name = "column 2", Key .data_type = "number"}}}))
+ 'End Using
+
+ 'Using response As System.Net.WebResponse = request.GetResponse()
+ ' Using streamReader As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
+ ' Dim jsonResponseText = streamReader.ReadToEnd()
+ ' ' The JSON returned in this example is the ID of our newly created data
+ ' dataId = Integer.Parse(jsonResponseText)
+ ' ' For more information, refer to the documentation
+ ' End Using
+ 'End Using
+
+ '' -- Add a few rows of data
+ 'request = System.Net.HttpWebRequest.Create("https://api.clicdata.com/data/" & dataId & "/rows")
+ 'request.Method = "POST"
+ 'request.ContentType = "application/json"
+ 'request.Headers.Add("Authorization", "Bearer " & accessToken)
+ 'Using tStreamWriter As System.IO.StreamWriter = New System.IO.StreamWriter(request.GetRequestStream())
+ ' tStreamWriter.Write(New System.Web.Script.Serialization.JavaScriptSerializer().Serialize(New With {Key .data = New Object() {New Object() {"one", 1}, New Object() {"two", 2}}}))
+ 'End Using
+
+ 'Using response As System.Net.WebResponse = request.GetResponse()
+ ' Using streamReader As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
+ ' Dim jsonResponseText = streamReader.ReadToEnd()
+ ' ' The JSON returned in this example tells us if the rows were inserted successfully:
+ ' ' { "success" true }
+ ' ' For more information, refer to the documentation
+ ' End Using
+ 'End Using
+ End Sub
+
+ Public Class RefreshTokenResultJSON
+ Public Property access_token As String
+ End Class
End Class
diff --git a/Aviso/My Project/AssemblyInfo.vb b/Aviso/My Project/AssemblyInfo.vb
index f6db28c..4fd3170 100644
--- a/Aviso/My Project/AssemblyInfo.vb
+++ b/Aviso/My Project/AssemblyInfo.vb
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
'
-
-
+
+
diff --git a/Aviso/My Project/Resources.Designer.vb b/Aviso/My Project/Resources.Designer.vb
index 8098824..3fb2093 100644
--- a/Aviso/My Project/Resources.Designer.vb
+++ b/Aviso/My Project/Resources.Designer.vb
@@ -669,6 +669,15 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die ähnelt.
+ '''
+ Friend ReadOnly Property gfh2fgh1fg2hfghfgh() As String
+ Get
+ Return ResourceManager.GetString("gfh2fgh1fg2hfghfgh", resourceCulture)
+ End Get
+ End Property
+
'''
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''
@@ -1179,15 +1188,6 @@ Namespace My.Resources
End Get
End Property
- '''
- ''' Sucht eine lokalisierte Zeichenfolge, die ähnelt.
- '''
- Friend ReadOnly Property sdf8sdfsidfsd8fsdjmkfsdfsdf() As String
- Get
- Return ResourceManager.GetString("sdf8sdfsidfsd8fsdjmkfsdfsdf", resourceCulture)
- End Get
- End Property
-
'''
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''
@@ -1548,7 +1548,7 @@ Namespace My.Resources
End Property
'''
- ''' Sucht eine lokalisierte Zeichenfolge, die 3.7.1.5 ähnelt.
+ ''' Sucht eine lokalisierte Zeichenfolge, die 3.7.1.7 ähnelt.
'''
Friend ReadOnly Property Version() As String
Get
diff --git a/Aviso/My Project/Resources.resx b/Aviso/My Project/Resources.resx
index b49aa4c..15d0b84 100644
--- a/Aviso/My Project/Resources.resx
+++ b/Aviso/My Project/Resources.resx
@@ -536,7 +536,7 @@
..\Resources\plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
- 3.7.1.5
+ 3.7.1.7
..\Resources\statusBtn_vorgeschrieben_Aktiv.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -619,7 +619,7 @@
F:\Grafik\VERAG\VERAG_Akten\eigAkt\FO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
+
\ No newline at end of file
diff --git a/Aviso/frmEintragAviso.vb b/Aviso/frmEintragAviso.vb
index 4da1e72..b7f3f84 100644
--- a/Aviso/frmEintragAviso.vb
+++ b/Aviso/frmEintragAviso.vb
@@ -113,7 +113,8 @@ Public Class frmEintragAviso
If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
ATILLA_NEUERAKTENDECKEL = True
End If
- initDrucker()
+ 'initDrucker()
+ SDL.cProgramFunctions.initDrucker(cboPrinter)
If StartFromOUTLOOK Then
optSchriftlich.Checked = True
@@ -1258,32 +1259,32 @@ Public Class frmEintragAviso
End Sub
- Sub initDrucker()
- ' alle installierten Drucker ermitteln und
- ' in in ein ArrayList-Objekt speichern
- Dim sPrinters As New ArrayList
- For Each sPrinter As String In PrinterSettings.InstalledPrinters
- sPrinters.Add(sPrinter)
- Next
+ 'Sub initDrucker()
+ ' ' alle installierten Drucker ermitteln und
+ ' ' in in ein ArrayList-Objekt speichern
+ ' Dim sPrinters As New ArrayList
+ ' For Each sPrinter As String In PrinterSettings.InstalledPrinters
+ ' sPrinters.Add(sPrinter)
+ ' Next
- ' Array sortieren
- sPrinters.Sort()
+ ' ' Array sortieren
+ ' sPrinters.Sort()
- ' printer()
+ ' ' printer()
- ' jetzt alle Drucker in sortierter Reihenfolge in einer
- ' ComboBox zur Auswahl anbieten
- Dim oPS As New System.Drawing.Printing.PrinterSettings
- Dim pList As List(Of PrinterList) = PROG.getPrinterList
- For i As Integer = 0 To sPrinters.Count - 1
- If PROG.isPrinterOnlineByList(pList, sPrinters(i)) Then
- setCboEntry(sPrinters(i)) ' cboPrinter.Items.Add(sPrinters(i))
- End If
- Next
+ ' ' jetzt alle Drucker in sortierter Reihenfolge in einer
+ ' ' ComboBox zur Auswahl anbieten
+ ' Dim oPS As New System.Drawing.Printing.PrinterSettings
+ ' Dim pList As List(Of PrinterList) = PROG.getPrinterList
+ ' For i As Integer = 0 To sPrinters.Count - 1
+ ' If PROG.isPrinterOnlineByList(pList, sPrinters(i)) Then
+ ' setCboEntry(sPrinters(i)) ' cboPrinter.Items.Add(sPrinters(i))
+ ' End If
+ ' Next
- setCboSelected(oPS.PrinterName)
+ ' setCboSelected(oPS.PrinterName)
- End Sub
+ 'End Sub
'threadsicherer Aufruf
diff --git a/Aviso/frmHauptfenster.vb b/Aviso/frmHauptfenster.vb
index bce21d4..979a6e2 100644
--- a/Aviso/frmHauptfenster.vb
+++ b/Aviso/frmHauptfenster.vb
@@ -2565,6 +2565,9 @@ Public Class frmHauptfenster
End Function
Private Sub Button3_Click_1(sender As Object, e As EventArgs) Handles Button3.Click
+ cHMRC.hmrcTEST()
+
+ Exit Sub
Dim list = VERAG_PROG_ALLGEMEIN.cRechnungsausgang.GET_LIST_WEB(717858, CDate("01.10.2021"), CDate("31.10.2021")) '{5})
@@ -2581,9 +2584,6 @@ Public Class frmHauptfenster
VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(mailTo, betreff, htmlBody, , False, False)
Exit Sub
- Exit Sub
- CHMRC.hmrcTEST()
-
Exit Sub
Dim ep As New SDL.cEORIWebService
MsgBox(ep.ValidateEoriNumber("ATEOS1000000199").Result(0).Name)
@@ -2634,6 +2634,10 @@ Public Class frmHauptfenster
Dim resultJson = FromClass(SH)
MsgBox(resultJson)
+
+
+
+
Exit Sub
Dim jsonPost As New VERAG_PROG_ALLGEMEIN.cJsonPost("https://api.verag.ag/api/V001/CustomsDeclaration?value=test123")
diff --git a/Aviso/frmLaufzettel.Designer.vb b/Aviso/frmLaufzettel.Designer.vb
index fdb449d..42482ef 100644
--- a/Aviso/frmLaufzettel.Designer.vb
+++ b/Aviso/frmLaufzettel.Designer.vb
@@ -41,15 +41,16 @@ Partial Class frmLaufzettel
Me.DocId = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.btnLaufzettelDrucken = New System.Windows.Forms.Button()
Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components)
+ Me.cboPrinter = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.cbxVPSplit = New System.Windows.Forms.CheckBox()
Me.pnlZumZoll = New System.Windows.Forms.Panel()
+ Me.Button2 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
Me.btnDIGITAL = New System.Windows.Forms.Button()
Me.Button1 = New System.Windows.Forms.Button()
Me.pnl = New System.Windows.Forms.Panel()
Me.btn = New System.Windows.Forms.Button()
- Me.Button2 = New System.Windows.Forms.Button()
- Me.cboPrinter = New VERAG_PROG_ALLGEMEIN.MyComboBox()
+ Me.Button4 = New System.Windows.Forms.Button()
CType(Me.dgvLaufzettelDruck, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.dgvDigitalMailanfügen, System.ComponentModel.ISupportInitialize).BeginInit()
Me.MyPanel1.SuspendLayout()
@@ -232,6 +233,7 @@ Partial Class frmLaufzettel
'MyPanel1
'
Me.MyPanel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
+ Me.MyPanel1.Controls.Add(Me.Button4)
Me.MyPanel1.Controls.Add(Me.cboPrinter)
Me.MyPanel1.Controls.Add(Me.cbxVPSplit)
Me.MyPanel1.Controls.Add(Me.pnlZumZoll)
@@ -249,6 +251,19 @@ Partial Class frmLaufzettel
Me.MyPanel1.Size = New System.Drawing.Size(564, 571)
Me.MyPanel1.TabIndex = 9
'
+ 'cboPrinter
+ '
+ Me.cboPrinter._allowedValuesFreiText = Nothing
+ Me.cboPrinter._allowFreiText = False
+ Me.cboPrinter._value = ""
+ Me.cboPrinter.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
+ Me.cboPrinter.DropDownWidth = 300
+ Me.cboPrinter.FormattingEnabled = True
+ Me.cboPrinter.Location = New System.Drawing.Point(18, 495)
+ Me.cboPrinter.Name = "cboPrinter"
+ Me.cboPrinter.Size = New System.Drawing.Size(260, 21)
+ Me.cboPrinter.TabIndex = 23
+ '
'cbxVPSplit
'
Me.cbxVPSplit.AutoSize = True
@@ -273,6 +288,16 @@ Partial Class frmLaufzettel
Me.pnlZumZoll.Size = New System.Drawing.Size(562, 49)
Me.pnlZumZoll.TabIndex = 12
'
+ 'Button2
+ '
+ Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
+ Me.Button2.Location = New System.Drawing.Point(468, 8)
+ Me.Button2.Name = "Button2"
+ Me.Button2.Size = New System.Drawing.Size(83, 36)
+ Me.Button2.TabIndex = 13
+ Me.Button2.Text = "nur z.Zoll drucken"
+ Me.Button2.UseVisualStyleBackColor = True
+ '
'Button3
'
Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat
@@ -305,7 +330,7 @@ Partial Class frmLaufzettel
Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button1.Location = New System.Drawing.Point(18, 363)
Me.Button1.Name = "Button1"
- Me.Button1.Size = New System.Drawing.Size(260, 36)
+ Me.Button1.Size = New System.Drawing.Size(188, 36)
Me.Button1.TabIndex = 9
Me.Button1.Text = "Laufzettel anzeigen"
Me.Button1.UseVisualStyleBackColor = True
@@ -337,28 +362,15 @@ Partial Class frmLaufzettel
Me.btn.Text = "X"
Me.btn.UseVisualStyleBackColor = False
'
- 'Button2
+ 'Button4
'
- Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
- Me.Button2.Location = New System.Drawing.Point(468, 8)
- Me.Button2.Name = "Button2"
- Me.Button2.Size = New System.Drawing.Size(83, 36)
- Me.Button2.TabIndex = 13
- Me.Button2.Text = "nur z.Zoll drucken"
- Me.Button2.UseVisualStyleBackColor = True
- '
- 'cboPrinter
- '
- Me.cboPrinter._allowedValuesFreiText = Nothing
- Me.cboPrinter._allowFreiText = False
- Me.cboPrinter._value = ""
- Me.cboPrinter.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
- Me.cboPrinter.DropDownWidth = 300
- Me.cboPrinter.FormattingEnabled = True
- Me.cboPrinter.Location = New System.Drawing.Point(18, 495)
- Me.cboPrinter.Name = "cboPrinter"
- Me.cboPrinter.Size = New System.Drawing.Size(260, 21)
- Me.cboPrinter.TabIndex = 23
+ Me.Button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat
+ Me.Button4.Location = New System.Drawing.Point(205, 363)
+ Me.Button4.Name = "Button4"
+ Me.Button4.Size = New System.Drawing.Size(73, 36)
+ Me.Button4.TabIndex = 24
+ Me.Button4.Text = "Kopieren"
+ Me.Button4.UseVisualStyleBackColor = True
'
'frmLaufzettel
'
@@ -411,4 +423,5 @@ Partial Class frmLaufzettel
Friend WithEvents printTyp As DataGridViewTextBoxColumn
Friend WithEvents Button2 As Button
Friend WithEvents cboPrinter As VERAG_PROG_ALLGEMEIN.MyComboBox
+ Friend WithEvents Button4 As Button
End Class
diff --git a/Aviso/frmLaufzettel.vb b/Aviso/frmLaufzettel.vb
index 63e044e..8a3560b 100644
--- a/Aviso/frmLaufzettel.vb
+++ b/Aviso/frmLaufzettel.vb
@@ -48,44 +48,44 @@ Public Class frmLaufzettel
Me.jeVP = jeVP
End Sub
- Public Shared Sub initDrucker(cboPrinter As ComboBox, Optional srch As String = "")
- ' alle installierten Drucker ermitteln und
- ' in in ein ArrayList-Objekt speichern
- Dim sPrinters As New ArrayList
- For Each sPrinter As String In PrinterSettings.InstalledPrinters
- sPrinters.Add(sPrinter)
- Next
+ 'Public Shared Sub initDrucker(cboPrinter As ComboBox, Optional srch As String = "")
+ ' ' alle installierten Drucker ermitteln und
+ ' ' in in ein ArrayList-Objekt speichern
+ ' Dim sPrinters As New ArrayList
+ ' For Each sPrinter As String In PrinterSettings.InstalledPrinters
+ ' sPrinters.Add(sPrinter)
+ ' Next
- ' Array sortieren
- sPrinters.Sort()
+ ' ' Array sortieren
+ ' sPrinters.Sort()
- ' jetzt alle Drucker in sortierter Reihenfolge in einer
- ' ComboBox zur Auswahl anbieten
- Dim oPS As New System.Drawing.Printing.PrinterSettings
- For i As Integer = 0 To sPrinters.Count - 1
- cboPrinter.Items.Add(sPrinters(i))
- Next
+ ' ' jetzt alle Drucker in sortierter Reihenfolge in einer
+ ' ' ComboBox zur Auswahl anbieten
+ ' Dim oPS As New System.Drawing.Printing.PrinterSettings
+ ' For i As Integer = 0 To sPrinters.Count - 1
+ ' cboPrinter.Items.Add(sPrinters(i))
+ ' Next
- If sPrinters.Count > 0 Then
- cboPrinter.SelectedIndex = 0
- If srch <> "" Then
- For Each i In cboPrinter.Items
- If i.ToString.ToUpper.Contains(srch.ToUpper) Then
- cboPrinter.SelectedItem = i
- Exit Sub
- End If
- Next
- Else
- For Each i In cboPrinter.Items
- If i.ToString = oPS.PrinterName Then
- cboPrinter.SelectedItem = i
- Exit Sub
- End If
- Next
- End If
- End If
- End Sub
+ ' If sPrinters.Count > 0 Then
+ ' cboPrinter.SelectedIndex = 0
+ ' If srch <> "" Then
+ ' For Each i In cboPrinter.Items
+ ' If i.ToString.ToUpper.Contains(srch.ToUpper) Then
+ ' cboPrinter.SelectedItem = i
+ ' Exit Sub
+ ' End If
+ ' Next
+ ' Else
+ ' For Each i In cboPrinter.Items
+ ' If i.ToString = oPS.PrinterName Then
+ ' cboPrinter.SelectedItem = i
+ ' Exit Sub
+ ' End If
+ ' Next
+ ' End If
+ ' End If
+ 'End Sub
Sub initLZ()
@@ -150,7 +150,7 @@ Public Class frmLaufzettel
End Sub
Private Sub frmLaufzettel_Load(sender As Object, e As EventArgs) Handles Me.Load
- initDrucker(cboPrinter)
+ SDL.cProgramFunctions.initDrucker(cboPrinter)
If DIGITAL Then
cbxDigitalLZ.Enabled = True
@@ -537,4 +537,26 @@ Public Class frmLaufzettel
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
printzZAnlagen()
End Sub
+
+ Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
+ Me.Cursor = Cursors.WaitCursor
+ Try
+
+ AVISO.LOAD_Vorpapiere()
+ Dim VP_Enum = VERAG_PROG_ALLGEMEIN.cSendungen.VP_Enum(SENDUNG_LIST) 'Filtert nach eindeutigen Vorpapieren
+
+ Dim paths As New List(Of String)
+ If Not genLZ(paths, False, VP_Enum) Then
+ Exit Sub
+ End If
+
+ Clipboard.Clear()
+ Dim d As New DataObject(DataFormats.FileDrop, paths.ToArray)
+ Clipboard.SetDataObject(d, True)
+
+ 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 Sub
End Class
\ No newline at end of file
diff --git a/Aviso/frmLogin.vb b/Aviso/frmLogin.vb
index b465b39..78bcf4f 100644
--- a/Aviso/frmLogin.vb
+++ b/Aviso/frmLogin.vb
@@ -248,6 +248,21 @@ Public Class frmLogin
End If
End If
+ Dim AVISO_OPTIONSDatei As String = "C:\AVISO_OPTIONS.txt"
+ If File.Exists(AVISO_OPTIONSDatei) Then
+ Dim l = IO.File.ReadAllLines(AVISO_OPTIONSDatei, System.Text.Encoding.Default)
+ If l.Count > 0 Then
+ For Each li In l
+ If li.StartsWith("BON:") Then
+ VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_BON = (li.Replace("BON:", "")).Trim
+ End If
+ If li.StartsWith("PRINTER:") Then
+ VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD = (li.Replace("PRINTER:", "")).Trim
+ End If
+ Next
+ End If
+ End If
+
''hier erfolgt die Anmelde-Prüfung
diff --git a/Aviso/frmSendungsdetailsNEU.vb b/Aviso/frmSendungsdetailsNEU.vb
index d000f66..ba92c1b 100644
--- a/Aviso/frmSendungsdetailsNEU.vb
+++ b/Aviso/frmSendungsdetailsNEU.vb
@@ -1726,10 +1726,17 @@ Public Class frmSendungsdetailsNEU
' alle installierten Drucker ermitteln und
' in in ein ArrayList-Objekt speichern
- Dim sPrinters As New ArrayList
- For Each sPrinter As String In PrinterSettings.InstalledPrinters
- sPrinters.Add(sPrinter)
- Next
+ Dim sPrinters As ArrayList
+
+ If VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_LIST IsNot Nothing Then
+ sPrinters = VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_LIST
+ Else
+ sPrinters = New ArrayList
+ For Each sPrinter As String In PrinterSettings.InstalledPrinters
+ sPrinters.Add(sPrinter)
+ Next
+ End If
+
' Array sortieren
sPrinters.Sort()
@@ -1746,29 +1753,13 @@ Public Class frmSendungsdetailsNEU
End If
Next
- setCboSelected(oPS.PrinterName)
- If False Then
-
- If sPrinters.Count > 0 Then
- cboPrinter.SelectedIndex = 0
- For Each i In cboPrinter.Items
- If i.ToString = oPS.PrinterName Then
- cboPrinter.SelectedItem = i
- Exit For
- End If
- Next
- End If
-
-
- ' For Each i In cboPrinter.Items
- 'If i.ToString.ToUpper.Contains("TALLY") Then
- 'cboPrinter.SelectedItem = i : Exit For
- ' End If
- ' Next
+ If VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD <> String.Empty Then
+ setCboSelected(VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD)
+ Else
+ setCboSelected(oPS.PrinterName)
End If
-
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name,, "Fehler beim initialisieren der Drucker!")
End Try
@@ -1808,7 +1799,7 @@ Public Class frmSendungsdetailsNEU
If found = False Then 'Falls kein TALLY, Standarddrucker
cboPrinter.SelectedIndex = 0
For Each i In cboPrinter.Items
- If i.ToString = standardDrucker Then
+ If i.ToString.ToUpper.Contains(standardDrucker.ToUpper) Then ' If i.ToString = standardDrucker Then ' Contains, weil sonst \\dc02\ stört
cboPrinter.SelectedItem = i
Exit For
End If
diff --git a/Aviso/packages.config b/Aviso/packages.config
index b4fbfca..55b1d51 100644
--- a/Aviso/packages.config
+++ b/Aviso/packages.config
@@ -6,6 +6,7 @@
+
@@ -17,6 +18,8 @@
+
+