Windows: Remove SeasonFinishWindow and TestWindow
This commit is contained in:
@ -273,10 +273,6 @@ namespace Elwig {
|
|||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SeasonFinishWindow FocusSeasonFinish() {
|
|
||||||
return FocusWindow<SeasonFinishWindow>(() => new());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static OriginHierarchyWindow FocusOriginHierarchy() {
|
public static OriginHierarchyWindow FocusOriginHierarchy() {
|
||||||
return FocusWindow<OriginHierarchyWindow>(() => new());
|
return FocusWindow<OriginHierarchyWindow>(() => new());
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,22 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Parameter">
|
<TabItem Header="Parameter">
|
||||||
|
<Grid>
|
||||||
|
<GroupBox x:Name="ParameterAreaComGroup" Header="Berechnung Flächenbindungen (aktuelle Saison)" Margin="10,10,10,10" VerticalAlignment="Top">
|
||||||
|
<Grid>
|
||||||
|
<CheckBox x:Name="ParameterAllowAttrIntoLowerInput" Content="Erlauben Lieferungen auch auf (konfigurierte) "schlechtere" Flächenbindungen aufzuteilen"
|
||||||
|
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,10,10,10"
|
||||||
|
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
|
||||||
|
<CheckBox x:Name="ParameterAvoidUnderDeliveriesInput" Content="Unterlieferungen durch Abzug bei "besseren" Flächenbindungen vermeiden"
|
||||||
|
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,30,10,10"
|
||||||
|
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
|
||||||
|
<CheckBox x:Name="ParameterHonorGebundenInput" Margin="10,50,10,10" VerticalAlignment="Top"
|
||||||
|
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed">
|
||||||
|
<TextBlock>Bei Lieferungen das Feld <Italic>Gebunden</Italic> berücksichtigen</TextBlock>
|
||||||
|
</CheckBox>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Textelemente">
|
<TabItem Header="Textelemente">
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Visible">
|
<ScrollViewer VerticalScrollBarVisibility="Visible">
|
||||||
|
@ -35,6 +35,7 @@ namespace Elwig.Windows {
|
|||||||
];
|
];
|
||||||
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
|
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
|
||||||
WineAttributeFillLowerLabel.Visibility = Visibility.Hidden;
|
WineAttributeFillLowerLabel.Visibility = Visibility.Hidden;
|
||||||
|
ParameterAreaComGroup.Header = ParameterAreaComGroup.Header.ToString()!.Split('(')[0] + $"({Utils.CurrentLastSeason})";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ShortcutNew() { }
|
protected override void ShortcutNew() { }
|
||||||
@ -85,6 +86,10 @@ namespace Elwig.Windows {
|
|||||||
SeasonModifierNameInput.IsReadOnly = true;
|
SeasonModifierNameInput.IsReadOnly = true;
|
||||||
SeasonModifierRelInput.TextBox.IsReadOnly = true;
|
SeasonModifierRelInput.TextBox.IsReadOnly = true;
|
||||||
SeasonModifierAbsInput.TextBox.IsReadOnly = true;
|
SeasonModifierAbsInput.TextBox.IsReadOnly = true;
|
||||||
|
|
||||||
|
ParameterAllowAttrIntoLowerInput.IsEnabled = false;
|
||||||
|
ParameterAvoidUnderDeliveriesInput.IsEnabled = false;
|
||||||
|
ParameterHonorGebundenInput.IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
new protected void UnlockInputs() {
|
new protected void UnlockInputs() {
|
||||||
@ -131,6 +136,10 @@ namespace Elwig.Windows {
|
|||||||
SeasonModifierNameInput.IsReadOnly = false;
|
SeasonModifierNameInput.IsReadOnly = false;
|
||||||
SeasonModifierRelInput.TextBox.IsReadOnly = false;
|
SeasonModifierRelInput.TextBox.IsReadOnly = false;
|
||||||
SeasonModifierAbsInput.TextBox.IsReadOnly = false;
|
SeasonModifierAbsInput.TextBox.IsReadOnly = false;
|
||||||
|
|
||||||
|
ParameterAllowAttrIntoLowerInput.IsEnabled = true;
|
||||||
|
ParameterAvoidUnderDeliveriesInput.IsEnabled = true;
|
||||||
|
ParameterHonorGebundenInput.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs evt) {
|
private void Window_Loaded(object sender, RoutedEventArgs evt) {
|
||||||
@ -211,6 +220,7 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
private async Task Save() {
|
private async Task Save() {
|
||||||
await UpdateClientParameters(App.Client);
|
await UpdateClientParameters(App.Client);
|
||||||
|
await UpdateParameters(Utils.CurrentLastSeason);
|
||||||
using var tx = await EditContext!.Database.BeginTransactionAsync();
|
using var tx = await EditContext!.Database.BeginTransactionAsync();
|
||||||
await BranchesSave(EditContext!);
|
await BranchesSave(EditContext!);
|
||||||
await WineAttributesSave(EditContext!);
|
await WineAttributesSave(EditContext!);
|
||||||
@ -383,5 +393,19 @@ namespace Elwig.Windows {
|
|||||||
ClientNameFull.Text = $"{ClientNameInput.Text}{(suffix != null ? $", {suffix}," : "")} {ClientNameTypeInput.Text}";
|
ClientNameFull.Text = $"{ClientNameInput.Text}{(suffix != null ? $", {suffix}," : "")} {ClientNameTypeInput.Text}";
|
||||||
TextBox_TextChanged(sender, evt);
|
TextBox_TextChanged(sender, evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task UpdateParameters(int year) {
|
||||||
|
try {
|
||||||
|
using var ctx = new AppDbContext();
|
||||||
|
if (await ctx.Seasons.FindAsync(year) is not Season s)
|
||||||
|
return;
|
||||||
|
|
||||||
|
s.Billing_AllowAttrsIntoLower = ParameterAllowAttrIntoLowerInput.IsChecked ?? false;
|
||||||
|
s.Billing_AvoidUnderDeliveries = ParameterAvoidUnderDeliveriesInput.IsChecked ?? false;
|
||||||
|
s.Billing_HonorGebunden = ParameterHonorGebundenInput.IsChecked ?? false;
|
||||||
|
ctx.Update(s);
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,20 @@ namespace Elwig.Windows {
|
|||||||
if (doc.Type == DocType.DeliveryConfirmation) {
|
if (doc.Type == DocType.DeliveryConfirmation) {
|
||||||
var details = ((int, bool))doc.Details!;
|
var details = ((int, bool))doc.Details!;
|
||||||
var year = details.Item1;
|
var year = details.Item1;
|
||||||
dcData[year] = await DeliveryConfirmationDeliveryData.ForSeason(ctx.DeliveryParts, year);
|
|
||||||
|
try {
|
||||||
|
var b = new Billing(year);
|
||||||
|
await b.FinishSeason();
|
||||||
|
await b.CalculateBuckets();
|
||||||
|
await App.HintContextChange();
|
||||||
|
|
||||||
|
dcData[year] = await DeliveryConfirmationDeliveryData.ForSeason(ctx.DeliveryParts, year);
|
||||||
|
} catch (Exception exc) {
|
||||||
|
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
GenerateButton.IsEnabled = true;
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else if (doc.Type == DocType.CreditNote) {
|
} else if (doc.Type == DocType.CreditNote) {
|
||||||
var details = ((int, int))doc.Details!;
|
var details = ((int, int))doc.Details!;
|
||||||
var year = details.Item1;
|
var year = details.Item1;
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
<Window x:Class="Elwig.Windows.MainWindow"
|
<local:ContextWindow
|
||||||
|
x:Class="Elwig.Windows.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:Elwig.Windows"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
Title="Elwig" Height="390" Width="520" ResizeMode="CanMinimize"
|
Title="Elwig" Height="390" Width="520" ResizeMode="CanMinimize"
|
||||||
Loaded="Window_Loaded" Closing="Window_Closing">
|
Loaded="Window_Loaded" Closing="Window_Closing">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
@ -17,13 +20,13 @@
|
|||||||
<Menu BorderThickness="0,0,0,1" VerticalAlignment="Top" Height="19" BorderBrush="LightGray" Background="White">
|
<Menu BorderThickness="0,0,0,1" VerticalAlignment="Top" Height="19" BorderBrush="LightGray" Background="White">
|
||||||
<MenuItem Header="Datenbank">
|
<MenuItem Header="Datenbank">
|
||||||
<MenuItem Header="Abfragen stellen" Click="Menu_Database_Query_Click"/>
|
<MenuItem Header="Abfragen stellen" Click="Menu_Database_Query_Click"/>
|
||||||
<!--MenuItem Header="Backup erstellen"/-->
|
<MenuItem Header="Speicherort öffnen..." Click="Menu_Database_Open_Click"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem x:Name="HelpMenu" Header="Hilfe">
|
<MenuItem x:Name="HelpMenu" Header="Hilfe">
|
||||||
<MenuItem Header="Über"/>
|
<MenuItem Header="Über"/>
|
||||||
<MenuItem x:Name="Menu_Help_Update" Header="Nach Updates suchen" Click="Menu_Help_Update_Click"/>
|
<MenuItem x:Name="Menu_Help_Update" Header="Nach Updates suchen" Click="Menu_Help_Update_Click"/>
|
||||||
<MenuItem x:Name="Menu_Help_Smtp" Header="E-Mail-Einstellungen testen" Click="Menu_Help_Smtp_Click"/>
|
<MenuItem x:Name="Menu_Help_Smtp" Header="E-Mail-Einstellungen testen" Click="Menu_Help_Smtp_Click"/>
|
||||||
<MenuItem x:Name="Menu_Help_TestWindow" Header="Test-Fenster" Click="Menu_Help_TestWindow_Click"/>
|
<MenuItem x:Name="Menu_Help_Config" Header="Konfigurationsspeicherort öffnen..." Click="Menu_Help_Config_Click"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|
||||||
@ -56,7 +59,34 @@
|
|||||||
Margin="210,220,0,0"/>
|
Margin="210,220,0,0"/>
|
||||||
<Button x:Name="BaseDataButton" Content="Stammdaten" Click="BaseDataButton_Click"
|
<Button x:Name="BaseDataButton" Content="Stammdaten" Click="BaseDataButton_Click"
|
||||||
Margin="0,260,210,0"/>
|
Margin="0,260,210,0"/>
|
||||||
<Button x:Name="SeasonFinishButton" Content="Leseabschluss" Click="SeasonFinishButton_Click"
|
<Button x:Name="RegistrationButton" Content="Anmeldungen" IsEnabled="False"
|
||||||
Margin="210,260,0,0"/>
|
Margin="210,260,0,0"/>
|
||||||
|
|
||||||
|
<Expander x:Name="SeasonFinish" Header="Leseabschluss" Expanded="SeasonFinish_Expanded" Collapsed="SeasonFinish_Collapsed"
|
||||||
|
HorizontalAlignment="Center" Width="410" Margin="0,300,0,0" VerticalAlignment="Top">
|
||||||
|
<Grid>
|
||||||
|
<Border BorderBrush="LightGray" BorderThickness="1"/>
|
||||||
|
<Label Content="Saison:" Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Center" Padding="2,4,2,4" Height="25"/>
|
||||||
|
<xctk:IntegerUpDown Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1000" Maximum="9999"
|
||||||
|
Margin="0,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
|
||||||
|
ValueChanged="SeasonInput_ValueChanged"/>
|
||||||
|
|
||||||
|
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigung"
|
||||||
|
Click="DeliveryConfirmationButton_Click"
|
||||||
|
Margin="0,50,200,10" Width="190"/>
|
||||||
|
|
||||||
|
<Button x:Name="PaymentButton" Content="Auszahlung"
|
||||||
|
Click="PaymentButton_Click"
|
||||||
|
Margin="200,50,0,10" Width="190"/>
|
||||||
|
|
||||||
|
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
|
||||||
|
Click="OverUnderDeliveryButton_Click"
|
||||||
|
Margin="0,90,200,10" Width="190"/>
|
||||||
|
|
||||||
|
<Button x:Name="AutoBusinessSharesButton" Content="Autom. GA nachzeichnen"
|
||||||
|
Click="AutoBusinessSharesButton_Click" IsEnabled="False"
|
||||||
|
Margin="200,90,0,10" Width="190"/>
|
||||||
|
</Grid>
|
||||||
|
</Expander>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</local:ContextWindow>
|
||||||
|
@ -1,27 +1,32 @@
|
|||||||
using Elwig.Helpers;
|
using Elwig.Helpers;
|
||||||
|
using Elwig.Helpers.Billing;
|
||||||
|
using Elwig.Helpers.Export;
|
||||||
|
using Elwig.Models.Dtos;
|
||||||
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Elwig.Windows {
|
namespace Elwig.Windows {
|
||||||
public partial class MainWindow : Window {
|
public partial class MainWindow : ContextWindow {
|
||||||
|
|
||||||
public MainWindow() {
|
public MainWindow() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
var v = Assembly.GetExecutingAssembly().GetName().Version;
|
var v = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
VersionField.Text = "Version: " + (v == null ? "?" : $"{v.Major}.{v.Minor}.{v.Build}") + $" – {App.BranchName}";
|
VersionField.Text = "Version: " + (v == null ? "?" : $"{v.Major}.{v.Minor}.{v.Build}") + $" – {App.BranchName}";
|
||||||
if (App.Client.Client == null) VersionField.Text += " (Unbekannt)";
|
if (App.Client.Client == null) VersionField.Text += " (Unbekannt)";
|
||||||
if (!App.Config.Debug) {
|
|
||||||
HelpMenu.Items.Remove(Menu_Help_TestWindow);
|
|
||||||
//QueryWindowButton.Visibility = Visibility.Hidden;
|
|
||||||
}
|
|
||||||
if (App.Config.UpdateUrl == null) Menu_Help_Update.IsEnabled = false;
|
if (App.Config.UpdateUrl == null) Menu_Help_Update.IsEnabled = false;
|
||||||
if (App.Config.Smtp == null) Menu_Help_Smtp.IsEnabled = false;
|
if (App.Config.Smtp == null) Menu_Help_Smtp.IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs evt) { }
|
private void Window_Loaded(object sender, RoutedEventArgs evt) {
|
||||||
|
SeasonInput.Value = Utils.CurrentLastSeason;
|
||||||
|
}
|
||||||
|
|
||||||
private void Window_Closing(object sender, CancelEventArgs evt) {
|
private void Window_Closing(object sender, CancelEventArgs evt) {
|
||||||
if (App.NumWindows > 1 && !App.ForceShutdown) {
|
if (App.NumWindows > 1 && !App.ForceShutdown) {
|
||||||
@ -35,11 +40,6 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Menu_Help_TestWindow_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
var w = new TestWindow();
|
|
||||||
w.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void Menu_Help_Update_Click(object sender, RoutedEventArgs evt) {
|
private async void Menu_Help_Update_Click(object sender, RoutedEventArgs evt) {
|
||||||
await App.CheckForUpdates();
|
await App.CheckForUpdates();
|
||||||
}
|
}
|
||||||
@ -56,11 +56,20 @@ namespace Elwig.Windows {
|
|||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Menu_Help_Config_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
Process.Start("explorer.exe", App.DataPath);
|
||||||
|
}
|
||||||
|
|
||||||
private void Menu_Database_Query_Click(object sender, RoutedEventArgs evt) {
|
private void Menu_Database_Query_Click(object sender, RoutedEventArgs evt) {
|
||||||
var w = new QueryWindow();
|
var w = new QueryWindow();
|
||||||
w.Show();
|
w.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Menu_Database_Open_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
if (Path.GetDirectoryName(App.Config.DatabaseFile) is string path)
|
||||||
|
Process.Start("explorer.exe", path);
|
||||||
|
}
|
||||||
|
|
||||||
private void MemberAdminButton_Click(object sender, RoutedEventArgs evt) {
|
private void MemberAdminButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
var w = new MemberAdminWindow();
|
var w = new MemberAdminWindow();
|
||||||
w.Show();
|
w.Show();
|
||||||
@ -79,12 +88,98 @@ namespace Elwig.Windows {
|
|||||||
App.FocusBaseData();
|
App.FocusBaseData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SeasonFinishButton_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
App.FocusSeasonFinish();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MailButton_Click(object sender, RoutedEventArgs evt) {
|
private void MailButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
App.FocusMailWindow();
|
App.FocusMailWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Task OnRenewContext(AppDbContext ctx) {
|
||||||
|
SeasonInput_ValueChanged(null, null);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SeasonFinish_Expanded(object sender, RoutedEventArgs evt) {
|
||||||
|
Height = 530;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SeasonFinish_Collapsed(object sender, RoutedEventArgs evt) {
|
||||||
|
Height = 390;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void SeasonInput_ValueChanged(object? sender, RoutedEventArgs? evt) {
|
||||||
|
using var ctx = new AppDbContext();
|
||||||
|
var s0 = await ctx.Seasons.FindAsync(SeasonInput.Value);
|
||||||
|
var valid = (s0 != null);
|
||||||
|
DeliveryConfirmationButton.IsEnabled = valid;
|
||||||
|
OverUnderDeliveryButton.IsEnabled = valid;
|
||||||
|
AutoBusinessSharesButton.IsEnabled = valid && false;
|
||||||
|
PaymentButton.IsEnabled = valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeliveryConfirmationButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
if (SeasonInput.Value is not int year)
|
||||||
|
return;
|
||||||
|
var w = App.FocusMailWindow(year);
|
||||||
|
w.AddDeliveryConfirmation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OverUnderDeliveryButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
if (SeasonInput.Value is not int year)
|
||||||
|
return;
|
||||||
|
var d = new SaveFileDialog() {
|
||||||
|
FileName = $"Über-Unterlieferungen-{year}.ods",
|
||||||
|
DefaultExt = "ods",
|
||||||
|
Filter = "OpenDocument Format Spreadsheet (*.ods)|*.ods",
|
||||||
|
Title = $"Über-/Unterlieferungen {year} speichern unter - Elwig"
|
||||||
|
};
|
||||||
|
if (d.ShowDialog() == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
|
try {
|
||||||
|
var b = new Billing(year);
|
||||||
|
await b.FinishSeason();
|
||||||
|
await b.CalculateBuckets();
|
||||||
|
await App.HintContextChange();
|
||||||
|
|
||||||
|
using var ctx = new AppDbContext();
|
||||||
|
var tbl1 = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, year);
|
||||||
|
var tbl2 = await AreaComUnderDeliveryData.ForSeason(ctx.AreaComUnderDeliveryRows, year);
|
||||||
|
var tbl3 = await MemberDeliveryPerVariantData.ForSeason(ctx.MemberDeliveryPerVariantRows, year);
|
||||||
|
using var ods = new OdsFile(d.FileName);
|
||||||
|
await ods.AddTable(tbl1);
|
||||||
|
await ods.AddTable(tbl2);
|
||||||
|
await ods.AddTable(tbl3);
|
||||||
|
} catch (Exception exc) {
|
||||||
|
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void AutoBusinessSharesButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
if (SeasonInput.Value is not int year)
|
||||||
|
return;
|
||||||
|
if (false && App.Client.IsMatzen) {
|
||||||
|
AutoBusinessSharesButton.IsEnabled = false;
|
||||||
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
|
|
||||||
|
var b = new Billing(year);
|
||||||
|
await b.AutoAdjustBusinessShare();
|
||||||
|
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
AutoBusinessSharesButton.IsEnabled = true;
|
||||||
|
} else {
|
||||||
|
MessageBox.Show(
|
||||||
|
"Es ist kein automatisches Nachzeichnen der Geschäftsanteile\n" +
|
||||||
|
"für diese Genossenschaft eingestellt!\n" +
|
||||||
|
"Bitte wenden Sie sich an die Programmierer!", "Fehler",
|
||||||
|
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PaymentButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
if (SeasonInput.Value is not int year)
|
||||||
|
return;
|
||||||
|
App.FocusPaymentVariants(year);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ using System.Diagnostics;
|
|||||||
using Elwig.Models.Dtos;
|
using Elwig.Models.Dtos;
|
||||||
using Elwig.Helpers.Export;
|
using Elwig.Helpers.Export;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using Elwig.Helpers.Billing;
|
||||||
|
|
||||||
namespace Elwig.Windows {
|
namespace Elwig.Windows {
|
||||||
public partial class MemberAdminWindow : AdministrationWindow {
|
public partial class MemberAdminWindow : AdministrationWindow {
|
||||||
@ -637,6 +638,11 @@ namespace Elwig.Windows {
|
|||||||
private static async Task GenerateDeliveryConfirmation(Member m, int year, ExportMode mode) {
|
private static async Task GenerateDeliveryConfirmation(Member m, int year, ExportMode mode) {
|
||||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
try {
|
try {
|
||||||
|
var b = new Billing(year);
|
||||||
|
await b.FinishSeason();
|
||||||
|
await b.CalculateBuckets();
|
||||||
|
await App.HintContextChange();
|
||||||
|
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
var data = await DeliveryConfirmationDeliveryData.ForMember(ctx.DeliveryParts, year, m);
|
var data = await DeliveryConfirmationDeliveryData.ForMember(ctx.DeliveryParts, year, m);
|
||||||
using var doc = new DeliveryConfirmation(ctx, year, m, data);
|
using var doc = new DeliveryConfirmation(ctx, year, m, data);
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
<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="CalculateBucketsButton" Content="Aufteilung Berechnen"
|
|
||||||
Click="CalculateBucketsButton_Click"
|
|
||||||
Margin="50,80,0,0"/>
|
|
||||||
<CheckBox x:Name="AllowAttrIntoLowerInput" Content="Erlauben Lieferungen auch auf (konfigurierte) "schlechtere" Flächenbindungen aufzuteilen"
|
|
||||||
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="255,68,0,0"/>
|
|
||||||
<CheckBox x:Name="AvoidUnderDeliveriesInput" Content="Unterlieferungen durch Abzug bei "besseren" Flächenbindungen vermeiden"
|
|
||||||
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="255,88,0,0"/>
|
|
||||||
<CheckBox x:Name="HonorGebundenInput" Margin="255,108,0,0" VerticalAlignment="Top">
|
|
||||||
<TextBlock>Bei Lieferungen das Feld <Italic>Gebunden</Italic> berücksichtigen</TextBlock>
|
|
||||||
</CheckBox>
|
|
||||||
|
|
||||||
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigungen"
|
|
||||||
Click="DeliveryConfirmationButton_Click"
|
|
||||||
Margin="50,120,0,0"/>
|
|
||||||
|
|
||||||
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
|
|
||||||
Click="OverUnderDeliveryButton_Click"
|
|
||||||
Margin="50,160,0,0"/>
|
|
||||||
|
|
||||||
<Button x:Name="AutoBusinessSharesButton" Content="Autom. GA nachzeichnen"
|
|
||||||
Click="AutoBusinessSharesButton_Click"
|
|
||||||
Margin="50,200,0,0"/>
|
|
||||||
|
|
||||||
<Button x:Name="PaymentButton" Content="Auszahlung"
|
|
||||||
Click="PaymentButton_Click"
|
|
||||||
Margin="50,240,0,0"/>
|
|
||||||
</Grid>
|
|
||||||
</local:ContextWindow>
|
|
@ -1,135 +0,0 @@
|
|||||||
using Elwig.Helpers;
|
|
||||||
using Elwig.Helpers.Billing;
|
|
||||||
using Elwig.Helpers.Export;
|
|
||||||
using Elwig.Models.Dtos;
|
|
||||||
using Elwig.Models.Entities;
|
|
||||||
using Microsoft.Win32;
|
|
||||||
using System;
|
|
||||||
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 Task OnRenewContext(AppDbContext ctx) {
|
|
||||||
SeasonInput_ValueChanged(null, null);
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void SeasonInput_ValueChanged(object? sender, RoutedEventArgs? evt) {
|
|
||||||
using var ctx = new AppDbContext();
|
|
||||||
var s0 = await ctx.Seasons.FindAsync(SeasonInput.Value);
|
|
||||||
var s1 = await ctx.Seasons.FindAsync(SeasonInput.Value + 1);
|
|
||||||
var valid = (s0 != null);
|
|
||||||
var last = (s1 == null);
|
|
||||||
CalculateBucketsButton.IsEnabled = valid && last;
|
|
||||||
DeliveryConfirmationButton.IsEnabled = valid;
|
|
||||||
OverUnderDeliveryButton.IsEnabled = valid;
|
|
||||||
AutoBusinessSharesButton.IsEnabled = valid;
|
|
||||||
PaymentButton.IsEnabled = valid;
|
|
||||||
AllowAttrIntoLowerInput.IsEnabled = valid && last;
|
|
||||||
AvoidUnderDeliveriesInput.IsEnabled = valid && last;
|
|
||||||
HonorGebundenInput.IsEnabled = valid && last;
|
|
||||||
AllowAttrIntoLowerInput.IsChecked = s0?.Billing_AllowAttrsIntoLower;
|
|
||||||
AvoidUnderDeliveriesInput.IsChecked = s0?.Billing_AvoidUnderDeliveries;
|
|
||||||
HonorGebundenInput.IsChecked = s0?.Billing_HonorGebunden;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void CalculateBucketsButton_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
if (SeasonInput.Value is not int year)
|
|
||||||
return;
|
|
||||||
CalculateBucketsButton.IsEnabled = false;
|
|
||||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
|
||||||
|
|
||||||
try {
|
|
||||||
using var ctx = new AppDbContext();
|
|
||||||
if (await ctx.Seasons.FindAsync(year) is not Season s)
|
|
||||||
return;
|
|
||||||
|
|
||||||
s.Billing_AllowAttrsIntoLower = AllowAttrIntoLowerInput.IsChecked ?? false;
|
|
||||||
s.Billing_AvoidUnderDeliveries = AvoidUnderDeliveriesInput.IsChecked ?? false;
|
|
||||||
s.Billing_HonorGebunden = HonorGebundenInput.IsChecked ?? false;
|
|
||||||
ctx.Update(s);
|
|
||||||
await ctx.SaveChangesAsync();
|
|
||||||
} catch { }
|
|
||||||
|
|
||||||
var b = new Billing(year);
|
|
||||||
await b.FinishSeason();
|
|
||||||
await b.CalculateBuckets();
|
|
||||||
await App.HintContextChange();
|
|
||||||
|
|
||||||
Mouse.OverrideCursor = null;
|
|
||||||
CalculateBucketsButton.IsEnabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeliveryConfirmationButton_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
if (SeasonInput.Value is not int year)
|
|
||||||
return;
|
|
||||||
var w = App.FocusMailWindow(year);
|
|
||||||
w.AddDeliveryConfirmation();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OverUnderDeliveryButton_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
if (SeasonInput.Value is not int year)
|
|
||||||
return;
|
|
||||||
var d = new SaveFileDialog() {
|
|
||||||
FileName = $"Über-Unterlieferungen-{year}.ods",
|
|
||||||
DefaultExt = "ods",
|
|
||||||
Filter = "OpenDocument Format Spreadsheet (*.ods)|*.ods",
|
|
||||||
Title = $"Über-/Unterlieferungen {year} speichern unter - Elwig"
|
|
||||||
};
|
|
||||||
if (d.ShowDialog() == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
|
||||||
try {
|
|
||||||
using var ctx = new AppDbContext();
|
|
||||||
var tbl1 = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, year);
|
|
||||||
var tbl2 = await AreaComUnderDeliveryData.ForSeason(ctx.AreaComUnderDeliveryRows, year);
|
|
||||||
var tbl3 = await MemberDeliveryPerVariantData.ForSeason(ctx.MemberDeliveryPerVariantRows, year);
|
|
||||||
using var ods = new OdsFile(d.FileName);
|
|
||||||
await ods.AddTable(tbl1);
|
|
||||||
await ods.AddTable(tbl2);
|
|
||||||
await ods.AddTable(tbl3);
|
|
||||||
} catch (Exception exc) {
|
|
||||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
Mouse.OverrideCursor = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void AutoBusinessSharesButton_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
if (SeasonInput.Value is not int year)
|
|
||||||
return;
|
|
||||||
if (false && App.Client.IsMatzen) {
|
|
||||||
AutoBusinessSharesButton.IsEnabled = false;
|
|
||||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
|
||||||
|
|
||||||
var b = new Billing(year);
|
|
||||||
await b.AutoAdjustBusinessShare();
|
|
||||||
|
|
||||||
Mouse.OverrideCursor = null;
|
|
||||||
AutoBusinessSharesButton.IsEnabled = true;
|
|
||||||
} else {
|
|
||||||
MessageBox.Show(
|
|
||||||
"Es ist kein automatisches Nachzeichnen der Geschäftsanteile\n" +
|
|
||||||
"für diese Genossenschaft eingestellt!\n" +
|
|
||||||
"Bitte wenden Sie sich an die Programmierer!", "Fehler",
|
|
||||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PaymentButton_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
if (SeasonInput.Value is not int year)
|
|
||||||
return;
|
|
||||||
App.FocusPaymentVariants(year);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
<Window x:Class="Elwig.Windows.TestWindow"
|
|
||||||
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"
|
|
||||||
Title="Test Fenster - Elwig" MinHeight="400" MinWidth="325" Height="450" Width="800" ResizeMode="CanResize">
|
|
||||||
<Grid>
|
|
||||||
<xctk:CheckComboBox x:Name="MyComboBox" HorizontalAlignment="Left" Margin="216,186,0,0" VerticalAlignment="Top" Delimiter=", "
|
|
||||||
SelectedValue="{Binding SelectedValue}"
|
|
||||||
SelectedItemsOverride="{Binding SelectedItems}"
|
|
||||||
ItemSelectionChanged="OnItemSelectionChanged"/>
|
|
||||||
<TextBlock x:Name="MyText" HorizontalAlignment="Left" Margin="318,246,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
|
|
||||||
<ListBox x:Name="MyListBox" HorizontalAlignment="Left" Margin="492,125,0,0" VerticalAlignment="Top"/>
|
|
||||||
<Button x:Name="WeighingButton1" Click="WeighingButton1_Click" Height="30" Content="Aktuelles Gewicht" Width="110" Margin="515,246,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
|
||||||
<Button x:Name="WeighingButton2" Click="WeighingButton2_Click" Height="30" Content="Wiegen" Width="110" Margin="515,285,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
|
||||||
<TextBlock x:Name="Output" Height="20" Width="200" Margin="470,329,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
|
||||||
<Button x:Name="ZipButton" Content="ZIP-File" Click="ZipButton_Click"
|
|
||||||
Margin="50,270,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
@ -1,57 +0,0 @@
|
|||||||
using Elwig.Documents;
|
|
||||||
using Elwig.Helpers;
|
|
||||||
using Elwig.Helpers.Billing;
|
|
||||||
using Elwig.Helpers.Export;
|
|
||||||
using Elwig.Helpers.Weighing;
|
|
||||||
using Elwig.Models.Dtos;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using Xceed.Wpf.Toolkit.Primitives;
|
|
||||||
|
|
||||||
namespace Elwig.Windows {
|
|
||||||
public partial class TestWindow : Window {
|
|
||||||
|
|
||||||
public TestWindow() {
|
|
||||||
InitializeComponent();
|
|
||||||
MyComboBox.ItemsSource = new string[] { "Klasse A" , "Klasse B", "Klasse C", "Klasse D", "Klasse E", "Klasse F" };
|
|
||||||
MyListBox.ItemsSource = new string[] { "Test 1", "Test 2", "Test 3", "Test 4" };
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnItemSelectionChanged(object sender, ItemSelectionChangedEventArgs e) {
|
|
||||||
MyText.Text = string.Join(", ", MyComboBox.SelectedItems.Cast<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void WeighingButton1_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
try {
|
|
||||||
if (App.Scales[0] is not ICommandScale cs) return;
|
|
||||||
var res = await cs.GetCurrentWeight();
|
|
||||||
Output.Text = res.ToString();
|
|
||||||
} catch (Exception e) {
|
|
||||||
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{e.Message}", "Waagenfehler",
|
|
||||||
MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void WeighingButton2_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
try {
|
|
||||||
if (App.Scales[0] is not ICommandScale cs) return;
|
|
||||||
var res = await cs.Weigh();
|
|
||||||
Output.Text = res.ToString();
|
|
||||||
} catch (Exception e) {
|
|
||||||
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{e.Message}", "Waagenfehler",
|
|
||||||
MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void ZipButton_Click(object sender, RoutedEventArgs evt) {
|
|
||||||
using var ctx = new AppDbContext();
|
|
||||||
using var ods = new OdsFile(@"C:\Users\Lorenz\Desktop\test.ods");
|
|
||||||
await ods.AddTable(await DeliveryConfirmationDeliveryData.ForMember(ctx.DeliveryParts, 2023, ctx.Members.Find(2948)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user