diff --git a/UID/usrctlProcedures.Designer.vb b/UID/usrctlProcedures.Designer.vb index 7d5a956..bbd4e8f 100644 --- a/UID/usrctlProcedures.Designer.vb +++ b/UID/usrctlProcedures.Designer.vb @@ -95,6 +95,7 @@ Partial Class usrctlProcedures Me.Button50 = New System.Windows.Forms.Button() Me.Button49 = New System.Windows.Forms.Button() Me.TabPage7 = New System.Windows.Forms.TabPage() + Me.Button53 = New System.Windows.Forms.Button() Me.Label22 = New System.Windows.Forms.Label() Me.dtpbis = New System.Windows.Forms.DateTimePicker() Me.lblDakosyImport = New System.Windows.Forms.Label() @@ -874,6 +875,7 @@ Partial Class usrctlProcedures ' 'TabPage7 ' + Me.TabPage7.Controls.Add(Me.Button53) Me.TabPage7.Controls.Add(Me.Label22) Me.TabPage7.Controls.Add(Me.dtpbis) Me.TabPage7.Controls.Add(Me.lblDakosyImport) @@ -889,6 +891,15 @@ Partial Class usrctlProcedures Me.TabPage7.Text = "Dakosy Import" Me.TabPage7.UseVisualStyleBackColor = True ' + 'Button53 + ' + Me.Button53.Location = New System.Drawing.Point(18, 115) + Me.Button53.Name = "Button53" + Me.Button53.Size = New System.Drawing.Size(145, 41) + Me.Button53.TabIndex = 73 + Me.Button53.Text = "Ursprungsland ISO2 einfügen" + Me.Button53.UseVisualStyleBackColor = True + ' 'Label22 ' Me.Label22.Location = New System.Drawing.Point(279, 19) @@ -1652,4 +1663,5 @@ Partial Class usrctlProcedures Friend WithEvents Button52 As Button Friend WithEvents Label22 As Label Friend WithEvents dtpbis As DateTimePicker + Friend WithEvents Button53 As Button End Class diff --git a/UID/usrctlProcedures.resx b/UID/usrctlProcedures.resx index c9977e7..508fc32 100644 --- a/UID/usrctlProcedures.resx +++ b/UID/usrctlProcedures.resx @@ -123,10 +123,4 @@ True - - True - - - True - \ No newline at end of file diff --git a/UID/usrctlProcedures.vb b/UID/usrctlProcedures.vb index 3b1edd0..c9e5a3a 100644 --- a/UID/usrctlProcedures.vb +++ b/UID/usrctlProcedures.vb @@ -3596,6 +3596,9 @@ Public Class usrctlProcedures DYIMPORT.Ursprung = isleernothing((currentRow(89))) + + If DYIMPORT.Ursprung IsNot Nothing AndAlso DYIMPORT.Ursprung <> "" Then DYIMPORT.Ursprungsland_ISO2 = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromLandbezeichnung(DYIMPORT.Ursprung) + DYIMPORT.Präferenzursprungsland = isleernothing((currentRow(90))) DYIMPORT.Beguenstigung = isleernothing((currentRow(91))) @@ -4301,6 +4304,72 @@ OPTION (MAXRECURSION 1000);", "AVISO") ' cProgramFunctions.genExcelFromDT_NEW(dt) + Dim dt_fehlendeLaender As DataTable = SQL.loadDgvBySql("select distinct (Ursprung) FROM [AVISO].[dbo].[tbl_DY_Zollmeldungen_Import] where Ursprungsland_ISO2 is null and Ursprung is not null", "AVISO") + If dt_fehlendeLaender.Rows.Count > 0 Then + MsgBox("ACHTUNG!, es befinden sich noch " & dt_fehlendeLaender.Rows.Count & " Länder, zu denen kein Ursprungsland zugewiesen wurde!" & vbNewLine & "Bitte zuweisen/bei Administration nachfragen!") + cProgramFunctions.genExcelFromDT_NEW(dt_fehlendeLaender) + End If + + + End Sub + + Private Sub Button53_Click(sender As Object, e As EventArgs) Handles Button53.Click + + + Dim Laneder = "select distinct (Ursprung) FROM [AVISO].[dbo].[tbl_DY_Zollmeldungen_Import] where Ursprungsland_ISO2 is null and Ursprung is not null" + + + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Dim dtiso2Laneder As DataTable = SQL.loadDgvBySql(Laneder, "AVISO") + + If dtiso2Laneder.Rows.Count > 0 Then + For Each r As DataRow In dtiso2Laneder.Rows + + + Dim landISO2 As String = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromLandbezeichnung(r.Item("Ursprung")) + + If landISO2 <> "" Then + SQL.doSQL("Update [AVISO].[dbo].[tbl_DY_Zollmeldungen_Import] set Ursprungsland_ISO2 = '" & landISO2 & "' where Ursprung = '" & r.Item("Ursprung") & "'", "AVISO") + Else + Dim ISO2SetCountry As String = "" + Select Case r.Item("Ursprung") + Case "El Salvador" : ISO2SetCountry = "SV" + Case "Europäische Union" : ISO2SetCountry = "EU" + Case "Guatemala" : ISO2SetCountry = "GT" + Case "Iran (Islamische Republik)" : ISO2SetCountry = "IR" + Case "Kambodscha" : ISO2SetCountry = "KH" + Case "Katar" : ISO2SetCountry = "QA" + Case "Macau" : ISO2SetCountry = "MO" + Case "Mali" : ISO2SetCountry = "ML" + Case "Moldau, Republik" : ISO2SetCountry = "MD" + Case "Myanmar" : ISO2SetCountry = "MM" + Case "Nordmazedonien" : ISO2SetCountry = "MK" + Case "Paraguay" : ISO2SetCountry = "PY" + Case "Russische Föderation" : ISO2SetCountry = "RU" + Case "Saudi-Arabien" : ISO2SetCountry = "SA" + Case "Sierra Leone" : ISO2SetCountry = "SL" + Case "Slowakische Republik" : ISO2SetCountry = "SK" + Case "Spanien (ohne XC, XL)" : ISO2SetCountry = "ES" + Case "Südkorea (Republik Korea)" : ISO2SetCountry = "KR" + Case "Tschechien" : ISO2SetCountry = "CZ" + Case "Vereinigte Arabische Emirate" : ISO2SetCountry = "AE" + Case "Vereinigte Staaten" : ISO2SetCountry = "US" + Case "Vereinigtes Königreich" : ISO2SetCountry = "GB" + End Select + + + If ISO2SetCountry <> "" Then + SQL.doSQL("Update [AVISO].[dbo].[tbl_DY_Zollmeldungen_Import] set Ursprungsland_ISO2 = '" & ISO2SetCountry & "' where Ursprung = '" & r.Item("Ursprung") & "'", "AVISO") + + End If + + End If + + Next + MsgBox("alle Länder gesetzt!") + Else + MsgBox("keine fehlenden Länder vorhanden!") + End If End Sub