diff --git a/SDL/kunden/usrCntlCBAM.Designer.vb b/SDL/kunden/usrCntlCBAM.Designer.vb index e709e771..850b6fd1 100644 --- a/SDL/kunden/usrCntlCBAM.Designer.vb +++ b/SDL/kunden/usrCntlCBAM.Designer.vb @@ -68,6 +68,8 @@ Partial Class usrCntlCBAM Me.Button3 = New System.Windows.Forms.Button() Me.lblKafkaCnt = New System.Windows.Forms.Label() Me.Panel1 = New System.Windows.Forms.Panel() + Me.txtBenchmark = New VERAG_PROG_ALLGEMEIN.MyTextBox() + Me.Label12 = New System.Windows.Forms.Label() Me.txtCalcLand = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtCalcErg = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.Button4 = New System.Windows.Forms.Button() @@ -89,8 +91,7 @@ Partial Class usrCntlCBAM Me.txtVon = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtBis = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtEori = New VERAG_PROG_ALLGEMEIN.MyTextBox() - Me.txtBenchmark = New VERAG_PROG_ALLGEMEIN.MyTextBox() - Me.Label12 = New System.Windows.Forms.Label() + Me.Button5 = New System.Windows.Forms.Button() Me.cntxtAddSdl.SuspendLayout() Me.Panel1.SuspendLayout() Me.MyPanel1.SuspendLayout() @@ -631,6 +632,39 @@ Partial Class usrCntlCBAM Me.Panel1.Size = New System.Drawing.Size(223, 331) Me.Panel1.TabIndex = 52 ' + 'txtBenchmark + ' + Me.txtBenchmark._DateTimeOnly = False + Me.txtBenchmark._numbersOnly = True + Me.txtBenchmark._numbersOnlyKommastellen = "" + Me.txtBenchmark._numbersOnlyTrennzeichen = True + Me.txtBenchmark._Prozent = False + Me.txtBenchmark._ShortDateNew = False + Me.txtBenchmark._ShortDateOnly = False + Me.txtBenchmark._TimeOnly = False + Me.txtBenchmark._TimeOnly_Seconds = False + Me.txtBenchmark._value = "" + Me.txtBenchmark._Waehrung = False + Me.txtBenchmark._WaehrungZeichen = True + Me.txtBenchmark.ForeColor = System.Drawing.Color.Black + Me.txtBenchmark.Location = New System.Drawing.Point(73, 82) + Me.txtBenchmark.MaxLength = 10 + Me.txtBenchmark.MaxLineLength = -1 + Me.txtBenchmark.MaxLines_Warning = "" + Me.txtBenchmark.MaxLines_Warning_Label = Nothing + Me.txtBenchmark.Name = "txtBenchmark" + Me.txtBenchmark.Size = New System.Drawing.Size(147, 20) + Me.txtBenchmark.TabIndex = 66 + ' + 'Label12 + ' + Me.Label12.AutoSize = True + Me.Label12.Location = New System.Drawing.Point(3, 85) + Me.Label12.Name = "Label12" + Me.Label12.Size = New System.Drawing.Size(67, 13) + Me.Label12.TabIndex = 67 + Me.Label12.Text = "(Benchmark)" + ' 'txtCalcLand ' Me.txtCalcLand._DateTimeOnly = False @@ -982,44 +1016,22 @@ Partial Class usrCntlCBAM Me.txtEori.Size = New System.Drawing.Size(341, 20) Me.txtEori.TabIndex = 1 ' - 'txtBenchmark + 'Button5 ' - Me.txtBenchmark._DateTimeOnly = False - Me.txtBenchmark._numbersOnly = True - Me.txtBenchmark._numbersOnlyKommastellen = "" - Me.txtBenchmark._numbersOnlyTrennzeichen = True - Me.txtBenchmark._Prozent = False - Me.txtBenchmark._ShortDateNew = False - Me.txtBenchmark._ShortDateOnly = False - Me.txtBenchmark._TimeOnly = False - Me.txtBenchmark._TimeOnly_Seconds = False - Me.txtBenchmark._value = "" - Me.txtBenchmark._Waehrung = False - Me.txtBenchmark._WaehrungZeichen = True - Me.txtBenchmark.ForeColor = System.Drawing.Color.Black - Me.txtBenchmark.Location = New System.Drawing.Point(73, 82) - Me.txtBenchmark.MaxLength = 10 - Me.txtBenchmark.MaxLineLength = -1 - Me.txtBenchmark.MaxLines_Warning = "" - Me.txtBenchmark.MaxLines_Warning_Label = Nothing - Me.txtBenchmark.Name = "txtBenchmark" - Me.txtBenchmark.Size = New System.Drawing.Size(147, 20) - Me.txtBenchmark.TabIndex = 66 - ' - 'Label12 - ' - Me.Label12.AutoSize = True - Me.Label12.Location = New System.Drawing.Point(3, 85) - Me.Label12.Name = "Label12" - Me.Label12.Size = New System.Drawing.Size(67, 13) - Me.Label12.TabIndex = 67 - Me.Label12.Text = "(Benchmark)" + Me.Button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button5.Location = New System.Drawing.Point(32, 90) + Me.Button5.Name = "Button5" + Me.Button5.Size = New System.Drawing.Size(68, 37) + Me.Button5.TabIndex = 53 + Me.Button5.Text = "test" + Me.Button5.UseVisualStyleBackColor = True ' 'usrCntlCBAM ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.BackColor = System.Drawing.Color.White + Me.Controls.Add(Me.Button5) Me.Controls.Add(Me.Panel1) Me.Controls.Add(Me.lblKafkaCnt) Me.Controls.Add(Me.Button3) @@ -1149,4 +1161,5 @@ Partial Class usrCntlCBAM Friend WithEvents txtCalcLand As VERAG_PROG_ALLGEMEIN.MyTextBox Friend WithEvents txtBenchmark As VERAG_PROG_ALLGEMEIN.MyTextBox Friend WithEvents Label12 As Label + Friend WithEvents Button5 As Button End Class diff --git a/SDL/kunden/usrCntlCBAM.vb b/SDL/kunden/usrCntlCBAM.vb index c564997e..00923204 100644 --- a/SDL/kunden/usrCntlCBAM.vb +++ b/SDL/kunden/usrCntlCBAM.vb @@ -18,6 +18,57 @@ Public Class usrCntlCBAM Me.kdnr = kdNr End Sub + Public Function CountCBAMTariffNumbersBySystemAndEORI(systemName As String, eori As String, dateFrom As Date, dateTo As Date) As Integer + + ' ------------------------------------------------------------ + ' CBAM-Pattern WHERE-Clause (HSCode) + ' ------------------------------------------------------------ + Dim cbamWhere As String = + VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("i.zaItem_HSCode") + + ' ------------------------------------------------------------ + ' SQL + ' ------------------------------------------------------------ + Dim sql As String = + "SELECT COUNT(distinct(z.Za_MRN)) AS Cnt " & + "FROM VERAG.dbo.tblVERAG_CustomsDeclarations z " & + "INNER JOIN VERAG.dbo.tblVERAG_CustomsDeclarations_Items i " & + " ON z.za_Id = i.zaItem_zaId " & + "INNER JOIN VERAG.dbo.tblVERAG_CustomsDeclarations_Parties p " & + " ON z.za_Id = p.zaParty_zaId " & + "WHERE z.za_System = @sys " & + " AND z.za_REGIME = 'IMPORT' " & + " AND z.za_IsFinalDeclaration = 1 " & + " AND z.za_DeclarationDate >= @dateFrom " & + " AND z.za_DeclarationDate <= @dateTo " & + " AND p.zaParty_EORI = @eori " & + " AND " & cbamWhere + + ' ------------------------------------------------------------ + ' Parameter + ' ------------------------------------------------------------ + Dim p As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) From { + New VERAG_PROG_ALLGEMEIN.SQLVariable("sys", systemName), + New VERAG_PROG_ALLGEMEIN.SQLVariable("eori", eori), + New VERAG_PROG_ALLGEMEIN.SQLVariable("dateFrom", dateFrom), + New VERAG_PROG_ALLGEMEIN.SQLVariable("dateTo", dateTo) + } + + ' ------------------------------------------------------------ + ' Execute + ' ------------------------------------------------------------ + Dim dt As DataTable = + New VERAG_PROG_ALLGEMEIN.SQL(). + loadDgvBySql_Param(sql, "VERAG", , p) + + If dt Is Nothing OrElse dt.Rows.Count = 0 OrElse IsDBNull(dt.Rows(0)("Cnt")) Then + Return 0 + End If + + Return Convert.ToInt32(dt.Rows(0)("Cnt")) + + End Function + Private Sub btnCBAMPruef_DAKOSY_Click(sender As Object, e As EventArgs) Handles btnCBAMPruef_DAKOSY.Click txtCBAMPruef_DAKOSY.Text = "-" @@ -36,8 +87,8 @@ Public Class usrCntlCBAM Dim SQLSTR = " SELECT COUNT(distinct(Registriernummer_MRN)) FROM [tbl_DY_Zollmeldungen_Import] where Überlassungsdatum between '" & txtVon._value & "' and '" & txtBis._value & "' - and - ( + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("Warentarifnummer") & " + /* ( left(Warentarifnummer,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616) OR left(Warentarifnummer,4) between 7301 and 7311 OR left(Warentarifnummer,4) between 7205 and 7229 @@ -52,7 +103,7 @@ Public Class usrCntlCBAM OR Warentarifnummer like '720260%' OR Warentarifnummer like '280410%' ) - and Warentarifnummer not like '310560%' + and Warentarifnummer not like '310560%'*/ " @@ -181,8 +232,8 @@ Public Class usrCntlCBAM inner join zsAnmDeclarant on zsAnmHea.LizenzNr=zsAnmDeclarant.LizenzNr and zsAnmHea.AnmID=zsAnmDeclarant.AnmID and zsAnmHea.VorgangID=zsAnmDeclarant.VorgangID and zsAnmHea.OperatorID=zsAnmDeclarant.OperatorID inner join zsAnmTransp on zsAnmHea.LizenzNr=zsAnmTransp.LizenzNr and zsAnmHea.AnmID=zsAnmTransp.AnmID and zsAnmHea.VorgangID=zsAnmTransp.VorgangID and zsAnmHea.OperatorID=zsAnmTransp.OperatorID where DecDT between '" & txtVon._value & "' and '" & txtBis._value & "' - and - ( + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("ComCd") & " + /* ( left(ComCd,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616) OR left(ComCd,4) between 7301 and 7311 OR left(ComCd,4) between 7205 and 7229 @@ -197,7 +248,7 @@ Public Class usrCntlCBAM OR ComCd like '720260%' OR ComCd like '280410%' ) - and ComCd not like '310560%' + and ComCd not like '310560%' */ and crn is not null and zsAnmDHFRefs.ErledigungsTypID like 'F%' " @@ -246,8 +297,8 @@ Public Class usrCntlCBAM inner join zsAnmDeclarant on zsAnmHea.LizenzNr=zsAnmDeclarant.LizenzNr and zsAnmHea.AnmID=zsAnmDeclarant.AnmID and zsAnmHea.VorgangID=zsAnmDeclarant.VorgangID and zsAnmHea.OperatorID=zsAnmDeclarant.OperatorID inner join zsAnmTransp on zsAnmHea.LizenzNr=zsAnmTransp.LizenzNr and zsAnmHea.AnmID=zsAnmTransp.AnmID and zsAnmHea.VorgangID=zsAnmTransp.VorgangID and zsAnmHea.OperatorID=zsAnmTransp.OperatorID where DecDT between '" & txtVon._value & "' and '" & txtBis._value & "' - and - ( + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("ComCd") & " + /*( left(ComCd,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616) OR left(ComCd,4) between 7301 and 7311 OR left(ComCd,4) between 7205 and 7229 @@ -262,7 +313,7 @@ Public Class usrCntlCBAM OR ComCd like '720260%' OR ComCd like '280410%' ) - and ComCd not like '310560%' + and ComCd not like '310560%' */ and crn is not null and zsAnmDHFRefs.ErledigungsTypID like 'F%' " @@ -316,8 +367,8 @@ Public Class usrCntlCBAM where 1=1 - and - ( + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("Item_ComCd") & " + /* ( left(Item_ComCd,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616) OR left(Item_ComCd,4) between 7301 and 7311 OR left(Item_ComCd,4) between 7205 and 7229 @@ -332,7 +383,7 @@ Public Class usrCntlCBAM OR Item_ComCd like '720260%' OR Item_ComCd like '280410%' ) - and Item_ComCd not like '310560%' + and Item_ComCd not like '310560%' */ and telnam_aktuellsteNachricht=1 @@ -587,8 +638,8 @@ Public Class usrCntlCBAM FROM [tbl_DY_Zollmeldungen_Import] where Überlassungsdatum between '" & txtVon._value & "' and '" & txtBis._value & "' - and - ( + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("Warentarifnummer") & " + /* ( left(Warentarifnummer,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616) OR left(Warentarifnummer,4) between 7301 and 7311 OR left(Warentarifnummer,4) between 7205 and 7229 @@ -603,7 +654,7 @@ Public Class usrCntlCBAM OR Warentarifnummer like '720260%' OR Warentarifnummer like '280410%' ) - and Warentarifnummer not like '310560%' + and Warentarifnummer not like '310560%' */ " @@ -733,7 +784,8 @@ Public Class usrCntlCBAM Dim SQLSTR = " FROM [tbl_DY_Zollmeldungen_Import] where Überlassungsdatum between '" & txtVon._value & "' and '" & txtBis._value & "' - AND ( + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("Warentarifnummer") & " + /* AND ( LEFT(Warentarifnummer,4) IN (2523,2716,2808,2814,2803,2818,3102,3103,3104,3105, 7201,7202,7203,7204,7325,7318,7326,7601,7602) OR LEFT(Warentarifnummer,4) BETWEEN 7205 AND 7229 @@ -751,7 +803,7 @@ Public Class usrCntlCBAM OR Warentarifnummer LIKE '720260%' OR Warentarifnummer LIKE '280410%' ) - AND Warentarifnummer NOT LIKE '310560%' + AND Warentarifnummer NOT LIKE '310560%'*/ " @@ -841,8 +893,8 @@ Public Class usrCntlCBAM inner join zsAnmDeclarant on zsAnmHea.LizenzNr=zsAnmDeclarant.LizenzNr and zsAnmHea.AnmID=zsAnmDeclarant.AnmID and zsAnmHea.VorgangID=zsAnmDeclarant.VorgangID and zsAnmHea.OperatorID=zsAnmDeclarant.OperatorID inner join zsAnmTransp on zsAnmHea.LizenzNr=zsAnmTransp.LizenzNr and zsAnmHea.AnmID=zsAnmTransp.AnmID and zsAnmHea.VorgangID=zsAnmTransp.VorgangID and zsAnmHea.OperatorID=zsAnmTransp.OperatorID where DecDT between '" & txtVon._value & "' and '" & txtBis._value & "' - and - ( + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("ComCd") & " + /* ( left(ComCd,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616) OR left(ComCd,4) between 7301 and 7311 OR left(ComCd,4) between 7205 and 7229 @@ -857,7 +909,7 @@ Public Class usrCntlCBAM OR ComCd like '720260%' OR ComCd like '280410%' ) - and ComCd not like '310560%' + and ComCd not like '310560%' */ and crn is not null and zsAnmDHFRefs.ErledigungsTypID like 'F%'" @@ -946,7 +998,8 @@ Public Class usrCntlCBAM where 1=1 - and + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("Item_ComCd") & " + /* ( left(Item_ComCd,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616) OR left(Item_ComCd,4) between 7301 and 7311 @@ -962,7 +1015,7 @@ Public Class usrCntlCBAM OR Item_ComCd like '720260%' OR Item_ComCd like '280410%' ) - and Item_ComCd not like '310560%' + and Item_ComCd not like '310560%' */ and telnam_aktuellsteNachricht=1 @@ -1231,8 +1284,8 @@ Public Class usrCntlCBAM inner join tblDakosy_EZA_Adressen on ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN' where eza_anmeldedatum between '" & txtVon._value & "' and '" & txtBis._value & "' - and - ( + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("ezaWP_WarennummerEZT") & " + /* ( left(ezaWP_WarennummerEZT,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616) OR left(ezaWP_WarennummerEZT,4) between 7301 and 7311 OR left(ezaWP_WarennummerEZT,4) between 7205 and 7229 @@ -1248,7 +1301,7 @@ Public Class usrCntlCBAM OR ezaWP_WarennummerEZT like '280410%' ) - and ezaWP_WarennummerEZT not like '310560%' + and ezaWP_WarennummerEZT not like '310560%'*/ and (eza_status between 50 and 60 or [eza_ANR] LIKE 'ATC%') " @@ -1678,8 +1731,8 @@ Public Class usrCntlCBAM inner join zsAnmDeclarant on zsAnmHea.LizenzNr=zsAnmDeclarant.LizenzNr and zsAnmHea.AnmID=zsAnmDeclarant.AnmID and zsAnmHea.VorgangID=zsAnmDeclarant.VorgangID and zsAnmHea.OperatorID=zsAnmDeclarant.OperatorID inner join zsAnmTransp on zsAnmHea.LizenzNr=zsAnmTransp.LizenzNr and zsAnmHea.AnmID=zsAnmTransp.AnmID and zsAnmHea.VorgangID=zsAnmTransp.VorgangID and zsAnmHea.OperatorID=zsAnmTransp.OperatorID where DecDT between '" & txtVon._value & "' and '" & txtBis._value & "' - and - ( + and " & VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("ComCd") & " + /* ( left(ComCd,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616) OR left(ComCd,4) between 7301 and 7311 OR left(ComCd,4) between 7205 and 7229 @@ -1694,7 +1747,7 @@ Public Class usrCntlCBAM OR ComCd like '720260%' OR ComCd like '280410%' ) - and ComCd not like '310560%' + and ComCd not like '310560%' */ and crn is not null and zsAnmDHFRefs.ErledigungsTypID like 'F%' " @@ -2032,4 +2085,9 @@ Public Class usrCntlCBAM Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click txtCalcErg.Text = cATEZ_Greenpulse_CBAM_CostCalculation.calcCBAM(txtCalcKN8._value, txtCalcGewicht._value, txtCalcLand._value, txtCalcEmission._value, txtCalcJahr._value, txtBenchmark._value) End Sub + + Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click + MsgBox(CountCBAMTariffNumbersBySystemAndEORI("DAKOSY", txtEori.Text, txtVon._value, txtBis._value)) + MsgBox(CountCBAMTariffNumbersBySystemAndEORI("DHF", txtEori.Text, txtVon._value, txtBis._value)) + End Sub End Class diff --git a/VERAG_PROG_ALLGEMEIN/Classes/cGreendeal_CBAM_Trn.vb b/VERAG_PROG_ALLGEMEIN/Classes/cGreendeal_CBAM_Trn.vb new file mode 100644 index 00000000..242ad940 --- /dev/null +++ b/VERAG_PROG_ALLGEMEIN/Classes/cGreendeal_CBAM_Trn.vb @@ -0,0 +1,230 @@ +Imports System.Data.SqlClient +Imports System.Reflection + +Public Class cGreendeal_CBAM_Trn + + ' ===================================================== + ' Properties = Spalten tblGreendeal_CBAM_Trn + ' ===================================================== + Public Property cbam_Id As Integer + Public Property trnPattern As String + Public Property ware As String + Public Property sektor As String + Public Property hinweis As String + Public Property is_exclusion As Boolean? + Public Property is_active As Boolean? + Public Property start_date As Date? + Public Property end_date As Date? + + Public Property hasEntry As Boolean = False + + Private SQL As New SQL + + ' ===================================================== + ' Konstruktor + ' ===================================================== + Sub New() + + End Sub + Sub New(cbam_Id As Integer) + Me.cbam_Id = cbam_Id + LOAD() + End Sub + + ' ===================================================== + ' Parameterliste (Mapping Property <-> SQL) + ' ===================================================== + Public Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) + + Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) + + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("cbam_Id", cbam_Id,, True)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("trnPattern", trnPattern)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ware", ware)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("sektor", sektor)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("hinweis", hinweis)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("is_exclusion", is_exclusion)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("is_active", is_active)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("start_date", start_date)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("end_date", end_date)) + + Return list + End Function + + ' ===================================================== + ' SAVE (Insert / Update) + ' ===================================================== + Public Function SAVE() As Boolean + + Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList() + + Dim sqlstr As String = + " BEGIN TRAN " & + " IF EXISTS (SELECT 1 FROM tblGreendeal_CBAM_Trn WHERE cbam_Id=@cbam_Id) " & + " BEGIN " & getUpdateCmd() & " END " & + " ELSE " & + " BEGIN " & getInsertCmd() & " END " & + " COMMIT TRAN " + + Return SQL.doSQLVarList(sqlstr, "VERAG", , list) + + End Function + + ' ===================================================== + ' LOAD + ' ===================================================== + Public Sub LOAD() + Try + hasEntry = False + + Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL() + Using cmd As New SqlCommand( + "SELECT * FROM tblGreendeal_CBAM_Trn WHERE cbam_Id=@cbam_Id", conn) + + cmd.Parameters.AddWithValue("@cbam_Id", cbam_Id) + + Using dr = cmd.ExecuteReader() + If dr.Read Then + For Each li In getParameterList() + Dim pi As PropertyInfo = + Me.GetType.GetProperty(li.Scalarvariable) + + If pi IsNot Nothing Then + If dr.Item(li.Text) Is DBNull.Value Then + pi.SetValue(Me, Nothing) + Else + pi.SetValue(Me, dr.Item(li.Text)) + End If + End If + Next + hasEntry = True + End If + End Using + End Using + End Using + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR( + ex.Message, + ex.StackTrace, + System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + End Sub + + ' ===================================================== + ' UPDATE Command + ' ===================================================== + Private Function getUpdateCmd() As String + Try + Dim list = getParameterList() + Dim str As String = "" + + For Each i In list + If Not i.isPrimaryParam Then + str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," + End If + Next + + str = str.Substring(0, str.Length - 1) + + Return " UPDATE tblGreendeal_CBAM_Trn SET " & str & + " WHERE cbam_Id=@cbam_Id " + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR( + ex.Message, + ex.StackTrace, + System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Return "" + End Function + + ' ===================================================== + ' INSERT Command + ' ===================================================== + Private Function getInsertCmd() As String + Try + Dim list = getParameterList() + Dim cols As String = "" + Dim vals As String = "" + + For Each i In list + If Not i.isPrimaryParam Then + cols &= "[" & i.Text & "]," + vals &= "@" & i.Scalarvariable & "," + End If + Next + + cols = cols.Substring(0, cols.Length - 1) + vals = vals.Substring(0, vals.Length - 1) + + Return " INSERT INTO tblGreendeal_CBAM_Trn (" & cols & ") VALUES (" & vals & ") " + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR( + ex.Message, + ex.StackTrace, + System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Return "" + End Function + + Public Shared Function BuildCBAMPatternWhereClause(columnName As String, Optional onlyActive As Boolean = True, Optional includeExclusions As Boolean = False) As String + + Dim sql As String = + "SELECT trnPattern " & + " FROM VERAG.dbo.tblGreendeal_CBAM_Trn " & + " WHERE trnPattern IS NOT NULL " & + " AND LTRIM(RTRIM(trnPattern)) <> '' " + + If onlyActive Then + sql &= " AND is_active = 1 " & + " AND (start_date IS NULL OR start_date <= GETDATE()) " & + " AND (end_date IS NULL OR end_date >= GETDATE()) " + End If + + If Not includeExclusions Then + sql &= " AND ISNULL(is_exclusion,0) = 0 " + End If + + Dim dt As DataTable = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(sql, "FMZOLL") + + If dt Is Nothing OrElse dt.Rows.Count = 0 Then + Return "1=0" ' bewusst: keine Patterns → kein Treffer + End If + + Dim conditions As New List(Of String) + + For Each r As DataRow In dt.Rows + Dim pattern As String = r("trnPattern").ToString().Trim() + + ' einfache SQL-Escaping-Sicherheit + pattern = pattern.Replace("'", "''") + + conditions.Add($"{columnName} LIKE '{pattern}'") + Next + + Return "(" & String.Join(" OR ", conditions) & ")" + + End Function + + + Public Shared Function DELETE_ALL() As Boolean + Try + + Dim sqlstr As String = " DELETE FROM tblGreendeal_CBAM_Trn " + Return (New VERAG_PROG_ALLGEMEIN.SQL).doSQL(sqlstr, "VERAG", , Nothing) + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR( + ex.Message, + ex.StackTrace, + System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Return False + End Function + +End Class \ No newline at end of file diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/ATEZ/GREENPULSE/cATEZ_Greenpulse_CBAM_CostCalculation.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/ATEZ/GREENPULSE/cATEZ_Greenpulse_CBAM_CostCalculation.vb index 68c91f0c..f3992dcc 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/ATEZ/GREENPULSE/cATEZ_Greenpulse_CBAM_CostCalculation.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/ATEZ/GREENPULSE/cATEZ_Greenpulse_CBAM_CostCalculation.vb @@ -33,7 +33,6 @@ Public Class cATEZ_Greenpulse_CBAM_CostCalculation json.Load(resp.BodyStr) Dim r As New cCBAM_CnCode_Response With {.success = json.BoolOf("success")} - If r.success Then r.data = New List(Of cCBAM_CnCode) Dim a = json.ArrayOf("data") @@ -51,6 +50,27 @@ Public Class cATEZ_Greenpulse_CBAM_CostCalculation Return r End Function + + Public Function insertinto_Greendeal_CBAM_Trn(cCBAM_CnCode_Response As cCBAM_CnCode_Response) As Boolean + + VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.DELETE_ALL() + + For Each CN In cCBAM_CnCode_Response.data + Dim CBAM As New VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn + + + CBAM.trnPattern = CN.cn_code & "%" + CBAM.sektor = "" + CBAM.ware = CN.cn_description + CBAM.is_exclusion = False + CBAM.is_active = True + CBAM.start_date = "01.10.2023" + CBAM.end_date = Nothing + CBAM.SAVE() + Next + Return True + End Function + ' ------------------------------------------------------------------------ ' GET /carbon-cost/cn-code-defaults ' ------------------------------------------------------------------------ diff --git a/VERAG_PROG_ALLGEMEIN/VERAG_PROG_ALLGEMEIN.vbproj b/VERAG_PROG_ALLGEMEIN/VERAG_PROG_ALLGEMEIN.vbproj index ad4fa205..2ef03e0b 100644 --- a/VERAG_PROG_ALLGEMEIN/VERAG_PROG_ALLGEMEIN.vbproj +++ b/VERAG_PROG_ALLGEMEIN/VERAG_PROG_ALLGEMEIN.vbproj @@ -385,6 +385,7 @@ + diff --git a/VERAG_PROG_ALLGEMEIN/VERAG_Zollanmeldung/cVERAG_Zollanmeldung.vb b/VERAG_PROG_ALLGEMEIN/VERAG_Zollanmeldung/cVERAG_Zollanmeldung.vb index 50df559d..7c9e440e 100644 --- a/VERAG_PROG_ALLGEMEIN/VERAG_Zollanmeldung/cVERAG_Zollanmeldung.vb +++ b/VERAG_PROG_ALLGEMEIN/VERAG_Zollanmeldung/cVERAG_Zollanmeldung.vb @@ -6,983 +6,820 @@ Imports System.Reflection ' Customs Declaration (Header + Items + Duties + Documents) ' ========================================================================== -Public Class cVERAG_Zollanmeldung - - '=== KONSTRUKTOR ======================================================= - - Public Sub New() - End Sub - - Public Sub New(id As Integer) - za_Id = id - LOAD() - End Sub - - - '=== FELDER ============================================================ +Public Class cVERAG_CustomsDeclarations Public Property za_Id As Integer - Public Property za_System As String - Public Property za_ExternalSystem As Boolean + Public Property za_System As String ' z.B. "DAKOSY" + Public Property za_CustomsSystem As String ' z.B. "ATLAS" + Public Property za_CustomsSystemCountry As String ' z.B. "DE" + Public Property za_IsExternalSystem As Boolean = False + Public Property za_IsFinalDeclaration As Boolean = False + Public Property za_UCR As String + Public Property za_Mandant_ID As String + Public Property za_Bereich_ID As String Public Property za_Firma As String Public Property za_Niederlassung As String - - Public Property za_AvisoId As Integer? - Public Property za_SendungsId As Integer? - Public Property za_InternalRef As String - Public Property za_MRN As String Public Property za_LRN As String Public Property za_DeclarationNo As String - - Public Property za_Procedure As String + Public Property za_ReferenceCustomer As String + Public Property za_REGIME As String ' IMPORT, EXPORT, ... + Public Property za_RegistrationType As String + Public Property za_MainProcedure As String + Public Property za_AdditionalProcedure As String + Public Property za_DeclarationDate As Date? + Public Property za_ReleaseDate As Date? + Public Property za_AcceptanceDate As Date? + Public Property za_CustomsOffice As String + Public Property za_EntryCustomsOffice As String Public Property za_RepresentationCode As String - Public Property za_FiscalRepresentation As Boolean? + Public Property za_TransportModeInland As String + Public Property za_TransportModeBorder As String + Public Property za_MeansOfTransport_Vehicle As String + Public Property za_MeansOfTransport_Type As String + Public Property za_MeansOfTransport_Nationality As String + Public Property za_ContainerNr1 As String + Public Property za_ContainerNr2 As String + Public Property za_ContainerNr3 As String + Public Property za_ContainerNr4 As String + Public Property za_ContainerNr5 As String + Public Property za_ContainerNr6 As String + Public Property za_ContainerNr7 As String + Public Property za_ContainerNr8 As String + Public Property za_ContainerNr9 As String Public Property za_CountryDispatch As String Public Property za_CountryDestination As String - Public Property za_CountryOrigin As String + Public Property za_CountryDestinationState As String + Public Property za_CountryImport As String + Public Property za_WarehouseCode As String + Public Property za_Incoterms As String + Public Property za_IncotermsPlace As String + Public Property za_InvoiceAmount As Decimal? + Public Property za_InvoiceCurrency As String - Public Property za_TotalItems As Integer? - Public Property za_TotalGross As Decimal? - Public Property za_TotalInvoice As Decimal? - Public Property za_TotalCustomsValue As Decimal? + Public Property za_FiscalRepFlag As Boolean? + Public Property za_TaxDeduction As Boolean? + Public Property za_ApplicantTaxOffice As String + Public Property za_ApplicantVATNo As String + Public Property za_DV1Flag As Boolean? + Public Property za_PrevDocument_Type As String + Public Property za_PrevDocument_No As String + Public Property za_AvisoId As Integer? + Public Property za_SendungsId As Integer? + Public Property za_Remarks As String + Public Property za_Sachbearbeiter As String + Public Property za_SachbearbeiterId As String - Public Property za_TransportMode_Border As Integer? - Public Property za_VehicleId As String - Public Property za_Incoterm As String - Public Property za_IncotermPlace As String + Public Property Parties As New List(Of cVERAG_CustomsDeclarations_Parties) + Public Property Items As New List(Of cVERAG_CustomsDeclarations_Item) + Public Property Duties As New List(Of cVERAG_CustomsDeclarations_Duty) + Public Property Documents As New List(Of cVERAG_CustomsDeclarations_Document) - Public Property za_DocumentsPresent As Boolean - - Public Property za_ReleaseDate As Date? - Public Property za_DeclarationDate As Date? - Public Property za_Created As Date = Now - Public Property za_Modified As Date = Now + Public Property hasEntry As Boolean = False - '=== UNTERKLASSEN ====================================================== - - Public Property Items As New List(Of cVERAG_Zollanmeldung_Item) - Public Property Duties As New List(Of cVERAG_Zollanmeldung_Duty) - Public Property Documents As New List(Of cVERAG_Zollanmeldung_Document) - Public Property ItemDocuments As New List(Of cVERAG_Zollanmeldung_ItemDocument) - - - Private SQL As New VERAG_PROG_ALLGEMEIN.SQL - - - - - '======================================================================== - ' PARAMETERLISTE (Header) - '======================================================================== - - Public Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) - - Dim L As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) - - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_Id", za_Id,, True, True)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_System", za_System)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_ExternalSystem", za_ExternalSystem)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_Firma", za_Firma)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_Niederlassung", za_Niederlassung)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_AvisoId", za_AvisoId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_SendungsId", za_SendungsId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_InternalRef", za_InternalRef)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_MRN", za_MRN)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_LRN", za_LRN)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_DeclarationNo", za_DeclarationNo)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_Procedure", za_Procedure)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_RepresentationCode", za_RepresentationCode)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_FiscalRepresentation", za_FiscalRepresentation)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_CountryDispatch", za_CountryDispatch)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_CountryDestination", za_CountryDestination)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_CountryOrigin", za_CountryOrigin)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_TotalItems", za_TotalItems)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_TotalGross", za_TotalGross)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_TotalInvoice", za_TotalInvoice)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_TotalCustomsValue", za_TotalCustomsValue)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_TransportMode_Border", za_TransportMode_Border)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_VehicleId", za_VehicleId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_Incoterm", za_Incoterm)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_IncotermPlace", za_IncotermPlace)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_DocumentsPresent", za_DocumentsPresent)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_ReleaseDate", za_ReleaseDate)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_DeclarationDate", za_DeclarationDate)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_Created", za_Created)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("za_Modified", za_Modified)) - - Return L + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Public Function getParameterList() As List(Of SQLVariable) + Return New List(Of SQLVariable) From { + New SQLVariable("za_Id", za_Id,, True), + New SQLVariable("za_System", za_System), + New SQLVariable("za_CustomsSystem", za_CustomsSystem), + New SQLVariable("za_CustomsSystemCountry", za_CustomsSystemCountry), + New SQLVariable("za_IsExternalSystem", za_IsExternalSystem), + New SQLVariable("za_IsFinalDeclaration", za_IsFinalDeclaration), + New SQLVariable("za_UCR", za_UCR), + New SQLVariable("za_Mandant_ID", za_Mandant_ID), + New SQLVariable("za_Bereich_ID", za_Bereich_ID), + New SQLVariable("za_Firma", za_Firma), + New SQLVariable("za_Niederlassung", za_Niederlassung), + New SQLVariable("za_MRN", za_MRN), + New SQLVariable("za_LRN", za_LRN), + New SQLVariable("za_DeclarationNo", za_DeclarationNo), + New SQLVariable("za_ReferenceCustomer", za_ReferenceCustomer), + New SQLVariable("za_REGIME", za_REGIME), + New SQLVariable("za_RegistrationType", za_RegistrationType), + New SQLVariable("za_MainProcedure", za_MainProcedure), + New SQLVariable("za_AdditionalProcedure", za_AdditionalProcedure), + New SQLVariable("za_DeclarationDate", za_DeclarationDate), + New SQLVariable("za_ReleaseDate", za_ReleaseDate), + New SQLVariable("za_AcceptanceDate", za_AcceptanceDate), + New SQLVariable("za_CustomsOffice", za_CustomsOffice), + New SQLVariable("za_EntryCustomsOffice", za_EntryCustomsOffice), + New SQLVariable("za_RepresentationCode", za_RepresentationCode), + New SQLVariable("za_TransportModeInland", za_TransportModeInland), + New SQLVariable("za_TransportModeBorder", za_TransportModeBorder), + New SQLVariable("za_MeansOfTransport_Vehicle", za_MeansOfTransport_Vehicle), + New SQLVariable("za_MeansOfTransport_Type", za_MeansOfTransport_Type), + New SQLVariable("za_MeansOfTransport_Nationality", za_MeansOfTransport_Nationality), + New SQLVariable("za_ContainerNr1", za_ContainerNr1), + New SQLVariable("za_ContainerNr2", za_ContainerNr2), + New SQLVariable("za_ContainerNr3", za_ContainerNr3), + New SQLVariable("za_ContainerNr4", za_ContainerNr4), + New SQLVariable("za_ContainerNr5", za_ContainerNr5), + New SQLVariable("za_ContainerNr6", za_ContainerNr6), + New SQLVariable("za_ContainerNr7", za_ContainerNr7), + New SQLVariable("za_ContainerNr8", za_ContainerNr8), + New SQLVariable("za_ContainerNr9", za_ContainerNr9), + New SQLVariable("za_CountryDispatch", za_CountryDispatch), + New SQLVariable("za_CountryDestination", za_CountryDestination), + New SQLVariable("za_CountryDestinationState", za_CountryDestinationState), + New SQLVariable("za_CountryImport", za_CountryImport), + New SQLVariable("za_WarehouseCode", za_WarehouseCode), + New SQLVariable("za_Incoterms", za_Incoterms), + New SQLVariable("za_IncotermsPlace", za_IncotermsPlace), + New SQLVariable("za_InvoiceAmount", za_InvoiceAmount), + New SQLVariable("za_InvoiceCurrency", za_InvoiceCurrency), + New SQLVariable("za_FiscalRepFlag", za_FiscalRepFlag), + New SQLVariable("za_TaxDeduction", za_TaxDeduction), + New SQLVariable("za_ApplicantTaxOffice", za_ApplicantTaxOffice), + New SQLVariable("za_ApplicantVATNo", za_ApplicantVATNo), + New SQLVariable("za_DV1Flag", za_DV1Flag), + New SQLVariable("za_PrevDocument_Type", za_PrevDocument_Type), + New SQLVariable("za_PrevDocument_No", za_PrevDocument_No), + New SQLVariable("za_AvisoId", za_AvisoId), + New SQLVariable("za_SendungsId", za_SendungsId), + New SQLVariable("za_Remarks", za_Remarks), + New SQLVariable("za_Sachbearbeiter", za_Sachbearbeiter), + New SQLVariable("za_SachbearbeiterId", za_SachbearbeiterId) + } End Function - - - '======================================================================== - ' SAVE (HEADER) - '======================================================================== - - Public Function SAVE() As Boolean - - Dim list = getParameterList() - - Dim sqlstr As String = - " BEGIN TRAN " & - " IF EXISTS(SELECT 1 FROM tblVERAG_CustomsDeclarations WHERE za_Id=@za_Id) " & - " BEGIN " & getUpdateCmd() & " END " & - " ELSE BEGIN " & getInsertCmd() & " END " & - " COMMIT TRAN " - - za_Id = SQL.doSQLVarListID(za_Id, sqlstr, "VERAG", , list) - Return za_Id > 0 - + Public Function getInsertCmd() As String + Dim f As String = "", v As String = "" + For Each i In getParameterList() + If Not i.isPrimaryParam Then + f &= "[" & i.Text & "]," + v &= "@" & i.Scalarvariable & "," + End If + Next + Return "INSERT INTO tblVERAG_CustomsDeclarations (" & + f.TrimEnd(","c) & ") VALUES (" & v.TrimEnd(","c) & ")" End Function - - - - '======================================================================== - ' SAVE_ALL (Header + Items + Duties + Docs) - '======================================================================== - - Public Function SAVE_ALL() As Boolean - - If Not SAVE() Then Return False - If Not SAVE_Items() Then Return False - If Not SAVE_Duties() Then Return False - If Not SAVE_Documents() Then Return False - If Not SAVE_ItemDocuments() Then Return False - - Return True - + Public Function getUpdateCmd() As String + Dim s As String = "" + For Each i In getParameterList() + If Not i.isPrimaryParam Then + s &= "[" & i.Text & "]=@" & i.Scalarvariable & "," + End If + Next + Return "UPDATE tblVERAG_CustomsDeclarations SET " & + s.TrimEnd(","c) & " WHERE za_Id=@za_Id" End Function + Public Sub LOAD() + Try + hasEntry = False + Using conn = SQL.GetNewOpenConnectionFMZOLL() + Using cmd As New SqlCommand( + "SELECT * FROM tblVERAG_CustomsDeclarations WHERE za_Id=@_BASE_id", conn) - - - '======================================================================== - ' LOAD HEADER - '======================================================================== - - Public Function LOAD(Optional loadALL As Boolean = True) As Boolean - - If loadALL Then - Items.Clear() - Duties.Clear() - Documents.Clear() - ItemDocuments.Clear() - End If - - Using conn = SQL.GetNewOpenConnectionFMZOLL() - Using cmd As New SqlCommand("SELECT * FROM tblVERAG_CustomsDeclarations WHERE za_Id=@id", conn) - cmd.Parameters.AddWithValue("@id", za_Id) - Using dr = cmd.ExecuteReader() + cmd.Parameters.AddWithValue("@_BASE_id", za_Id) + Dim dr = cmd.ExecuteReader() If dr.Read Then - - For Each p In getParameterList() - Dim prop = Me.GetType().GetProperty(p.Scalarvariable) - If prop IsNot Nothing Then - If IsDBNull(dr(p.Text)) Then - prop.SetValue(Me, Nothing) - Else - prop.SetValue(Me, dr(p.Text)) - End If + For Each li In getParameterList() + Dim pi = Me.GetType.GetProperty(li.Scalarvariable) + If dr.Item(li.Text) Is DBNull.Value Then + pi.SetValue(Me, Nothing) + Else + pi.SetValue(Me, dr.Item(li.Text)) End If Next - - dr.Close() - - If loadALL Then - LOAD_Items() - LOAD_Duties() - LOAD_Documents() - LOAD_ItemDocuments() - End If - - Return True - + hasEntry = True End If + dr.Close() End Using End Using - End Using - Return False - - End Function - - - - - - '======================================================================== - ' SAVE ITEMS - '======================================================================== - - Private Function SAVE_Items() As Boolean - For Each it In Items - it.zaItem_DeclarationId = za_Id - If Not it.SAVE() Then Return False - Next - Return True - End Function - - - - '======================================================================== - ' SAVE DUTIES - '======================================================================== - - Private Function SAVE_Duties() As Boolean - For Each du In Duties - du.zaDuty_DeclarationId = za_Id - If Not du.SAVE() Then Return False - Next - Return True - End Function - - - - '======================================================================== - ' SAVE DOCS HEADER - '======================================================================== - - Private Function SAVE_Documents() As Boolean - For Each d In Documents - d.zaDoc_DeclarationId = za_Id - If Not d.SAVE() Then Return False - Next - Return True - End Function - - - - '======================================================================== - ' SAVE DOCS ITEM - '======================================================================== - - Private Function SAVE_ItemDocuments() As Boolean - For Each d In ItemDocuments - If Not d.SAVE() Then Return False - Next - Return True - End Function - - - - - - '======================================================================== - ' LOAD UNTERKLASSEN - '======================================================================== - - Private Sub LOAD_Items() - - Using conn = SQL.GetNewOpenConnectionFMZOLL() - Using cmd As New SqlCommand("SELECT * FROM tblVERAG_CustomsDeclarations_Items WHERE zaItem_DeclarationId=@id ORDER BY zaItem_Line", conn) - cmd.Parameters.AddWithValue("@id", za_Id) - Using dr = cmd.ExecuteReader() - While dr.Read - Dim it As New cVERAG_Zollanmeldung_Item - it.LOAD_FROM_READER(dr) - Items.Add(it) - End While - End Using - End Using - End Using + Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(za_Id) + Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(za_Id) + Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(za_Id) + Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(za_Id) + Catch ex As Exception + cErrorHandler.ERR(ex.Message, ex.StackTrace, MethodInfo.GetCurrentMethod.Name) + End Try End Sub + Public Shared Function loadByMRN(MRN As String, loadall As Boolean) As cVERAG_CustomsDeclarations + Dim ZA As New cVERAG_CustomsDeclarations + If If(MRN, "") = "" Then Return ZA + Try + ZA.hasEntry = False + Using conn = SQL.GetNewOpenConnectionFMZOLL() + Using cmd As New SqlCommand( + "SELECT * FROM tblVERAG_CustomsDeclarations WHERE za_MRN=@_BASE_id", conn) - - Private Sub LOAD_Duties() - - Using conn = SQL.GetNewOpenConnectionFMZOLL() - Using cmd As New SqlCommand("SELECT * FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_DeclarationId=@id", conn) - cmd.Parameters.AddWithValue("@id", za_Id) - Using dr = cmd.ExecuteReader() - While dr.Read - Dim du As New cVERAG_Zollanmeldung_Duty - du.LOAD_FROM_READER(dr) - Duties.Add(du) - End While + cmd.Parameters.AddWithValue("@_BASE_id", MRN) + Dim dr = cmd.ExecuteReader() + If dr.Read Then + For Each li In ZA.getParameterList() + Dim pi = ZA.GetType.GetProperty(li.Scalarvariable) + If dr.Item(li.Text) Is DBNull.Value Then + pi.SetValue(ZA, Nothing) + Else + pi.SetValue(ZA, dr.Item(li.Text)) + End If + Next + ZA.hasEntry = True + End If + dr.Close() End Using End Using - End Using + If loadall Then - End Sub - - - - Private Sub LOAD_Documents() - - Using conn = SQL.GetNewOpenConnectionFMZOLL() - Using cmd As New SqlCommand("SELECT * FROM tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_DeclarationId=@id AND zaDoc_Level='H'", conn) - cmd.Parameters.AddWithValue("@id", za_Id) - Using dr = cmd.ExecuteReader() - While dr.Read - Dim d As New cVERAG_Zollanmeldung_Document - d.LOAD_FROM_READER(dr) - Documents.Add(d) - End While - End Using - End Using - End Using - - End Sub - - - - - Private Sub LOAD_ItemDocuments() - - Using conn = SQL.GetNewOpenConnectionFMZOLL() - Using cmd As New SqlCommand("SELECT * FROM tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_Level='I' AND zaDoc_DeclarationId=@id", conn) - cmd.Parameters.AddWithValue("@id", za_Id) - Using dr = cmd.ExecuteReader() - While dr.Read - Dim d As New cVERAG_Zollanmeldung_ItemDocument - d.LOAD_FROM_READER(dr) - ItemDocuments.Add(d) - End While - End Using - End Using - End Using - - End Sub - - - - - - '======================================================================== - ' SQL HELPERS - '======================================================================== - - Private Function getUpdateCmd() As String - - Dim cols As New Text.StringBuilder() - - For Each p In getParameterList() - If Not p.isPrimaryParam Then - cols.Append("[" & p.Text & "]=@" & p.Scalarvariable & ",") + ZA.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(ZA.za_Id) + ZA.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(ZA.za_Id) + ZA.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(ZA.za_Id) + ZA.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(ZA.za_Id) End If - Next - - Dim setClause = cols.ToString().TrimEnd(","c) - - Return "UPDATE tblVERAG_CustomsDeclarations SET " & setClause & " WHERE za_Id=@za_Id" + Catch ex As Exception + cErrorHandler.ERR(ex.Message, ex.StackTrace, MethodInfo.GetCurrentMethod.Name) + End Try + Return ZA End Function + Public Function SAVE() As Boolean + Dim list = getParameterList() + Dim sqlstr = + "BEGIN TRAN " & + "IF EXISTS(SELECT 1 FROM tblVERAG_CustomsDeclarations WHERE za_Id=@za_Id) " & + "BEGIN " & getUpdateCmd() & " END " & + "ELSE BEGIN " & getInsertCmd() & " END " & + "COMMIT TRAN" - Private Function getInsertCmd() As String + za_Id = SQL.doSQLVarListID(za_Id, sqlstr, "FMZOLL", , list) + If za_Id <= 0 Then Return False - Dim C As New List(Of String) - Dim V As New List(Of String) - - For Each p In getParameterList() - If Not p.isPrimaryParam Then - C.Add("[" & p.Text & "]") - V.Add("@" & p.Scalarvariable) - End If - Next - - Return "INSERT INTO tblVERAG_CustomsDeclarations (" & - String.Join(",", C) & - ") VALUES (" & - String.Join(",", V) & - ");" + cVERAG_CustomsDeclarations_Parties.REPLACE_ALL(za_Id, Parties) + cVERAG_CustomsDeclarations_Duty.REPLACE_ALL(za_Id, Duties) + cVERAG_CustomsDeclarations_Document.REPLACE_HEAD(za_Id, Documents) + cVERAG_CustomsDeclarations_Item.REPLACE_ALL(za_Id, Items) + Return True End Function - - - End Class +Public Class cVERAG_CustomsDeclarations_Parties + Public Property zaParty_Id As Integer + Public Property zaParty_zaId As Integer + Public Property zaParty_Role As String + Public Property zaParty_EORI As String + Public Property zaParty_EORI_NL As String + Public Property zaParty_Name As String + Public Property zaParty_Street As String + Public Property zaParty_PostalCode As String + Public Property zaParty_City As String + Public Property zaParty_Country As String + Public Property zaParty_TIN As String + Public Property zaParty_VATNumber As String + Public Property zaParty_TaxOffice As String + Public Property zaParty_ContactName As String + Public Property zaParty_Phone As String + Public Property zaParty_Email As String + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Public Function getParameterList() As List(Of SQLVariable) + Return New List(Of SQLVariable) From { + New SQLVariable("zaParty_Id", zaParty_Id,, True), + New SQLVariable("zaParty_zaId", zaParty_zaId), + New SQLVariable("zaParty_Role", zaParty_Role), + New SQLVariable("zaParty_EORI", zaParty_EORI), + New SQLVariable("zaParty_EORI_NL", zaParty_EORI_NL), + New SQLVariable("zaParty_Name", zaParty_Name), + New SQLVariable("zaParty_Street", zaParty_Street), + New SQLVariable("zaParty_PostalCode", zaParty_PostalCode), + New SQLVariable("zaParty_City", zaParty_City), + New SQLVariable("zaParty_Country", zaParty_Country), + New SQLVariable("zaParty_VATNumber", zaParty_VATNumber), + New SQLVariable("zaParty_TaxOffice", zaParty_TaxOffice), + New SQLVariable("zaParty_TIN", zaParty_TIN), + New SQLVariable("zaParty_ContactName", zaParty_ContactName), + New SQLVariable("zaParty_Phone", zaParty_Phone), + New SQLVariable("zaParty_Email", zaParty_Email) + } + End Function + Public Function getInsertCmd() As String + Dim f As String = "", v As String = "" + For Each i In getParameterList() + If Not i.isPrimaryParam Then + f &= "[" & i.Text & "]," + v &= "@" & i.Scalarvariable & "," + End If + Next + Return "INSERT INTO tblVERAG_CustomsDeclarations_Parties (" & + f.TrimEnd(","c) & ") VALUES (" & v.TrimEnd(","c) & ")" + End Function + Public Shared Sub REPLACE_ALL(zaId As Integer, list As List(Of cVERAG_CustomsDeclarations_Parties)) + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Parties WHERE zaParty_zaId=" & zaId, "FMZOLL") + For Each p In list + p.zaParty_zaId = zaId + p.zaParty_Id = SQL.doSQLVarListID(p.zaParty_Id, p.getInsertCmd(), "FMZOLL", , p.getParameterList()) + Next + End Sub + Public Shared Function LOAD_BY_ZAID(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_Parties) + Dim result As New List(Of cVERAG_CustomsDeclarations_Parties) -' ========================================================================== -' ITEM -' ========================================================================== + Try + Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL() + Using cmd As New SqlCommand( + "SELECT * FROM tblVERAG_CustomsDeclarations_Parties WHERE zaParty_zaId=@zaId", + conn) -Public Class cVERAG_Zollanmeldung_Item + cmd.Parameters.AddWithValue("@zaId", zaId) + + Using dr As SqlDataReader = cmd.ExecuteReader() + While dr.Read() + + Dim obj As New cVERAG_CustomsDeclarations_Parties + + For Each li In obj.getParameterList() + Dim propInfo As PropertyInfo = + obj.GetType().GetProperty(li.Scalarvariable) + + If dr.Item(li.Text) Is DBNull.Value Then + propInfo.SetValue(obj, Nothing) + Else + propInfo.SetValue(obj, dr.Item(li.Text)) + End If + Next + + result.Add(obj) + + End While + End Using + End Using + End Using + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR( + ex.Message, + ex.StackTrace, + System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Return result + End Function +End Class + +' ########################################################## +' ITEMS +' ########################################################## +Public Class cVERAG_CustomsDeclarations_Item Public Property zaItem_Id As Integer - Public Property zaItem_DeclarationId As Integer + Public Property zaItem_zaId As Integer + Public Property zaItem_PosNo As Integer - Public Property zaItem_Line As Integer Public Property zaItem_ArticleCode As String Public Property zaItem_HSCode As String + Public Property zaItem_HSAddition1 As String + Public Property zaItem_HSAddition2 As String + Public Property zaItem_HSAddCodes1 As String + Public Property zaItem_HSAddCodes2 As String + Public Property zaItem_HSAddCodes3 As String + Public Property zaItem_HSAddCodes4 As String + Public Property zaItem_HSAddCodes5 As String + Public Property zaItem_HSAddCodes6 As String + Public Property zaItem_HSAddCodes7 As String + Public Property zaItem_HSAddCodes8 As String + Public Property zaItem_HSAddCodes9 As String + Public Property zaItem_HSAddCodes10 As String Public Property zaItem_Description As String - Public Property zaItem_Qty As Decimal? - Public Property zaItem_Unit As String - Public Property zaItem_Gross As Decimal? - Public Property zaItem_Net As Decimal? - - Public Property zaItem_InvoiceValue As Decimal? - Public Property zaItem_CustomsValue As Decimal? - Public Property zaItem_StatisticalValue As Decimal? - Public Property zaItem_Currency As String - + Public Property zaItem_PackageColli As String + Public Property zaItem_PackageType As String + Public Property zaItem_PackageMark As String Public Property zaItem_OriginCountry As String + Public Property zaItem_PreferentialCountry As String Public Property zaItem_PreferenceCode As String + Public Property zaItem_QuotaNo As String - Private SQL As New VERAG_PROG_ALLGEMEIN.SQL + Public Property zaItem_MainProcedure As String + Public Property zaItem_AdditionalProc As String + Public Property zaItem_PrevProcedure As String + Public Property zaItem_GrossMass As Decimal? + Public Property zaItem_NetMass As Decimal? + Public Property zaItem_SuppUnitCode As String + Public Property zaItem_SuppQuantity As Decimal? - '--- PARAMLIST ---------------------------------------------------------- + Public Property zaItem_StatisticalValueEUR As Decimal? + Public Property zaItem_CustomsValueEUR As Decimal? - Public Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) + Public Property zaItem_InvoiceCurrency As String + Public Property zaItem_InvoiceValueForeign As Decimal? + Public Property zaItem_InvoiceValueEUR As Decimal? - Dim L As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) + Public Property zaItem_BeguenstigungCode As String + Public Property zaItem_DV1Flag As Boolean? + Public Property zaItem_PosAddition As String + Public Property zaItem_Remarks As String - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_Id", zaItem_Id,, True, True)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_DeclarationId", zaItem_DeclarationId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_Line", zaItem_Line)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_ArticleCode", zaItem_ArticleCode)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_HSCode", zaItem_HSCode)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_Description", zaItem_Description)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_Qty", zaItem_Qty)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_Unit", zaItem_Unit)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_Gross", zaItem_Gross)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_Net", zaItem_Net)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_InvoiceValue", zaItem_InvoiceValue)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_CustomsValue", zaItem_CustomsValue)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_StatisticalValue", zaItem_StatisticalValue)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_Currency", zaItem_Currency)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_OriginCountry", zaItem_OriginCountry)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaItem_PreferenceCode", zaItem_PreferenceCode)) + Public Property Documents As New List(Of cVERAG_CustomsDeclarations_Document) + Public Property hasEntry As Boolean = False - Return L + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Public Function getParameterList() As List(Of SQLVariable) + Return New List(Of SQLVariable) From { + New SQLVariable("zaItem_Id", zaItem_Id,, True), + New SQLVariable("zaItem_zaId", zaItem_zaId), + New SQLVariable("zaItem_PosNo", zaItem_PosNo), + New SQLVariable("zaItem_ArticleCode", zaItem_ArticleCode), + New SQLVariable("zaItem_HSCode", zaItem_HSCode), + New SQLVariable("zaItem_HSAddition1", zaItem_HSAddition1), + New SQLVariable("zaItem_HSAddition2", zaItem_HSAddition2), + New SQLVariable("zaItem_HSAddCodes1", zaItem_HSAddCodes1), + New SQLVariable("zaItem_HSAddCodes2", zaItem_HSAddCodes2), + New SQLVariable("zaItem_HSAddCodes3", zaItem_HSAddCodes3), + New SQLVariable("zaItem_HSAddCodes4", zaItem_HSAddCodes4), + New SQLVariable("zaItem_HSAddCodes5", zaItem_HSAddCodes5), + New SQLVariable("zaItem_HSAddCodes6", zaItem_HSAddCodes6), + New SQLVariable("zaItem_HSAddCodes7", zaItem_HSAddCodes7), + New SQLVariable("zaItem_HSAddCodes8", zaItem_HSAddCodes8), + New SQLVariable("zaItem_HSAddCodes9", zaItem_HSAddCodes9), + New SQLVariable("zaItem_HSAddCodes10", zaItem_HSAddCodes10), + New SQLVariable("zaItem_Description", zaItem_Description), + New SQLVariable("zaItem_PackageColli", zaItem_PackageColli), + New SQLVariable("zaItem_PackageType", zaItem_PackageType), + New SQLVariable("zaItem_PackageMark", zaItem_PackageMark), + New SQLVariable("zaItem_OriginCountry", zaItem_OriginCountry), + New SQLVariable("zaItem_PreferentialCountry", zaItem_PreferentialCountry), + New SQLVariable("zaItem_PreferenceCode", zaItem_PreferenceCode), + New SQLVariable("zaItem_QuotaNo", zaItem_QuotaNo), + New SQLVariable("zaItem_MainProcedure", zaItem_MainProcedure), + New SQLVariable("zaItem_AdditionalProc", zaItem_AdditionalProc), + New SQLVariable("zaItem_PrevProcedure", zaItem_PrevProcedure), + New SQLVariable("zaItem_GrossMass", zaItem_GrossMass), + New SQLVariable("zaItem_NetMass", zaItem_NetMass), + New SQLVariable("zaItem_SuppUnitCode", zaItem_SuppUnitCode), + New SQLVariable("zaItem_SuppQuantity", zaItem_SuppQuantity), + New SQLVariable("zaItem_StatisticalValueEUR", zaItem_StatisticalValueEUR), + New SQLVariable("zaItem_CustomsValueEUR", zaItem_CustomsValueEUR), + New SQLVariable("zaItem_InvoiceCurrency", zaItem_InvoiceCurrency), + New SQLVariable("zaItem_InvoiceValueForeign", zaItem_InvoiceValueForeign), + New SQLVariable("zaItem_InvoiceValueEUR", zaItem_InvoiceValueEUR), + New SQLVariable("zaItem_BeguenstigungCode", zaItem_BeguenstigungCode), + New SQLVariable("zaItem_DV1Flag", zaItem_DV1Flag), + New SQLVariable("zaItem_PosAddition", zaItem_PosAddition), + New SQLVariable("zaItem_Remarks", zaItem_Remarks) + } End Function - - '--- SAVE --------------------------------------------------------------- - - Public Function SAVE() As Boolean - - Dim list = getParameterList() - - Dim sqlstr As String = - " BEGIN TRAN " & - " IF EXISTS(SELECT 1 FROM tblVERAG_CustomsDeclarations_Items WHERE zaItem_Id=@zaItem_Id) " & - " BEGIN " & getUpdateCmd() & " END " & - " ELSE BEGIN " & getInsertCmd() & " END " & - " COMMIT TRAN " - - zaItem_Id = SQL.doSQLVarListID(zaItem_Id, sqlstr, "VERAG", , list) - Return zaItem_Id > 0 - - End Function - - - - '--- LOAD FROM DATAREADER ---------------------------------------------- - - Public Sub LOAD_FROM_READER(dr As SqlDataReader) - - For Each p In getParameterList() - Dim prop = Me.GetType().GetProperty(p.Scalarvariable) - If prop IsNot Nothing Then - If IsDBNull(dr(p.Text)) Then - prop.SetValue(Me, Nothing) - Else - prop.SetValue(Me, dr(p.Text)) - End If + Public Function getInsertCmd() As String + Dim f As String = "", v As String = "" + For Each i In getParameterList() + If Not i.isPrimaryParam Then + f &= "[" & i.Text & "]," + v &= "@" & i.Scalarvariable & "," End If Next + Return "INSERT INTO tblVERAG_CustomsDeclarations_Items (" & + f.TrimEnd(","c) & ") VALUES (" & v.TrimEnd(","c) & ")" + End Function + + ' ---------- DELETE + INSERT ---------- + Public Shared Sub REPLACE_ALL(zaId As Integer, list As List(Of cVERAG_CustomsDeclarations_Item)) + + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + + SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Items WHERE zaItem_zaId=" & zaId, "FMZOLL") + SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_zaId=" & zaId & " AND zaDoc_ItemId is not null", "FMZOLL") + + For Each it In list + it.zaItem_zaId = zaId + it.zaItem_Id = SQL.doSQLVarListID(it.zaItem_Id, it.getInsertCmd(), "FMZOLL", , it.getParameterList()) + 'MsgBox(it.zaItem_Id) + cVERAG_CustomsDeclarations_Document.INSERT_ITEM(it.zaItem_zaId, it.zaItem_Id, it.Documents) + Next End Sub + Public Shared Function LOAD_BY_ZAID(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_Item) + Dim result As New List(Of cVERAG_CustomsDeclarations_Item) + Try + Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL() - '--- SQL HELPERS -------------------------------------------------------- + Using cmd As New SqlCommand( + "SELECT * FROM tblVERAG_CustomsDeclarations_Items WHERE zaItem_zaId=@zaId", + conn) - Private Function getUpdateCmd() As String + cmd.Parameters.AddWithValue("@zaId", zaId) - Dim cols As New List(Of String) + Using dr As SqlDataReader = cmd.ExecuteReader() + While dr.Read() - For Each p In getParameterList() - If Not p.isPrimaryParam Then - cols.Add("[" & p.Text & "]=@" & p.Scalarvariable) - End If - Next + Dim it As New cVERAG_CustomsDeclarations_Item + it.hasEntry = False - Return "UPDATE tblVERAG_CustomsDeclarations_Items SET " & - String.Join(",", cols) & - " WHERE zaItem_Id=@zaItem_Id" + For Each li In it.getParameterList() + Dim pi As PropertyInfo = + it.GetType().GetProperty(li.Scalarvariable) + If dr.Item(li.Text) Is DBNull.Value Then + pi.SetValue(it, Nothing) + Else + pi.SetValue(it, dr.Item(li.Text)) + End If + Next + + it.hasEntry = True + result.Add(it) + + End While + End Using + End Using + End Using + + ' ===== Documents NACHLADEN (pro Item) ===== + For Each it In result + it.Documents = + cVERAG_CustomsDeclarations_Document.LOAD_ITEM_BY_ITEMID(zaId, it.zaItem_Id) + Next + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Return result End Function - - - - Private Function getInsertCmd() As String - - Dim C As New List(Of String) - Dim V As New List(Of String) - - For Each p In getParameterList() - If Not p.isPrimaryParam Then - C.Add("[" & p.Text & "]") - V.Add("@" & p.Scalarvariable) - End If - Next - - Return "INSERT INTO tblVERAG_CustomsDeclarations_Items (" & - String.Join(",", C) & - ") VALUES (" & - String.Join(",", V) & - ")" - - End Function - - - End Class - - - - - - -' ========================================================================== -' DUTY -' ========================================================================== - -Public Class cVERAG_Zollanmeldung_Duty +' ########################################################## +' DUTIES +' ########################################################## +Public Class cVERAG_CustomsDeclarations_Duty Public Property zaDuty_Id As Integer - Public Property zaDuty_DeclarationId As Integer - Public Property zaDuty_ItemId As Integer? + Public Property zaDuty_zaId As Integer + Public Property zaDuty_AccountType As String + Public Property zaDuty_AccountHeadCustoms As String + Public Property zaDuty_ApplicationType As String + Public Property zaDuty_AccountNo As String - Public Property zaDuty_Type As String - Public Property zaDuty_BaseAmountForeign As Decimal? - Public Property zaDuty_BaseCurrency As String - Public Property zaDuty_BaseAmountEUR As Decimal? - Public Property zaDuty_Rate As String - Public Property zaDuty_AmountForeign As Decimal? - Public Property zaDuty_AmountCurrency As String + + + Public Property zaDuty_AccountEORI As String + Public Property zaDuty_AccountHolderName As String + Public Property zaDuty_DutyType As String + Public Property zaDuty_BIN As String Public Property zaDuty_AmountEUR As Decimal? + Public Property zaDuty_AmountForeign As Decimal? + Public Property zaDuty_Currency As String + Public Property zaDuty_LimitDate As Date? + Public Property hasEntry As Boolean = False - Public Property zaDuty_DeferredFlag As Boolean? - Public Property zaDuty_DeferredAccount As String - - Public Property zaDuty_MeasureId As String - Public Property zaDuty_Indicator As String - Public Property zaDuty_Remarks As String - - Private SQL As New VERAG_PROG_ALLGEMEIN.SQL - - - - '--- PARAMLIST ---------------------------------------------------------- - - Public Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) - - Dim L As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) - - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_Id", zaDuty_Id,, True, True)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_DeclarationId", zaDuty_DeclarationId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_ItemId", zaDuty_ItemId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_Type", zaDuty_Type)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_BaseAmountForeign", zaDuty_BaseAmountForeign)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_BaseCurrency", zaDuty_BaseCurrency)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_BaseAmountEUR", zaDuty_BaseAmountEUR)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_Rate", zaDuty_Rate)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_AmountForeign", zaDuty_AmountForeign)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_AmountCurrency", zaDuty_AmountCurrency)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_AmountEUR", zaDuty_AmountEUR)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_DeferredFlag", zaDuty_DeferredFlag)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_DeferredAccount", zaDuty_DeferredAccount)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_MeasureId", zaDuty_MeasureId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_Indicator", zaDuty_Indicator)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDuty_Remarks", zaDuty_Remarks)) - - Return L - + Public Function getParameterList() As List(Of SQLVariable) + Return New List(Of SQLVariable) From { + New SQLVariable("zaDuty_Id", zaDuty_Id,, True), + New SQLVariable("zaDuty_zaId", zaDuty_zaId), + New SQLVariable("zaDuty_AccountType", zaDuty_AccountType), + New SQLVariable("zaDuty_AccountHeadCustoms", zaDuty_AccountHeadCustoms), + New SQLVariable("zaDuty_ApplicationType", zaDuty_ApplicationType), + New SQLVariable("zaDuty_AccountNo", zaDuty_AccountNo), + New SQLVariable("zaDuty_AccountEORI", zaDuty_AccountEORI), + New SQLVariable("zaDuty_AccountHolderName", zaDuty_AccountHolderName), + New SQLVariable("zaDuty_DutyType", zaDuty_DutyType), + New SQLVariable("zaDuty_BIN", zaDuty_BIN), + New SQLVariable("zaDuty_AmountEUR", zaDuty_AmountEUR), + New SQLVariable("zaDuty_AmountForeign", zaDuty_AmountForeign), + New SQLVariable("zaDuty_Currency", zaDuty_Currency), + New SQLVariable("zaDuty_LimitDate", zaDuty_LimitDate) + } End Function - - - '--- SAVE --------------------------------------------------------------- - - Public Function SAVE() As Boolean - - Dim list = getParameterList() - - Dim sqlstr As String = - " BEGIN TRAN " & - " IF EXISTS(SELECT 1 FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_Id=@zaDuty_Id) " & - " BEGIN " & getUpdateCmd() & " END " & - " ELSE BEGIN " & getInsertCmd() & " END " & - " COMMIT TRAN " - - zaDuty_Id = SQL.doSQLVarListID(zaDuty_Id, sqlstr, "VERAG", , list) - Return zaDuty_Id > 0 - - End Function - - - - '--- LOAD FROM DATAREADER ---------------------------------------------- - - Public Sub LOAD_FROM_READER(dr As SqlDataReader) - - For Each p In getParameterList() - Dim prop = Me.GetType().GetProperty(p.Scalarvariable) - If prop IsNot Nothing Then - If IsDBNull(dr(p.Text)) Then - prop.SetValue(Me, Nothing) - Else - prop.SetValue(Me, dr(p.Text)) - End If + Public Function getInsertCmd() As String + Dim f As String = "", v As String = "" + For Each i In getParameterList() + If Not i.isPrimaryParam Then + f &= "[" & i.Text & "]," + v &= "@" & i.Scalarvariable & "," End If Next - - End Sub - - - - - '--- SQL HELPERS -------------------------------------------------------- - - Private Function getUpdateCmd() As String - - Dim cols As New List(Of String) - - For Each p In getParameterList() - If Not p.isPrimaryParam Then - cols.Add("[" & p.Text & "]=@" & p.Scalarvariable) - End If - Next - - Return "UPDATE tblVERAG_CustomsDeclarations_Duties SET " & - String.Join(",", cols) & - " WHERE zaDuty_Id=@zaDuty_Id" - - End Function - - - - Private Function getInsertCmd() As String - - Dim C As New List(Of String) - Dim V As New List(Of String) - - For Each p In getParameterList() - If Not p.isPrimaryParam Then - C.Add("[" & p.Text & "]") - V.Add("@" & p.Scalarvariable) - End If - Next - Return "INSERT INTO tblVERAG_CustomsDeclarations_Duties (" & - String.Join(",", C) & - ") VALUES (" & - String.Join(",", V) & - ")" - + f.TrimEnd(","c) & ") VALUES (" & v.TrimEnd(","c) & ")" End Function -End Class + ' ---------- DELETE + INSERT ---------- + Public Shared Sub REPLACE_ALL(zaId As Integer, list As List(Of cVERAG_CustomsDeclarations_Duty)) + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL - - - - - - -' ========================================================================== -' DOCUMENT (HEADER) -' ========================================================================== - -Public Class cVERAG_Zollanmeldung_Document - - Public Property zaDoc_Id As Integer - Public Property zaDoc_DeclarationId As Integer - - Public Property zaDoc_Level As String = "H" - - Public Property zaDoc_Code As String - Public Property zaDoc_Type As String - Public Property zaDoc_Reference As String - Public Property zaDoc_IssueDate As Date? - Public Property zaDoc_IssueCountry As String - Public Property zaDoc_IssueTIN As String - Public Property zaDoc_UID As String - Public Property zaDoc_ValidTo As Date? - Public Property zaDoc_Remarks As String - - Private SQL As New VERAG_PROG_ALLGEMEIN.SQL - - - - - '--- PARAMLIST ---------------------------------------------------------- - - Public Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) - - Dim L As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) - - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Id", zaDoc_Id,, True, True)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_DeclarationId", zaDoc_DeclarationId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Level", zaDoc_Level)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Code", zaDoc_Code)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Type", zaDoc_Type)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Reference", zaDoc_Reference)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_IssueDate", zaDoc_IssueDate)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_IssueCountry", zaDoc_IssueCountry)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_IssueTIN", zaDoc_IssueTIN)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_UID", zaDoc_UID)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_ValidTo", zaDoc_ValidTo)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Remarks", zaDoc_Remarks)) - - Return L - - End Function - - - - '--- SAVE --------------------------------------------------------------- - - Public Function SAVE() As Boolean - - Dim list = getParameterList() - - Dim sqlstr As String = - " BEGIN TRAN " & - " IF EXISTS(SELECT 1 FROM tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_Id=@zaDoc_Id) " & - " BEGIN " & getUpdateCmd() & " END " & - " ELSE BEGIN " & getInsertCmd() & " END " & - " COMMIT TRAN " - - zaDoc_Id = SQL.doSQLVarListID(zaDoc_Id, sqlstr, "VERAG", , list) - Return zaDoc_Id > 0 - - End Function - - - - '--- LOAD FROM DATAREADER ---------------------------------------------- - - Public Sub LOAD_FROM_READER(dr As SqlDataReader) - - For Each p In getParameterList() - Dim prop = Me.GetType().GetProperty(p.Scalarvariable) - If prop IsNot Nothing Then - If IsDBNull(dr(p.Text)) Then - prop.SetValue(Me, Nothing) - Else - prop.SetValue(Me, dr(p.Text)) - End If - End If + SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=" & zaId, "FMZOLL") + For Each d In list + d.zaDuty_zaId = zaId + d.zaDuty_Id = SQL.doSQLVarListID(d.zaDuty_Id, d.getInsertCmd(), "FMZOLL", , d.getParameterList()) Next - End Sub + Public Shared Function LOAD_BY_ZAID(zaId As Integer) _ + As List(Of cVERAG_CustomsDeclarations_Duty) + Dim result As New List(Of cVERAG_CustomsDeclarations_Duty) + Try + Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL() + Using cmd As New SqlCommand( + "SELECT * FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=@zaId", + conn) - '--- SQL HELPERS -------------------------------------------------------- + cmd.Parameters.AddWithValue("@zaId", zaId) - Private Function getUpdateCmd() As String + Using dr As SqlDataReader = cmd.ExecuteReader() + While dr.Read() - Dim cols As New List(Of String) + Dim d As New cVERAG_CustomsDeclarations_Duty + d.hasEntry = False - For Each p In getParameterList() - If Not p.isPrimaryParam Then - cols.Add("[" & p.Text & "]=@" & p.Scalarvariable) - End If - Next + ' ===== DEINE LOAD-VORLAGE (1:1, nur in While) ===== + For Each li In d.getParameterList() + Dim pi As PropertyInfo = + d.GetType().GetProperty(li.Scalarvariable) - Return "UPDATE tblVERAG_CustomsDeclarations_Documents SET " & - String.Join(",", cols) & - " WHERE zaDoc_Id=@zaDoc_Id" + If dr.Item(li.Text) Is DBNull.Value Then + pi.SetValue(d, Nothing) + Else + pi.SetValue(d, dr.Item(li.Text)) + End If + Next + d.hasEntry = True + result.Add(d) + + End While + End Using + End Using + End Using + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR( + ex.Message, + ex.StackTrace, + System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Return result End Function - - - Private Function getInsertCmd() As String - - Dim C As New List(Of String) - Dim V As New List(Of String) - - For Each p In getParameterList() - If Not p.isPrimaryParam Then - C.Add("[" & p.Text & "]") - V.Add("@" & p.Scalarvariable) - End If - Next - - Return "INSERT INTO tblVERAG_CustomsDeclarations_Documents (" & - String.Join(",", C) & - ") VALUES (" & - String.Join(",", V) & - ")" - - End Function - - - End Class - - - - - - -' ========================================================================== -' DOCUMENT (ITEM) -' ========================================================================== - -Public Class cVERAG_Zollanmeldung_ItemDocument +' ########################################################## +' DOCUMENTS (HEAD + ITEM) +' ########################################################## +Public Class cVERAG_CustomsDeclarations_Document Public Property zaDoc_Id As Integer - Public Property zaDoc_DeclarationId As Integer? + Public Property zaDoc_zaId As Integer Public Property zaDoc_ItemId As Integer? - - Public Property zaDoc_Level As String = "I" - + Public Property zaDoc_Date As String + Public Property zaDoc_Section As String Public Property zaDoc_Code As String - Public Property zaDoc_Type As String + Public Property zaDoc_Presentation As String + Public Property zaDoc_DepreciationAmount As String + Public Property zaDoc_DepreciationUnitmeasurement As String + Public Property zaDoc_DepreciationUnitmeasurementQualifier As String + + Public Property zaDoc_Reference As String - Public Property zaDoc_IssueDate As Date? - Public Property zaDoc_IssueCountry As String - Public Property zaDoc_IssueTIN As String - Public Property zaDoc_UID As String - Public Property zaDoc_ValidTo As Date? - Public Property zaDoc_Remarks As String + Public Property zaDoc_Description As String - Private SQL As New VERAG_PROG_ALLGEMEIN.SQL - - - - - '--- PARAMLIST ---------------------------------------------------------- - - Public Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) - - Dim L As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) - - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Id", zaDoc_Id,, True, True)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_DeclarationId", zaDoc_DeclarationId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_ItemId", zaDoc_ItemId)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Level", zaDoc_Level)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Code", zaDoc_Code)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Type", zaDoc_Type)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Reference", zaDoc_Reference)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_IssueDate", zaDoc_IssueDate)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_IssueCountry", zaDoc_IssueCountry)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_IssueTIN", zaDoc_IssueTIN)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_UID", zaDoc_UID)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_ValidTo", zaDoc_ValidTo)) - L.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("zaDoc_Remarks", zaDoc_Remarks)) - - Return L + Public Property hasEntry As Boolean = False + Public Function getParameterList() As List(Of SQLVariable) + Return New List(Of SQLVariable) From { + New SQLVariable("zaDoc_Id", zaDoc_Id,, True), + New SQLVariable("zaDoc_zaId", zaDoc_zaId), + New SQLVariable("zaDoc_ItemId", zaDoc_ItemId), + New SQLVariable("zaDoc_Date", zaDoc_Date), + New SQLVariable("zaDoc_Section", zaDoc_Section), + New SQLVariable("zaDoc_Code", zaDoc_Code), + New SQLVariable("zaDoc_Reference", zaDoc_Reference), + New SQLVariable("zaDoc_Presentation", zaDoc_Presentation), + New SQLVariable("zaDoc_DepreciationAmount", zaDoc_DepreciationAmount), + New SQLVariable("zaDoc_DepreciationUnitmeasurement", zaDoc_DepreciationUnitmeasurement), + New SQLVariable("zaDoc_DepreciationUnitmeasurementQualifier", zaDoc_DepreciationUnitmeasurementQualifier), + New SQLVariable("zaDoc_Description ", zaDoc_Description) + } End Function - - - '--- SAVE --------------------------------------------------------------- - - Public Function SAVE() As Boolean - - Dim list = getParameterList() - - Dim sqlstr As String = - " BEGIN TRAN " & - " IF EXISTS(SELECT 1 FROM tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_Id=@zaDoc_Id) " & - " BEGIN " & getUpdateCmd() & " END " & - " ELSE BEGIN " & getInsertCmd() & " END " & - " COMMIT TRAN " - - zaDoc_Id = SQL.doSQLVarListID(zaDoc_Id, sqlstr, "VERAG", , list) - Return zaDoc_Id > 0 - - End Function - - - - '--- LOAD FROM DATAREADER ---------------------------------------------- - - Public Sub LOAD_FROM_READER(dr As SqlDataReader) - - For Each p In getParameterList() - Dim prop = Me.GetType().GetProperty(p.Scalarvariable) - If prop IsNot Nothing Then - If IsDBNull(dr(p.Text)) Then - prop.SetValue(Me, Nothing) - Else - prop.SetValue(Me, dr(p.Text)) - End If + Public Function getInsertCmd() As String + Dim f As String = "", v As String = "" + For Each i In getParameterList() + If Not i.isPrimaryParam Then + f &= "[" & i.Text & "]," + v &= "@" & i.Scalarvariable & "," End If Next + Return "INSERT INTO tblVERAG_CustomsDeclarations_Documents (" & + f.TrimEnd(","c) & ") VALUES (" & v.TrimEnd(","c) & ")" + End Function + + + ' ---------- DELETE + INSERT ---------- + Public Shared Sub REPLACE_HEAD(zaId As Integer, list As List(Of cVERAG_CustomsDeclarations_Document)) + + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + SQL.doSQL( + "DELETE FROM tblVERAG_CustomsDeclarations_Documents + WHERE zaDoc_zaId=" & zaId & " AND zaDoc_ItemId IS NULL", + "FMZOLL") + + For Each d In list + d.zaDoc_zaId = zaId + d.zaDoc_ItemId = Nothing + d.zaDoc_Id = SQL.doSQLVarListID(d.zaDoc_Id, d.getInsertCmd(), "FMZOLL", , d.getParameterList()) + Next End Sub + Public Shared Sub INSERT_ITEM(zaId As Integer, itemId As Integer, list As List(Of cVERAG_CustomsDeclarations_Document)) + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL - - '--- SQL HELPERS -------------------------------------------------------- - - Private Function getUpdateCmd() As String - - Dim cols As New List(Of String) - - For Each p In getParameterList() - If Not p.isPrimaryParam Then - cols.Add("[" & p.Text & "]=@" & p.Scalarvariable) - End If + For Each d In list + d.zaDoc_zaId = zaId + d.zaDoc_ItemId = itemId + d.zaDoc_Id = SQL.doSQLVarListID(d.zaDoc_Id, d.getInsertCmd(), "FMZOLL", , d.getParameterList()) Next + End Sub - Return "UPDATE tblVERAG_CustomsDeclarations_Documents SET " & - String.Join(",", cols) & - " WHERE zaDoc_Id=@zaDoc_Id" - + Public Shared Function LOAD_HEAD_BY_ZAID(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_Document) + Return LOAD_BY_SQL( + "SELECT * FROM tblVERAG_CustomsDeclarations_Documents + WHERE zaDoc_zaId=" & zaId & " AND zaDoc_ItemId IS NULL") End Function - - - Private Function getInsertCmd() As String - - Dim C As New List(Of String) - Dim V As New List(Of String) - - For Each p In getParameterList() - If Not p.isPrimaryParam Then - C.Add("[" & p.Text & "]") - V.Add("@" & p.Scalarvariable) - End If - Next - - Return "INSERT INTO tblVERAG_CustomsDeclarations_Documents (" & - String.Join(",", C) & - ") VALUES (" & - String.Join(",", V) & - ")" - + Public Shared Function LOAD_ITEM_BY_ITEMID(zaId As Integer, itemId As Integer) As List(Of cVERAG_CustomsDeclarations_Document) + Return LOAD_BY_SQL( + "SELECT * FROM tblVERAG_CustomsDeclarations_Documents + WHERE zaDoc_zaId=" & zaId & " AND zaDoc_ItemId=" & itemId) End Function + Private Shared Function LOAD_BY_SQL(sqlstr As String) _ + As List(Of cVERAG_CustomsDeclarations_Document) + + Dim result As New List(Of cVERAG_CustomsDeclarations_Document) + + Try + Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL() + Using cmd As New SqlCommand(sqlstr, conn) + + Using dr As SqlDataReader = cmd.ExecuteReader() + While dr.Read() + + Dim d As New cVERAG_CustomsDeclarations_Document + d.hasEntry = False + + ' ===== DEINE LOAD-VORLAGE (1:1, kombiniert) ===== + For Each li In d.getParameterList() + Dim pi As PropertyInfo = + d.GetType().GetProperty(li.Scalarvariable) + + If dr.Item(li.Text) Is DBNull.Value Then + pi.SetValue(d, Nothing) + Else + pi.SetValue(d, dr.Item(li.Text)) + End If + Next + + d.hasEntry = True + result.Add(d) + + End While + End Using + End Using + End Using + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR( + ex.Message, + ex.StackTrace, + System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Return result + End Function + +End Class + + -End Class \ No newline at end of file