Proc, etc.

This commit is contained in:
2025-06-13 10:05:53 +02:00
parent dbb7a78111
commit fd43887f58
6 changed files with 1666 additions and 1441 deletions

View File

@@ -331,7 +331,7 @@ Public Class cPLOSE_Inv_Data
For Each r As DataRow In dtREohneWahrung.Rows For Each r As DataRow In dtREohneWahrung.Rows
Dim Waehrungtabelle As DataTable = SQL.loadDgvBySql("Select plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land from tblPLOSE_Details INNER JOIN tblPLOSE_Produktbeschreibung ON [plp_ProductCode]=[plose_ProduktCode] WHERE plose_RechnungsNr = '" & r.Item("plInv_SupplierRechnungsNr") & "' And plose_RechnungsDatum = '" & r.Item("plInv_SupplierRechnungsDatum") & "' group by plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land", "FMZOLL") Dim Waehrungtabelle As DataTable = SQL.loadDgvBySql("Select plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land from tblPLOSE_Details INNER JOIN tblPLOSE_Produktbeschreibung ON [plp_ProductCode]=[plose_ProduktCode] WHERE plose_SupplierRechnungsNr = '" & r.Item("plInv_SupplierRechnungsNr") & "' And plose_SupplierRechnungsDatum = '" & r.Item("plInv_SupplierRechnungsDatum") & "' group by plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land", "FMZOLL")
If Waehrungtabelle.Rows.Count = 1 Then If Waehrungtabelle.Rows.Count = 1 Then
If Waehrungtabelle.Rows(0).Item("plose_WaehrungAbbuchung") = Waehrungtabelle.Rows(0).Item("plose_WaehrungLandDiesntleistung") And Waehrungtabelle.Rows(0).Item("plp_Land").ToString.Trim = r.Item("plInv_SupplierCountry").ToString.Trim Then If Waehrungtabelle.Rows(0).Item("plose_WaehrungAbbuchung") = Waehrungtabelle.Rows(0).Item("plose_WaehrungLandDiesntleistung") And Waehrungtabelle.Rows(0).Item("plp_Land").ToString.Trim = r.Item("plInv_SupplierCountry").ToString.Trim Then
@@ -359,6 +359,66 @@ Public Class cPLOSE_Inv_Data
End Function End Function
Public Shared Function checkAndsetArchivFromUSTVAPos(jahr As Integer, Optional message As Boolean = False, Optional kdNr As Integer = -1) As Boolean
If jahr > Now.Year Then Return False
If jahr < 2020 Then Return False
Dim nichtEingearbetieteEintrage As String = "select * from tblPLOSE_Details where Year(plose_RechnungsDatum) = " & jahr & " and UStVAn_ID is null and plose_ArchiviertDatum is null and plose_Archiv = 0 " & IIf(kdNr > 0, " And plose_POLSEKundennummer = " & kdNr, "")
Dim REohneWaehrung As String = "SELECT [plInv_SupplierRechnungsDatum],[plInv_SupplierRechnungsNr],[plInv_SupplierCountry],[plInv_Lieferant]
FROM [VERAG].[dbo].[tblPLOSE_Inv_Data]
where YEAR( [plInv_SupplierRechnungsDatum]) = " & jahr & " and plInv_Currency is null " & "
Group by [plInv_SupplierCountry],[plInv_Lieferant],[plInv_SupplierRechnungsDatum],[plInv_SupplierRechnungsNr]"
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim dtREohneWahrung As DataTable = SQL.loadDgvBySql(REohneWaehrung, "FMZOLL")
'TODO: umbauen auf checkAndSet
'If dtREohneWahrung.Rows.Count > 0 Then
' If vbYes = MsgBox("Details der fehlenden Währungen anzeigen?", vbYesNo) Then
' cProgramFunctions.genExcelFromDT_NEW(dtREohneWahrung,,, "Fehlende Währung in Rechnungen: " & jahr)
' End If
' If IIf(message, vbYes = MsgBox("Bei " & dtREohneWahrung.Rows.Count & " PLOSE-Rechnungen fehlt die Währungsbezeichnung in den Rechnungen." & vbNewLine & "Währung setzen?", vbYesNoCancel), True) Then
' For Each r As DataRow In dtREohneWahrung.Rows
' Dim Waehrungtabelle As DataTable = SQL.loadDgvBySql("Select plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land from tblPLOSE_Details INNER JOIN tblPLOSE_Produktbeschreibung ON [plp_ProductCode]=[plose_ProduktCode] WHERE plose_SupplierRechnungsNr = '" & r.Item("plInv_SupplierRechnungsNr") & "' And plose_SupplierRechnungsDatum = '" & r.Item("plInv_SupplierRechnungsDatum") & "' group by plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land", "FMZOLL")
' If Waehrungtabelle.Rows.Count = 1 Then
' If Waehrungtabelle.Rows(0).Item("plose_WaehrungAbbuchung") = Waehrungtabelle.Rows(0).Item("plose_WaehrungLandDiesntleistung") And Waehrungtabelle.Rows(0).Item("plp_Land").ToString.Trim = r.Item("plInv_SupplierCountry").ToString.Trim Then
' Dim Waehrung As String = IIf(IsDBNull(Waehrungtabelle.Rows(0).Item("plose_WaehrungAbbuchung")), "", Waehrungtabelle.Rows(0).Item("plose_WaehrungAbbuchung"))
' If Waehrung <> "" Then
' SQL.doSQL("UPDATE [tblPLOSE_Inv_Data] SET plInv_Currency = '" & Waehrung & "' WHERE plInv_Currency is null and [plInv_SupplierRechnungsDatum] = '" & r.Item("plInv_SupplierRechnungsDatum") & "' AND [plInv_SupplierRechnungsNr] = '" & r.Item("plInv_SupplierRechnungsNr") & "' and [plInv_SupplierCountry] ='" & r.Item("plInv_SupplierCountry") & "'", "FMZOLL")
' End If
' End If
' End If
' Next
' If message Then MsgBox("alle Währungen gesetzt!")
' Return True
' End If
'Else
' If message Then MsgBox("keine fehlenden Währungen vorhanden!")
' Return False
'End If
End Function
End Class End Class

