kontobeühren (feature), etc.

This commit is contained in:
2026-10-13 09:59:56 +02:00
parent 99d6392b80
commit 7d0c61b9b1
13 changed files with 1343 additions and 85 deletions

View File

@@ -156,7 +156,22 @@ Partial Class usrCntlBH
Me.Label29 = New System.Windows.Forms.Label()
Me.Button7 = New System.Windows.Forms.Button()
Me.TabPage2 = New System.Windows.Forms.TabPage()
Me.GroupBox15 = New System.Windows.Forms.GroupBox()
Me.Label72 = New System.Windows.Forms.Label()
Me.cbxBankspesentyp = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Button19 = New System.Windows.Forms.Button()
Me.Button18 = New System.Windows.Forms.Button()
Me.txtnichtabgerechneteKundenBankspesen = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.btnDelBankspesen = New VERAG_PROG_ALLGEMEIN.FlatButton()
Me.Label70 = New System.Windows.Forms.Label()
Me.txtBankspesen = New System.Windows.Forms.TextBox()
Me.btnImport = New System.Windows.Forms.Button()
Me.Label69 = New System.Windows.Forms.Label()
Me.pb_bankspesen = New System.Windows.Forms.ProgressBar()
Me.lblBankspesen = New System.Windows.Forms.Label()
Me.Label68 = New System.Windows.Forms.Label()
Me.GroupBox14 = New System.Windows.Forms.GroupBox()
Me.Button17 = New System.Windows.Forms.Button()
Me.Label63 = New System.Windows.Forms.Label()
Me.Label66 = New System.Windows.Forms.Label()
Me.txtLand = New VERAG_PROG_ALLGEMEIN.MyTextBox()
@@ -169,6 +184,7 @@ Partial Class usrCntlBH
Me.btn_Erloeskkonten = New System.Windows.Forms.Button()
Me.Label62 = New System.Windows.Forms.Label()
Me.GroupBox11 = New System.Windows.Forms.GroupBox()
Me.cbxPOSBNZerstellen = New System.Windows.Forms.CheckBox()
Me.txtPloseAnh_Einarbeitung = New System.Windows.Forms.TextBox()
Me.Label71 = New System.Windows.Forms.Label()
Me.pbPloseAnh_Proz = New System.Windows.Forms.ProgressBar()
@@ -198,8 +214,6 @@ Partial Class usrCntlBH
Me.txtZRbis = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Label51 = New System.Windows.Forms.Label()
Me.txtJahr_FIBU = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Button17 = New System.Windows.Forms.Button()
Me.cbxPOSBNZerstellen = New System.Windows.Forms.CheckBox()
Me.pnl.SuspendLayout()
Me.TabPage1.SuspendLayout()
Me.GroupBox13.SuspendLayout()
@@ -220,6 +234,7 @@ Partial Class usrCntlBH
Me.GroupBox9.SuspendLayout()
Me.GroupBox6.SuspendLayout()
Me.TabPage2.SuspendLayout()
Me.GroupBox15.SuspendLayout()
Me.GroupBox14.SuspendLayout()
Me.GroupBox11.SuspendLayout()
Me.SuspendLayout()
@@ -1977,6 +1992,8 @@ Partial Class usrCntlBH
'
'TabPage2
'
Me.TabPage2.Controls.Add(Me.GroupBox15)
Me.TabPage2.Controls.Add(Me.Label68)
Me.TabPage2.Controls.Add(Me.GroupBox14)
Me.TabPage2.Controls.Add(Me.Label62)
Me.TabPage2.Controls.Add(Me.GroupBox11)
@@ -1989,6 +2006,182 @@ Partial Class usrCntlBH
Me.TabPage2.Text = "MDM"
Me.TabPage2.UseVisualStyleBackColor = True
'
'GroupBox15
'
Me.GroupBox15.Controls.Add(Me.Label72)
Me.GroupBox15.Controls.Add(Me.cbxBankspesentyp)
Me.GroupBox15.Controls.Add(Me.Button19)
Me.GroupBox15.Controls.Add(Me.Button18)
Me.GroupBox15.Controls.Add(Me.txtnichtabgerechneteKundenBankspesen)
Me.GroupBox15.Controls.Add(Me.btnDelBankspesen)
Me.GroupBox15.Controls.Add(Me.Label70)
Me.GroupBox15.Controls.Add(Me.txtBankspesen)
Me.GroupBox15.Controls.Add(Me.btnImport)
Me.GroupBox15.Controls.Add(Me.Label69)
Me.GroupBox15.Controls.Add(Me.pb_bankspesen)
Me.GroupBox15.Controls.Add(Me.lblBankspesen)
Me.GroupBox15.Location = New System.Drawing.Point(20, 216)
Me.GroupBox15.Name = "GroupBox15"
Me.GroupBox15.Size = New System.Drawing.Size(265, 155)
Me.GroupBox15.TabIndex = 78
Me.GroupBox15.TabStop = False
'
'Label72
'
Me.Label72.AutoSize = True
Me.Label72.Location = New System.Drawing.Point(7, 13)
Me.Label72.Name = "Label72"
Me.Label72.Size = New System.Drawing.Size(28, 13)
Me.Label72.TabIndex = 87
Me.Label72.Text = "Typ:"
'
'cbxBankspesentyp
'
Me.cbxBankspesentyp._allowedValuesFreiText = Nothing
Me.cbxBankspesentyp._allowFreiText = False
Me.cbxBankspesentyp._value = ""
Me.cbxBankspesentyp.FormattingEnabled = True
Me.cbxBankspesentyp.Location = New System.Drawing.Point(50, 10)
Me.cbxBankspesentyp.Name = "cbxBankspesentyp"
Me.cbxBankspesentyp.Size = New System.Drawing.Size(76, 21)
Me.cbxBankspesentyp.TabIndex = 86
'
'Button19
'
Me.Button19.BackgroundImage = Global.SDL.My.Resources.Resources.fragezeichen
Me.Button19.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.Button19.FlatAppearance.BorderSize = 0
Me.Button19.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button19.Location = New System.Drawing.Point(240, 13)
Me.Button19.Name = "Button19"
Me.Button19.Size = New System.Drawing.Size(25, 20)
Me.Button19.TabIndex = 82
Me.Button19.UseVisualStyleBackColor = True
'
'Button18
'
Me.Button18.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.Button18.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button18.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(54, Byte), Integer), CType(CType(128, Byte), Integer))
Me.Button18.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button18.Location = New System.Drawing.Point(105, 40)
Me.Button18.Name = "Button18"
Me.Button18.Size = New System.Drawing.Size(78, 29)
Me.Button18.TabIndex = 82
Me.Button18.Text = "Übersicht"
Me.Button18.UseVisualStyleBackColor = True
'
'txtnichtabgerechneteKundenBankspesen
'
Me.txtnichtabgerechneteKundenBankspesen._DateTimeOnly = False
Me.txtnichtabgerechneteKundenBankspesen._numbersOnly = False
Me.txtnichtabgerechneteKundenBankspesen._numbersOnlyKommastellen = ""
Me.txtnichtabgerechneteKundenBankspesen._numbersOnlyTrennzeichen = True
Me.txtnichtabgerechneteKundenBankspesen._Prozent = False
Me.txtnichtabgerechneteKundenBankspesen._ShortDateNew = False
Me.txtnichtabgerechneteKundenBankspesen._ShortDateOnly = False
Me.txtnichtabgerechneteKundenBankspesen._TimeOnly = False
Me.txtnichtabgerechneteKundenBankspesen._TimeOnly_Seconds = False
Me.txtnichtabgerechneteKundenBankspesen._value = "0"
Me.txtnichtabgerechneteKundenBankspesen._Waehrung = False
Me.txtnichtabgerechneteKundenBankspesen._WaehrungZeichen = True
Me.txtnichtabgerechneteKundenBankspesen.ForeColor = System.Drawing.Color.Black
Me.txtnichtabgerechneteKundenBankspesen.Location = New System.Drawing.Point(149, 75)
Me.txtnichtabgerechneteKundenBankspesen.MaxLineLength = -1
Me.txtnichtabgerechneteKundenBankspesen.MaxLines_Warning = ""
Me.txtnichtabgerechneteKundenBankspesen.MaxLines_Warning_Label = Nothing
Me.txtnichtabgerechneteKundenBankspesen.Name = "txtnichtabgerechneteKundenBankspesen"
Me.txtnichtabgerechneteKundenBankspesen.ReadOnly = True
Me.txtnichtabgerechneteKundenBankspesen.Size = New System.Drawing.Size(34, 20)
Me.txtnichtabgerechneteKundenBankspesen.TabIndex = 83
Me.txtnichtabgerechneteKundenBankspesen.Text = "0"
Me.txtnichtabgerechneteKundenBankspesen.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'btnDelBankspesen
'
Me.btnDelBankspesen.allowBorder = False
Me.btnDelBankspesen.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnDelBankspesen.BackgroundImage = Global.SDL.My.Resources.Resources.del
Me.btnDelBankspesen.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.btnDelBankspesen.FlatAppearance.BorderSize = 0
Me.btnDelBankspesen.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnDelBankspesen.ForeColor = System.Drawing.Color.Black
Me.btnDelBankspesen.Location = New System.Drawing.Point(227, 72)
Me.btnDelBankspesen.Name = "btnDelBankspesen"
Me.btnDelBankspesen.Size = New System.Drawing.Size(20, 20)
Me.btnDelBankspesen.TabIndex = 82
Me.btnDelBankspesen.UseVisualStyleBackColor = True
Me.btnDelBankspesen.Visible = False
'
'Label70
'
Me.Label70.AutoSize = True
Me.Label70.Location = New System.Drawing.Point(5, 78)
Me.Label70.Name = "Label70"
Me.Label70.Size = New System.Drawing.Size(144, 13)
Me.Label70.TabIndex = 82
Me.Label70.Text = "Nicht abgerechnete Kunden:"
'
'txtBankspesen
'
Me.txtBankspesen.BackColor = System.Drawing.Color.White
Me.txtBankspesen.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.txtBankspesen.Location = New System.Drawing.Point(70, 128)
Me.txtBankspesen.Name = "txtBankspesen"
Me.txtBankspesen.Size = New System.Drawing.Size(106, 13)
Me.txtBankspesen.TabIndex = 85
'
'btnImport
'
Me.btnImport.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.btnImport.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnImport.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(54, Byte), Integer), CType(CType(128, Byte), Integer))
Me.btnImport.Image = Global.SDL.My.Resources.Resources.Excel_logo
Me.btnImport.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnImport.Location = New System.Drawing.Point(11, 40)
Me.btnImport.Name = "btnImport"
Me.btnImport.Size = New System.Drawing.Size(88, 29)
Me.btnImport.TabIndex = 82
Me.btnImport.Text = "Import"
Me.btnImport.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnImport.UseVisualStyleBackColor = True
'
'Label69
'
Me.Label69.AutoSize = True
Me.Label69.Location = New System.Drawing.Point(3, 126)
Me.Label69.Name = "Label69"
Me.Label69.Size = New System.Drawing.Size(56, 13)
Me.Label69.TabIndex = 82
Me.Label69.Text = "Fortschritt:"
'
'pb_bankspesen
'
Me.pb_bankspesen.Location = New System.Drawing.Point(6, 99)
Me.pb_bankspesen.Name = "pb_bankspesen"
Me.pb_bankspesen.Size = New System.Drawing.Size(245, 23)
Me.pb_bankspesen.TabIndex = 83
'
'lblBankspesen
'
Me.lblBankspesen.Location = New System.Drawing.Point(182, 128)
Me.lblBankspesen.Name = "lblBankspesen"
Me.lblBankspesen.Size = New System.Drawing.Size(69, 13)
Me.lblBankspesen.TabIndex = 84
Me.lblBankspesen.Text = "0%"
Me.lblBankspesen.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'Label68
'
Me.Label68.AutoSize = True
Me.Label68.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label68.ForeColor = System.Drawing.SystemColors.ControlDarkDark
Me.Label68.Location = New System.Drawing.Point(11, 196)
Me.Label68.Name = "Label68"
Me.Label68.Size = New System.Drawing.Size(183, 17)
Me.Label68.TabIndex = 77
Me.Label68.Text = "Kontoführungsgebühren"
'
'GroupBox14
'
Me.GroupBox14.Controls.Add(Me.Button17)
@@ -2002,12 +2195,24 @@ Partial Class usrCntlBH
Me.GroupBox14.Controls.Add(Me.btn_ZV)
Me.GroupBox14.Controls.Add(Me.btn_Laender)
Me.GroupBox14.Controls.Add(Me.btn_Erloeskkonten)
Me.GroupBox14.Location = New System.Drawing.Point(14, 227)
Me.GroupBox14.Location = New System.Drawing.Point(14, 397)
Me.GroupBox14.Name = "GroupBox14"
Me.GroupBox14.Size = New System.Drawing.Size(841, 123)
Me.GroupBox14.TabIndex = 38
Me.GroupBox14.TabStop = False
'
'Button17
'
Me.Button17.BackgroundImage = Global.SDL.My.Resources.Resources.fragezeichen
Me.Button17.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.Button17.FlatAppearance.BorderSize = 0
Me.Button17.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button17.Location = New System.Drawing.Point(816, 19)
Me.Button17.Name = "Button17"
Me.Button17.Size = New System.Drawing.Size(25, 20)
Me.Button17.TabIndex = 81
Me.Button17.UseVisualStyleBackColor = True
'
'Label63
'
Me.Label63.AutoSize = True
@@ -2158,7 +2363,7 @@ Partial Class usrCntlBH
Me.Label62.AutoSize = True
Me.Label62.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label62.ForeColor = System.Drawing.SystemColors.ControlDarkDark
Me.Label62.Location = New System.Drawing.Point(11, 207)
Me.Label62.Location = New System.Drawing.Point(11, 377)
Me.Label62.Name = "Label62"
Me.Label62.Size = New System.Drawing.Size(145, 17)
Me.Label62.TabIndex = 37
@@ -2200,6 +2405,18 @@ Partial Class usrCntlBH
Me.GroupBox11.TabIndex = 36
Me.GroupBox11.TabStop = False
'
'cbxPOSBNZerstellen
'
Me.cbxPOSBNZerstellen.AutoSize = True
Me.cbxPOSBNZerstellen.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cbxPOSBNZerstellen.Location = New System.Drawing.Point(524, 90)
Me.cbxPOSBNZerstellen.Name = "cbxPOSBNZerstellen"
Me.cbxPOSBNZerstellen.Size = New System.Drawing.Size(115, 17)
Me.cbxPOSBNZerstellen.TabIndex = 81
Me.cbxPOSBNZerstellen.Text = "POS-BNZ erstellen"
Me.cbxPOSBNZerstellen.UseVisualStyleBackColor = True
Me.cbxPOSBNZerstellen.Visible = False
'
'txtPloseAnh_Einarbeitung
'
Me.txtPloseAnh_Einarbeitung.BackColor = System.Drawing.Color.White
@@ -2615,7 +2832,7 @@ Partial Class usrCntlBH
Me.txtJahr_FIBU._Waehrung = False
Me.txtJahr_FIBU._WaehrungZeichen = True
Me.txtJahr_FIBU.ForeColor = System.Drawing.Color.Black
Me.txtJahr_FIBU.Location = New System.Drawing.Point(169, 207)
Me.txtJahr_FIBU.Location = New System.Drawing.Point(169, 377)
Me.txtJahr_FIBU.MaxLineLength = -1
Me.txtJahr_FIBU.MaxLines_Warning = ""
Me.txtJahr_FIBU.MaxLines_Warning_Label = Nothing
@@ -2624,30 +2841,6 @@ Partial Class usrCntlBH
Me.txtJahr_FIBU.TabIndex = 76
Me.txtJahr_FIBU.Text = "0"
'
'Button17
'
Me.Button17.BackgroundImage = Global.SDL.My.Resources.Resources.fragezeichen
Me.Button17.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.Button17.FlatAppearance.BorderSize = 0
Me.Button17.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button17.Location = New System.Drawing.Point(816, 19)
Me.Button17.Name = "Button17"
Me.Button17.Size = New System.Drawing.Size(25, 20)
Me.Button17.TabIndex = 81
Me.Button17.UseVisualStyleBackColor = True
'
'cbxPOSBNZerstellen
'
Me.cbxPOSBNZerstellen.AutoSize = True
Me.cbxPOSBNZerstellen.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cbxPOSBNZerstellen.Location = New System.Drawing.Point(524, 90)
Me.cbxPOSBNZerstellen.Name = "cbxPOSBNZerstellen"
Me.cbxPOSBNZerstellen.Size = New System.Drawing.Size(115, 17)
Me.cbxPOSBNZerstellen.TabIndex = 81
Me.cbxPOSBNZerstellen.Text = "POS-BNZ erstellen"
Me.cbxPOSBNZerstellen.UseVisualStyleBackColor = True
Me.cbxPOSBNZerstellen.Visible = False
'
'usrCntlBH
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -2695,6 +2888,8 @@ Partial Class usrCntlBH
Me.GroupBox6.PerformLayout()
Me.TabPage2.ResumeLayout(False)
Me.TabPage2.PerformLayout()
Me.GroupBox15.ResumeLayout(False)
Me.GroupBox15.PerformLayout()
Me.GroupBox14.ResumeLayout(False)
Me.GroupBox14.PerformLayout()
Me.GroupBox11.ResumeLayout(False)
@@ -2880,4 +3075,18 @@ Partial Class usrCntlBH
Friend WithEvents lblPloseAnh_Proz As Label
Friend WithEvents Button17 As Button
Friend WithEvents cbxPOSBNZerstellen As CheckBox
Friend WithEvents GroupBox15 As GroupBox
Friend WithEvents btnImport As Button
Friend WithEvents Label68 As Label
Friend WithEvents txtBankspesen As TextBox
Friend WithEvents Label69 As Label
Friend WithEvents pb_bankspesen As ProgressBar
Friend WithEvents lblBankspesen As Label
Friend WithEvents Button19 As Button
Friend WithEvents Button18 As Button
Friend WithEvents txtnichtabgerechneteKundenBankspesen As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents btnDelBankspesen As VERAG_PROG_ALLGEMEIN.FlatButton
Friend WithEvents Label70 As Label
Friend WithEvents Label72 As Label
Friend WithEvents cbxBankspesentyp As VERAG_PROG_ALLGEMEIN.MyComboBox
End Class

