Files
Checkin-Tool/pages/Page1/queries/qryReisen/qryReisen.txt
T
2026-07-31 10:42:00 +00:00

46 lines
1.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
DECLARE @Haus nvarchar(200) =
{{ Hausauswahl.selectedOptionValue }};
DECLARE @Heute date =
CAST(GETDATE() AS date);
SELECT
CONCAT(
CONVERT(varchar(10), R.TerminVon, 104),
N' ',
CONVERT(varchar(10), R.TerminBis, 104),
N' | ',
P.Bezeichnung,
CASE
WHEN NULLIF(R.Code, N'') IS NOT NULL
THEN CONCAT(N' | ', R.Code)
ELSE N''
END
) AS label,
R.IDReise AS value,
R.IDReise,
R.Code AS Reisecode,
R.Bezeichnung AS Reise,
P.Bezeichnung AS Produkt,
R.TerminVon,
R.TerminBis
FROM dbo.Reise R
INNER JOIN dbo.Produkt P
ON P.IDProdukt = R.IDProdukt_FS
WHERE
COALESCE(R.Status, N'') <> N'L'
AND COALESCE(P.Status, N'') <> N'L'
AND CHARINDEX(@Haus, P.Bezeichnung) > 0
-- Reise überschneidet den Zeitraum heute -7 bis heute +20
AND CAST(R.TerminBis AS date) >=
DATEADD(DAY, -7, @Heute)
AND CAST(R.TerminVon AS date) <=
DATEADD(DAY, 20, @Heute)
ORDER BY
R.TerminVon,
P.Bezeichnung,
R.Code;