View File

@@ -46,6 +46,8 @@ Public Class usrCntlAPI
cboAPIArt.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AVISO_OUT_BELEGMAIL", VERAG_PROG_ALLGEMEIN.cAPI_ART.AVISO_OUT_BELEGMAIL)) cboAPIArt.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("AVISO_OUT_BELEGMAIL", VERAG_PROG_ALLGEMEIN.cAPI_ART.AVISO_OUT_BELEGMAIL))
cboAPIArt.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("VERAG_OUT_EZA", VERAG_PROG_ALLGEMEIN.cAPI_ART.VERAG_OUT_EZA)) cboAPIArt.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("VERAG_OUT_EZA", VERAG_PROG_ALLGEMEIN.cAPI_ART.VERAG_OUT_EZA))
cboAPIArt.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("VERAG_OUT_NCTS", VERAG_PROG_ALLGEMEIN.cAPI_ART.VERAG_OUT_NCTS)) cboAPIArt.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("VERAG_OUT_NCTS", VERAG_PROG_ALLGEMEIN.cAPI_ART.VERAG_OUT_NCTS))
cboAPIArt.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("MSE", VERAG_PROG_ALLGEMEIN.cAPI_ART.AVISO_IN_MSE))
cboAPIArt.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("MDM SAMMELRECHNUNG", VERAG_PROG_ALLGEMEIN.cAPI_ART.SDL_OUT_SAMMELRECHNUNG))
cboAPIArt.changeItem("") cboAPIArt.changeItem("")

View File

