From 68bf284a8e7232e02115a16d90f2dabe3b89233a Mon Sep 17 00:00:00 2001 From: Andreas Luxbauer Date: Sun, 18 Oct 2026 11:06:41 +0200 Subject: [PATCH 1/3] Datenarchivarchiv --- .../frmDatenarchivarchiv.Designer.vb | 106 +++++++++++--- .../frmDatenarchivarchiv.vb | 130 +++++++++++++----- 2 files changed, 183 insertions(+), 53 deletions(-) diff --git a/initATLASAufschubkonten/frmDatenarchivarchiv.Designer.vb b/initATLASAufschubkonten/frmDatenarchivarchiv.Designer.vb index 1d88fd8..ddbb006 100644 --- a/initATLASAufschubkonten/frmDatenarchivarchiv.Designer.vb +++ b/initATLASAufschubkonten/frmDatenarchivarchiv.Designer.vb @@ -43,11 +43,15 @@ Partial Class frmDatenarchivarchiv Me.txtUOrdner1 = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtOrdner = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtKategorie = New VERAG_PROG_ALLGEMEIN.MyTextBox() + Me.MyComboBox1 = New VERAG_PROG_ALLGEMEIN.MyComboBox() + Me.MyTextBox1 = New VERAG_PROG_ALLGEMEIN.MyTextBox() + Me.Label11 = New System.Windows.Forms.Label() + Me.Label12 = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'ProgressBar1 ' - Me.ProgressBar1.Location = New System.Drawing.Point(29, 123) + Me.ProgressBar1.Location = New System.Drawing.Point(29, 147) Me.ProgressBar1.Name = "ProgressBar1" Me.ProgressBar1.Size = New System.Drawing.Size(664, 23) Me.ProgressBar1.TabIndex = 0 @@ -55,7 +59,7 @@ Partial Class frmDatenarchivarchiv 'Label1 ' Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(350, 153) + Me.Label1.Location = New System.Drawing.Point(350, 177) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(24, 13) Me.Label1.TabIndex = 1 @@ -64,7 +68,7 @@ Partial Class frmDatenarchivarchiv 'Label2 ' Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(26, 19) + Me.Label2.Location = New System.Drawing.Point(26, 26) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(174, 13) Me.Label2.TabIndex = 1 @@ -73,7 +77,7 @@ Partial Class frmDatenarchivarchiv 'Label3 ' Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(26, 56) + Me.Label3.Location = New System.Drawing.Point(26, 80) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(55, 13) Me.Label3.TabIndex = 2 @@ -82,7 +86,7 @@ Partial Class frmDatenarchivarchiv 'Label4 ' Me.Label4.AutoSize = True - Me.Label4.Location = New System.Drawing.Point(160, 56) + Me.Label4.Location = New System.Drawing.Point(160, 80) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(42, 13) Me.Label4.TabIndex = 4 @@ -91,7 +95,7 @@ Partial Class frmDatenarchivarchiv 'Label5 ' Me.Label5.AutoSize = True - Me.Label5.Location = New System.Drawing.Point(294, 56) + Me.Label5.Location = New System.Drawing.Point(294, 80) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(62, 13) Me.Label5.TabIndex = 6 @@ -100,7 +104,7 @@ Partial Class frmDatenarchivarchiv 'Label6 ' Me.Label6.AutoSize = True - Me.Label6.Location = New System.Drawing.Point(428, 56) + Me.Label6.Location = New System.Drawing.Point(428, 80) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(62, 13) Me.Label6.TabIndex = 8 @@ -109,7 +113,7 @@ Partial Class frmDatenarchivarchiv 'Label7 ' Me.Label7.AutoSize = True - Me.Label7.Location = New System.Drawing.Point(562, 56) + Me.Label7.Location = New System.Drawing.Point(562, 80) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(62, 13) Me.Label7.TabIndex = 10 @@ -118,7 +122,7 @@ Partial Class frmDatenarchivarchiv 'Label8 ' Me.Label8.AutoSize = True - Me.Label8.Location = New System.Drawing.Point(562, 2) + Me.Label8.Location = New System.Drawing.Point(562, 9) Me.Label8.Name = "Label8" Me.Label8.Size = New System.Drawing.Size(33, 13) Me.Label8.TabIndex = 13 @@ -127,7 +131,7 @@ Partial Class frmDatenarchivarchiv 'Button1 ' Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.Button1.Location = New System.Drawing.Point(278, 194) + Me.Button1.Location = New System.Drawing.Point(278, 198) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(165, 33) Me.Button1.TabIndex = 14 @@ -137,7 +141,7 @@ Partial Class frmDatenarchivarchiv 'Label9 ' Me.Label9.AutoSize = True - Me.Label9.Location = New System.Drawing.Point(428, 2) + Me.Label9.Location = New System.Drawing.Point(428, 9) Me.Label9.Name = "Label9" Me.Label9.Size = New System.Drawing.Size(23, 13) Me.Label9.TabIndex = 17 @@ -146,7 +150,7 @@ Partial Class frmDatenarchivarchiv 'Label10 ' Me.Label10.AutoSize = True - Me.Label10.Location = New System.Drawing.Point(294, 2) + Me.Label10.Location = New System.Drawing.Point(294, 9) Me.Label10.Name = "Label10" Me.Label10.Size = New System.Drawing.Size(28, 13) Me.Label10.TabIndex = 15 @@ -167,7 +171,7 @@ Partial Class frmDatenarchivarchiv Me.txtBis._Waehrung = False Me.txtBis._WaehrungZeichen = True Me.txtBis.ForeColor = System.Drawing.Color.Black - Me.txtBis.Location = New System.Drawing.Point(431, 19) + Me.txtBis.Location = New System.Drawing.Point(431, 26) Me.txtBis.MaxLength = 10 Me.txtBis.MaxLineLength = -1 Me.txtBis.MaxLines_Warning = "" @@ -192,7 +196,7 @@ Partial Class frmDatenarchivarchiv Me.txtVon._Waehrung = False Me.txtVon._WaehrungZeichen = True Me.txtVon.ForeColor = System.Drawing.Color.Black - Me.txtVon.Location = New System.Drawing.Point(297, 19) + Me.txtVon.Location = New System.Drawing.Point(297, 26) Me.txtVon.MaxLength = 10 Me.txtVon.MaxLineLength = -1 Me.txtVon.MaxLines_Warning = "" @@ -217,7 +221,7 @@ Partial Class frmDatenarchivarchiv Me.txtMax._Waehrung = False Me.txtMax._WaehrungZeichen = True Me.txtMax.ForeColor = System.Drawing.Color.Black - Me.txtMax.Location = New System.Drawing.Point(565, 19) + Me.txtMax.Location = New System.Drawing.Point(565, 26) Me.txtMax.MaxLineLength = -1 Me.txtMax.MaxLines_Warning = "" Me.txtMax.MaxLines_Warning_Label = Nothing @@ -243,7 +247,7 @@ Partial Class frmDatenarchivarchiv Me.txtUOrdner3._WaehrungZeichen = True Me.txtUOrdner3.Enabled = False Me.txtUOrdner3.ForeColor = System.Drawing.Color.Black - Me.txtUOrdner3.Location = New System.Drawing.Point(565, 73) + Me.txtUOrdner3.Location = New System.Drawing.Point(565, 97) Me.txtUOrdner3.MaxLineLength = -1 Me.txtUOrdner3.MaxLines_Warning = "" Me.txtUOrdner3.MaxLines_Warning_Label = Nothing @@ -267,7 +271,7 @@ Partial Class frmDatenarchivarchiv Me.txtUOrdner2._WaehrungZeichen = True Me.txtUOrdner2.Enabled = False Me.txtUOrdner2.ForeColor = System.Drawing.Color.Black - Me.txtUOrdner2.Location = New System.Drawing.Point(431, 73) + Me.txtUOrdner2.Location = New System.Drawing.Point(431, 97) Me.txtUOrdner2.MaxLineLength = -1 Me.txtUOrdner2.MaxLines_Warning = "" Me.txtUOrdner2.MaxLines_Warning_Label = Nothing @@ -291,7 +295,7 @@ Partial Class frmDatenarchivarchiv Me.txtUOrdner1._WaehrungZeichen = True Me.txtUOrdner1.Enabled = False Me.txtUOrdner1.ForeColor = System.Drawing.Color.Black - Me.txtUOrdner1.Location = New System.Drawing.Point(297, 73) + Me.txtUOrdner1.Location = New System.Drawing.Point(297, 97) Me.txtUOrdner1.MaxLineLength = -1 Me.txtUOrdner1.MaxLines_Warning = "" Me.txtUOrdner1.MaxLines_Warning_Label = Nothing @@ -314,7 +318,7 @@ Partial Class frmDatenarchivarchiv Me.txtOrdner._Waehrung = False Me.txtOrdner._WaehrungZeichen = True Me.txtOrdner.ForeColor = System.Drawing.Color.Black - Me.txtOrdner.Location = New System.Drawing.Point(163, 73) + Me.txtOrdner.Location = New System.Drawing.Point(163, 97) Me.txtOrdner.MaxLineLength = -1 Me.txtOrdner.MaxLines_Warning = "" Me.txtOrdner.MaxLines_Warning_Label = Nothing @@ -338,7 +342,7 @@ Partial Class frmDatenarchivarchiv Me.txtKategorie._Waehrung = False Me.txtKategorie._WaehrungZeichen = True Me.txtKategorie.ForeColor = System.Drawing.Color.Black - Me.txtKategorie.Location = New System.Drawing.Point(29, 73) + Me.txtKategorie.Location = New System.Drawing.Point(29, 97) Me.txtKategorie.MaxLineLength = -1 Me.txtKategorie.MaxLines_Warning = "" Me.txtKategorie.MaxLines_Warning_Label = Nothing @@ -347,12 +351,70 @@ Partial Class frmDatenarchivarchiv Me.txtKategorie.TabIndex = 3 Me.txtKategorie.Text = "DOKUMENTE" ' + 'MyComboBox1 + ' + Me.MyComboBox1._allowedValuesFreiText = Nothing + Me.MyComboBox1._allowFreiText = False + Me.MyComboBox1._value = "" + Me.MyComboBox1.FormattingEnabled = True + Me.MyComboBox1.Location = New System.Drawing.Point(343, 47) + Me.MyComboBox1.Name = "MyComboBox1" + Me.MyComboBox1.Size = New System.Drawing.Size(82, 21) + Me.MyComboBox1.TabIndex = 19 + ' + 'MyTextBox1 + ' + Me.MyTextBox1._DateTimeOnly = False + Me.MyTextBox1._numbersOnly = False + Me.MyTextBox1._numbersOnlyKommastellen = "" + Me.MyTextBox1._numbersOnlyTrennzeichen = True + Me.MyTextBox1._Prozent = False + Me.MyTextBox1._ShortDateNew = False + Me.MyTextBox1._ShortDateOnly = False + Me.MyTextBox1._TimeOnly = False + Me.MyTextBox1._TimeOnly_Seconds = False + Me.MyTextBox1._value = "1000" + Me.MyTextBox1._Waehrung = False + Me.MyTextBox1._WaehrungZeichen = True + Me.MyTextBox1.ForeColor = System.Drawing.Color.Black + Me.MyTextBox1.Location = New System.Drawing.Point(467, 47) + Me.MyTextBox1.MaxLineLength = -1 + Me.MyTextBox1.MaxLines_Warning = "" + Me.MyTextBox1.MaxLines_Warning_Label = Nothing + Me.MyTextBox1.Name = "MyTextBox1" + Me.MyTextBox1.Size = New System.Drawing.Size(92, 20) + Me.MyTextBox1.TabIndex = 20 + Me.MyTextBox1.Text = "1000" + Me.MyTextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + ' + 'Label11 + ' + Me.Label11.AutoSize = True + Me.Label11.Location = New System.Drawing.Point(431, 50) + Me.Label11.Name = "Label11" + Me.Label11.Size = New System.Drawing.Size(30, 13) + Me.Label11.TabIndex = 22 + Me.Label11.Text = "Jahr:" + ' + 'Label12 + ' + Me.Label12.AutoSize = True + Me.Label12.Location = New System.Drawing.Point(297, 50) + Me.Label12.Name = "Label12" + Me.Label12.Size = New System.Drawing.Size(40, 13) + Me.Label12.TabIndex = 21 + Me.Label12.Text = "Monat:" + ' 'frmDatenarchivarchiv ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.BackColor = System.Drawing.Color.White Me.ClientSize = New System.Drawing.Size(722, 239) + Me.Controls.Add(Me.Label11) + Me.Controls.Add(Me.Label12) + Me.Controls.Add(Me.MyTextBox1) + Me.Controls.Add(Me.MyComboBox1) Me.Controls.Add(Me.txtBis) Me.Controls.Add(Me.Label9) Me.Controls.Add(Me.txtVon) @@ -402,4 +464,8 @@ Partial Class frmDatenarchivarchiv Friend WithEvents Label9 As Label Friend WithEvents txtVon As VERAG_PROG_ALLGEMEIN.MyTextBox Friend WithEvents Label10 As Label + Friend WithEvents MyComboBox1 As VERAG_PROG_ALLGEMEIN.MyComboBox + Friend WithEvents MyTextBox1 As VERAG_PROG_ALLGEMEIN.MyTextBox + Friend WithEvents Label11 As Label + Friend WithEvents Label12 As Label End Class diff --git a/initATLASAufschubkonten/frmDatenarchivarchiv.vb b/initATLASAufschubkonten/frmDatenarchivarchiv.vb index b1cea0b..f68f966 100644 --- a/initATLASAufschubkonten/frmDatenarchivarchiv.vb +++ b/initATLASAufschubkonten/frmDatenarchivarchiv.vb @@ -4,56 +4,120 @@ Public Class frmDatenarchivarchiv Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Me.Cursor = Cursors.WaitCursor - If txtMax._value = "" Then Me.Cursor = Cursors.Default : Exit Sub - If Not IsNumeric(txtMax._value) Then Me.Cursor = Cursors.Default : Exit Sub - If Not IsDate(txtVon._value) Then Me.Cursor = Cursors.Default : Exit Sub - If Not IsDate(txtBis._value) Then Me.Cursor = Cursors.Default : Exit Sub - If txtKategorie.Text Is String.Empty Then Me.Cursor = Cursors.Default : Exit Sub - If txtOrdner.Text Is String.Empty Then Me.Cursor = Cursors.Default : Exit Sub - Dim DT = SQL.loadDgvBySql(" SELECT TOP (" & txtMax._value & ") [da_id] FROM [tblDatenarchiv] inner join tblDatenarchiv_Collection on da_id=coll_daId - where da_vorlage=0 and coll_date BETWEEN '" & txtVon._value & "' and '" & txtBis._value & "' and coll_pfad NOT LIKE '%\\stor01.verag.ost.dmn\DatenArchivArchiv%' and coll_pfad NOT LIKE '\\DELETED\%' - AND da_kategorie='" & txtKategorie.Text & "' and da_ordner='" & txtOrdner.Text & "' - and da_id>=392150 group by [da_id] order by [da_id] ", "FMZOLL") + Dim maxEintraege As Integer + Dim datumVon As Date + Dim datumBis As Date - If DT Is Nothing Then Me.Cursor = Cursors.Default : Exit Sub - If DT.Rows.Count = 0 Then Me.Cursor = Cursors.Default : Exit Sub + If Not Integer.TryParse(txtMax._value, maxEintraege) OrElse maxEintraege <= 0 Then Exit Sub + If Not Date.TryParse(txtVon._value, datumVon) Then Exit Sub + If Not Date.TryParse(txtBis._value, datumBis) Then Exit Sub + If datumVon.Date > datumBis.Date Then Exit Sub + If String.IsNullOrWhiteSpace(txtKategorie.Text) Then Exit Sub + If String.IsNullOrWhiteSpace(txtOrdner.Text) Then Exit Sub - If vbYes = MsgBox("Es werden '" & DT.Rows.Count & "' Einträge verschoben - fortfahren?", vbYesNoCancel) Then + Dim sqlText As String = + "SELECT TOP (" & maxEintraege & ") da.da_id " & + "FROM tblDatenarchiv da " & + "WHERE da.da_vorlage = 0 " & + "AND da.da_kategorie = '" & txtKategorie.Text.Replace("'", "''") & "' " & + "AND da.da_ordner = '" & txtOrdner.Text.Replace("'", "''") & "' " & + "AND da.da_id >= 392150 " & + "AND EXISTS (" & + "SELECT 1 FROM tblDatenarchiv_Collection coll " & + "WHERE coll.coll_daId = da.da_id " & + "AND coll.coll_date >= '" & datumVon.ToString("yyyyMMdd") & "' " & + "AND coll.coll_date < '" & datumBis.AddDays(1).ToString("yyyyMMdd") & "' " & + "AND coll.coll_pfad NOT LIKE '%\\stor01.verag.ost.dmn\DatenArchivArchiv%' " & + "AND coll.coll_pfad NOT LIKE '\\DELETED\%' " & + ") ORDER BY da.da_id" - ProgressBar1.Minimum = 1 - ProgressBar1.Maximum = DT.Rows.Count - ProgressBar1.Step = 1 - ProgressBar1.Value = 1 + Dim DT = SQL.loadDgvBySql(sqlText, "FMZOLL") - For Each ROW In DT.Rows - 'Dim DS = New VERAG_PROG_ALLGEMEIN.cDATENSERVER(txtKategorie._value, txtOrdner._value, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, txtMax._value) + If DT Is Nothing OrElse DT.Rows.Count = 0 Then Exit Sub + If MsgBox("Es werden '" & DT.Rows.Count & "' Einträge verschoben - fortfahren?", vbYesNoCancel) <> vbYes Then Exit Sub + + ProgressBar1.Minimum = 0 + ProgressBar1.Maximum = DT.Rows.Count + ProgressBar1.Value = 0 + + Dim erfolgreich As Integer = 0 + Dim fehler As Integer = 0 + + For Each ROW As DataRow In DT.Rows + Try Dim DS = New VERAG_PROG_ALLGEMEIN.cDATENSERVER(ROW("da_id")) + If DS.DATA_LIST.LIST.Count > 0 Then - DS.moveTo_ARCHIVARCHIV() - End If - ProgressBar1.PerformStep() - - Label1.Text = ProgressBar1.Value & "/" & DT.Rows.Count - - If DT.Rows.Count < 100 Then - Me.Refresh() - Else - If ProgressBar1.Value Mod 20 = 0 Then - Me.Refresh() + If DS.moveTo_ARCHIVARCHIV() Then + erfolgreich += 1 + Else + fehler += 1 End If End If - Next - End If + Catch ex2 As Exception + fehler += 1 + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex2.Message, "da_id: " & ROW("da_id").ToString() & vbNewLine & ex2.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name) + End Try + + ProgressBar1.Value += 1 + Label1.Text = ProgressBar1.Value & "/" & DT.Rows.Count & " | Fehler: " & fehler + + If DT.Rows.Count < 10 OrElse ProgressBar1.Value Mod 20 = 0 Then + Me.Refresh() + End If + Next + + MsgBox("Archivierung abgeschlossen." & vbNewLine & + "Erfolgreich: " & erfolgreich & vbNewLine & + "Fehler: " & fehler, vbInformation) Catch ex As Exception VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name) + Finally + Me.Cursor = Cursors.Default End Try - Me.Cursor = Cursors.Default + End Sub + + + + Private Sub frmDatenarchivarchiv_Load(sender As Object, e As EventArgs) Handles Me.Load + Dim monate As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem) + + For i As Integer = 1 To 12 + monate.Add(New VERAG_PROG_ALLGEMEIN.MyListItem(New Date(2000, i, 1).ToString("MMMM", New System.Globalization.CultureInfo("de-AT")), i.ToString())) + Next + + MyComboBox1.fillWithMyListItem(monate) + MyComboBox1._value = Date.Today.Month.ToString() + MyTextBox1._value = Date.Today.Year.ToString() + + UpdateZeitraum() + End Sub + + Private Sub MyComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles MyComboBox1.SelectedIndexChanged + UpdateZeitraum() + End Sub + + Private Sub MyTextBox1_TextChanged(sender As Object, e As EventArgs) Handles MyTextBox1.TextChanged + UpdateZeitraum() + End Sub + + Private Sub UpdateZeitraum() + Dim jahr As Integer + Dim monat As Integer + + If Not Integer.TryParse(MyTextBox1._value, jahr) Then Exit Sub + If Not Integer.TryParse(MyComboBox1._value, monat) Then Exit Sub + If jahr < 1 OrElse jahr > 9999 OrElse monat < 1 OrElse monat > 12 Then Exit Sub + + txtVon._value = New Date(jahr, monat, 1).ToString("dd.MM.yyyy") + txtBis._value = New Date(jahr, monat, Date.DaysInMonth(jahr, monat)).ToString("dd.MM.yyyy") End Sub End Class \ No newline at end of file From e2d177e09e51db05645b2ef3189f9024ac9aeb95 Mon Sep 17 00:00:00 2001 From: Andreas Luxbauer Date: Mon, 19 Oct 2026 07:57:29 +0200 Subject: [PATCH 2/3] DatenarchivArchiv, log --- .../frmDatenarchivarchiv.Designer.vb | 33 +++++- .../frmDatenarchivarchiv.vb | 103 ++++++++++++++---- 2 files changed, 108 insertions(+), 28 deletions(-) diff --git a/initATLASAufschubkonten/frmDatenarchivarchiv.Designer.vb b/initATLASAufschubkonten/frmDatenarchivarchiv.Designer.vb index ddbb006..9182d37 100644 --- a/initATLASAufschubkonten/frmDatenarchivarchiv.Designer.vb +++ b/initATLASAufschubkonten/frmDatenarchivarchiv.Designer.vb @@ -47,6 +47,8 @@ Partial Class frmDatenarchivarchiv Me.MyTextBox1 = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.Label11 = New System.Windows.Forms.Label() Me.Label12 = New System.Windows.Forms.Label() + Me.RichTextBox1 = New System.Windows.Forms.RichTextBox() + Me.Label13 = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'ProgressBar1 @@ -58,12 +60,12 @@ Partial Class frmDatenarchivarchiv ' 'Label1 ' - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(350, 177) + Me.Label1.Location = New System.Drawing.Point(528, 196) Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(24, 13) + Me.Label1.Size = New System.Drawing.Size(165, 55) Me.Label1.TabIndex = 1 Me.Label1.Text = "0/0" + Me.Label1.TextAlign = System.Drawing.ContentAlignment.BottomCenter ' 'Label2 ' @@ -131,7 +133,7 @@ Partial Class frmDatenarchivarchiv 'Button1 ' Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.Button1.Location = New System.Drawing.Point(278, 198) + Me.Button1.Location = New System.Drawing.Point(528, 259) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(165, 33) Me.Button1.TabIndex = 14 @@ -405,12 +407,31 @@ Partial Class frmDatenarchivarchiv Me.Label12.TabIndex = 21 Me.Label12.Text = "Monat:" ' + 'RichTextBox1 + ' + Me.RichTextBox1.Location = New System.Drawing.Point(29, 196) + Me.RichTextBox1.Name = "RichTextBox1" + Me.RichTextBox1.Size = New System.Drawing.Size(493, 96) + Me.RichTextBox1.TabIndex = 23 + Me.RichTextBox1.Text = "" + ' + 'Label13 + ' + Me.Label13.AutoSize = True + Me.Label13.Location = New System.Drawing.Point(26, 180) + Me.Label13.Name = "Label13" + Me.Label13.Size = New System.Drawing.Size(46, 13) + Me.Label13.TabIndex = 24 + Me.Label13.Text = "Errorlog:" + ' 'frmDatenarchivarchiv ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.BackColor = System.Drawing.Color.White - Me.ClientSize = New System.Drawing.Size(722, 239) + Me.ClientSize = New System.Drawing.Size(722, 304) + Me.Controls.Add(Me.Label13) + Me.Controls.Add(Me.RichTextBox1) Me.Controls.Add(Me.Label11) Me.Controls.Add(Me.Label12) Me.Controls.Add(Me.MyTextBox1) @@ -468,4 +489,6 @@ Partial Class frmDatenarchivarchiv Friend WithEvents MyTextBox1 As VERAG_PROG_ALLGEMEIN.MyTextBox Friend WithEvents Label11 As Label Friend WithEvents Label12 As Label + Friend WithEvents RichTextBox1 As RichTextBox + Friend WithEvents Label13 As Label End Class diff --git a/initATLASAufschubkonten/frmDatenarchivarchiv.vb b/initATLASAufschubkonten/frmDatenarchivarchiv.vb index f68f966..3fcd1a2 100644 --- a/initATLASAufschubkonten/frmDatenarchivarchiv.vb +++ b/initATLASAufschubkonten/frmDatenarchivarchiv.vb @@ -5,6 +5,8 @@ Public Class frmDatenarchivarchiv Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Me.Cursor = Cursors.WaitCursor @@ -17,44 +19,61 @@ Public Class frmDatenarchivarchiv If Not Date.TryParse(txtVon._value, datumVon) Then Exit Sub If Not Date.TryParse(txtBis._value, datumBis) Then Exit Sub If datumVon.Date > datumBis.Date Then Exit Sub + If datumBis.Date = Date.MaxValue.Date Then Exit Sub If String.IsNullOrWhiteSpace(txtKategorie.Text) Then Exit Sub If String.IsNullOrWhiteSpace(txtOrdner.Text) Then Exit Sub Dim sqlText As String = - "SELECT TOP (" & maxEintraege & ") da.da_id " & - "FROM tblDatenarchiv da " & - "WHERE da.da_vorlage = 0 " & - "AND da.da_kategorie = '" & txtKategorie.Text.Replace("'", "''") & "' " & - "AND da.da_ordner = '" & txtOrdner.Text.Replace("'", "''") & "' " & - "AND da.da_id >= 392150 " & - "AND EXISTS (" & - "SELECT 1 FROM tblDatenarchiv_Collection coll " & - "WHERE coll.coll_daId = da.da_id " & - "AND coll.coll_date >= '" & datumVon.ToString("yyyyMMdd") & "' " & - "AND coll.coll_date < '" & datumBis.AddDays(1).ToString("yyyyMMdd") & "' " & - "AND coll.coll_pfad NOT LIKE '%\\stor01.verag.ost.dmn\DatenArchivArchiv%' " & - "AND coll.coll_pfad NOT LIKE '\\DELETED\%' " & - ") ORDER BY da.da_id" + "SELECT TOP (" & maxEintraege & ") da.da_id " & + "FROM tblDatenarchiv da " & + "WHERE da.da_vorlage = 0 " & + "AND da.da_kategorie = '" & txtKategorie.Text.Replace("'", "''") & "' " & + "AND da.da_ordner = '" & txtOrdner.Text.Replace("'", "''") & "' " & + "AND da.da_id >= 392150 " & + "AND EXISTS (" & + "SELECT 1 FROM tblDatenarchiv_Collection coll " & + "WHERE coll.coll_daId = da.da_id " & + "AND coll.coll_date >= '" & datumVon.ToString("yyyyMMdd") & "' " & + "AND coll.coll_date < '" & datumBis.AddDays(1).ToString("yyyyMMdd") & "' " & + "AND coll.coll_pfad NOT LIKE '%\\stor01.verag.ost.dmn\DatenArchivArchiv%' " & + "AND coll.coll_pfad NOT LIKE '\\DELETED\%' " & + ") ORDER BY da.da_id" Dim DT = SQL.loadDgvBySql(sqlText, "FMZOLL") - If DT Is Nothing OrElse DT.Rows.Count = 0 Then Exit Sub + If DT Is Nothing OrElse DT.Rows.Count = 0 Then + MsgBox("Keine Einträge gefunden.", vbInformation) + Exit Sub + End If If MsgBox("Es werden '" & DT.Rows.Count & "' Einträge verschoben - fortfahren?", vbYesNoCancel) <> vbYes Then Exit Sub + Button1.Enabled = False + RichTextBox1.Clear() + ProgressBar1.Minimum = 0 ProgressBar1.Maximum = DT.Rows.Count ProgressBar1.Value = 0 Dim erfolgreich As Integer = 0 Dim fehler As Integer = 0 + Dim fehlerListe As New List(Of String) + Dim angezeigteFehler As Integer = 0 + + Dim logOrdner = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "AVISO", "ArchivMigration") + System.IO.Directory.CreateDirectory(logOrdner) + + Dim logPfad As String = System.IO.Path.Combine(logOrdner, "ArchivFehler_" & Date.Now.ToString("yyyyMMdd_HHmmss") & ".txt") + System.IO.File.WriteAllText(logPfad, "Archivmigration gestartet: " & Date.Now.ToString("dd.MM.yyyy HH:mm:ss") & Environment.NewLine & Environment.NewLine, System.Text.Encoding.UTF8) + + Dim sw As Stopwatch = Stopwatch.StartNew() For Each ROW As DataRow In DT.Rows Try Dim DS = New VERAG_PROG_ALLGEMEIN.cDATENSERVER(ROW("da_id")) If DS.DATA_LIST.LIST.Count > 0 Then - If DS.moveTo_ARCHIVARCHIV() Then + If DS.moveTo_ARCHIVARCHIV(fehlerListe, logPfad) Then erfolgreich += 1 Else fehler += 1 @@ -63,30 +82,68 @@ Public Class frmDatenarchivarchiv Catch ex2 As Exception fehler += 1 - VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex2.Message, "da_id: " & ROW("da_id").ToString() & vbNewLine & ex2.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name) + Dim eintrag = Date.Now.ToString("dd.MM.yyyy HH:mm:ss") & " | FEHLER | da_id=" & ROW("da_id").ToString() & " | " & ex2.Message + fehlerListe.Add(eintrag) + System.IO.File.AppendAllText(logPfad, eintrag & Environment.NewLine, System.Text.Encoding.UTF8) End Try - ProgressBar1.Value += 1 - Label1.Text = ProgressBar1.Value & "/" & DT.Rows.Count & " | Fehler: " & fehler + ' Neue Fehler laufend in RichTextBox1 anzeigen + If fehlerListe.Count > angezeigteFehler Then + For i As Integer = angezeigteFehler To fehlerListe.Count - 1 + RichTextBox1.AppendText(fehlerListe(i) & Environment.NewLine) + Next - If DT.Rows.Count < 10 OrElse ProgressBar1.Value Mod 20 = 0 Then - Me.Refresh() + angezeigteFehler = fehlerListe.Count + RichTextBox1.SelectionStart = RichTextBox1.TextLength + RichTextBox1.ScrollToCaret() + RichTextBox1.Refresh() End If + + ' Fortschritt und Statistik aktualisieren + ProgressBar1.Value += 1 + + Dim laufzeit As TimeSpan = sw.Elapsed + Dim dauer As String = String.Format("{0:00}:{1:00}:{2:00}", CInt(Math.Floor(laufzeit.TotalHours)), laufzeit.Minutes, laufzeit.Seconds) + + Label1.Text = ProgressBar1.Value & "/" & DT.Rows.Count & vbNewLine & + "Erfolgreich: " & erfolgreich & vbNewLine & + "Fehler: " & fehler & vbNewLine & + "Laufzeit: " & dauer + + ProgressBar1.Refresh() + Label1.Refresh() + + ' UI-Ereignisse verarbeiten, damit die Anzeige aktuell bleibt + Application.DoEvents() Next + sw.Stop() + + System.IO.File.AppendAllText(logPfad, Environment.NewLine & + "Archivmigration beendet: " & Date.Now.ToString("dd.MM.yyyy HH:mm:ss") & + " | Erfolgreich: " & erfolgreich & + " | Fehler: " & fehler & + " | Laufzeit: " & sw.Elapsed.ToString("hh\:mm\:ss") & + Environment.NewLine, System.Text.Encoding.UTF8) + MsgBox("Archivierung abgeschlossen." & vbNewLine & - "Erfolgreich: " & erfolgreich & vbNewLine & - "Fehler: " & fehler, vbInformation) + "Erfolgreich: " & erfolgreich & vbNewLine & + "Datensätze mit Fehlern: " & fehler & vbNewLine & + "Einzelne Fehler: " & fehlerListe.Count & vbNewLine & + "Laufzeit: " & sw.Elapsed.ToString("hh\:mm\:ss") & vbNewLine & vbNewLine & + "Fehlerprotokoll: " & logPfad, vbInformation) Catch ex As Exception VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name) Finally + Button1.Enabled = True Me.Cursor = Cursors.Default End Try End Sub + Private Sub frmDatenarchivarchiv_Load(sender As Object, e As EventArgs) Handles Me.Load Dim monate As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem) From 40b993b0e6e15909293424e63a617d683c54008c Mon Sep 17 00:00:00 2001 From: Andreas Luxbauer Date: Mon, 19 Oct 2026 14:40:48 +0200 Subject: [PATCH 3/3] division3 --- DAKOSY_Worker/DAKOSY/ATLAS/NCTS/cDakosyNCTSOut004.vb | 2 +- initATLASAufschubkonten/frmStartOptions.vb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DAKOSY_Worker/DAKOSY/ATLAS/NCTS/cDakosyNCTSOut004.vb b/DAKOSY_Worker/DAKOSY/ATLAS/NCTS/cDakosyNCTSOut004.vb index 1420a48..c2f53df 100644 --- a/DAKOSY_Worker/DAKOSY/ATLAS/NCTS/cDakosyNCTSOut004.vb +++ b/DAKOSY_Worker/DAKOSY/ATLAS/NCTS/cDakosyNCTSOut004.vb @@ -1619,7 +1619,7 @@ Public Class cDakosyNCTSOut004 XML.Transaktion.IOPartner = cDakosyFunftions.getIOPartner(cDY.ncts_firma, Art) 'If(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "VERA", "VERG") XML.Transaktion.IODatumZeit = Now XML.Transaktion.IOReferenz = cDY.ncts_Trans_Referenz - 'If Not VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then XML.Transaktion.IODivision3 = cDakosyFunftions.getDivision(cDY.ncts_firma, Art) '"SUW" + If Not VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then XML.Transaktion.IODivision3 = cDakosyFunftions.getDivision(cDY.ncts_firma, Art) '"SUW" XML.Transaktion.Version = Interface_VERSION ' XML.Transaktion.IODivision3 = "DUR" XML.EinzelVersandanmeldung = New VersandanmeldungNCTSDE_004.EinzelVersandanmeldungTyp diff --git a/initATLASAufschubkonten/frmStartOptions.vb b/initATLASAufschubkonten/frmStartOptions.vb index 8ef7468..c4c7ec0 100644 --- a/initATLASAufschubkonten/frmStartOptions.vb +++ b/initATLASAufschubkonten/frmStartOptions.vb @@ -4850,8 +4850,11 @@ Public Class frmStartOptions showPic(importEZOLLWechselkurse(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, 2, 2), PictureBox24) End Sub Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click + Me.Visible = False Dim f As New frmDatenarchivarchiv f.ShowDialog() + Me.Visible = True + End Sub Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click