From 6db2e0a4ec883d87983e030f06ddbb7710862c32 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Thu, 16 Nov 2023 09:32:25 +0100 Subject: [PATCH] DeliveryAdminWindow: Add filter for branch when in Receipt mode --- Elwig/App.xaml.cs | 2 ++ Elwig/Windows/DeliveryAdminWindow.xaml.cs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Elwig/App.xaml.cs b/Elwig/App.xaml.cs index b894afb..8738162 100644 --- a/Elwig/App.xaml.cs +++ b/Elwig/App.xaml.cs @@ -35,6 +35,7 @@ namespace Elwig { } } + public static int BranchNum { get; private set; } public static string ZwstId { get; private set; } public static string BranchName { get; private set; } public static int? BranchPlz { get; private set; } @@ -91,6 +92,7 @@ namespace Elwig { Shutdown(); return; } + BranchNum = branches.Count; } Utils.RunBackground("HTML Initialization", () => Html.Init(PrintingReadyChanged)); diff --git a/Elwig/Windows/DeliveryAdminWindow.xaml.cs b/Elwig/Windows/DeliveryAdminWindow.xaml.cs index d266e16..435dddc 100644 --- a/Elwig/Windows/DeliveryAdminWindow.xaml.cs +++ b/Elwig/Windows/DeliveryAdminWindow.xaml.cs @@ -296,6 +296,10 @@ namespace Elwig.Windows { private async Task<(List, IQueryable, IQueryable, List)> GetFilters() { List filterNames = new(); IQueryable deliveryQuery = Context.Deliveries; + if (IsReceipt && App.BranchNum > 1) { + deliveryQuery = deliveryQuery.Where(d => d.ZwstId == App.ZwstId); + filterNames.Add($"Zweigstelle {App.BranchName}"); + } if (Member != null) { deliveryQuery = deliveryQuery.Where(d => d.MgNr == Member.MgNr); filterNames.Add(Member.AdministrativeName);