This commit is contained in:
2025-10-03 12:28:49 +02:00
parent 96a87afca4
commit 7ea2686718

View File

@@ -618,17 +618,21 @@ Public Class frmUSTVoffeneAntraege
If dtKundeMWST.Columns.Contains("KdNr") Then If dtKundeMWST.Columns.Contains("KdNr") Then
'bei Einstellung "ALLE KUNDEN"
If dtKundeMWST.Rows.Count > 0 Then sqlwhereLand &= " AND ( NOT " If dtKundeMWST.Rows.Count > 0 Then sqlwhereLand &= " AND ( NOT "
For Each row As DataRow In dtKundeMWST.Rows For Each row As DataRow In dtKundeMWST.Rows
landBez = row.Item("abc").ToString.Replace(";", "'") landBez = row.Item("abc").ToString.Replace(";", "'")
counter = counter + 1 counter = counter + 1
sqlwhereLand &= " ( AdressenNr = " & 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 ", ")") 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 ", ")")
Next Next
Else Else
For Each row As DataRow In dtKundeMWST.Rows 'bei Einstellung "SPEZIFISCHER KUNDE"
For Each row As DataRow In dtKundeMWST.Rows
landBez &= "'" & row.Item("LandKz") & "'" landBez &= "'" & row.Item("LandKz") & "'"
counter = counter + 1 counter = counter + 1
If (dtKundeMWST.Rows.Count <> 0 And counter <> dtKundeMWST.Rows.Count) Then landBez &= "," If (dtKundeMWST.Rows.Count <> 0 And counter <> dtKundeMWST.Rows.Count) Then landBez &= ","