This commit is contained in:
2025-02-25 08:37:27 +01:00
parent 0debf6f694
commit 55030fc729
6 changed files with 810 additions and 647 deletions

View File

@@ -1,6 +1,7 @@

Imports System.Data.SqlClient
Imports System.Reflection
Imports System.Text.RegularExpressions
Public Class cPLOSE_Inv_Data
Property plInv_Id As Integer
@@ -27,6 +28,7 @@ Public Class cPLOSE_Inv_Data
Property plInv_UStVAn_ID As Object = Nothing
Property plInv_Archiv As Boolean = False
Property plInv_ArchiviertDatum As Object = Nothing
Property plInv_daIdgesetztDatum As Object = Nothing
Public hasEntry = False
@@ -41,9 +43,14 @@ Public Class cPLOSE_Inv_Data
Me.plInv_Id = plInv_Id
LOAD()
End Sub
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
Function getParameterList(Optional withPrimaryKey As Boolean = True) As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("plInv_Id", plInv_Id,, True))
If withPrimaryKey Then
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("plInv_Id", plInv_Id,, True))
Else
'list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("plInv_Id", plInv_Id))
End If
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("plInv_SupplierRechnungsDatum", plInv_SupplierRechnungsDatum))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("plInv_SupplierRechnungsNr", plInv_SupplierRechnungsNr))
@@ -68,6 +75,7 @@ Public Class cPLOSE_Inv_Data
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("plInv_UStVAn_ID", plInv_UStVAn_ID))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("plInv_Archiv", plInv_Archiv))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("plInv_ArchiviertDatum", plInv_ArchiviertDatum))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("plInv_daIdgesetztDatum", plInv_daIdgesetztDatum))
Return list
End Function
@@ -88,6 +96,23 @@ Public Class cPLOSE_Inv_Data
Return (plInv_Id > 0)
End Function
Public Function SAVEUNQIUE() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT plInv_Id FROM tblPLOSE_Inv_Data WHERE plInv_SupplierRechnungsDatum=@plInv_SupplierRechnungsDatum and plInv_SupplierRechnungsNr=@plInv_SupplierRechnungsNr and plInv_SupplierCountry=@plInv_SupplierCountry and plInv_LieferantCode=@plInv_LieferantCode and plInv_PLOSEKundennummer=@plInv_PLOSEKundennummer) " &
" BEGIN " & getUpdateCmdUnique() & " END " &
" Else " &
" BEGIN " & getInsertCmd() & " END " &
" commit tran "
plInv_Id = SQL.doSQLVarListID(plInv_Id, sqlstr, "FMZOLL", , list)
Return (plInv_Id > 0)
End Function
Public Sub LOAD()
Try
hasEntry = False
@@ -137,6 +162,25 @@ Public Class cPLOSE_Inv_Data
Return ""
End Function
Public Function getUpdateCmdUnique() As String
Try
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim str As String = ""
For Each i In list
If Not i.isPrimaryParam Then
str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
End If
Next
str = str.Substring(0, str.Length - 1) 'wg. ','
Return (" UPDATE [tblPLOSE_Inv_Data] SET " & str & " WHERE plInv_SupplierRechnungsDatum=@plInv_SupplierRechnungsDatum and plInv_SupplierRechnungsNr=@plInv_SupplierRechnungsNr and plInv_SupplierCountry=@plInv_SupplierCountry and plInv_LieferantCode=@plInv_LieferantCode and plInv_PLOSEKundennummer=@plInv_PLOSEKundennummer ")
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
Return ""
End Function
Public Function getInsertCmd() As String
Try
@@ -158,5 +202,79 @@ Public Class cPLOSE_Inv_Data
Return ""
End Function
Public Shared Function setDatenarchivID(jahr As Integer, Optional message As Boolean = False) As Boolean
If jahr > Now.Year Then Return False
If jahr < 2020 Then Return False
Dim REohneDAID As String = "Select plInv_Id, plInv_PdfFileName, plInv_daId FROM [tblPLOSE_Inv_Data] where plInv_daId Is null And plInv_PdfFileName Is Not null And Year(plInv_SupplierRechnungsDatum) = " & jahr
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim dtREohneDAID As DataTable = SQL.loadDgvBySql(REohneDAID, "FMZOLL")
If dtREohneDAID.Rows.Count > 0 Then
If IIf(message, vbYes = MsgBox("Bei " & dtREohneDAID.Rows.Count & " PLOSE-Rechnungen fehlt die Zuweisung zur Datenarchiv-ID (PDF)." & vbNewLine & "Datenarchiv-ID setzen?", vbYesNoCancel), True) Then
For Each r As DataRow In dtREohneDAID.Rows
Dim filename As String = IIf(Not IsDBNull(r.Item("plInv_PdfFileName")), r.Item("plInv_PdfFileName"), "")
Dim filename2 As String = ""
Dim filename3 As String = ""
Dim filename4 As String = ""
If filename <> "" Then
filename2 = filename.Replace("-", "_")
If Regex.IsMatch(filename, "^[A-Za-z]") Then
Dim match As Match = Regex.Match(filename, "\d+")
If match.Success Then
filename3 = filename.Substring(match.Index).Trim
filename4 = filename.Replace("-", "_")
End If
End If
Dim daId As Integer = 0
If filename3 = "" Then
daId = CInt(SQL.getValueTxtBySql("Select top(1) isnull(da_id,0) FROM tblDatenarchiv WHERE da_KundenNr = 0 And da_kategorie = 'MDM' AND da_ordner='MDM_DATEN' AND da_uOrdner1= 'PLOSE' AND da_uOrdner2= '" & jahr & "' AND (da_name like '%" & filename & "' or da_name like '%" & filename2 & "')", "FMZOLL",,, 0))
Else
daId = CInt(SQL.getValueTxtBySql("Select top(1) isnull(da_id,0) FROM tblDatenarchiv WHERE da_KundenNr = 0 And da_kategorie = 'MDM' AND da_ordner='MDM_DATEN' AND da_uOrdner1= 'PLOSE' AND da_uOrdner2= '" & jahr & "' AND (da_name like '%" & filename & "' or da_name like '%" & filename2 & "' or da_name like '%" & filename3 & "' or da_name like '%" & filename4 & "')", "FMZOLL",,, 0))
End If
If daId > 0 Then
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(daId)
Dim Path As String = DS.GET_TOP1_PATH()
If Path <> "" And System.IO.File.Exists(Path) Then
SQL.doSQL("UPDATE [tblPLOSE_Inv_Data] SET plInv_daId = " & DS.da_id & ", plInv_daIdgesetztDatum = getdate() WHERE plInv_Id = " & r.Item("plInv_Id") & " AND plInv_daId is null", "FMZOLL")
End If
End If
End If
Next
If message Then MsgBox("alle Rechnungsdaten gesetzt!")
Return True
End If
Else
If message Then MsgBox("keine fehlenden Rechnunngsdaten vorhanden!")
Return False
End If
End Function
End Class