@@ -83,6 +83,7 @@ Partial Class usrctlProcedures
Me.tctModalTEstLRN = New System.Windows.Forms.TextBox() Me.tctModalTEstLRN = New System.Windows.Forms.TextBox()
Me.Button45 = New System.Windows.Forms.Button() Me.Button45 = New System.Windows.Forms.Button()
Me.TabPage5 = New System.Windows.Forms.TabPage() Me.TabPage5 = New System.Windows.Forms.TabPage()
Me.Button48 = New System.Windows.Forms.Button()
Me.Button47 = New System.Windows.Forms.Button() Me.Button47 = New System.Windows.Forms.Button()
Me.Button18 = New System.Windows.Forms.Button() Me.Button18 = New System.Windows.Forms.Button()
Me.TextBox1 = New System.Windows.Forms.TextBox() Me.TextBox1 = New System.Windows.Forms.TextBox()
@@ -137,7 +138,7 @@ Partial Class usrctlProcedures
Me.Button43 = New System.Windows.Forms.Button() Me.Button43 = New System.Windows.Forms.Button()
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn() Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn2 = New System.Windows.Forms.DataGridViewTextBoxColumn() Me.DataGridViewTextBoxColumn2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Button48 = New System.Windows.Forms.Button() Me.Button49 = New System.Windows.Forms.Button()
Me.TabControl1.SuspendLayout() Me.TabControl1.SuspendLayout()
Me.TabPage3.SuspendLayout() Me.TabPage3.SuspendLayout()
Me.TabPage1.SuspendLayout() Me.TabPage1.SuspendLayout()
@@ -740,6 +741,15 @@ Partial Class usrctlProcedures
Me.TabPage5.Text = "Teleotec" Me.TabPage5.Text = "Teleotec"
Me.TabPage5.UseVisualStyleBackColor = True Me.TabPage5.UseVisualStyleBackColor = True
' '
'Button48
'
Me.Button48.Location = New System.Drawing.Point(209, 24)
Me.Button48.Name = "Button48"
Me.Button48.Size = New System.Drawing.Size(145, 49)
Me.Button48.TabIndex = 63
Me.Button48.Text = "getTAD File"
Me.Button48.UseVisualStyleBackColor = True
'
'Button47 'Button47
' '
Me.Button47.Location = New System.Drawing.Point(20, 24) Me.Button47.Location = New System.Drawing.Point(20, 24)
@@ -1228,19 +1238,20 @@ Partial Class usrctlProcedures
Me.DataGridViewTextBoxColumn2.HeaderText = "anz" Me.DataGridViewTextBoxColumn2.HeaderText = "anz"
Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2" Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2"
' '
'Button48 'Button49
' '
Me.Button48.Location = New System.Drawing.Point(209, 24) Me.Button49.Location = New System.Drawing.Point(547, 29)
Me.Button48.Name = "Button48" Me.Button49.Name = "Button49"
Me.Button48.Size = New System.Drawing.Size(145, 49) Me.Button49.Size = New System.Drawing.Size(145, 49)
Me.Button48.TabIndex = 63 Me.Button49.TabIndex = 66
Me.Button48.Text = "getTAD File" Me.Button49.Text = "Kundenkontakte imp."
Me.Button48.UseVisualStyleBackColor = True Me.Button49.UseVisualStyleBackColor = True
' '
'usrctlProcedures 'usrctlProcedures
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Controls.Add(Me.Button49)
Me.Controls.Add(Me.Button43) Me.Controls.Add(Me.Button43)
Me.Controls.Add(Me.Button33) Me.Controls.Add(Me.Button33)
Me.Controls.Add(Me.lblStatus) Me.Controls.Add(Me.lblStatus)
@@ -1429,4 +1440,5 @@ Partial Class usrctlProcedures
Friend WithEvents TabPage5 As TabPage Friend WithEvents TabPage5 As TabPage
Friend WithEvents Button47 As Button Friend WithEvents Button47 As Button
Friend WithEvents Button48 As Button Friend WithEvents Button48 As Button
Friend WithEvents Button49 As Button
End Class End Class

View File

