diff --git a/Elwig/Windows/MainWindow.xaml b/Elwig/Windows/MainWindow.xaml
index 8633834..ac0ff59 100644
--- a/Elwig/Windows/MainWindow.xaml
+++ b/Elwig/Windows/MainWindow.xaml
@@ -8,6 +8,8 @@
Loaded="Window_Loaded">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Elwig/Windows/SeasonFinishWindow.xaml.cs b/Elwig/Windows/SeasonFinishWindow.xaml.cs
new file mode 100644
index 0000000..82900ec
--- /dev/null
+++ b/Elwig/Windows/SeasonFinishWindow.xaml.cs
@@ -0,0 +1,78 @@
+using Elwig.Documents;
+using Elwig.Helpers;
+using Elwig.Helpers.Billing;
+using Microsoft.EntityFrameworkCore;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
+
+namespace Elwig.Windows {
+ public partial class SeasonFinishWindow : ContextWindow {
+ public SeasonFinishWindow() {
+ InitializeComponent();
+ }
+
+ private void Window_Loaded(object sender, RoutedEventArgs evt) {
+ SeasonInput.Value = Utils.CurrentLastSeason;
+ }
+
+ protected override async Task OnRenewContext() {
+
+ }
+
+ private async void SeasonInput_ValueChanged(object sender, RoutedEventArgs evt) {
+ var s = await Context.Seasons.FindAsync(SeasonInput.Value);
+ var valid = (s != null);
+ CalculateBinsButton.IsEnabled = valid;
+ DeliveryConfirmationButton.IsEnabled = valid;
+ OverUnderDeliveryButton.IsEnabled = valid;
+ }
+
+ private async void CalculateBinsButton_Click(object sender, RoutedEventArgs evt) {
+ if (SeasonInput.Value is not int year)
+ return;
+ Mouse.OverrideCursor = Cursors.AppStarting;
+ var b = new Billing(year);
+ await b.FinishSeason();
+ await b.CalculateBins();
+ Mouse.OverrideCursor = null;
+ }
+
+ private async void DeliveryConfirmationButton_Click(object sender, RoutedEventArgs evt) {
+ if (SeasonInput.Value is not int year)
+ return;
+ var res = MessageBox.Show(
+ $"Sollen wirklich alle Bestätigungen gedruckt werden?", "Ausdruck Bestätigen",
+ MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
+ if (res != MessageBoxResult.Yes)
+ return;
+ Mouse.OverrideCursor = Cursors.AppStarting;
+ using var doc = await Document.Merge(Context.Members.FromSqlRaw($"""
+ SELECT m.*
+ FROM member m
+ JOIN delivery d ON d.mgnr = m.mgnr
+ WHERE m.active AND d.year = {year}
+ GROUP BY m.mgnr
+ ORDER BY m.mgnr
+ """)
+ .ToList()
+ .Select(m => new DeliveryConfirmation(Context, year, m)));
+ await doc.Generate();
+ Mouse.OverrideCursor = null;
+ if (App.Config.Debug) {
+ doc.Show();
+ } else {
+ await doc.Print();
+ }
+ }
+
+ private void OverUnderDeliveryButton_Click(object sender, RoutedEventArgs evt) {
+ }
+
+ private void PaymentButton_Click(object sender, RoutedEventArgs evt) {
+ var w = new ChartWindow();
+ w.Show();
+ }
+ }
+}