View File

@@ -75,7 +75,8 @@
Private Sub gdvGruppen_KeyDown(sender As Object, e As KeyEventArgs) Handles gdvGruppen.KeyDown
If gdvGruppen.SelectedRows.Count = 0 Then Exit Sub
If e.KeyCode = Keys.Delete Then
If vbYes = MsgBox("Möchten Sie die Gruppe und alle verbundenen Zuordnungen wirklich löschen?", vbYesNoCancel) Then
Dim mitarbeiterInfo As New VERAG_PROG_ALLGEMEIN.cMitarbeiter(mitId)
If vbYes = MsgBox("Möchten Sie für " & mitarbeiterInfo.mit_username & " die Gruppenzuweisung wirklich löschen?", vbYesNoCancel) Then
Dim BGRZ As New VERAG_PROG_ALLGEMEIN.cBerechtigungenBenutzerGruppenZuordnung
BGRZ.berbgz_id = gdvGruppen.SelectedRows(0).Cells("dgvGrp_id").Value
BGRZ.DELETE()

View File

@@ -815,16 +815,12 @@ Public Class frmMDMNachrichtenVerarbeitung
If currentRow(0) <> "PloseCode" Then ' Header
If currentRow.Length >= 15 Then
Dim PLOSE_INV As New MDM_Worker.cPLOSE_Inv_Data
' MsgBox(SQL.isleernothingDateFormatstring(currentRow(7)))
' MsgBox(currentRow(7))
PLOSE_INV.plInv_SupplierRechnungsDatum = SQL.isleernothingDateFormatstring(currentRow(7))
' MsgBox(PLOSE_INV.plInv_SupplierRechnungsDatum)
PLOSE_INV.plInv_SupplierRechnungsNr = SQL.isleernothing(currentRow(8))
PLOSE_INV.plInv_SupplierCountry = SQL.isleernothing(currentRow(6))
PLOSE_INV.plInv_Lieferant = SQL.isleernothing(currentRow(4))
PLOSE_INV.plInv_LieferantCode = SQL.isleernothing(currentRow(3))
PLOSE_INV.plInv_LieferantUID = SQL.isleernothing(currentRow(5))
'PLOSE_INV.plInv_RechnungsJahr = SQL.isleernothing(currentRow(7)) --> JAHR
PLOSE_INV.plInv_PdfFileName = SQL.isleernothing(currentRow(14))
If If(PLOSE_INV.plInv_PdfFileName, "") <> "" Then
If Not PLOSE_INV.plInv_PdfFileName.ToString.ToLower.EndsWith(".pdf") Then PLOSE_INV.plInv_PdfFileName += ".pdf" ' Falls Endung nciht .pdf --> anfügen
@@ -858,7 +854,7 @@ Public Class frmMDMNachrichtenVerarbeitung
PLOSE_INV.plInv_Dateiname = fi.Name
''''''''''''
If PLOSE_INV.SAVE() Then
If PLOSE_INV.SAVEUNQIUE() Then
' UPDATE tblPLOSE_Details:
SQL.doSQL("UPDATE [tblPLOSE_Details] SET [plose_plInvId] ='" & PLOSE_INV.plInv_Id & "' where plose_SupplierRechnungsNr='" & PLOSE_INV.plInv_SupplierRechnungsNr & "' AND plose_SupplierRechnungsDatum='" & PLOSE_INV.plInv_SupplierRechnungsDatum & "'", "FMZOLL")