@@ -3965,6 +3965,110 @@ Public Class usrctlProcedures
End Using End Using
End Sub
Private Sub Button49_Click(sender As Object, e As EventArgs) Handles Button49.Click
Dim cnt = 0
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Dim kdnr_tmp = ""
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = CheckBox3.Checked
Try
Dim fd As New OpenFileDialog
If fd.ShowDialog = DialogResult.OK Then
If fd.FileName.ToLower.EndsWith(".csv") Then
' fd.FileName.EndsWith(".csv")
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(fd.FileName, Encoding.Default)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(";")
Dim currentRow As String()
While Not MyReader.EndOfData
Try
'
currentRow = MyReader.ReadFields()
If currentRow.Length > 2 Then
If Not (currentRow(0).Trim() = "aktiv") Then
If currentRow.Length > 12 Then
Dim kundenNr = isleernothing((currentRow(1)))
If kundenNr IsNot Nothing Then
kdnr_tmp = kundenNr
'Mahnung an
If isleernothing((currentRow(9))) IsNot Nothing Then
Dim KDKont As New VERAG_PROG_ALLGEMEIN.cKundenKontakte(10, kundenNr)
KDKont.kkd_Email = isleernothing((currentRow(9)))
KDKont.kkd_kkaId = 10 'Mahnung an
KDKont.kkd_kkaBez = "Mahnung an"
If KDKont.SAVE() Then
TextBox10.Text &= KDKont.kkd_id & vbNewLine
Else
MsgBox("FEHLER: " & currentRow(2).Trim() & " - " & currentRow(3).Trim())
End If
End If
'Rechnung an
If isleernothing((currentRow(10))) IsNot Nothing Then
Dim KDKont As New VERAG_PROG_ALLGEMEIN.cKundenKontakte(8, kundenNr)
KDKont.kkd_Email = isleernothing((currentRow(10)))
KDKont.kkd_kkaId = 8 'Rechnung an
KDKont.kkd_kkaBez = "Rechnung an"
If KDKont.SAVE() Then
TextBox10.Text &= KDKont.kkd_id & vbNewLine
Else
MsgBox("FEHLER: " & currentRow(2).Trim() & " - " & currentRow(3).Trim())
End If
End If
End If
If cnt Mod 10 = 0 Then
Application.DoEvents()
Label10.Text = (cnt + 1)
End If
Else
'MsgBox(currentRow(2))
End If
End If
End If
'For Each currentField In currentRow
cnt += 1
'Next
Catch ex As Exception
MsgBox(kdnr_tmp & " " & ex.Message & ex.StackTrace)
End Try
End While
End Using
End If
End If
Catch ex As Exception
MessageBox.Show("Datei nicht vorhanden.")
Finally
End Try
End Sub End Sub

File diff suppressed because it is too large Load Diff

View File

