Compare commits
8 Commits
ff2968c989
...
v0.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f8e4ca812 | |||
| 450f5d8109 | |||
| 62d6707d10 | |||
| 2bcf26cc8d | |||
| daddd069a3 | |||
| 3b3489b492 | |||
| 505ee0ad24 | |||
| 0b79fa192e |
32
Elwig/Dialogs/DeliveryConfirmationsDialog.xaml
Normal file
32
Elwig/Dialogs/DeliveryConfirmationsDialog.xaml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<local:ContextWindow x:Class="Elwig.Dialogs.DeliveryConfirmationsDialog"
|
||||||
|
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"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
Title="Anlieferungsbestätingungen - Elwig" Height="400" Width="600">
|
||||||
|
<Grid>
|
||||||
|
<GroupBox Header="Sortieren nach" Margin="10,10,10,10" Width="150" Height="80" VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||||
|
<StackPanel Margin="5,5,0,5">
|
||||||
|
<RadioButton GroupName="Order" x:Name="OrderMgNrInput" Content="Mitgliedsnummer" IsChecked="True"/>
|
||||||
|
<RadioButton GroupName="Order" x:Name="OrderNameInput" Content="Name"/>
|
||||||
|
<RadioButton GroupName="Order" x:Name="OrderPlzInput" Content="PLZ, Ort, Name"/>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
|
||||||
|
<TextBox x:Name="TextElement" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" AcceptsReturn="True"
|
||||||
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="170,10,10,10" Height="Auto"/>
|
||||||
|
|
||||||
|
<Button x:Name="TestButton" Content="Stichprobe" FontSize="14" Width="150" Margin="10,10,10,74" Height="27"
|
||||||
|
Click="TestButton_Click"
|
||||||
|
VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
|
||||||
|
<Button x:Name="ShowButton" Content="Vorschau" FontSize="14" Width="150" Margin="10,10,10,42" Height="27"
|
||||||
|
Click="ShowButton_Click"
|
||||||
|
VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
|
||||||
|
<Button x:Name="PrintButton" Content="Drucken" FontSize="14" Width="150" Margin="10,10,10,10" Height="27"
|
||||||
|
Click="PrintButton_Click"
|
||||||
|
VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
|
||||||
|
</Grid>
|
||||||
|
</local:ContextWindow>
|
||||||
101
Elwig/Dialogs/DeliveryConfirmationsDialog.xaml.cs
Normal file
101
Elwig/Dialogs/DeliveryConfirmationsDialog.xaml.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using Elwig.Documents;
|
||||||
|
using Elwig.Models;
|
||||||
|
using Elwig.Windows;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Elwig.Dialogs {
|
||||||
|
public partial class DeliveryConfirmationsDialog : ContextWindow {
|
||||||
|
|
||||||
|
public readonly int Year;
|
||||||
|
|
||||||
|
public DeliveryConfirmationsDialog(int year) {
|
||||||
|
InitializeComponent();
|
||||||
|
Year = year;
|
||||||
|
Title = $"Anlieferungsbestätigungen - Lese {Year} - Elwig";
|
||||||
|
TextElement.Text = App.Client.TextDeliveryConfirmation;
|
||||||
|
if (!App.Config.Debug) {
|
||||||
|
TestButton.Visibility = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnRenewContext() { }
|
||||||
|
|
||||||
|
private async Task UpdateTextParameter() {
|
||||||
|
var text = TextElement.Text;
|
||||||
|
if (text.Length == 0) text = null;
|
||||||
|
if (text != App.Client.TextDeliveryConfirmation) {
|
||||||
|
App.Client.TextDeliveryConfirmation = text;
|
||||||
|
await App.Client.UpdateValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Generate(int mode) {
|
||||||
|
|
||||||
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
|
await UpdateTextParameter();
|
||||||
|
|
||||||
|
var members = Context.Members.FromSqlRaw($"""
|
||||||
|
SELECT m.*
|
||||||
|
FROM member m
|
||||||
|
INNER JOIN delivery d ON d.mgnr = m.mgnr
|
||||||
|
WHERE d.year = {Year}
|
||||||
|
GROUP BY m.mgnr
|
||||||
|
""");
|
||||||
|
if (OrderMgNrInput.IsChecked == true) {
|
||||||
|
members = members
|
||||||
|
.OrderBy(m => m.MgNr);
|
||||||
|
} else if (OrderNameInput.IsChecked == true) {
|
||||||
|
members = members
|
||||||
|
.OrderBy(m => m.FamilyName)
|
||||||
|
.ThenBy(m => m.GivenName)
|
||||||
|
.ThenBy(m => m.MgNr);
|
||||||
|
} else if (OrderPlzInput.IsChecked == true) {
|
||||||
|
members = members
|
||||||
|
.OrderBy(m => m.PostalDest.AtPlz.Plz)
|
||||||
|
.ThenBy(m => m.PostalDest.AtPlz.Ort.Name)
|
||||||
|
.ThenBy(m => m.FamilyName)
|
||||||
|
.ThenBy(m => m.GivenName)
|
||||||
|
.ThenBy(m => m.MgNr);
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerable<Member> list = await members.ToListAsync();
|
||||||
|
if (mode == 0) {
|
||||||
|
var r = new Random().Next(0, 10);
|
||||||
|
list = list.Where((_, n) => n % 10 == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
using var doc = await Document.Merge(list.Select(m => new DeliveryConfirmation(Context, Year, m))); ;
|
||||||
|
await doc.Generate();
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
|
||||||
|
if (mode < 2) {
|
||||||
|
doc.Show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (App.Config.Debug) {
|
||||||
|
doc.Show();
|
||||||
|
} else {
|
||||||
|
await doc.Print();
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void TestButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
await Generate(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ShowButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
await Generate(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void PrintButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
await Generate(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -78,6 +78,8 @@ table.delivery-confirmation-stats {
|
|||||||
table.delivery-confirmation-stats th,
|
table.delivery-confirmation-stats th,
|
||||||
table.delivery-confirmation-stats td {
|
table.delivery-confirmation-stats td {
|
||||||
padding: 0.125mm 0;
|
padding: 0.125mm 0;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.delivery-confirmation-stats tr.subheading th {
|
table.delivery-confirmation-stats tr.subheading th {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||||
<ApplicationIcon>elwig.ico</ApplicationIcon>
|
<ApplicationIcon>elwig.ico</ApplicationIcon>
|
||||||
<Version>0.3.7</Version>
|
<Version>0.4.0</Version>
|
||||||
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace Elwig.Helpers.Billing {
|
|||||||
var u = used.GetValueOrDefault(key, 0);
|
var u = used.GetValueOrDefault(key, 0);
|
||||||
var vr = Math.Max(0, Math.Min(rightsAndObligations[key].Item1 - u, w));
|
var vr = Math.Max(0, Math.Min(rightsAndObligations[key].Item1 - u, w));
|
||||||
var vo = Math.Max(0, Math.Min(rightsAndObligations[key].Item2 - u, w));
|
var vo = Math.Max(0, Math.Min(rightsAndObligations[key].Item2 - u, w));
|
||||||
var v = (c == 0 || p.Select(a => attrVals[a]).Min() == 2) ? vr : vo;
|
var v = (attributes.Length == 0 || attributes.Select(a => attrVals[a]).Min() == 2) ? vr : vo;
|
||||||
used[key] = u + v;
|
used[key] = u + v;
|
||||||
inserts.Add((did, dpnr, i, key[2..], v));
|
inserts.Add((did, dpnr, i, key[2..], v));
|
||||||
w -= v;
|
w -= v;
|
||||||
|
|||||||
@@ -32,12 +32,16 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image Source="/elwig.png" RenderOptions.BitmapScalingMode="HighQuality" Grid.Column="0"
|
<Image Source="/elwig.png" RenderOptions.BitmapScalingMode="HighQuality" Grid.Column="0"
|
||||||
HorizontalAlignment="Left" Margin="5,5,5,5" VerticalAlignment="Top"/>
|
HorizontalAlignment="Left" Margin="5,5,5,5" VerticalAlignment="Top"/>
|
||||||
<Label Grid.Column="1" Content="Elwig" FontSize="32"
|
<TextBlock Grid.Column="1" FontSize="32" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top">
|
||||||
HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top"/>
|
Elwig
|
||||||
<Label Grid.Column="1" Content="Elektonische Winzer-"
|
</TextBlock>
|
||||||
HorizontalAlignment="Left" Margin="0,55,0,0" VerticalAlignment="Top"/>
|
<TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="0,50,0,0" VerticalAlignment="Top" LineHeight="14" LineStackingStrategy="BlockLineHeight">
|
||||||
<Label Grid.Column="1" Content="genossenschaftsverwaltung"
|
Elektonische Winzer-<LineBreak/>
|
||||||
HorizontalAlignment="Left" Margin="0,70,0,0" VerticalAlignment="Top"/>
|
genossenschaftsverwaltung
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock x:Name="VersionField" Grid.Column="1" FontSize="10" HorizontalAlignment="Left" Margin="0,80,0,0" VerticalAlignment="Top">
|
||||||
|
Version: ?
|
||||||
|
</TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Button x:Name="MemberAdminButton" Content="Mitglieder" Click="MemberAdminButton_Click"
|
<Button x:Name="MemberAdminButton" Content="Mitglieder" Click="MemberAdminButton_Click"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Reflection;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace Elwig.Windows {
|
namespace Elwig.Windows {
|
||||||
@@ -5,6 +6,8 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
public MainWindow() {
|
public MainWindow() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
var v = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
VersionField.Text = "Version: " + (v == null ? "?" : $"{v.Major}.{v.Minor}.{v.Build}");
|
||||||
if (!App.Config.Debug) {
|
if (!App.Config.Debug) {
|
||||||
TestWindowButton.Visibility = Visibility.Hidden;
|
TestWindowButton.Visibility = Visibility.Hidden;
|
||||||
//QueryWindowButton.Visibility = Visibility.Hidden;
|
//QueryWindowButton.Visibility = Visibility.Hidden;
|
||||||
|
|||||||
@@ -59,6 +59,8 @@
|
|||||||
Click="Menu_Print_Letterheads_MgNr_Click"/>
|
Click="Menu_Print_Letterheads_MgNr_Click"/>
|
||||||
<MenuItem x:Name="Menu_Print_Letterheads_Name" Header="nach Name sortiert" IsEnabled="False" Tag="Print"
|
<MenuItem x:Name="Menu_Print_Letterheads_Name" Header="nach Name sortiert" IsEnabled="False" Tag="Print"
|
||||||
Click="Menu_Print_Letterheads_Name_Click"/>
|
Click="Menu_Print_Letterheads_Name_Click"/>
|
||||||
|
<MenuItem x:Name="Menu_Print_Letterheads_Plz" Header="nach PLZ, Ort, Name sortiert" IsEnabled="False" Tag="Print"
|
||||||
|
Click="Menu_Print_Letterheads_Plz_Click"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Rundschreiben">
|
<MenuItem Header="Rundschreiben">
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Menu_Print_Letterheads_MgNr_Click(object sender, RoutedEventArgs evt) {
|
private async Task PrintLetterheads(int ordering) {
|
||||||
var n = await Context.Members.CountAsync(m => m.IsActive);
|
var n = await Context.Members.CountAsync(m => m.IsActive);
|
||||||
var res = MessageBox.Show(
|
var res = MessageBox.Show(
|
||||||
$"Sollen wirklich {n} Seiten gedruckt werden?", "Ausdruck Bestätigen",
|
$"Sollen wirklich {n} Seiten gedruckt werden?", "Ausdruck Bestätigen",
|
||||||
@@ -299,10 +299,25 @@ namespace Elwig.Windows {
|
|||||||
if (res != MessageBoxResult.Yes)
|
if (res != MessageBoxResult.Yes)
|
||||||
return;
|
return;
|
||||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
using var doc = await Document.Merge(Context.Members
|
var members = Context.Members.Where(m => m.IsActive && m.ContactViaPost);
|
||||||
.Where(m => m.IsActive && m.ContactViaPost)
|
switch (ordering) {
|
||||||
.OrderBy(m => m.MgNr)
|
case 0: members = members
|
||||||
.Select(m => new Letterhead(m)));
|
.OrderBy(m => m.MgNr);
|
||||||
|
break;
|
||||||
|
case 1: members = members
|
||||||
|
.OrderBy(m => m.FamilyName)
|
||||||
|
.ThenBy(m => m.GivenName)
|
||||||
|
.ThenBy(m => m.MgNr);
|
||||||
|
break;
|
||||||
|
case 2: members = members
|
||||||
|
.OrderBy(m => m.PostalDest.AtPlz.Plz)
|
||||||
|
.ThenBy(m => m.PostalDest.AtPlz.Ort.Name)
|
||||||
|
.ThenBy(m => m.FamilyName)
|
||||||
|
.ThenBy(m => m.GivenName)
|
||||||
|
.ThenBy(m => m.MgNr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
using var doc = await Document.Merge((await members.ToListAsync()).Select(m => new Letterhead(m)));
|
||||||
await doc.Generate();
|
await doc.Generate();
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
if (App.Config.Debug) {
|
if (App.Config.Debug) {
|
||||||
@@ -312,26 +327,16 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void Menu_Print_Letterheads_MgNr_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
await PrintLetterheads(0);
|
||||||
|
}
|
||||||
|
|
||||||
private async void Menu_Print_Letterheads_Name_Click(object sender, RoutedEventArgs evt) {
|
private async void Menu_Print_Letterheads_Name_Click(object sender, RoutedEventArgs evt) {
|
||||||
var n = await Context.Members.CountAsync(m => m.IsActive);
|
await PrintLetterheads(1);
|
||||||
var res = MessageBox.Show(
|
}
|
||||||
$"Sollen wirklich {n} Seiten gedruckt werden?", "Ausdruck Bestätigen",
|
|
||||||
MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
|
private async void Menu_Print_Letterheads_Plz_Click(object sender, RoutedEventArgs evt) {
|
||||||
if (res != MessageBoxResult.Yes)
|
await PrintLetterheads(2);
|
||||||
return;
|
|
||||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
|
||||||
using var doc = await Document.Merge(Context.Members
|
|
||||||
.Where(m => m.IsActive && m.ContactViaPost)
|
|
||||||
.OrderBy(m => m.FamilyName)
|
|
||||||
.ThenBy(m => m.GivenName)
|
|
||||||
.Select(m => new Letterhead(m)));
|
|
||||||
await doc.Generate();
|
|
||||||
Mouse.OverrideCursor = null;
|
|
||||||
if (App.Config.Debug) {
|
|
||||||
doc.Show();
|
|
||||||
} else {
|
|
||||||
await doc.Print();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FocusSearchInput(object sender, RoutedEventArgs evt) {
|
private void FocusSearchInput(object sender, RoutedEventArgs evt) {
|
||||||
|
|||||||
@@ -24,29 +24,27 @@
|
|||||||
Margin="110,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"
|
Margin="110,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||||
ValueChanged="SeasonInput_ValueChanged"/>
|
ValueChanged="SeasonInput_ValueChanged"/>
|
||||||
|
|
||||||
<Button x:Name="CalculateBinsButton"
|
<Button x:Name="CalculateBinsButton" Content="Aufteilung Berechnen"
|
||||||
Click="CalculateBinsButton_Click"
|
Click="CalculateBinsButton_Click"
|
||||||
Margin="50,80,0,0" FontSize="12" Height="40">
|
Margin="50,80,0,0"/>
|
||||||
<TextBlock TextAlignment="Center">Lieferungen auf Flächen-<LineBreak/>bindungen aufteilen</TextBlock>
|
<CheckBox x:Name="AllowAttrIntoLowerBinsInput" Content="Erlauben Lieferungen auch auf (konfigurierte) "schlechtere" Flächenbindungen aufzuteilen" IsChecked="True"
|
||||||
</Button>
|
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="255,68,0,0"/>
|
||||||
<CheckBox x:Name="AllowAttrIntoLowerBinsInput" Content="Lieferungen auch auf "schlechtere" Flächenbindungen aufteilen" IsChecked="True"
|
<CheckBox x:Name="AvoidUnderDeliveriesInput" Content="Unterlieferungen durch Abzug bei "besseren" Flächenbindungen vermeiden" IsEnabled="False"
|
||||||
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="255,72,0,0"/>
|
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="255,88,0,0"/>
|
||||||
<CheckBox x:Name="AvoidUnderDeliveriesInput" Content="Unterlieferungen vermeiden" IsEnabled="False"
|
<CheckBox x:Name="HonorGebundenInput" Margin="255,108,0,0" VerticalAlignment="Top">
|
||||||
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="255,92,0,0"/>
|
|
||||||
<CheckBox x:Name="HonorGebundenInput" Margin="255,112,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
|
|
||||||
<TextBlock>Bei Lieferungen das Feld <Italic>Gebunden</Italic> berücksichtigen</TextBlock>
|
<TextBlock>Bei Lieferungen das Feld <Italic>Gebunden</Italic> berücksichtigen</TextBlock>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
|
||||||
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigungen"
|
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigungen"
|
||||||
Click="DeliveryConfirmationButton_Click"
|
Click="DeliveryConfirmationButton_Click"
|
||||||
Margin="50,130,0,0"/>
|
Margin="50,122,0,0"/>
|
||||||
|
|
||||||
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
|
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
|
||||||
Click="OverUnderDeliveryButton_Click"
|
Click="OverUnderDeliveryButton_Click"
|
||||||
Margin="50,172,0,0"/>
|
Margin="50,164,0,0"/>
|
||||||
|
|
||||||
<Button x:Name="PaymentButton" Content="Auszahlung"
|
<Button x:Name="PaymentButton" Content="Auszahlung"
|
||||||
Click="PaymentButton_Click"
|
Click="PaymentButton_Click"
|
||||||
Margin="50,214,0,0"/>
|
Margin="50,206,0,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</local:ContextWindow>
|
</local:ContextWindow>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using Elwig.Documents;
|
using Elwig.Dialogs;
|
||||||
using Elwig.Helpers;
|
using Elwig.Helpers;
|
||||||
using Elwig.Helpers.Billing;
|
using Elwig.Helpers.Billing;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@@ -18,13 +16,15 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnRenewContext() {
|
protected override async Task OnRenewContext() {
|
||||||
|
SeasonInput_ValueChanged(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void SeasonInput_ValueChanged(object sender, RoutedEventArgs evt) {
|
private async void SeasonInput_ValueChanged(object? sender, RoutedEventArgs? evt) {
|
||||||
var s = await Context.Seasons.FindAsync(SeasonInput.Value);
|
var s0 = await Context.Seasons.FindAsync(SeasonInput.Value);
|
||||||
var valid = (s != null);
|
var s1 = await Context.Seasons.FindAsync(SeasonInput.Value + 1);
|
||||||
CalculateBinsButton.IsEnabled = valid;
|
var valid = (s0 != null);
|
||||||
|
var last = (s1 == null);
|
||||||
|
CalculateBinsButton.IsEnabled = valid && last;
|
||||||
DeliveryConfirmationButton.IsEnabled = valid;
|
DeliveryConfirmationButton.IsEnabled = valid;
|
||||||
OverUnderDeliveryButton.IsEnabled = valid;
|
OverUnderDeliveryButton.IsEnabled = valid;
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,7 @@ namespace Elwig.Windows {
|
|||||||
private async void CalculateBinsButton_Click(object sender, RoutedEventArgs evt) {
|
private async void CalculateBinsButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
if (SeasonInput.Value is not int year)
|
if (SeasonInput.Value is not int year)
|
||||||
return;
|
return;
|
||||||
|
CalculateBinsButton.IsEnabled = false;
|
||||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
var b = new Billing(year);
|
var b = new Billing(year);
|
||||||
await b.FinishSeason();
|
await b.FinishSeason();
|
||||||
@@ -40,34 +41,14 @@ namespace Elwig.Windows {
|
|||||||
AvoidUnderDeliveriesInput.IsChecked ?? false,
|
AvoidUnderDeliveriesInput.IsChecked ?? false,
|
||||||
HonorGebundenInput.IsChecked ?? false);
|
HonorGebundenInput.IsChecked ?? false);
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
|
CalculateBinsButton.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void DeliveryConfirmationButton_Click(object sender, RoutedEventArgs evt) {
|
private void DeliveryConfirmationButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
if (SeasonInput.Value is not int year)
|
if (SeasonInput.Value is not int year)
|
||||||
return;
|
return;
|
||||||
var res = MessageBox.Show(
|
var d = new DeliveryConfirmationsDialog(year);
|
||||||
$"Sollen wirklich alle Bestätigungen gedruckt werden?", "Ausdruck Bestätigen",
|
d.Show();
|
||||||
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 OverUnderDeliveryButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
|||||||
Reference in New Issue
Block a user