View File

@@ -1,10 +1,8 @@
Imports System.Globalization

Imports System.Globalization
Imports System.Text
Imports System.Web.UI.WebControls.Expressions
Imports ClosedXML.Excel
Imports com.sun.xml.internal.rngom
Imports VERAG_PROG_ALLGEMEIN
Imports VERAG_PROG_ALLGEMEIN.TESTJSON
Public Class usrCntlBH
Dim GrenzeVersicherung = 50000
@@ -84,6 +82,11 @@ Public Class usrCntlBH
btnDel_.Visible = False
End If
cbxBankspesentyp.Items.Add(New MyListItem("QUARTAL", "Q"))
cbxBankspesentyp.Items.Add(New MyListItem("MONATLICH", "M"))
setnichtAbgerechnteBankspesen()
Else
End If
@@ -618,7 +621,7 @@ Public Class usrCntlBH
If fd.ShowDialog = DialogResult.OK Then
If fd.FileName.ToUpper.EndsWith(".CSV") Then
Dim Lines As String() = My.Computer.FileSystem.ReadAllText(fd.FileName, System.Text.Encoding.Default).Split(vbCr)
Dim Lines As String() = My.Computer.FileSystem.ReadAllText(fd.FileName, System.Text.Encoding.Default).split(vbCr)
Dim LineCount As Integer = Lines.Length
' fd.FileName.EndsWith(".csv")
@@ -1345,7 +1348,7 @@ Public Class usrCntlBH
Private Sub Button13_Click_1(sender As Object, e As EventArgs) Handles Button13.Click
Dim frm As New frmZinsnachberechnung("tblMDM_Zinsberechnung", "FMZOLL")
Dim frm As New frmZinsnachberechnung("tblMDM_Zinsberechnung", "FMZOLL", "")
frm.ShowDialog(Me)
End Sub
@@ -2201,4 +2204,439 @@ Public Class usrCntlBH
Private Sub Button18_Click(sender As Object, e As EventArgs)
End Sub
Private Sub btnImport_Click(sender As Object, e As EventArgs) Handles btnImport.Click
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Try
If cbxBankspesentyp._value = "" Then
MsgBox("Typ auswählen!")
cbxBankspesentyp.Focus()
Exit Sub
End If
Dim importiert As Boolean = False
Dim fd As New OpenFileDialog
fd.InitialDirectory = "\\share01.verag.ost.dmn\F\19 VERAG 360 - MDM\Buchhaltung MDM\Bank\Subkonten"
fd.Filter = "Excel Dateien (*.csv)|*.csv"
If fd.ShowDialog() <> DialogResult.OK Then Exit Sub
If Not fd.FileName.ToUpper().EndsWith(".CSV") Then
MessageBox.Show("Bitte eine CSV-Datei auswählen.")
Exit Sub
End If
Dim exclApp As Object = Nothing
Dim Datei As Object = Nothing
Dim Blatt As Object = Nothing
Dim dt As New DataTable
Dim visibleKdNrCheck As Boolean = False
Dim missingKdNr As Integer = 0
If dt IsNot Nothing And Not dt.Columns.Contains("name") Then
dt.Columns.Add("Umsatz-ID", GetType(String))
dt.Columns.Add("Datum", GetType(String))
dt.Columns.Add("IBAN", GetType(String))
dt.Columns.Add("BIC", GetType(String))
dt.Columns.Add("Buchungstext", GetType(String))
dt.Columns.Add("Währung", GetType(String))
dt.Columns.Add("Betrag", GetType(Double))
dt.Columns.Add("Gebühr", GetType(Double))
dt.Columns.Add("Kontoauszug", GetType(String))
dt.Columns.Add("KdNr", GetType(Integer))
dt.Columns.Add("KdNrCheck", GetType(String))
dt.Columns.Add("KdNrValid", GetType(Boolean))
End If
Try
exclApp = CreateObject("Excel.Application")
exclApp.DisplayAlerts = False
exclApp.CutCopyMode = False
'Try to open exclusively
Datei = exclApp.Workbooks.Open(Filename:=fd.FileName, ReadOnly:=False, IgnoreReadOnlyRecommended:=True, Notify:=False)
If Datei.ReadOnly Then
MessageBox.Show("Die Datei wird bereits von einem anderen Benutzer oder einer anderen Excel-Instanz verwendet, bitte Datei vor dem Import schließen!")
Exit Sub
End If
Blatt = Datei.Worksheets(1)
' Header einlesen
Dim headerMap As New Dictionary(Of String, Integer)(StringComparer.OrdinalIgnoreCase)
For col As Integer = 1 To Blatt.UsedRange.Columns.Count
Dim header As String = Convert.ToString(Blatt.Cells(1, col).Value).Trim()
If header <> "" AndAlso Not headerMap.ContainsKey(header) Then
headerMap.Add(header, col)
End If
Next
' Pflichtspalten prüfen
Dim requiredHeaders As String() = {
"Umsatz-ID",
"Datum",
"IBAN",
"BIC",
"Buchungstext",
"Währung",
"Betrag",
"Kontoauszug"
}
For Each h As String In requiredHeaders
If Not headerMap.ContainsKey(h) Then
MsgBox("Pflichtspalte nicht gefunden: " & h)
Exit Sub
End If
Next
If headerMap.ContainsKey("KDNR") Then
visibleKdNrCheck = True
End If
Dim letzteZeile As Integer = Blatt.UsedRange.Rows.Count
For row As Integer = 2 To letzteZeile
Dim Umsatz_ID As String =
Convert.ToString(Blatt.Cells(row, headerMap("Umsatz-ID")).Value)
Dim Datum As String =
Convert.ToString(Blatt.Cells(row, headerMap("Datum")).Value)
Dim IBAN As String =
Convert.ToString(Blatt.Cells(row, headerMap("IBAN")).Value)
Dim BIC As String =
Convert.ToString(Blatt.Cells(row, headerMap("BIC")).Value)
Dim Buchungstext As String =
Convert.ToString(Blatt.Cells(row, headerMap("Buchungstext")).Value)
Dim Währung As String =
Convert.ToString(Blatt.Cells(row, headerMap("Währung")).Value)
Dim Kontoauszug As String =
Convert.ToString(Blatt.Cells(row, headerMap("Kontoauszug")).Value)
Dim Betrag As Double =
Convert.ToDouble(Blatt.Cells(row, headerMap("Betrag")).Value)
Dim KundenNrCheck As String = ""
If headerMap.ContainsKey("KDNR") Then
KundenNrCheck = Convert.ToString(Blatt.Cells(row, headerMap("KDNR")).Value)
End If
If String.IsNullOrWhiteSpace(Umsatz_ID) Then
Continue For
End If
If IsNumeric(Umsatz_ID) AndAlso IsNumeric(Betrag) AndAlso Not String.IsNullOrWhiteSpace(Kontoauszug) Then
Dim R As DataRow = dt.NewRow
R("Umsatz-ID") = Umsatz_ID
R("Datum") = Datum
R("IBAN") = IBAN
R("BIC") = BIC
R("Buchungstext") = Buchungstext
R("Währung") = Währung
R("Betrag") = Betrag
R("Kontoauszug") = Kontoauszug
Dim BuchungstextOnlyNr As String = System.Text.RegularExpressions.Regex.Replace(Buchungstext, "[^0-9]", "")
Dim KundeNr = CInt(sql.DLookup("bnk_KundenNr", "tblBankverbindungen", "bnk_iban like '%" & BuchungstextOnlyNr & "%' and isnull(bnk_archiv,0) = 0", "FMZOLL", "-1"))
R("KdNr") = KundeNr
If visibleKdNrCheck Then
R("KdNrCheck") = KundenNrCheck
If KundenNrCheck <> "" AndAlso IsNumeric(KundenNrCheck) Then
If CInt(KundenNrCheck) = KundeNr Then
R("KdNrValid") = True
Else
R("KdNrValid") = False
End If
End If
End If
If KundeNr = -1 Then
missingKdNr += 1
End If
'Betrag laut folgendem Schema berechnen:
Betrag = Betrag * -1
Betrag = Betrag + 1
Dim aufgerundet As Double = Math.Ceiling(Betrag / 5) * 5
R("Gebühr") = aufgerundet
dt.Rows.Add(R)
Else
Continue For
End If
Next
If dt.Rows.Count > 0 Then
Using frm As New frmAbrechnungHandling(dt, Nothing, "Import " & dt.Rows.Count & " Buchungsdaten " & cbxBankspesentyp.SelectedItem.Text & IIf(missingKdNr > 0, missingKdNr & " Kundenkonten konnten nicht gefunden werden!", ""))
With frm
.btnPreisliste.Visible = False
.dgvHandling.RowHeadersVisible = False
.Button2.Text = "Importieren"
'.cbxDivers.Visible = True
'.cbxDivers.Text = "VZ und RZ-Beträge im Antrag erhöhen"
End With
frm.ShowDialog()
If frm.DialogResult = DialogResult.OK Then
Dim counter = 0
Dim dateTemp
For Each r As DataGridViewRow In frm.dgvHandling.SelectedRows
Dim Datum = r.Cells("Datum").Value
Dim TYP = cbxBankspesentyp._value
Dim KdNr = r.Cells("KdNr").Value
dateTemp = Datum
If KdNr > 0 Then
Dim Bankspesen = New VERAG_PROG_ALLGEMEIN.cMDM_Bankspesen(KdNr, Datum, TYP)
If Not Bankspesen.hasEntry Then
Bankspesen.IBAN = r.Cells("IBAN").Value
Bankspesen.BIC = r.Cells("BIC").Value
Bankspesen.umsatzID = r.Cells("Umsatz-ID").Value
Bankspesen.buchungstext = r.Cells("Buchungstext").Value
Bankspesen.waehrung = r.Cells("Währung").Value
Bankspesen.betrag = r.Cells("Betrag").Value
Bankspesen.gebuehr = r.Cells("Gebühr").Value
Bankspesen.kontoauszug = r.Cells("Kontoauszug").Value
If Bankspesen.SAVE() Then
counter += 1
End If
txtBankspesen.Text = counter & " / " & frm.dgvHandling.SelectedRows.Count
End If
End If
Next
Dim MDMEinarb As New cMDMEinarbeitung("BANK", Now())
MDMEinarb.invoicedate = CDate(dateTemp)
MDMEinarb.import_date = Now()
MDMEinarb.importfilename = fd.FileName
MDMEinarb.ds_count += counter
MDMEinarb.ds_total += frm.dgvHandling.SelectedRows.Count
MDMEinarb.completed = 1
MDMEinarb.completed_date = Now()
MDMEinarb.SAVE()
importiert = True
MsgBox(counter & " von " & dt.Rows.Count & " erfolgreich importiert!")
pb_bankspesen.Value = 100
txtBankspesen.Text = frm.dgvHandling.SelectedRows.Count & " / " & frm.dgvHandling.SelectedRows.Count
lblBankspesen.Text = "100.00 %"
End If
End Using
Else
MsgBox("keine zu importierende Daten vorhanden!")
Exit Sub
End If
Finally
If Datei IsNot Nothing Then
Datei.Close(False)
End If
If exclApp IsNot Nothing Then
exclApp.Quit()
End If
If Blatt IsNot Nothing Then
Runtime.InteropServices.Marshal.ReleaseComObject(Blatt)
End If
If Datei IsNot Nothing Then
Runtime.InteropServices.Marshal.ReleaseComObject(Datei)
End If
If exclApp IsNot Nothing Then
Runtime.InteropServices.Marshal.ReleaseComObject(exclApp)
End If
Blatt = Nothing
Datei = Nothing
exclApp = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
If importiert Then
Dim zielOrdner As String = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(fd.FileName), "Importiert")
If Not System.IO.Directory.Exists(zielOrdner) Then
System.IO.Directory.CreateDirectory(zielOrdner)
End If
Dim zielDatei As String = System.IO.Path.Combine(zielOrdner, System.IO.Path.GetFileName(fd.FileName))
'Falls bereits vorhanden, überschreiben
If System.IO.File.Exists(zielDatei) Then
System.IO.File.Delete(zielDatei)
End If
System.IO.File.Move(fd.FileName, zielDatei)
End If
End Try
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Me.Refresh()
End Sub
Function getTrimedString(s As String, l As Integer) As String
Try
If s Is Nothing Then Return ""
If s.ToString.Length > l Then
Return s.Substring(0, l)
End If
Return s.ToString
Catch ex As Exception
MsgBox("getTrimedString: " & ex.Message & ex.StackTrace)
End Try
Return ""
End Function
Private Sub Button18_Click_1(sender As Object, e As EventArgs) Handles Button18.Click
Dim where As String = ""
If cbxBankspesentyp._value <> "" Then
where = " AND typ = '" & cbxBankspesentyp._value & "'"
End If
Dim frm As New frmZinsnachberechnung("tblMDM_Bankspesen", "FMZOLL", where)
frm.ShowDialog(Me)
End Sub
Private Sub btnDelBankspesen_Click(sender As Object, e As EventArgs) Handles btnDelBankspesen.Click
If cbxBankspesentyp._value <> "" Then
If vbYes = MsgBox("Möchten Sie die alle nicht abgerechneten Kontoführungsgebühren (" & cbxBankspesentyp.SelectedItem.Text & ") löschen?", vbYesNoCancel) Then
If SQL.doSQL("delete from [tblMDM_Bankspesen] WHERE [verrechnet] Is null and typ = '" & cbxBankspesentyp._value & "'", "FMZOLL") Then
txtnichtabgerechneteKundenBankspesen.Text = SQL.getValueTxtBySql("SELECT count(distinct(kundenNr)) FROM [VERAG].[dbo].[tblMDM_Bankspesen] where verrechnet is null and typ = '" & cbxBankspesentyp._value & "'", "FMZOLL",,, "0")
End If
End If
End If
End Sub
Private Sub setnichtAbgerechnteBankspesen()
If cbxBankspesentyp._value <> "" Then
txtnichtabgerechneteKundenBankspesen.Text = SQL.getValueTxtBySql("SELECT count(distinct(kundenNr)) FROM [VERAG].[dbo].[tblMDM_Bankspesen] where verrechnet is null and typ = '" & cbxBankspesentyp._value & "'", "FMZOLL",,, "0")
Else
txtnichtabgerechneteKundenBankspesen.Text = 0
End If
If IsNumeric(txtnichtabgerechneteKundenBankspesen.Text) AndAlso CInt(txtnichtabgerechneteKundenBankspesen.Text) > 0 Then
btnDelBankspesen.Visible = True
Else
btnDelBankspesen.Visible = False
End If
End Sub
Private Sub cbxBankspesentyp_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxBankspesentyp.SelectedIndexChanged
setnichtAbgerechnteBankspesen()
End Sub
Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
End Sub
End Class