@@ -5408,6 +5408,11 @@ Public Class frmStartOptions
Exit Sub Exit Sub
End If End If
If cbxPlose.Checked And cbxPloseNeu.Checked Then
MsgBox("Plose-Vorschausummen werden per alter Logik UND neuer Logik berechnet, das würde die Plose-Vorschausumme doppelt berechnet werden!" & vbNewLine & "Vorgang wird abgebrochen!")
Exit Sub
End If
cMDMFunctionsAllgemein.setSchnittstellen(cbxPlose.Checked, cbxITalt.Checked, cbxMSEalt.Checked, cbxMSEneu.Checked, cbxIDSalt.Checked, cbxIDSneu.Checked, cbxUTAalt.Checked, cbxUTANeu.Checked, cbxPloseNeu.Checked) cMDMFunctionsAllgemein.setSchnittstellen(cbxPlose.Checked, cbxITalt.Checked, cbxMSEalt.Checked, cbxMSEneu.Checked, cbxIDSalt.Checked, cbxIDSneu.Checked, cbxUTAalt.Checked, cbxUTANeu.Checked, cbxPloseNeu.Checked)
If sender Is Button23 Then If sender Is Button23 Then
@@ -5823,7 +5828,7 @@ weiter:
End If End If
Dim fehlendePDFzuRE As String = "select Rechnungsnummer_pro_Lieferland, cast([Rechnungsdatum] as Date) as Rechnungsdatum, Kundennummer, Abrechnungsnummer from tblUTAImportNew where daId is null and cast([Rechnungsdatum] as Date) = '" & utaDate & "' and Lieferland <> 'ROM' and Steuerliches_Lieferland <> 'ROM' group by Rechnungsdatum, Kundennummer, Abrechnungsnummer, Rechnungsnummer_pro_Lieferland " Dim fehlendePDFzuRE As String = "select Rechnungsnummer_pro_Lieferland, cast([Rechnungsdatum] as Date) as Rechnungsdatum, Kundennummer, Abrechnungsnummer from tblUTAImportNew where daId is null and cast([Rechnungsdatum] as Date) = '" & utaDate & "' and Lieferland <> 'ROM' and Steuerliches_Lieferland <> 'ROM' or daId is null and cast([Rechnungsdatum] as Date) = '" & utaDate & "' and Kundennummer = 868070 group by Rechnungsdatum, Kundennummer, Abrechnungsnummer, Rechnungsnummer_pro_Lieferland "
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim dtRechnnungsdaten As DataTable = SQL.loadDgvBySql(fehlendePDFzuRE, "FMZOLL") Dim dtRechnnungsdaten As DataTable = SQL.loadDgvBySql(fehlendePDFzuRE, "FMZOLL")
@@ -5953,4 +5958,33 @@ weiter:
End Sub End Sub
Private Sub LinkLabel53_LinkClicked_1(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel53.LinkClicked
Dim sql As New SQL
Dim PLOSEdaidaktualiseren As String = "select * from tblPLOSE_Details where Year(plose_RechnungsDatum) = " & txtPloseJahr.Text & " and UStVAn_ID is null and plose_ArchiviertDatum is null and plose_Archiv = 0 and plose_POLSEKundennummer = 540961 "
Dim dtUSTVA_daid_akt As DataTable = sql.loadDgvBySql(PLOSEdaidaktualiseren, "FMZOLL")
For Each row As DataRow In dtUSTVA_daid_akt.Rows
Dim ustva As New cUSTVAntrag(row.Item("UStVAn_ID"))
If ustva.UStVAn_LandNr IsNot Nothing AndAlso IsNumeric(ustva.UStVAn_LandNr) Then
Dim Antrag_LandKz = sql.DLookup("LandKz", "[Länderverzeichnis für die Außenhandelsstatistik]", "Landnr='" & ustva.UStVAn_LandNr & "'", "FMZOLL")
Dim daId As Integer = 0
Dim SQL_String = "SELECT isnull(tblIDSInvoicesNewSplittedByCountry.daId ,0) FROM [tblIDSInvoicesNewSplittedByCountry] where tblIDSInvoicesNewSplittedByCountry.[YearMonthDay] ='" & CDate(row.Item("UStVPo_ReDat")).ToShortDateString & "' AND tblIDSInvoicesNewSplittedByCountry.Invoicenumber ='" & row.Item("UStVPo_ReNr").ToString.Replace("/", "") & "' and tblIDSInvoicesNewSplittedByCountry.Country='" & Antrag_LandKz & "' AND tblIDSInvoicesNewSplittedByCountry.daId is not null"
daId = CInt(sql.getValueTxtBySql(SQL_String, "FMZOLL",,, 0))
If daId > 0 Then sql.doSQL("update tblUStVPositionen set UStVPo_daId = " & daId & ", UStVPo_SchnittstellenNr = 12 where UStVAn_ID = " & row.Item("UStVAn_ID") & " and UStVPo_ID = " & row.Item("UStVPo_ID") & " AND UStVPo_SchnittstellenNr = 8", "FMZOLL")
End If
Next
End Sub
End Class End Class