diff --git a/SDL/USTV/frmUSTVoffeneAntraege.vb b/SDL/USTV/frmUSTVoffeneAntraege.vb index e878c58c..fc47e190 100644 --- a/SDL/USTV/frmUSTVoffeneAntraege.vb +++ b/SDL/USTV/frmUSTVoffeneAntraege.vb @@ -618,17 +618,21 @@ Public Class frmUSTVoffeneAntraege If dtKundeMWST.Columns.Contains("KdNr") Then + 'bei Einstellung "ALLE KUNDEN" + If dtKundeMWST.Rows.Count > 0 Then sqlwhereLand &= " AND ( NOT " For Each row As DataRow In dtKundeMWST.Rows - landBez = row.Item("abc").ToString.Replace(";", "'") - 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 ", ")") + 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 ", ")") 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") & "'" counter = counter + 1 If (dtKundeMWST.Rows.Count <> 0 And counter <> dtKundeMWST.Rows.Count) Then landBez &= ","