Windows: Add SeasonFinishWindow
This commit is contained in:
@ -8,6 +8,8 @@
|
|||||||
Loaded="Window_Loaded">
|
Loaded="Window_Loaded">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<Style TargetType="Button">
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
<Setter Property="FontSize" Value="14"/>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
<Setter Property="Padding" Value="9,3"/>
|
<Setter Property="Padding" Value="9,3"/>
|
||||||
<Setter Property="Height" Value="32"/>
|
<Setter Property="Height" Value="32"/>
|
||||||
@ -39,19 +41,19 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Button x:Name="MemberAdminButton" Content="Mitglieder" Click="MemberAdminButton_Click"
|
<Button x:Name="MemberAdminButton" Content="Mitglieder" Click="MemberAdminButton_Click"
|
||||||
Margin="50,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
Margin="50,160,0,0"/>
|
||||||
<Button x:Name="ReceiptButton" Content="Übernahme" Click="ReceiptButton_Click"
|
<Button x:Name="ReceiptButton" Content="Übernahme" Click="ReceiptButton_Click"
|
||||||
Margin="50,200,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
Margin="50,200,0,0"/>
|
||||||
<Button x:Name="DeliveryAdminButton" Content="Lieferungen" Click="DeliveryAdminButton_Click"
|
<Button x:Name="DeliveryAdminButton" Content="Lieferungen" Click="DeliveryAdminButton_Click"
|
||||||
Margin="50,240,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
Margin="50,240,0,0"/>
|
||||||
<Button x:Name="PaymentWindowButton" Content="Auszahlung" Click="PaymentWindowButton_Click"
|
<Button x:Name="SeasonFinishButton" Content="Leseabschluss" Click="SeasonFinishButton_Click"
|
||||||
Margin="50,280,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
Margin="50,280,0,0"/>
|
||||||
<Button x:Name="BaseDataButton" Content="Stammdaten" Click="BaseDataButton_Click"
|
<Button x:Name="BaseDataButton" Content="Stammdaten" Click="BaseDataButton_Click"
|
||||||
Margin="50,320,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
Margin="50,320,0,0"/>
|
||||||
|
|
||||||
<Button x:Name="TestWindowButton" Content="Test Fenster" Click="TestWindowButton_Click"
|
<Button x:Name="TestWindowButton" Content="Test Fenster" Click="TestWindowButton_Click"
|
||||||
Margin="260,280,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
Margin="260,280,0,0"/>
|
||||||
<Button x:Name="QueryWindowButton" Content="Datenbankabfragen" Click="QueryWindowButton_Click"
|
<Button x:Name="QueryWindowButton" Content="Datenbankabfragen" Click="QueryWindowButton_Click"
|
||||||
Margin="260,320,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
Margin="260,320,0,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -52,8 +52,8 @@ namespace Elwig.Windows {
|
|||||||
w.Show();
|
w.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PaymentWindowButton_Click(object sender, RoutedEventArgs e) {
|
private void SeasonFinishButton_Click(object sender, RoutedEventArgs e) {
|
||||||
var w = new ChartWindow();
|
var w = new SeasonFinishWindow();
|
||||||
w.Show();
|
w.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
45
Elwig/Windows/SeasonFinishWindow.xaml
Normal file
45
Elwig/Windows/SeasonFinishWindow.xaml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<local:ContextWindow x:Class="Elwig.Windows.SeasonFinishWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Elwig.Windows"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Loaded="Window_Loaded"
|
||||||
|
Title="Leseabschluss - Elwig" Height="450" Width="800">
|
||||||
|
<Window.Resources>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="Padding" Value="9,3"/>
|
||||||
|
<Setter Property="Height" Value="32"/>
|
||||||
|
<Setter Property="Width" Value="200"/>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Label Content="Saison:" Margin="50,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="2,4,2,4" Height="25"/>
|
||||||
|
<xctk:IntegerUpDown Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1000" Maximum="9999"
|
||||||
|
Margin="110,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||||
|
ValueChanged="SeasonInput_ValueChanged"/>
|
||||||
|
|
||||||
|
<Button x:Name="CalculateBinsButton"
|
||||||
|
Click="CalculateBinsButton_Click"
|
||||||
|
Margin="50,80,0,0" FontSize="12" Height="40">
|
||||||
|
<TextBlock TextAlignment="Center">Lieferungen auf Flächen-<LineBreak/>bindungen aufteilen</TextBlock>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigungen"
|
||||||
|
Click="DeliveryConfirmationButton_Click"
|
||||||
|
Margin="50,130,0,0"/>
|
||||||
|
|
||||||
|
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
|
||||||
|
Click="OverUnderDeliveryButton_Click"
|
||||||
|
Margin="50,172,0,0"/>
|
||||||
|
|
||||||
|
<Button x:Name="PaymentButton" Content="Auszahlung"
|
||||||
|
Click="PaymentButton_Click"
|
||||||
|
Margin="50,214,0,0"/>
|
||||||
|
</Grid>
|
||||||
|
</local:ContextWindow>
|
78
Elwig/Windows/SeasonFinishWindow.xaml.cs
Normal file
78
Elwig/Windows/SeasonFinishWindow.xaml.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user