diff --git a/SDL/Administration/frmZinsnachberechnung.vb b/SDL/Administration/frmZinsnachberechnung.vb index c0eb1ed4..f1c36bb4 100644 --- a/SDL/Administration/frmZinsnachberechnung.vb +++ b/SDL/Administration/frmZinsnachberechnung.vb @@ -2,9 +2,11 @@ Dim KASSENBind As cEasyBinding Public table Public BIND_DB - Sub New(table, BIND_DB) + Public WHERE As String + Sub New(table, BIND_DB, WHERE) Me.table = table Me.BIND_DB = BIND_DB + Me.WHERE = WHERE InitializeComponent() End Sub @@ -14,7 +16,7 @@ Select Case table Case "" 'Sonderfall Case Else - KASSENBind.initBinding("SELECT * FROM " & table & " WHERE verrechnet is null", table) + KASSENBind.initBinding("SELECT * FROM " & table & " WHERE verrechnet is null " & WHERE, table) For Each c As DataColumn In KASSENBind.bindingdataTable.Columns If c.ColumnName = "SSMA_TimeStamp" Then KASSENBind.bindingdataTable.Columns.Remove(c) diff --git a/SDL/USTV/frmMDM_USTVAntrag.vb b/SDL/USTV/frmMDM_USTVAntrag.vb index 9a964a70..e67ebc52 100644 --- a/SDL/USTV/frmMDM_USTVAntrag.vb +++ b/SDL/USTV/frmMDM_USTVAntrag.vb @@ -209,7 +209,7 @@ Public Class frmMDM_USTVAntrag If Not IsDBNull(r.Cells("UStVPo_daId").Value) Then da_id = r.Cells("UStVPo_daId").Value - If da_id > 0 AndAlso r.Cells("UStVPo_daId_nicht_im_Datenarchiv").Value IsNot Nothing AndAlso r.Cells("UStVPo_daId_nicht_im_Datenarchiv").Value Then + If da_id > 0 AndAlso r.Cells("UStVPo_daId_nicht_im_Datenarchiv").Value IsNot Nothing AndAlso r.Cells("UStVPo_daId_nicht_im_Datenarchiv").Value AndAlso Not (r.Cells("UStVPo_SchnittstellenNr").Value = 1) Then r.Cells("clmnPDF").Style.BackColor = Color.IndianRed End If Else diff --git a/SDL/buchhaltung/usrCntlBH.Designer.vb b/SDL/buchhaltung/usrCntlBH.Designer.vb index 610d0d46..611c1052 100644 --- a/SDL/buchhaltung/usrCntlBH.Designer.vb +++ b/SDL/buchhaltung/usrCntlBH.Designer.vb @@ -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 diff --git a/SDL/buchhaltung/usrCntlBH.vb b/SDL/buchhaltung/usrCntlBH.vb index 2ef72a76..0d721807 100644 --- a/SDL/buchhaltung/usrCntlBH.vb +++ b/SDL/buchhaltung/usrCntlBH.vb @@ -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 diff --git a/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb b/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb index e174fa5f..889c6ab9 100644 --- a/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb +++ b/SDL/mdm/frmMDMDatenverarbetiung.Designer.vb @@ -86,6 +86,7 @@ Partial Class frmMDMDatenverarbetiung Me.Button2 = New System.Windows.Forms.Button() Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.MyDatagridview1 = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components) + Me.Button11 = New System.Windows.Forms.Button() Me.pnl.SuspendLayout() CType(Me.pb_importOK, System.ComponentModel.ISupportInitialize).BeginInit() Me.Panel5.SuspendLayout() @@ -289,6 +290,7 @@ Partial Class frmMDMDatenverarbetiung Me.FlowLayoutPanel.Controls.Add(Me.Button8) Me.FlowLayoutPanel.Controls.Add(Me.Button4) Me.FlowLayoutPanel.Controls.Add(Me.Button9) + Me.FlowLayoutPanel.Controls.Add(Me.Button11) Me.FlowLayoutPanel.Location = New System.Drawing.Point(139, 37) Me.FlowLayoutPanel.Name = "FlowLayoutPanel" Me.FlowLayoutPanel.Size = New System.Drawing.Size(840, 31) @@ -837,6 +839,17 @@ Partial Class frmMDMDatenverarbetiung Me.MyDatagridview1.Size = New System.Drawing.Size(1163, 547) Me.MyDatagridview1.TabIndex = 0 ' + 'Button11 + ' + Me.Button11.BackColor = System.Drawing.Color.FloralWhite + Me.Button11.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button11.Location = New System.Drawing.Point(633, 3) + Me.Button11.Name = "Button11" + Me.Button11.Size = New System.Drawing.Size(120, 23) + Me.Button11.TabIndex = 5 + Me.Button11.Text = "Bankspesen" + Me.Button11.UseVisualStyleBackColor = False + ' 'frmMDMDatenverarbetiung ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -935,4 +948,5 @@ Partial Class frmMDMDatenverarbetiung Friend WithEvents cbxIDSmitVerag As CheckBox Friend WithEvents pb_importOK As PictureBox Friend WithEvents btnImportdet As Button + Friend WithEvents Button11 As Button End Class diff --git a/SDL/mdm/frmMDMDatenverarbetiung.vb b/SDL/mdm/frmMDMDatenverarbetiung.vb index d4599490..0123a6e0 100644 --- a/SDL/mdm/frmMDMDatenverarbetiung.vb +++ b/SDL/mdm/frmMDMDatenverarbetiung.vb @@ -40,6 +40,7 @@ Public Class frmMDMDatenverarbetiung Case "UTA" : genSummenbericht_UTA(LIEFERANT & "_Summenbericht_" & Now.ToShortDateString) Case "IDS" : genSummenbericht_IDS(LIEFERANT & "_Summenbericht_" & Now.ToShortDateString, 17, cbxIDSmitVerag.Checked) : genSummenbericht_IDS(LIEFERANT & "_Summenbericht_" & Now.ToShortDateString, 21, cbxIDSmitVerag.Checked) Case "MSE" : genSummenbericht_MSE(LIEFERANT & "_Summenbericht_" & Now.ToShortDateString) + Case "BANK" : genSummenbericht_Bank(LIEFERANT & "_Summenbericht_" & Now.ToShortDateString) Case Else : MsgBox("Nicht verfügbar!") End Select End Sub @@ -61,6 +62,7 @@ Public Class frmMDMDatenverarbetiung Case "UTA" : pruef = pruefData_UTA() Case "IDS" : pruef = pruefData_IDS() Case "MSE" : pruef = pruefData_MSE() + Case "BANK" : pruef = pruefData_Bank() Case Else : MsgBox("Nicht verfügbar!") : Exit Sub End Select @@ -95,9 +97,12 @@ Public Class frmMDMDatenverarbetiung btnDatenLaden.Text = "Daten laden" Case "IDS" : checkImport(LIEFERANT) : initDgv_IDS() btnDatenLaden.Text = "Daten laden" - 'Button1.Enabled = False + Case "MSE" : checkImport(LIEFERANT) : initDgv_MSE() btnDatenLaden.Text = "Daten laden" + Case "BANK" : checkImport(LIEFERANT) : initDgv_Bank() + btnDatenLaden.Text = "Daten laden" + Button1.Enabled = False End Select End Sub @@ -112,7 +117,7 @@ Public Class frmMDMDatenverarbetiung Dim sqlstr As String = "" Select Case LIEFERANT - Case "PLOSE" + Case "PLOSE", "BANK" sqlstr = "SELECT * FROM [VERAG].[dbo].[tblMDMEinarbeitung] where supplier = '" & LIEFERANT & "' and invoicedate between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "'" Case "ASFINAG" sqlstr = "SELECT * FROM [VERAG].[dbo].[tblMDMEinarbeitung] where supplier = '" & LIEFERANT & "' and YEAR(invoicedate) = " & Today().Year @@ -193,6 +198,15 @@ Public Class frmMDMDatenverarbetiung setFakturiert(LIEFERANT) End If End If + + Case "BANK" + Dim dTLANDEU = (New SQL).loadDgvBySql("select LandKz, MitgliedslandEU from Währungstabelle where LandKz is not null", "FMZOLL") + + If genRG_Bank(dTLANDEU) Then + setFakturiert(LIEFERANT) + End If + + Case "ASFINAG" Dim asfinagParam As New cAsfinagMaut asfinagParam.initImportPfade() @@ -788,6 +802,79 @@ Public Class frmMDMDatenverarbetiung print.Show() End Sub + Sub genSummenbericht_Bank(Berichtsname As String) + Dim displayFilter = False + Dim sqlstr As String = "" + + sqlstr &= " SELECT spesen.kundenNr as KundenNr, Adressen.[Name 1] as Name, datum , (spesen.betrag * -1) as Betrag, spesen.gebuehr , spesen.buchungstext,spesen.kontoauszug, spesen.iban, spesen.bic FROM [tblMDM_Bankspesen] as spesen + inner join adressen ON spesen.kundenNr = Adressen.AdressenNr + where datum between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "' and spesen.typ = 'Q' and isnull(spesen.RK_ID,0) = 0 and spesen.SR_datum is null" + + Dim dt As DataTable = SQL.loadDgvBySql_Param(sqlstr, "FMZOLL") + + Dim print As New frmPrintLayout + print.Text = Berichtsname + + Dim rpt As New rptASFINAG_TransaktionenSumary + + rpt.DataSource = dt + + Dim sum = 0 + rpt.lblUeberschrift.Text = "Bankspesen (Quartal) Summenbericht " & CDate(Now.ToShortDateString) + rpt.lblSachbearbeiter.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME + rpt.lblBrutto.Text = "Gebühren" + rpt.lblNetto.Text = "Bankspesen" + rpt.Label4.Text = rpt.lblNetto.Text + rpt.Label2.Visible = False + rpt.Label14.Text = rpt.lblBrutto.Text + + rpt.lblDat.Text = Now.ToLongDateString + + Dim sumNetto As Double = 0 + 'Dim sumMWST As Double = 0 + Dim sumBrutto As Double = 0 + + Dim sumperKdNrNetto As Double = 0 + 'Dim sumperKdNrMWST As Double = 0 + Dim sumperKdNrBrutto As Double = 0 + + + AddHandler rpt.Detail.Format, Sub() + + + rpt.lblKundennr.Text = SQL.isDbnullEmpty(rpt.Fields.Item("KundenNr").Value, "") + rpt.lblKartennr.Text = SQL.isDbnullEmpty(rpt.Fields.Item("buchungstext").Value, "") & " - " & SQL.isDbnullEmpty(rpt.Fields.Item("kontoauszug").Value, "") '& " - " & SQL.isDbnullEmpty(rpt.Fields.Item("CardNr").Value, "") + rpt.lblName1.Text = SQL.isDbnullEmpty(rpt.Fields.Item("Name").Value, "") + + rpt.lblNetto.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Betrag").Value, 2, "") + rpt.lblMWST.Text = "" + rpt.lblBrutto.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("gebuehr").Value, 2, "") + + + rpt.lblSumNet.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Betrag").Value, 2, "") + rpt.lblSumVat.Text = "" + rpt.lblSumBrt.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("gebuehr").Value, 2, "") + + sumNetto += SQL.isDbnullEmptyDbl(rpt.Fields.Item("Betrag").Value, 4, 0) + sumBrutto += SQL.isDbnullEmptyDbl(rpt.Fields.Item("gebuehr").Value, 4, 0) + + + End Sub + + + AddHandler rpt.ReportFooter1.Format, Sub() + + rpt.lblSumNetto.Text = sumNetto.ToString("N2") + rpt.lblSumMwst.Text = "" + rpt.lblSumBrutto.Text = sumBrutto.ToString("N2") + + End Sub + + print.Viewer.LoadDocument(rpt) + print.Viewer.ViewType = GrapeCity.Viewer.Common.Model.ViewType.Continuous + print.Show() + End Sub + Sub genSummenbericht_IDS(Berichtsname As String, typ As Integer, mitVerag360_VeragAG As Boolean) Dim displayFilter = False @@ -1068,6 +1155,45 @@ Public Class frmMDMDatenverarbetiung End Sub + Sub initDgv_Bank() + With MyDatagridview1 + .Columns.Clear() + + .SET_SQL(" SELECT spesen.kundenNr as KdNr, Adressen.[Name 1] as Name, datum as Datum , (spesen.betrag * -1) as Betrag, spesen.gebuehr as Gebühr , spesen.buchungstext as Buchnungstext,spesen.kontoauszug as Kontoauszug, spesen.iban as IBAN, spesen.bic as BIC FROM [tblMDM_Bankspesen] as spesen + inner join adressen ON spesen.kundenNr = Adressen.AdressenNr + where datum between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "' and isnull(spesen.RK_ID,0) = 0 and spesen.SR_datum is null", "FMZOLL") + + .LOAD() + + If .Columns.Count > 0 Then + + .Columns("Buchnungstext").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill + .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells + + End If + + Dim sumGes As Double = 0 + Dim sumFee As Double = 0 + Dim sumTr As Double = 0 + For Each r As DataGridViewRow In .Rows + sumGes += If(IsNumeric(r.Cells("Betrag").Value), CDbl(r.Cells("Betrag").Value), 0) + sumTr += If(IsNumeric(r.Cells("Gebühr").Value), CDbl(r.Cells("Gebühr").Value), 0) + Next + + txtAnzahl.Text = .Rows.Count + txtPruefsummeNetto.Text = CDbl(sumTr).ToString("C2") + txtPruefsummeBrutto.Text = CDbl(sumGes).ToString("C2") + + lblTTRSum.Visible = False + txtTTRSum.Visible = True + txtTTRSum._WaehrungZeichen = True + + .ClearSelection() + + End With + + End Sub + Sub initDgv_IDS() With MyDatagridview1 .Columns.Clear() @@ -1291,6 +1417,9 @@ Public Class frmMDMDatenverarbetiung Dim c As New usrCntlMDMDatenverarbeitungAuswertungen_divers(Me, Me.LIEFERANT) pnlMDMDetailberichte.Controls.Add(c) c.Dock = DockStyle.Fill + + Case "BANK" + Panel4.Visible = True End Select init() @@ -1670,12 +1799,72 @@ Public Class frmMDMDatenverarbetiung End Function + Function genRG_Bank(dtLand As DataTable) As Boolean + Dim top = "" + 'top = " TOP 20 " + Dim sqlWhere = "" + + Dim SQLStr = "SELECT spesen.kundenNr, Adressen.[Name 1], sum(spesen.gebuehr) as gebuehr FROM [tblMDM_Bankspesen] as spesen + inner join adressen ON spesen.kundenNr = Adressen.AdressenNr + where datum between '" & dat_Sum_Von.Value.ToShortDateString & "' and '" & dat_Sum_Bis.Value.ToShortDateString & "' and spesen.typ = 'Q' and isnull(spesen.RK_ID,0) = 0 and spesen.SR_datum is null group by spesen.kundenNr,Adressen.[Name 1]" + + Dim dt_Main As DataTable = SQL.loadDgvBySql_Param(SQLStr, "FMZOLL", 1200) + + + If dt_Main Is Nothing OrElse dt_Main.Rows.Count = 0 Then + MsgBox("Keine Daten!") + Return False + End If + + + Dim cnt = 0 + If vbYes = MsgBox("Es wurden Daten von " & dt_Main.Rows.Count & " Kunden gefunden " & vbNewLine & " Möchten Sie die Rechnungen erstellen?", vbYesNoCancel) Then + + + For Each BANK In dt_Main.Rows + + Dim SPEDBUCH As VERAG_PROG_ALLGEMEIN.cSpeditionsbuch = Nothing + Dim verarbOK = IIf(test, False, True) + Dim RECHNUNG As cRechnungsausgang = Nothing + + If Not gen_SPEDBUCH_ByKdNr(BANK("kundenNr"), SPEDBUCH, "BANK",,,, datPloseAnhang.Value, dtLand) Then verarbOK = False + If Not gen_RECHNUNG_BySPEDBUCH(BANK("kundenNr"), SPEDBUCH, "BANK",, dat_Sum_Von.Value.ToShortDateString, dat_Sum_Bis.Value.ToShortDateString, RECHNUNG) Then verarbOK = False + + + If verarbOK Then + 'Update Fakturiert + SQL.doSQL("UPDATE tblMDM_Bankspesen set RK_ID = " & RECHNUNG.RK_ID & ", SR_datum = '" & datPloseAnhang.Value.ToShortDateString & "' where datum between '" & dat_Sum_Von.Value.ToShortDateString & "' and '" & dat_Sum_Bis.Value.ToShortDateString & "' and typ = 'Q' and isnull(RK_ID,0) = 0 and SR_datum is null and kundenNr = " & BANK("kundenNr"), "FMZOLL") + + End If + + If True Then 'cnt Mod 10 = 0 Then + txtPloseAnh_Einarbeitung.Text = cnt & " / " & dt_Main.Rows.Count + Dim proz As Double = (cnt / dt_Main.Rows.Count) * 100 + pbPloseAnh_Proz.Value = proz + lblPloseAnh_Proz.Text = proz.ToString("N2") & " %" + 'GroupBox12.Refresh() + My.Application.DoEvents() + End If + cnt += 1 + Next + + + pbPloseAnh_Proz.Value = 100 + txtPloseAnh_Einarbeitung.Text = dt_Main.Rows.Count & " / " & dt_Main.Rows.Count + lblPloseAnh_Proz.Text = "100.00 %" + + Return True + End If + Return False + End Function + + Function genRGAtt_IDS(art As String, idsParam As cIDS) As Boolean Dim top = "" Dim sqlWhere = "" Select Case art - Case "IDS" : sqlWhere = " AND tblIDSTransactionsNew.OutletCountryCode<>740543 and Adressen.AdressenNr = 402022 " + Case "IDS" : sqlWhere = " AND tblIDSTransactionsNew.OutletCountryCode<>740543" Case "IDS_AT" : sqlWhere = " AND tblIDSTransactionsNew.OutletCountryCode=740543" Case Else MsgBox("falscher Typ!") : Return False @@ -3508,7 +3697,7 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land End Function - Function gen_SPEDBUCH_ByKdNr(KdNr As String, ByRef SPEDBUCH As VERAG_PROG_ALLGEMEIN.cSpeditionsbuch, Lieferant As String, Optional PLOSEKundenNr As String = "", Optional von As Date = Nothing, Optional bis As Date = Nothing, Optional abrechnugsdatum As Date = Nothing) + Function gen_SPEDBUCH_ByKdNr(KdNr As String, ByRef SPEDBUCH As VERAG_PROG_ALLGEMEIN.cSpeditionsbuch, Lieferant As String, Optional PLOSEKundenNr As String = "", Optional von As Date = Nothing, Optional bis As Date = Nothing, Optional abrechnugsdatum As Date = Nothing, Optional dtLand As DataTable = Nothing) Try If KdNr = "" Then Return False @@ -3525,6 +3714,29 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land Case "MSE" : OffertenNr = 23 : Abfertigungsart = 10 : SPEDBUCH.FilialenNr = 4821 Case "IDS" : OffertenNr = 17 : Abfertigungsart = 10 : SPEDBUCH.FilialenNr = 4868 Case "IDS_AT" : OffertenNr = 21 : Abfertigungsart = 10 : SPEDBUCH.FilialenNr = 4868 + Case "BANK" + + Abfertigungsart = 10 : SPEDBUCH.FilialenNr = 4817 + If AD.LandKz = "RO" Then + + OffertenNr = 31 + Else + If dtLand IsNot Nothing Then + + Dim isEU As Boolean = dtLand.AsEnumerable().Where(Function(res) res.Field(Of String)("LandKz") = AD.LandKz).Select(Function(res) res.Field(Of Boolean)("MitgliedslandEU")).FirstOrDefault() + + If isEU Then + OffertenNr = 14 + Else + OffertenNr = 15 + End If + + End If + + + End If + + End Select Dim GJ = Now.Year @@ -3573,8 +3785,6 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land Dim OffertenNr As Integer Dim Abfertigungsart As Integer - - Dim KUNDE_ERW As New cKundenErweitert(KdNr) Dim anh_Bez As String = "Email-Anhang" @@ -3603,7 +3813,8 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land Case "MSE" : OffertenNr = 23 : Abfertigungsart = 10 : RG.Anlage_1 = anh_Bez Case "IDS" : OffertenNr = 17 : Abfertigungsart = 10 : RG.Anlage_1 = anh_Bez Case "IDS_AT" : OffertenNr = 21 : Abfertigungsart = 10 : RG.Anlage_1 = anh_Bez - + Case "BANK" + OffertenNr = SPEDBUCH.VermittlerOffertenNr : Abfertigungsart = 10 : RG.Anlage_1 = "" End Select RG.Firma_ID = 19 'RG.Firma_ID = 15 @@ -3852,6 +4063,48 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land Next + Case "BANK" + + sqlstr = "SELECT spesen.kundenNr, sum(spesen.gebuehr) as gebuehr, 424 as LeistungsNr, min(cast(datum as Date)) as MinDatum, max(cast(datum as Date)) as MaxDatum FROM [tblMDM_Bankspesen] as spesen + where spesen.datum between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' and spesen.typ = 'Q' and isnull(spesen.RK_ID,0) = 0 and spesen.SR_datum is null and spesen.KundenNr = " & KdNr & " + group by spesen.kundenNr" + + Dim dt As DataTable = SQL.loadDgvBySql_Param(sqlstr, "FMZOLL") + + For Each r As DataRow In dt.Rows + + Dim NettoBetrag As Double = r("gebuehr") + Dim BruttoBetrag As Double = r("gebuehr") + Dim LeistungsNr As Integer = r("LeistungsNr") + Dim LeistungsBezAdd As String = "" + + Dim minDatum As DateTime + Dim maxDatum As DateTime + Dim minQuartal As Integer = -1 + Dim maxQuartal As Integer = -1 + + If DateTime.TryParse(Convert.ToString(r("MinDatum")), minDatum) Then + minQuartal = ((minDatum.Month - 1) \ 3) + 1 + End If + + If DateTime.TryParse(Convert.ToString(r("MaxDatum")), maxDatum) Then + maxQuartal = ((maxDatum.Month - 1) \ 3) + 1 + End If + + If minQuartal > 0 AndAlso maxQuartal > 0 Then + If minDatum.Year = maxDatum.Year AndAlso minQuartal = maxQuartal Then + LeistungsBezAdd = " Q " & minQuartal & "/" & minDatum.Year + Else + LeistungsBezAdd = " Q " & minQuartal & "-" & maxQuartal & "/" & minDatum.Year + End If + End If + + + allPos(RG, OFFERTE, LeistungsNr, NettoBetrag, BruttoBetrag,,, LeistungsBezAdd) + + Next + + End Select @@ -3894,7 +4147,7 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land End Function - Function allPos(ByRef RG As VERAG_PROG_ALLGEMEIN.cRechnungsausgang, OFFERTE As VERAG_PROG_ALLGEMEIN.cOfferte, LeistungsNr As Integer, NettoBetrag As Double, BruttoBetrag As Double, Optional UstBetrag As Double = 0, Optional leistungsBez As String = "") + Function allPos(ByRef RG As VERAG_PROG_ALLGEMEIN.cRechnungsausgang, OFFERTE As VERAG_PROG_ALLGEMEIN.cOfferte, LeistungsNr As Integer, NettoBetrag As Double, BruttoBetrag As Double, Optional UstBetrag As Double = 0, Optional leistungsBez As String = "", Optional leistungsBezAdd As String = "") Try For Each o In OFFERTE.POSITIONEN @@ -3910,6 +4163,10 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land POS.LeistungsNr = o.LeistungsNr POS.LeistungsBez = o.LeistungsBez + If leistungsBezAdd <> "" Then + POS.LeistungsBez &= " " & leistungsBezAdd + End If + POS.BerechnungsartNr = o.BerechnungsartNr 'POS.Preis = BruttoBetrag POS.Anzahl = 1 @@ -4672,6 +4929,26 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land End Try End Function + Function pruefData_Bank() As Boolean + pruefData_Bank = True + Try + + Dim fehlendeKundenr As Integer = CInt((New SQL).getValueTxtBySql("select count(*) from tblMDM_Bankspesen as spesen + WHERE datum between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "' and spesen.typ = 'Q' and isnull(spesen.RK_ID,0) = 0 and spesen.SR_datum is null and spesen.kundenNr <= 0 ", "FMZOLL")) + + If fehlendeKundenr > 0 Then + pruefData_Bank = False + MsgBox("Es konnten bei den Bankspesendaten " & fehlendeKundenr & " Kunden aufgrund des hinterlegten IBAN nicht ermittelt werden!" & vbNewLine & "Bitte an die Buchhaltung/IT wenden.") + Return False + End If + + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + pruefData_Bank = False + End Try + End Function + Function pruefData_IDS() As Boolean pruefData_IDS = True @@ -4956,6 +5233,15 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land where cast(tblIDSTransactionsNew.YearMonthDay As Date) = '" & DateTimePicker2.Text & "' and chargedDatetime is not null and isnull(charged,0) = 0 and tblIDSTransactionsNew.OutletCountryCode = 740543 ", "FMZOLL") Then PictureBox1.Visible = True End If + + Case "BANK" + If SQL.doSQL("UPDATE [VERAG].[dbo].[tblMDM_Bankspesen] Set verrechnet = getDate() + where datum between '" & dat_Sum_Von.Value.ToShortDateString & "' and '" & dat_Sum_Bis.Value.ToShortDateString & "' and typ = 'Q' and isnull(RK_ID,0) <> 0 and SR_datum is not null ", "FMZOLL") Then + + setBillingDateCompleted(Lieferant, datPloseAnhang.Value) + + PictureBox1.Visible = True + End If Case Else MsgBox("Funktion setFakturiert für den Lieferant " & Lieferant & " nicht definiert!") End Select @@ -4983,6 +5269,7 @@ LEFT JOIN VERAG.dbo.tbl_IDS_Länder land Case "MSE" : setFakturiert(LIEFERANT) Case "ASFINAG" : setFakturiert_ASFINAG() Case "IDS" : setFakturiert(LIEFERANT) : setFakturiert("IDS_AT") + Case "BANK" : setFakturiert(LIEFERANT) End Select End If End Sub @@ -5638,4 +5925,8 @@ RabattBerechnen: End Using End Sub + + Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click + initLieferant("BANK", sender) + End Sub End Class diff --git a/SDL/mdm/usrcntlFremdrechnungen.vb b/SDL/mdm/usrcntlFremdrechnungen.vb index 6863aed9..014aa417 100644 --- a/SDL/mdm/usrcntlFremdrechnungen.vb +++ b/SDL/mdm/usrcntlFremdrechnungen.vb @@ -1299,10 +1299,15 @@ Public Class usrcntlFremdrechnungen Dim daId As Integer = IIf(IsDBNull(r.Item("daId")), -1, r.Item("daId")) If daId > 0 Then Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(daId) - pdflist.Add(DS.GET_TOP1_PATH()) - TextHTMLtable &= "