View File

@@ -26,7 +26,6 @@ Partial Class frmStartOptions
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmStartOptions))
Me.pnl = New System.Windows.Forms.Panel()
Me.LinkLabel69 = New System.Windows.Forms.LinkLabel()
Me.Button27 = New System.Windows.Forms.Button()
Me.txtMRNPrefix = New System.Windows.Forms.TextBox()
Me.LinkLabel66 = New System.Windows.Forms.LinkLabel()
Me.PictureBox24 = New System.Windows.Forms.PictureBox()
@@ -163,6 +162,7 @@ Partial Class frmStartOptions
Me.MyComboBox1 = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.txtVRGOut_BezugsNr = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.TabPage3 = New System.Windows.Forms.TabPage()
Me.CheckBox9 = New System.Windows.Forms.CheckBox()
Me.Label49 = New System.Windows.Forms.Label()
Me.MyTextBox5 = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Button28 = New System.Windows.Forms.Button()
@@ -188,6 +188,8 @@ Partial Class frmStartOptions
Me.LinkLabel30 = New System.Windows.Forms.LinkLabel()
Me.Label11 = New System.Windows.Forms.Label()
Me.TabPage4 = New System.Windows.Forms.TabPage()
Me.LinkLabel72 = New System.Windows.Forms.LinkLabel()
Me.txtPloseJahr = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.lblUTAPDFvollst = New System.Windows.Forms.LinkLabel()
Me.txtUTADate = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.TextBox3 = New System.Windows.Forms.TextBox()
@@ -302,7 +304,6 @@ Partial Class frmStartOptions
Me.txtGJ_UNISPED = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Button21 = New System.Windows.Forms.Button()
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.CheckBox9 = New System.Windows.Forms.CheckBox()
Me.pnl.SuspendLayout()
CType(Me.PictureBox24, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox23, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -345,8 +346,6 @@ Partial Class frmStartOptions
'
Me.pnl.BackColor = System.Drawing.Color.White
Me.pnl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.pnl.Controls.Add(Me.LinkLabel69)
Me.pnl.Controls.Add(Me.Button27)
Me.pnl.Controls.Add(Me.txtMRNPrefix)
Me.pnl.Controls.Add(Me.LinkLabel66)
Me.pnl.Controls.Add(Me.PictureBox24)
@@ -431,17 +430,12 @@ Partial Class frmStartOptions
'
'LinkLabel69
'
Me.LinkLabel69.Location = New System.Drawing.Point(248, 0)
Me.LinkLabel69.Location = New System.Drawing.Point(722, 211)
Me.LinkLabel69.Name = "LinkLabel69"
Me.LinkLabel69.Size = New System.Drawing.Size(100, 23)
Me.LinkLabel69.Size = New System.Drawing.Size(132, 23)
Me.LinkLabel69.TabIndex = 0
'
'Button27
'
Me.Button27.Location = New System.Drawing.Point(391, 0)
Me.Button27.Name = "Button27"
Me.Button27.Size = New System.Drawing.Size(75, 23)
Me.Button27.TabIndex = 1
Me.LinkLabel69.TabStop = True
Me.LinkLabel69.Text = "Land in Steuernr setzen"
'
'txtMRNPrefix
'
@@ -2180,6 +2174,19 @@ Partial Class frmStartOptions
Me.TabPage3.Text = "Partner-Systeme"
Me.TabPage3.UseVisualStyleBackColor = True
'
'CheckBox9
'
Me.CheckBox9.AutoSize = True
Me.CheckBox9.Checked = True
Me.CheckBox9.CheckState = System.Windows.Forms.CheckState.Checked
Me.CheckBox9.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CheckBox9.Location = New System.Drawing.Point(419, 168)
Me.CheckBox9.Name = "CheckBox9"
Me.CheckBox9.Size = New System.Drawing.Size(111, 17)
Me.CheckBox9.TabIndex = 147
Me.CheckBox9.Text = "mit Positionsdaten"
Me.CheckBox9.UseVisualStyleBackColor = True
'
'Label49
'
Me.Label49.AutoSize = True
@@ -2477,6 +2484,9 @@ Partial Class frmStartOptions
'
'TabPage4
'
Me.TabPage4.Controls.Add(Me.LinkLabel69)
Me.TabPage4.Controls.Add(Me.LinkLabel72)
Me.TabPage4.Controls.Add(Me.txtPloseJahr)
Me.TabPage4.Controls.Add(Me.lblUTAPDFvollst)
Me.TabPage4.Controls.Add(Me.txtUTADate)
Me.TabPage4.Controls.Add(Me.TextBox3)
@@ -2572,6 +2582,43 @@ Partial Class frmStartOptions
Me.TabPage4.Text = "VERAG 360"
Me.TabPage4.UseVisualStyleBackColor = True
'
'LinkLabel72
'
Me.LinkLabel72.AutoSize = True
Me.LinkLabel72.LinkColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(54, Byte), Integer), CType(CType(128, Byte), Integer))
Me.LinkLabel72.Location = New System.Drawing.Point(797, 114)
Me.LinkLabel72.Name = "LinkLabel72"
Me.LinkLabel72.Size = New System.Drawing.Size(119, 13)
Me.LinkLabel72.TabIndex = 159
Me.LinkLabel72.TabStop = True
Me.LinkLabel72.Text = "PDF mit RE verknüpfen"
'
'txtPloseJahr
'
Me.txtPloseJahr._DateTimeOnly = False
Me.txtPloseJahr._numbersOnly = True
Me.txtPloseJahr._numbersOnlyKommastellen = ""
Me.txtPloseJahr._numbersOnlyTrennzeichen = False
Me.txtPloseJahr._Prozent = False
Me.txtPloseJahr._ShortDateNew = False
Me.txtPloseJahr._ShortDateOnly = False
Me.txtPloseJahr._TimeOnly = False
Me.txtPloseJahr._TimeOnly_Seconds = False
Me.txtPloseJahr._value = ""
Me.txtPloseJahr._Waehrung = False
Me.txtPloseJahr._WaehrungZeichen = False
Me.txtPloseJahr.BackColor = System.Drawing.SystemColors.Window
Me.txtPloseJahr.ForeColor = System.Drawing.Color.Red
Me.txtPloseJahr.Location = New System.Drawing.Point(725, 111)
Me.txtPloseJahr.MaxLength = 10
Me.txtPloseJahr.MaxLineLength = -1
Me.txtPloseJahr.MaxLines_Warning = ""
Me.txtPloseJahr.MaxLines_Warning_Label = Nothing
Me.txtPloseJahr.Name = "txtPloseJahr"
Me.txtPloseJahr.Size = New System.Drawing.Size(66, 20)
Me.txtPloseJahr.TabIndex = 158
Me.txtPloseJahr.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'lblUTAPDFvollst
'
Me.lblUTAPDFvollst.AutoSize = True
@@ -3984,19 +4031,6 @@ Partial Class frmStartOptions
Me.DataGridViewTextBoxColumn1.MinimumWidth = 8
Me.DataGridViewTextBoxColumn1.Name = "DataGridViewTextBoxColumn1"
'
'CheckBox9
'
Me.CheckBox9.AutoSize = True
Me.CheckBox9.Checked = True
Me.CheckBox9.CheckState = System.Windows.Forms.CheckState.Checked
Me.CheckBox9.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CheckBox9.Location = New System.Drawing.Point(419, 168)
Me.CheckBox9.Name = "CheckBox9"
Me.CheckBox9.Size = New System.Drawing.Size(111, 17)
Me.CheckBox9.TabIndex = 147
Me.CheckBox9.Text = "mit Positionsdaten"
Me.CheckBox9.UseVisualStyleBackColor = True
'
'frmStartOptions
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -4315,7 +4349,6 @@ Partial Class frmStartOptions
Friend WithEvents PictureBox26 As PictureBox
Friend WithEvents LinkLabel69 As LinkLabel
Friend WithEvents LinkLabel70 As LinkLabel
Friend WithEvents Button27 As Button
Friend WithEvents Label48 As Label
Friend WithEvents datTranscodeBis As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents datTranscodeVon As VERAG_PROG_ALLGEMEIN.MyTextBox
@@ -4333,4 +4366,6 @@ Partial Class frmStartOptions
Friend WithEvents Button28 As Button
Friend WithEvents Label49 As Label
Friend WithEvents CheckBox9 As CheckBox
Friend WithEvents LinkLabel72 As LinkLabel
Friend WithEvents txtPloseJahr As VERAG_PROG_ALLGEMEIN.MyTextBox
End Class

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,9 @@ Imports System.Net
Imports System.Net.Security
Imports System.Security.Cryptography.X509Certificates
Imports System.Text
Imports System.Text.RegularExpressions
Imports System.Xml
Imports MDM_Worker
Imports Renci.SshNet
Imports VERAG_PROG_ALLGEMEIN
@@ -5612,4 +5614,12 @@ Public Class frmStartOptions
Label49.Text = dt.Rows.Count & "fin"
End If
End Sub
Private Sub LinkLabel72_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel72.LinkClicked
If txtPloseJahr.Text.ToString.Length <> 4 Then MsgBox("Bitte Jahr eingeben!") : Exit Sub
cPLOSE_Inv_Data.setDatenarchivID(txtPloseJahr.Text, True)
End Sub
End Class