This commit is contained in:
2025-10-09 11:41:11 +02:00
parent ca2e86ac26
commit 71248e97a9
3 changed files with 102 additions and 59 deletions

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.4.6.0")>
<Assembly: AssemblyFileVersion("1.4.6.0")>
<Assembly: AssemblyVersion("1.4.6.2")>
<Assembly: AssemblyFileVersion("1.4.6.2")>

View File

@@ -1322,6 +1322,10 @@ Public Class frmMDM_USTVAntrag
Dim leistenderName As String = ""
Dim useNewAdress As Boolean = False
If CDate(USTV_POS.UStVPo_ReDat) >= New Date("2025", "09", "30") Then useNewAdress = True
Select Case Antrag_LandKz
Case "RO"
leistenderName = "Kuwait Petroleum Romania S.R.L"
@@ -1338,7 +1342,7 @@ Public Class frmMDM_USTVAntrag
Case "ES"
leistenderName = "Fuel Iberia S.L.U"
Case Else
leistenderName = "IDS EUROPE B.V."
leistenderName = IIf(Not useNewAdress, "IDS EUROPE B.V.", "Q8Truck International B.V.")
End Select

View File

@@ -619,13 +619,49 @@ Public Class frmUSTVoffeneAntraege
'bei Einstellung "ALLE KUNDEN"
If dtKundeMWST.Rows.Count > 0 Then sqlwhereLand &= " AND ( NOT ("
If dtKundeMWST.Rows.Count > 0 Then sqlwhereLand &= " AND NOT EXISTS (SELECT 1 FROM (VALUES "
For Each row As DataRow In dtKundeMWST.Rows
landBez = row.Item("abc").ToString.Replace(";", "'")
counter = counter + 1
sqlwhereLand &= " (isnull(AdressenNr,0) = " & row.Item("KdNr") & " AND Einreichland in (" & landBez.ToString.Substring(0, landBez.ToString.Length - 1) & ")) " & IIf(dtKundeMWST.Rows.Count <> 0 And counter <> dtKundeMWST.Rows.Count, "OR ", "))")
' landBez = row.Item("abc").ToString.Replace(";", "'")
' counter = counter + 1
' sqlwhereLand &= " (" & row.Item("KdNr") & "," & landBez.ToString.Substring(0, landBez.ToString.Length - 1) & ") " & IIf(dtKundeMWST.Rows.Count <> 0 And counter <> dtKundeMWST.Rows.Count, ", ", ") AS Excluded(AdressenNr, Einreichland) WHERE Excluded.AdressenNr = temp.KdNr AND Excluded.Einreichland = temp.Einreichland)")
'Next
Dim kdNr_ As String = row("KdNr").ToString()
Dim landBez_ As String = row("abc").ToString()
' Entferne führende/mehrfache Semikolons
landBez_ = landBez_.Replace(";;", ";").Trim(";"c, " "c)
' Teile die Länder anhand von „;,;“
Dim laender() As String = landBez_.Split(New String() {",,"}, StringSplitOptions.None)
' Fallback: wenn nur einfache Trennung mit „;,“
If laender.Length = 1 Then
laender = landBez_.Split(New String() {",;"}, StringSplitOptions.RemoveEmptyEntries)
End If
' Jede gültige Länderkombination hinzufügen
For Each land In landBez_.Split(New String() {",;"}, StringSplitOptions.RemoveEmptyEntries)
land = land.Replace(";", "").Trim()
If land <> "" Then
Dim landTemp As String = land.Replace(",", "")
counter += 1
sqlwhereLand &= "(" & kdNr_ & ", '" & landTemp & "'), "
End If
Next
Next
If sqlwhereLand.EndsWith(", ") Then
sqlwhereLand = sqlwhereLand.Substring(0, sqlwhereLand.Length - 2)
End If
' Abschluss der NOT EXISTS-Klausel
sqlwhereLand &= ") AS Excluded(AdressenNr, Einreichland) " &
"WHERE Excluded.AdressenNr = temp.KdNr " &
"AND Excluded.Einreichland = temp.Einreichland)"
Else
@@ -640,10 +676,13 @@ Public Class frmUSTVoffeneAntraege
End If
End If
End If
If year >= 2025 Then
SQLPLOSEUMSTELLUNG = "