Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
6fc38b9db0 | |||
5a4ff26f31 | |||
012352c562 | |||
81f286f504 | |||
324a63cf9a | |||
ca0497e396 | |||
08f551a394 | |||
3460b9378c | |||
a06921d4ec | |||
f2c2d3270b | |||
6927d44b82 | |||
cc0843f183 | |||
5039c1252a | |||
6e4f3b799d | |||
4c9a151f77 | |||
03cacf604b | |||
c12d111c57 | |||
302870fb58 | |||
f756220d75 | |||
293c8967be | |||
601ac548fe | |||
4e477c38e0 | |||
46fc0db6ba | |||
a531e948c1 | |||
cc4ec6c5db | |||
ff375e3caf |
106
Elwig/Controls/IntegerUpDown.cs
Normal file
106
Elwig/Controls/IntegerUpDown.cs
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Elwig.Controls {
|
||||||
|
public class IntegerUpDown : TextBox {
|
||||||
|
|
||||||
|
public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register("Miminum", typeof(int?), typeof(IntegerUpDown), new FrameworkPropertyMetadata(null));
|
||||||
|
public int? Minimum {
|
||||||
|
get => (int?)GetValue(MinimumProperty);
|
||||||
|
set => SetValue(MinimumProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register("Maximum", typeof(int?), typeof(IntegerUpDown), new FrameworkPropertyMetadata(null));
|
||||||
|
public int? Maximum {
|
||||||
|
get => (int?)GetValue(MaximumProperty);
|
||||||
|
set => SetValue(MaximumProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int? Value {
|
||||||
|
get => int.TryParse(Text, out var res) ? res : null;
|
||||||
|
set => Text = $"{value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
static IntegerUpDown() {
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(IntegerUpDown), new FrameworkPropertyMetadata(typeof(IntegerUpDown)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntegerUpDown() {
|
||||||
|
TextChanged += IntegerUpDown_TextChanged;
|
||||||
|
LostFocus += IntegerUpDown_LostFocus;
|
||||||
|
KeyUp += IntegerUpDown_KeyUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnApplyTemplate() {
|
||||||
|
var incButton = GetTemplateChild("IncrementButton") as RepeatButton;
|
||||||
|
var decButton = GetTemplateChild("DecrementButton") as RepeatButton;
|
||||||
|
incButton!.Click += IncrementButton_Click;
|
||||||
|
decButton!.Click += DecrementButton_Click;
|
||||||
|
base.OnApplyTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void IntegerUpDown_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||||
|
var idx = CaretIndex;
|
||||||
|
Text = new string(Text.Where(char.IsAsciiDigit).Take(4).ToArray());
|
||||||
|
CaretIndex = idx;
|
||||||
|
evt.Handled = !(Value >= Minimum && Value <= Maximum);
|
||||||
|
if (idx >= 4) {
|
||||||
|
if (Value < Minimum) {
|
||||||
|
Value = Minimum;
|
||||||
|
} else if (Value > Maximum) {
|
||||||
|
Value = Maximum;
|
||||||
|
}
|
||||||
|
CaretIndex = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void IntegerUpDown_LostFocus(object sender, RoutedEventArgs evt) {
|
||||||
|
if (Value < Minimum) {
|
||||||
|
Value = Minimum;
|
||||||
|
} else if (Value > Maximum) {
|
||||||
|
Value = Maximum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void IncrementButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
Value = Math.Min((Value ?? 0) + 1, Maximum ?? int.MaxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DecrementButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
Value = Math.Max((Value ?? 0) - 1, Minimum ?? int.MinValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void IntegerUpDown_KeyUp(object sender, KeyEventArgs evt) {
|
||||||
|
switch (evt.Key) {
|
||||||
|
case Key.Up:
|
||||||
|
case Key.Add:
|
||||||
|
case Key.OemPlus:
|
||||||
|
Value = Math.Min((Value ?? 0) + 1, Maximum ?? int.MaxValue);
|
||||||
|
evt.Handled = true;
|
||||||
|
CaretIndex = 4;
|
||||||
|
break;
|
||||||
|
case Key.Down:
|
||||||
|
case Key.Subtract:
|
||||||
|
case Key.OemMinus:
|
||||||
|
Value = Math.Max((Value ?? 0) - 1, Minimum ?? int.MinValue);
|
||||||
|
evt.Handled = true;
|
||||||
|
CaretIndex = 4;
|
||||||
|
break;
|
||||||
|
case Key.PageUp:
|
||||||
|
Value = Math.Min((Value ?? 0) + 10, Maximum ?? int.MaxValue);
|
||||||
|
evt.Handled = true;
|
||||||
|
CaretIndex = 4;
|
||||||
|
break;
|
||||||
|
case Key.PageDown:
|
||||||
|
Value = Math.Max((Value ?? 0) - 10, Minimum ?? int.MinValue);
|
||||||
|
evt.Handled = true;
|
||||||
|
CaretIndex = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
52
Elwig/Controls/IntegerUpDown.xaml
Normal file
52
Elwig/Controls/IntegerUpDown.xaml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:ctrl="clr-namespace:Elwig.Controls">
|
||||||
|
<Style TargetType="ctrl:IntegerUpDown" BasedOn="{StaticResource {x:Type TextBox}}">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ctrl:IntegerUpDown">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="18"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Border x:Name="Border" BorderThickness="1,1,0,1"
|
||||||
|
BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
||||||
|
SnapsToDevicePixels="True" Grid.RowSpan="2">
|
||||||
|
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<RepeatButton x:Name="IncrementButton" Padding="0" Height="Auto" Width="Auto" BorderThickness="1,1,1,1"
|
||||||
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="0" Grid.Column="1">
|
||||||
|
<Path x:Name="IconIncrement" Data="M 0,4 L 4,0 L 8,4 Z" Fill="#FF444444"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</RepeatButton>
|
||||||
|
<RepeatButton x:Name="DecrementButton" Padding="0" Height="Auto" Width="Auto" BorderThickness="1,0,1,1"
|
||||||
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" Grid.Column="1">
|
||||||
|
<Path x:Name="IconDecrement" Data="M 0,0 L 4,4 L 8,0 Z" Fill="#FF444444"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</RepeatButton>
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter TargetName="Border" Property="BorderBrush" Value="LightGray"/>
|
||||||
|
<Setter TargetName="IconIncrement" Property="Fill" Value="#FF888888"/>
|
||||||
|
<Setter TargetName="IconDecrement" Property="Fill" Value="#FF888888"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="TextAlignment" Value="Right"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Foreground" Value="Gray"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
@ -5,7 +5,8 @@
|
|||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="ctrl:UnitTextBox">
|
<ControlTemplate TargetType="ctrl:UnitTextBox">
|
||||||
<Border BorderThickness="{Binding Path=BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
<Border x:Name="Border"
|
||||||
|
BorderThickness="{Binding Path=BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
||||||
BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
||||||
SnapsToDevicePixels="True">
|
SnapsToDevicePixels="True">
|
||||||
<Grid>
|
<Grid>
|
||||||
@ -22,9 +23,19 @@
|
|||||||
FontSize="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="3"/>
|
FontSize="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="3"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter TargetName="Border" Property="BorderBrush" Value="LightGray"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="TextAlignment" Value="Right"/>
|
<Setter Property="TextAlignment" Value="Right"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Foreground" Value="Gray"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Elwig.Dialogs"
|
xmlns:local="clr-namespace:Elwig.Dialogs"
|
||||||
mc:Ignorable="d"
|
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
|
||||||
ResizeMode="NoResize"
|
|
||||||
ShowInTaskbar="False"
|
|
||||||
Topmost="True"
|
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
|
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
|
||||||
Title="Teillieferung abwerten" Height="190" Width="400">
|
Title="Teillieferung abwerten" Height="190" Width="400">
|
||||||
|
74
Elwig/Dialogs/AreaComDialog.xaml
Normal file
74
Elwig/Dialogs/AreaComDialog.xaml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<Window x:Class="Elwig.Dialogs.AreaComDialog"
|
||||||
|
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.Dialogs"
|
||||||
|
xmlns:ctrl="clr-namespace:Elwig.Controls"
|
||||||
|
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||||
|
Title="Flächenbindungen übertragen" Height="230" Width="450">
|
||||||
|
<Window.Resources>
|
||||||
|
<Style TargetType="Label">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="Padding" Value="2,4,2,4"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="TextBox">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="Padding" Value="2"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
<Setter Property="TextWrapping" Value="NoWrap"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||||
|
<Setter Property="Width" Value="100"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock x:Name="QuestionBlock1" TextAlignment="Center" Margin="0,10,0,0"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
|
Sollen die aktiven Flächenbindungen des angegebenen Vorgängers<LineBreak/>
|
||||||
|
übernommen werden? (<Run Text="{Binding AreaComNum}"/> FB, <Run Text="{Binding Area}"/> m²)
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock x:Name="QuestionBlock2" TextAlignment="Center" Margin="0,10,0,0" Visibility="Hidden"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
|
Sollen die aktiven Flächenbindungen gekündigt werden? (<Run Text="{Binding AreaComNum}"/> FB, <Run Text="{Binding Area}"/> m²)
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
|
<Label x:Name="SeasonLabel" Content="Saison:" Margin="0,50,100,0"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||||
|
<ctrl:IntegerUpDown x:Name="SeasonInput" Width="56" Height="25" Margin="0,50,0,0" FontSize="14"
|
||||||
|
Minimum="1900" Maximum="9999"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Top"
|
||||||
|
TextChanged="SeasonInput_TextChanged"/>
|
||||||
|
|
||||||
|
<TextBlock x:Name="DescBlock1" Margin="0,85,0,0" TextAlignment="Center"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
|
Die Flächenbindungen beim <Bold>Vorgänger</Bold> sind bis inkl. Saison <Bold><Run x:Name="CancelSeason1"/></Bold> gültig,<LineBreak/>
|
||||||
|
und werden beim <Bold>Nachfolger</Bold> ab inkl. Saison <Bold><Run x:Name="TransferSeason"/></Bold> übernommen.
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock x:Name="DescBlock2" Margin="0,70,0,0" TextAlignment="Center" Visibility="Hidden"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
|
Die Flächenbindungen sind bis inklusive Saison <Bold><Run x:Name="CancelSeason2"/></Bold> gültig.
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
|
<TextBlock x:Name="InfoBlock" Margin="0,0,0,75" TextAlignment="Center"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Bottom">
|
||||||
|
Falls die Flächenbindungen später an ein neues Mitglied<LineBreak/>
|
||||||
|
übertragen werden sollen bitte <Italic>Nein</Italic> auswählen!
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock Text="Die Änderungen werden erst beim Speichern übernommen!"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,50"/>
|
||||||
|
|
||||||
|
<Button x:Name="ConfirmButton" Content="Ja" Margin="10,10,115,10" Grid.Column="1"
|
||||||
|
Click="ConfirmButton_Click"/>
|
||||||
|
<Button x:Name="CancelButton" Content="Nein" Margin="10,10,10,10" Grid.Column="1" IsCancel="True"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
52
Elwig/Dialogs/AreaComDialog.xaml.cs
Normal file
52
Elwig/Dialogs/AreaComDialog.xaml.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using Elwig.Helpers;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace Elwig.Dialogs {
|
||||||
|
public partial class AreaComDialog : Window {
|
||||||
|
|
||||||
|
public int CancelSeason { get; set; }
|
||||||
|
public int SuccessorSeason => CancelSeason + 1;
|
||||||
|
|
||||||
|
public string AreaComNum { get; set; }
|
||||||
|
public string Area { get; set; }
|
||||||
|
|
||||||
|
public AreaComDialog(string name, int areaComNum, int area) {
|
||||||
|
CancelSeason = Utils.FollowingSeason - 1;
|
||||||
|
AreaComNum = $"{areaComNum:N0}";
|
||||||
|
Area = $"{area:N0}";
|
||||||
|
InitializeComponent();
|
||||||
|
SeasonInput.Text = $"{CancelSeason}";
|
||||||
|
Title = $"Aktive Flächenbindungen kündigen - {name}";
|
||||||
|
QuestionBlock1.Visibility = Visibility.Hidden;
|
||||||
|
QuestionBlock2.Visibility = Visibility.Visible;
|
||||||
|
DescBlock1.Visibility = Visibility.Hidden;
|
||||||
|
DescBlock2.Visibility = Visibility.Visible;
|
||||||
|
Height = 240;
|
||||||
|
SeasonInput.Margin = new(0, 40, 0, 0);
|
||||||
|
SeasonLabel.Margin = new(0, 40, 100, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AreaComDialog(string name, string successorName, int areaComNum, int area) {
|
||||||
|
CancelSeason = Utils.FollowingSeason - 1;
|
||||||
|
AreaComNum = $"{areaComNum:N0}";
|
||||||
|
Area = $"{area:N0}";
|
||||||
|
InitializeComponent();
|
||||||
|
SeasonInput.Text = $"{CancelSeason}";
|
||||||
|
Title = $"Aktive Flächenbindungen übertragen - {name} - {successorName}";
|
||||||
|
InfoBlock.Visibility = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SeasonInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||||
|
CancelSeason = (int)SeasonInput.Value!;
|
||||||
|
CancelSeason1.Text = $"{CancelSeason}";
|
||||||
|
CancelSeason2.Text = $"{CancelSeason}";
|
||||||
|
TransferSeason.Text = $"{SuccessorSeason}";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
DialogResult = true;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
63
Elwig/Dialogs/DeleteMemberDialog.xaml
Normal file
63
Elwig/Dialogs/DeleteMemberDialog.xaml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<Window x:Class="Elwig.Dialogs.DeleteMemberDialog"
|
||||||
|
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.Dialogs"
|
||||||
|
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||||
|
Title="Mitglied löschen" Height="280" Width="400">
|
||||||
|
<Window.Resources>
|
||||||
|
<Style TargetType="Label">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="Padding" Value="2,4,2,4"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="TextBox">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="Padding" Value="2"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
<Setter Property="TextWrapping" Value="NoWrap"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="CheckBox">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||||
|
<Setter Property="Width" Value="100"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock TextAlignment="Center" Margin="10,10,10,10" VerticalAlignment="Top">
|
||||||
|
Bei Bestätigung wird das Mitglied samt zugehöriger Daten<LineBreak/>
|
||||||
|
<Bold>unwiderruflich gelöscht!</Bold> Wenn möglich sollte stattdessen<LineBreak/>
|
||||||
|
der Status des Mitglieds auf <Italic>Inaktiv</Italic> gesetzt werden!
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
|
<Label Content="Name u. MgNr. wiederholen:" Margin="10,60,10,10" HorizontalAlignment="Center"/>
|
||||||
|
<TextBox x:Name="NameInput" Margin="10,85,10,10"
|
||||||
|
TextChanged="NameInput_TextChanged"/>
|
||||||
|
|
||||||
|
<Label Content="Beim Löschen müssen folgende Daten auch gelöscht werden:" Margin="10,120,10,10"/>
|
||||||
|
<CheckBox x:Name="AreaComInput" Content="Flächenbindungen" Margin="40,145,0,0"
|
||||||
|
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
|
||||||
|
IsChecked="{Binding DeleteAreaComs}"/>
|
||||||
|
<CheckBox x:Name="DeliveryInput" Content="Lieferungen" Margin="40,165,0,0"
|
||||||
|
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
|
||||||
|
IsChecked="{Binding DeleteDeliveries}"/>
|
||||||
|
<CheckBox x:Name="PaymentInput" Content="Auszahlungsdaten" Margin="40,185,0,0"
|
||||||
|
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
|
||||||
|
IsChecked="{Binding DeletePaymentData}"/>
|
||||||
|
|
||||||
|
<Button x:Name="ConfirmButton" Content="Bestätigen" Margin="10,10,115,10" Grid.Column="1" IsEnabled="False"
|
||||||
|
Click="ConfirmButton_Click"/>
|
||||||
|
<Button x:Name="CancelButton" Content="Abbrechen" Margin="10,10,10,10" Grid.Column="1" IsCancel="True"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
66
Elwig/Dialogs/DeleteMemberDialog.xaml.cs
Normal file
66
Elwig/Dialogs/DeleteMemberDialog.xaml.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using Elwig.Helpers;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace Elwig.Dialogs {
|
||||||
|
public partial class DeleteMemberDialog : Window {
|
||||||
|
|
||||||
|
protected string[] NameParts;
|
||||||
|
|
||||||
|
public bool DeleteAreaComs { get; set; }
|
||||||
|
public bool DeleteDeliveries { get; set; }
|
||||||
|
public bool DeletePaymentData { get; set; }
|
||||||
|
|
||||||
|
public DeleteMemberDialog(int mgnr, string name, int numAreaComs, int numDeliveries, int numCredits) {
|
||||||
|
NameParts = name.ToLower().Split(' ').Where(p => p.Length > 0).Append($"{mgnr}").ToArray();
|
||||||
|
InitializeComponent();
|
||||||
|
Title += " - " + name;
|
||||||
|
AreaComInput.IsEnabled = numAreaComs != 0;
|
||||||
|
AreaComInput.Content += $" ({numAreaComs:N0})";
|
||||||
|
DeliveryInput.IsEnabled = numDeliveries != 0;
|
||||||
|
DeliveryInput.Content += $" ({numDeliveries:N0})";
|
||||||
|
PaymentInput.IsEnabled = numCredits != 0;
|
||||||
|
PaymentInput.Content += $" ({numCredits:N0})";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NameInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckBox_Changed(object sender, RoutedEventArgs evt) {
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UpdateCheckBox(CheckBox cb) {
|
||||||
|
if (cb.IsEnabled && cb.IsChecked != true) {
|
||||||
|
ControlUtils.SetInputInvalid(cb);
|
||||||
|
} else {
|
||||||
|
ControlUtils.ClearInputState(cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update() {
|
||||||
|
var t = NameInput.Text.ToLower().Split(' ');
|
||||||
|
var nameValid = NameParts.All(t.Contains);
|
||||||
|
UpdateCheckBox(AreaComInput);
|
||||||
|
UpdateCheckBox(DeliveryInput);
|
||||||
|
UpdateCheckBox(PaymentInput);
|
||||||
|
if (!nameValid) {
|
||||||
|
ControlUtils.SetInputInvalid(NameInput);
|
||||||
|
} else {
|
||||||
|
ControlUtils.ClearInputState(NameInput);
|
||||||
|
}
|
||||||
|
ConfirmButton.IsEnabled =
|
||||||
|
(!AreaComInput.IsEnabled || DeleteAreaComs) &&
|
||||||
|
(!DeliveryInput.IsEnabled || DeleteDeliveries) &&
|
||||||
|
(!PaymentInput.IsEnabled || DeletePaymentData) &&
|
||||||
|
nameValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
DialogResult = true;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,10 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Elwig.Dialogs"
|
xmlns:local="clr-namespace:Elwig.Dialogs"
|
||||||
mc:Ignorable="d"
|
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
|
||||||
ResizeMode="NoResize"
|
|
||||||
ShowInTaskbar="False"
|
|
||||||
Topmost="True"
|
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
|
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
|
||||||
Title="Teillieferung extrahieren" Height="210" Width="380">
|
Title="Teillieferung extrahieren" Height="210" Width="380">
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Elwig.Dialogs"
|
xmlns:local="clr-namespace:Elwig.Dialogs"
|
||||||
mc:Ignorable="d"
|
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
|
||||||
ResizeMode="NoResize"
|
|
||||||
ShowInTaskbar="False"
|
|
||||||
Topmost="True"
|
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
FocusManager.FocusedElement="{Binding ElementName=PriceInput}"
|
FocusManager.FocusedElement="{Binding ElementName=PriceInput}"
|
||||||
Title="Linear wachsen" Height="140" Width="270">
|
Title="Linear wachsen" Height="140" Width="270">
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Elwig.Dialogs"
|
xmlns:local="clr-namespace:Elwig.Dialogs"
|
||||||
mc:Ignorable="d"
|
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
|
||||||
ResizeMode="NoResize"
|
|
||||||
ShowInTaskbar="False"
|
|
||||||
Topmost="True"
|
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
|
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
|
||||||
Title="Handwiegung" Height="170" Width="400">
|
Title="Handwiegung" Height="170" Width="400">
|
||||||
|
68
Elwig/Dialogs/NewSeasonDialog.xaml
Normal file
68
Elwig/Dialogs/NewSeasonDialog.xaml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<Window x:Class="Elwig.Dialogs.NewSeasonDialog"
|
||||||
|
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.Dialogs"
|
||||||
|
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||||
|
Title="Saison anlegen" Height="180" Width="400">
|
||||||
|
<Window.Resources>
|
||||||
|
<Style TargetType="Label">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="Padding" Value="2,4,2,4"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="ComboBox">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="CheckBox">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||||
|
<Setter Property="Width" Value="100"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Label Content="Währung:" Margin="10,10,10,10"/>
|
||||||
|
<ComboBox x:Name="CurrencyInput" Width="150" Margin="130,10,10,10"
|
||||||
|
ItemsSource="{Binding Currencies}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding Code}" Width="30"/>
|
||||||
|
<TextBlock Text="- "/>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
|
<Label Content="Nachkommastellen:" Margin="10,40,10,10"/>
|
||||||
|
<ComboBox x:Name="PrecisionInput" Width="50" Margin="130,40,10,10">
|
||||||
|
<ComboBoxItem>2</ComboBoxItem>
|
||||||
|
<ComboBoxItem>3</ComboBoxItem>
|
||||||
|
<ComboBoxItem IsSelected="True">4</ComboBoxItem>
|
||||||
|
<ComboBoxItem>5</ComboBoxItem>
|
||||||
|
<ComboBoxItem>6</ComboBoxItem>
|
||||||
|
<ComboBoxItem>7</ComboBoxItem>
|
||||||
|
<ComboBoxItem>8</ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
|
<CheckBox x:Name="CopyModifiersInput" Content="Zu-/Abschläge der letzten Saison übernehmen"
|
||||||
|
Margin="15,75,10,10" IsChecked="{Binding CopyModifiers}"/>
|
||||||
|
|
||||||
|
<Button x:Name="ConfirmButton" Content="Bestätigen" Margin="10,10,115,10" Grid.Column="1" IsDefault="True"
|
||||||
|
Click="ConfirmButton_Click"/>
|
||||||
|
<Button x:Name="CancelButton" Content="Abbrechen" Margin="10,10,10,10" Grid.Column="1" IsCancel="True"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
30
Elwig/Dialogs/NewSeasonDialog.xaml.cs
Normal file
30
Elwig/Dialogs/NewSeasonDialog.xaml.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using Elwig.Helpers;
|
||||||
|
using Elwig.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Elwig.Dialogs {
|
||||||
|
public partial class NewSeasonDialog : Window {
|
||||||
|
|
||||||
|
public IEnumerable<Currency> Currencies { get; set; }
|
||||||
|
public int Year { get; set; }
|
||||||
|
|
||||||
|
public string CurrencyCode => (CurrencyInput.SelectedItem as Currency)!.Code;
|
||||||
|
public byte Precision => (byte)(PrecisionInput.SelectedIndex + 2);
|
||||||
|
public bool CopyModifiers { get; set; }
|
||||||
|
|
||||||
|
public NewSeasonDialog(Season? s, IEnumerable<Currency> currencies) {
|
||||||
|
Currencies = currencies;
|
||||||
|
CopyModifiers = s != null;
|
||||||
|
InitializeComponent();
|
||||||
|
CopyModifiersInput.IsEnabled = s != null;
|
||||||
|
ControlUtils.SelectItemWithPk(CurrencyInput, s?.CurrencyCode ?? "EUR");
|
||||||
|
PrecisionInput.SelectedIndex = (s?.Precision ?? 4) - 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
DialogResult = true;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,10 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
|
||||||
ResizeMode="NoResize"
|
|
||||||
ShowInTaskbar="False"
|
|
||||||
Topmost="True"
|
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
Title="Neues Update verfügbar - Elwig" Height="180" Width="400">
|
Title="Neues Update verfügbar - Elwig" Height="180" Width="400">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
@ -20,7 +20,6 @@ namespace Elwig.Documents {
|
|||||||
Season = ctx.Seasons.Find(year) ?? throw new ArgumentException("invalid season");
|
Season = ctx.Seasons.Find(year) ?? throw new ArgumentException("invalid season");
|
||||||
ShowDateAndLocation = true;
|
ShowDateAndLocation = true;
|
||||||
UseBillingAddress = true;
|
UseBillingAddress = true;
|
||||||
IncludeSender = true;
|
|
||||||
DocumentId = $"Anl.-Best. {Season.Year}/{m.MgNr}";
|
DocumentId = $"Anl.-Best. {Season.Year}/{m.MgNr}";
|
||||||
Data = data;
|
Data = data;
|
||||||
MemberBuckets = ctx.GetMemberBuckets(Season.Year, m.MgNr).GetAwaiter().GetResult();
|
MemberBuckets = ctx.GetMemberBuckets(Season.Year, m.MgNr).GetAwaiter().GetResult();
|
||||||
|
@ -49,14 +49,20 @@
|
|||||||
<td class="center">@(Model.BillingData.ConsiderContractPenalties ? "Ja" : "Nein")</td>
|
<td class="center">@(Model.BillingData.ConsiderContractPenalties ? "Ja" : "Nein")</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Datum:</th>
|
<th style="overflow: visible;">Nto./bto.-Zuschl:</th>
|
||||||
<td colspan="3">@($"{Model.Variant.Date:dd.MM.yyyy}")</td>
|
<td colspan="3" class="center">
|
||||||
|
@($"{Utils.GetSign(Model.BillingData.NetWeightModifier)}{Math.Abs(Model.BillingData.NetWeightModifier) * 100:N2}") % /
|
||||||
|
@($"{Utils.GetSign(Model.BillingData.GrossWeightModifier)}{Math.Abs(Model.BillingData.GrossWeightModifier) * 100:N2}") %
|
||||||
|
</td>
|
||||||
<th colspan="2" class="lborder">Strafen bei Unterlieferungen (GA):</th>
|
<th colspan="2" class="lborder">Strafen bei Unterlieferungen (GA):</th>
|
||||||
<td class="center">@(Model.BillingData.ConsiderTotalPenalty ? "Ja" : "Nein")</td>
|
<td class="center">@(Model.BillingData.ConsiderTotalPenalty ? "Ja" : "Nein")</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Überw.:</th>
|
<th style="overflow: visible;">Datum/Überw.:</th>
|
||||||
<td colspan="3">@($"{Model.Variant.TransferDate:dd.MM.yyyy}")</td>
|
<td colspan="3" class="center">
|
||||||
|
@($"{Model.Variant.Date:dd.MM.yyyy}") /
|
||||||
|
@($"{Model.Variant.TransferDate:dd.MM.yyyy}")
|
||||||
|
</td>
|
||||||
<th colspan="2" class="lborder">Automatische Nachzeichnung der GA:</th>
|
<th colspan="2" class="lborder">Automatische Nachzeichnung der GA:</th>
|
||||||
<td class="center">@(Model.BillingData.ConsiderAutoBusinessShares ? "Ja" : "Nein")</td>
|
<td class="center">@(Model.BillingData.ConsiderAutoBusinessShares ? "Ja" : "Nein")</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||||
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
|
||||||
<Version>0.8.2</Version>
|
<Version>0.8.3</Version>
|
||||||
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
@ -27,15 +27,15 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.0" />
|
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.0" />
|
||||||
<PackageReference Include="LinqKit" Version="1.2.5" />
|
<PackageReference Include="LinqKit" Version="1.2.5" />
|
||||||
<PackageReference Include="MailKit" Version="4.5.0" />
|
<PackageReference Include="MailKit" Version="4.6.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.29" />
|
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.31" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2478.35" />
|
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2535.41" />
|
||||||
<PackageReference Include="NJsonSchema" Version="11.0.0" />
|
<PackageReference Include="NJsonSchema" Version="11.0.0" />
|
||||||
<PackageReference Include="RazorLight" Version="2.3.1" />
|
<PackageReference Include="RazorLight" Version="2.3.1" />
|
||||||
<PackageReference Include="ScottPlot.WPF" Version="5.0.31" />
|
<PackageReference Include="ScottPlot.WPF" Version="5.0.34" />
|
||||||
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
|
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
|
||||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
|
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -241,23 +241,23 @@ namespace Elwig.Helpers {
|
|||||||
.LastAsync();
|
.LastAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateDeliveryPartModifiers(DeliveryPart part, IEnumerable<Modifier> modifiers) {
|
public void UpdateDeliveryPartModifiers(DeliveryPart part, IEnumerable<Modifier> oldModifiers, IEnumerable<Modifier> newModifiers) {
|
||||||
foreach (var m in Modifiers.Where(m => m.Year == part.Year)) {
|
foreach (var m in Modifiers.Where(m => m.Year == part.Year)) {
|
||||||
var mod = part.PartModifiers.Where(pa => pa.ModId == m.ModId).FirstOrDefault();
|
var mod = new DeliveryPartModifier {
|
||||||
if (modifiers.Contains(m)) {
|
|
||||||
var dpm = new DeliveryPartModifier {
|
|
||||||
Year = part.Year,
|
Year = part.Year,
|
||||||
DId = part.DId,
|
DId = part.DId,
|
||||||
DPNr = part.DPNr,
|
DPNr = part.DPNr,
|
||||||
ModId = m.ModId,
|
ModId = m.ModId,
|
||||||
};
|
};
|
||||||
if (mod == null) {
|
var old = oldModifiers.Where(pa => pa.ModId == m.ModId).FirstOrDefault();
|
||||||
Add(dpm);
|
if (newModifiers.Any(md => md.ModId == m.ModId)) {
|
||||||
|
if (old == null) {
|
||||||
|
Add(mod);
|
||||||
} else {
|
} else {
|
||||||
Update(dpm);
|
Update(mod);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mod != null) {
|
if (old != null) {
|
||||||
Remove(mod);
|
Remove(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,6 +354,27 @@ namespace Elwig.Helpers {
|
|||||||
_memberUnderDelivery[year] = buckets;
|
_memberUnderDelivery[year] = buckets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Dictionary<int, long>> GetBusinessSharePenalties(int year) {
|
||||||
|
using var cnx = await ConnectAsync();
|
||||||
|
var dict = new Dictionary<int, long>();
|
||||||
|
using var cmd = cnx.CreateCommand();
|
||||||
|
cmd.CommandText = $"""
|
||||||
|
SELECT mgnr, ROUND((
|
||||||
|
COALESCE(-s.penalty_amount, 0) +
|
||||||
|
COALESCE(-s.penalty_per_bs_amount * CEIL(CAST(-u.diff AS REAL) / s.min_kg_per_bs), 0) +
|
||||||
|
COALESCE(u.diff * s.penalty_per_kg, 0)
|
||||||
|
) / POW(10, s.precision - 2))
|
||||||
|
FROM v_total_under_delivery u
|
||||||
|
JOIN season s ON s.year = u.year
|
||||||
|
WHERE s.year = {year} AND u.diff < 0
|
||||||
|
""";
|
||||||
|
using var reader = await cmd.ExecuteReaderAsync();
|
||||||
|
while (await reader.ReadAsync()) {
|
||||||
|
dict[reader.GetInt32(0)] = reader.GetInt64(1);
|
||||||
|
}
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<Dictionary<string, AreaComBucket>> GetMemberAreaCommitmentBuckets(int year, int mgnr, SqliteConnection? cnx = null) {
|
public async Task<Dictionary<string, AreaComBucket>> GetMemberAreaCommitmentBuckets(int year, int mgnr, SqliteConnection? cnx = null) {
|
||||||
if (!_memberAreaCommitmentBuckets.ContainsKey(year))
|
if (!_memberAreaCommitmentBuckets.ContainsKey(year))
|
||||||
await FetchMemberAreaCommitmentBuckets(year, cnx);
|
await FetchMemberAreaCommitmentBuckets(year, cnx);
|
||||||
|
@ -9,7 +9,7 @@ namespace Elwig.Helpers {
|
|||||||
public static class AppDbUpdater {
|
public static class AppDbUpdater {
|
||||||
|
|
||||||
// Don't forget to update value in Tests/fetch-resources.bat!
|
// Don't forget to update value in Tests/fetch-resources.bat!
|
||||||
public static readonly int RequiredSchemaVersion = 19;
|
public static readonly int RequiredSchemaVersion = 20;
|
||||||
|
|
||||||
private static int VersionOffset = 0;
|
private static int VersionOffset = 0;
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ namespace Elwig.Helpers.Billing {
|
|||||||
ROUND(lp.amount / POW(10, s.precision - 2)) AS prev_amount,
|
ROUND(lp.amount / POW(10, s.precision - 2)) AS prev_amount,
|
||||||
IIF(m.buchführend, s.vat_normal, s.vat_flatrate) AS vat,
|
IIF(m.buchführend, s.vat_normal, s.vat_flatrate) AS vat,
|
||||||
ROUND(IIF({Data.ConsiderContractPenalties}, COALESCE(u.total_penalty, 0), 0) / POW(10, 4 - 2)) +
|
ROUND(IIF({Data.ConsiderContractPenalties}, COALESCE(u.total_penalty, 0), 0) / POW(10, 4 - 2)) +
|
||||||
ROUND(IIF({Data.ConsiderTotalPenalty}, COALESCE(b.total_penalty, 0), 0) / POW(10, s.precision - 2)) +
|
|
||||||
ROUND(IIF({Data.ConsiderAutoBusinessShares}, -COALESCE(a.total_amount, 0), 0) / POW(10, s.precision - 2))
|
ROUND(IIF({Data.ConsiderAutoBusinessShares}, -COALESCE(a.total_amount, 0), 0) / POW(10, s.precision - 2))
|
||||||
AS modifiers,
|
AS modifiers,
|
||||||
lc.modifiers AS prev_modifiers
|
lc.modifiers AS prev_modifiers
|
||||||
@ -66,10 +65,28 @@ namespace Elwig.Helpers.Billing {
|
|||||||
LEFT JOIN payment_member p ON (p.year, p.avnr, p.mgnr) = (v.year, v.avnr, m.mgnr)
|
LEFT JOIN payment_member p ON (p.year, p.avnr, p.mgnr) = (v.year, v.avnr, m.mgnr)
|
||||||
LEFT JOIN credit lc ON (lc.year, lc.avnr, lc.mgnr) = (l.year, l.avnr, m.mgnr)
|
LEFT JOIN credit lc ON (lc.year, lc.avnr, lc.mgnr) = (l.year, l.avnr, m.mgnr)
|
||||||
LEFT JOIN v_penalty_area_commitments u ON (u.year, u.mgnr) = (s.year, m.mgnr)
|
LEFT JOIN v_penalty_area_commitments u ON (u.year, u.mgnr) = (s.year, m.mgnr)
|
||||||
LEFT JOIN v_penalty_business_shares b ON (b.year, b.mgnr) = (s.year, m.mgnr)
|
|
||||||
LEFT JOIN v_auto_business_shares a ON (a.year, a.mgnr) = (s.year, m.mgnr)
|
LEFT JOIN v_auto_business_shares a ON (a.year, a.mgnr) = (s.year, m.mgnr)
|
||||||
WHERE s.year = {Year} AND v.avnr = {AvNr};
|
WHERE s.year = {Year} AND v.avnr = {AvNr};
|
||||||
|
""");
|
||||||
|
if (Data.ConsiderTotalPenalty) {
|
||||||
|
if (App.Client.IsWinzerkeller) {
|
||||||
|
// TODO
|
||||||
|
} else {
|
||||||
|
await AppDbContext.ExecuteBatch(cnx, $"""
|
||||||
|
UPDATE credit AS c
|
||||||
|
SET modifiers = modifiers + ROUND((
|
||||||
|
COALESCE(-s.penalty_amount, 0) +
|
||||||
|
COALESCE(-s.penalty_per_bs_amount * CEIL(CAST(-u.diff AS REAL) / s.min_kg_per_bs), 0) +
|
||||||
|
COALESCE(u.diff * s.penalty_per_kg, 0)
|
||||||
|
) / POW(10, s.precision - 2))
|
||||||
|
FROM v_total_under_delivery u
|
||||||
|
JOIN season s ON s.year = u.year
|
||||||
|
WHERE c.year = {Year} AND c.avnr = {AvNr} AND (u.year, u.mgnr) = (c.year, c.mgnr) AND
|
||||||
|
u.diff < 0
|
||||||
|
""");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await AppDbContext.ExecuteBatch(cnx, $"""
|
||||||
UPDATE payment_variant SET test_variant = FALSE WHERE (year, avnr) = ({Year}, {AvNr});
|
UPDATE payment_variant SET test_variant = FALSE WHERE (year, avnr) = ({Year}, {AvNr});
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,9 @@ namespace Elwig.Models.Dtos {
|
|||||||
public static async Task<CreditNoteData> ForPaymentVariant(AppDbContext ctx, int year, int avnr) {
|
public static async Task<CreditNoteData> ForPaymentVariant(AppDbContext ctx, int year, int avnr) {
|
||||||
var variant = await ctx.PaymentVariants.FindAsync(year, avnr);
|
var variant = await ctx.PaymentVariants.FindAsync(year, avnr);
|
||||||
var name = variant!.Name;
|
var name = variant!.Name;
|
||||||
|
var bsPenalty = await ctx.GetBusinessSharePenalties(year);
|
||||||
var data = BillingData.FromJson(variant!.Data);
|
var data = BillingData.FromJson(variant!.Data);
|
||||||
var rows = (await FromDbSet(ctx.CreditNoteRows, year, avnr)).Select(r => new CreditNoteRow(r, data)).ToList();
|
var rows = (await FromDbSet(ctx.CreditNoteRows, year, avnr)).Select(r => new CreditNoteRow(r, data, bsPenalty)).ToList();
|
||||||
return new CreditNoteData(rows, year, name);
|
return new CreditNoteData(rows, year, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +57,6 @@ namespace Elwig.Models.Dtos {
|
|||||||
p.amount - p.net_amount AS surcharge,
|
p.amount - p.net_amount AS surcharge,
|
||||||
c.net_amount, c.prev_net_amount, c.vat, c.vat_amount, c.gross_amount, c.modifiers, c.prev_modifiers, c.amount,
|
c.net_amount, c.prev_net_amount, c.vat, c.vat_amount, c.gross_amount, c.modifiers, c.prev_modifiers, c.amount,
|
||||||
ROUND(COALESCE(u.total_penalty, 0) / POW(10, 4 - 2)) AS fb_penalty,
|
ROUND(COALESCE(u.total_penalty, 0) / POW(10, 4 - 2)) AS fb_penalty,
|
||||||
ROUND(COALESCE(b.total_penalty, 0) / POW(10, s.precision - 2)) AS bs_penalty,
|
|
||||||
ROUND(COALESCE(a.total_amount, 0) / POW(10, s.precision - 2)) AS auto_bs
|
ROUND(COALESCE(a.total_amount, 0) / POW(10, s.precision - 2)) AS auto_bs
|
||||||
FROM credit c
|
FROM credit c
|
||||||
LEFT JOIN member m ON m.mgnr = c.mgnr
|
LEFT JOIN member m ON m.mgnr = c.mgnr
|
||||||
@ -65,7 +65,6 @@ namespace Elwig.Models.Dtos {
|
|||||||
LEFT JOIN AT_ort o ON o.okz = p.okz
|
LEFT JOIN AT_ort o ON o.okz = p.okz
|
||||||
LEFT JOIN season s ON s.year = c.year
|
LEFT JOIN season s ON s.year = c.year
|
||||||
LEFT JOIN v_penalty_area_commitments u ON (u.year, u.mgnr) = (s.year, m.mgnr)
|
LEFT JOIN v_penalty_area_commitments u ON (u.year, u.mgnr) = (s.year, m.mgnr)
|
||||||
LEFT JOIN v_penalty_business_shares b ON (b.year, b.mgnr) = (s.year, m.mgnr)
|
|
||||||
LEFT JOIN v_auto_business_shares a ON (a.year, a.mgnr) = (s.year, m.mgnr)
|
LEFT JOIN v_auto_business_shares a ON (a.year, a.mgnr) = (s.year, m.mgnr)
|
||||||
WHERE c.year = {year} AND c.avnr = {avnr}
|
WHERE c.year = {year} AND c.avnr = {avnr}
|
||||||
ORDER BY m.mgnr
|
ORDER BY m.mgnr
|
||||||
@ -96,7 +95,7 @@ namespace Elwig.Models.Dtos {
|
|||||||
public decimal? Considered;
|
public decimal? Considered;
|
||||||
public decimal Amount;
|
public decimal Amount;
|
||||||
|
|
||||||
public CreditNoteRow(CreditNoteRowSingle row, BillingData data) {
|
public CreditNoteRow(CreditNoteRowSingle row, BillingData data, Dictionary<int, long> bsPenalty) {
|
||||||
byte prec1 = 2, prec2 = row.Precision;
|
byte prec1 = 2, prec2 = row.Precision;
|
||||||
MgNr = row.MgNr;
|
MgNr = row.MgNr;
|
||||||
Name1 = row.Name1;
|
Name1 = row.Name1;
|
||||||
@ -120,7 +119,7 @@ namespace Elwig.Models.Dtos {
|
|||||||
if (data.ConsiderContractPenalties)
|
if (data.ConsiderContractPenalties)
|
||||||
Penalties = (row.FbPenalty == null || row.FbPenalty == 0) ? null : Utils.DecFromDb((long)row.FbPenalty, prec1);
|
Penalties = (row.FbPenalty == null || row.FbPenalty == 0) ? null : Utils.DecFromDb((long)row.FbPenalty, prec1);
|
||||||
if (data.ConsiderTotalPenalty)
|
if (data.ConsiderTotalPenalty)
|
||||||
Penalty = (row.BsPealty == null || row.BsPealty == 0) ? null : Utils.DecFromDb((long)row.BsPealty, prec1);
|
Penalty = (!bsPenalty.TryGetValue(row.MgNr, out var val) || val == 0) ? null : Utils.DecFromDb(val, prec1);
|
||||||
if (data.ConsiderAutoBusinessShares)
|
if (data.ConsiderAutoBusinessShares)
|
||||||
AutoBs = (row.AutoBs == null || row.AutoBs == 0) ? null : -Utils.DecFromDb((long)row.AutoBs, prec1);
|
AutoBs = (row.AutoBs == null || row.AutoBs == 0) ? null : -Utils.DecFromDb((long)row.AutoBs, prec1);
|
||||||
mod -= (Penalties ?? 0) + (Penalty ?? 0) + (AutoBs ?? 0);
|
mod -= (Penalties ?? 0) + (Penalty ?? 0) + (AutoBs ?? 0);
|
||||||
@ -175,8 +174,6 @@ namespace Elwig.Models.Dtos {
|
|||||||
public long Amount { get; set; }
|
public long Amount { get; set; }
|
||||||
[Column("fb_penalty")]
|
[Column("fb_penalty")]
|
||||||
public long? FbPenalty { get; set; }
|
public long? FbPenalty { get; set; }
|
||||||
[Column("bs_penalty")]
|
|
||||||
public long? BsPealty { get; set; }
|
|
||||||
[Column("auto_bs")]
|
[Column("auto_bs")]
|
||||||
public long? AutoBs { get; set; }
|
public long? AutoBs { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,9 @@ namespace Elwig.Models.Entities {
|
|||||||
[InverseProperty(nameof(Delivery.Member))]
|
[InverseProperty(nameof(Delivery.Member))]
|
||||||
public virtual ICollection<Delivery> Deliveries { get; private set; } = null!;
|
public virtual ICollection<Delivery> Deliveries { get; private set; } = null!;
|
||||||
|
|
||||||
|
[InverseProperty(nameof(Credit.Member))]
|
||||||
|
public virtual ICollection<Credit> Credits { get; private set; } = null!;
|
||||||
|
|
||||||
[InverseProperty(nameof(MemberTelNr.Member))]
|
[InverseProperty(nameof(MemberTelNr.Member))]
|
||||||
public virtual ICollection<MemberTelNr> TelephoneNumbers { get; private set; } = null!;
|
public virtual ICollection<MemberTelNr> TelephoneNumbers { get; private set; } = null!;
|
||||||
|
|
||||||
|
@ -55,6 +55,22 @@ namespace Elwig.Models.Entities {
|
|||||||
set => PenaltyNoneValue = value != null ? DecToDb(value.Value) : null;
|
set => PenaltyNoneValue = value != null ? DecToDb(value.Value) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Column("penalty_per_bs_amount")]
|
||||||
|
public long? PenaltyPerBsAmountValue { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public decimal? PenaltyPerBsAmount {
|
||||||
|
get => PenaltyPerBsAmountValue != null ? DecFromDb(PenaltyPerBsAmountValue.Value) : null;
|
||||||
|
set => PenaltyPerBsAmountValue = value != null ? DecToDb(value.Value) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Column("penalty_per_bs_none")]
|
||||||
|
public long? PenaltyPerBsNoneValue { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public decimal? PenaltyPerBsNone {
|
||||||
|
get => PenaltyPerBsNoneValue != null ? DecFromDb(PenaltyPerBsNoneValue.Value) : null;
|
||||||
|
set => PenaltyPerBsNoneValue = value != null ? DecToDb(value.Value) : null;
|
||||||
|
}
|
||||||
|
|
||||||
[Column("bs_value")]
|
[Column("bs_value")]
|
||||||
public long? BusinessShareValueValue { get; set; }
|
public long? BusinessShareValueValue { get; set; }
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
|
7
Elwig/Resources/Sql/19-20.sql
Normal file
7
Elwig/Resources/Sql/19-20.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
-- schema version 19 to 20
|
||||||
|
|
||||||
|
ALTER TABLE season ADD COLUMN penalty_per_bs_amount INTEGER DEFAULT NULL;
|
||||||
|
ALTER TABLE season ADD COLUMN penalty_per_bs_none INTEGER DEFAULT NULL;
|
||||||
|
DROP VIEW v_penalty_business_shares;
|
||||||
|
|
||||||
|
UPDATE season SET penalty_none = NULL;
|
@ -1,5 +1,6 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="/Elwig;component/Controls/UnitTextBox.xaml"/>
|
<ResourceDictionary Source="/Elwig;component/Controls/UnitTextBox.xaml"/>
|
||||||
|
<ResourceDictionary Source="/Elwig;component/Controls/IntegerUpDown.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
@ -25,6 +25,15 @@
|
|||||||
<Setter Property="Height" Value="25"/>
|
<Setter Property="Height" Value="25"/>
|
||||||
<Setter Property="TextWrapping" Value="NoWrap"/>
|
<Setter Property="TextWrapping" Value="NoWrap"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style TargetType="ctrl:UnitTextBox">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="Padding" Value="2"/>
|
||||||
|
<Setter Property="IsReadOnly" Value="True"/>
|
||||||
|
<Setter Property="Height" Value="25"/>
|
||||||
|
<Setter Property="TextWrapping" Value="NoWrap"/>
|
||||||
|
</Style>
|
||||||
<Style TargetType="ComboBox">
|
<Style TargetType="ComboBox">
|
||||||
<Setter Property="IsEnabled" Value="False"/>
|
<Setter Property="IsEnabled" Value="False"/>
|
||||||
<Setter Property="Height" Value="25"/>
|
<Setter Property="Height" Value="25"/>
|
||||||
|
@ -395,11 +395,11 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="205"/>
|
<RowDefinition Height="180"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<ListBox x:Name="SeasonList" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,10,10,10" Grid.RowSpan="2"
|
<ListBox x:Name="SeasonList" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,10,10,40" Grid.RowSpan="2"
|
||||||
SelectionChanged="SeasonList_SelectionChanged">
|
SelectionChanged="SeasonList_SelectionChanged">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@ -411,11 +411,17 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
<Button x:Name="SeasonAddButton" Content="Neu anlegen..." FontSize="12" Height="25" Grid.Row="2"
|
||||||
|
VerticalAlignment="Bottom" Margin="10,10,40,10" Padding="0,0,0,0"
|
||||||
|
Click="SeasonAddButton_Click"/>
|
||||||
|
<Button x:Name="SeasonRemoveButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="2" Height="25" Width="25"
|
||||||
|
VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="10,10,10,10" Padding="0.5,0,0,0"
|
||||||
|
Click="SeasonRemoveButton_Click"/>
|
||||||
|
|
||||||
<Grid Grid.Column="1" Margin="0,10,0,0">
|
<Grid Grid.Column="1" Margin="0,10,0,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="130"/>
|
<ColumnDefinition Width="130"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="120"/>
|
||||||
<ColumnDefinition Width="150"/>
|
<ColumnDefinition Width="150"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
@ -440,29 +446,32 @@
|
|||||||
<TextBox x:Name="SeasonEndInput" Grid.Column="1" Margin="0,130,10,10" Width="78" IsEnabled="False"
|
<TextBox x:Name="SeasonEndInput" Grid.Column="1" Margin="0,130,10,10" Width="78" IsEnabled="False"
|
||||||
HorizontalAlignment="Left"/>
|
HorizontalAlignment="Left"/>
|
||||||
|
|
||||||
<Label Content="Lieferpflicht:" Margin="10,10,0,10" Grid.Column="2"/>
|
<Label Content="Lieferpflicht/-recht:" Margin="10,10,0,10" Grid.Column="2"/>
|
||||||
<ctrl:UnitTextBox x:Name="SeasonMinKgPerBsInput" Unit="kg/GA" TextChanged="SeasonMinMaxKgInput_TextChanged"
|
<ctrl:UnitTextBox x:Name="SeasonMinKgPerBsInput" Unit="kg/GA" TextChanged="SeasonMinMaxKgInput_TextChanged"
|
||||||
Grid.Column="3" Width="80" Margin="0,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
Grid.Column="3" Width="80" Margin="0,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
|
|
||||||
<Label Content="Lieferrecht:" Margin="10,40,0,10" Grid.Column="2"/>
|
|
||||||
<ctrl:UnitTextBox x:Name="SeasonMaxKgPerBsInput" Unit="kg/GA" TextChanged="SeasonMinMaxKgInput_TextChanged"
|
<ctrl:UnitTextBox x:Name="SeasonMaxKgPerBsInput" Unit="kg/GA" TextChanged="SeasonMinMaxKgInput_TextChanged"
|
||||||
|
Grid.Column="3" Width="80" Margin="85,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
|
|
||||||
|
<Label Content="Strafe (pro unterl. kg):" Margin="10,40,0,10" Grid.Column="2"/>
|
||||||
|
<ctrl:UnitTextBox x:Name="SeasonPenaltyPerKgInput" Unit="€/kg" TextChanged="SeasonPenaltyPerKgInput_TextChanged"
|
||||||
Grid.Column="3" Width="80" Margin="0,40,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
Grid.Column="3" Width="80" Margin="0,40,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
|
|
||||||
<Label Content="Strafe (pro unterl. kg):" Margin="10,70,0,10" Grid.Column="2"/>
|
<Label Content="Strafe (Unterlieferung):" Margin="10,70,0,10" Grid.Column="2"/>
|
||||||
<ctrl:UnitTextBox x:Name="SeasonPenaltyPerKgInput" Unit="€/kg" TextChanged="SeasonPenaltyPerKgInput_TextChanged"
|
|
||||||
Grid.Column="3" Width="80" Margin="0,70,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
|
||||||
|
|
||||||
<Label Content="Strafe (Unterlieferung):" Margin="10,100,0,10" Grid.Column="2"/>
|
|
||||||
<ctrl:UnitTextBox x:Name="SeasonPenaltyInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged"
|
<ctrl:UnitTextBox x:Name="SeasonPenaltyInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged"
|
||||||
|
Grid.Column="3" Width="68" Margin="0,70,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
|
<ctrl:UnitTextBox x:Name="SeasonPenaltyPerBsInput" Unit="€/GA" TextChanged="SeasonPenaltyPerBsInput_TextChanged"
|
||||||
|
Grid.Column="3" Width="100" Margin="72,70,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
|
|
||||||
|
<Label Content="Strafe (Nicht-Lieferung):" Margin="10,100,0,10" Grid.Column="2"/>
|
||||||
|
<ctrl:UnitTextBox x:Name="SeasonPenaltyNoneInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged" IsEnabled="False"
|
||||||
Grid.Column="3" Width="68" Margin="0,100,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
Grid.Column="3" Width="68" Margin="0,100,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
|
<ctrl:UnitTextBox x:Name="SeasonPenaltyPerBsNoneInput" Unit="€/GA" TextChanged="SeasonPenaltyPerBsInput_TextChanged" IsEnabled="False"
|
||||||
|
Grid.Column="3" Width="100" Margin="72,100,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
|
|
||||||
<Label Content="Strafe (Nicht-Lieferung):" Margin="10,130,0,10" Grid.Column="2"/>
|
|
||||||
<ctrl:UnitTextBox x:Name="SeasonPenaltyNoneInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged"
|
|
||||||
Grid.Column="3" Width="68" Margin="0,130,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
|
||||||
|
|
||||||
<Label Content="GA-Wert:" Margin="10,160,0,10" Grid.Column="2"/>
|
<Label Content="GA-Wert (Nachz.):" Margin="10,130,0,10" Grid.Column="2"/>
|
||||||
<ctrl:UnitTextBox x:Name="SeasonBsValueInput" Unit="€/GA" TextChanged="SeasonPenaltyInput_TextChanged"
|
<ctrl:UnitTextBox x:Name="SeasonBsValueInput" Unit="€/GA" TextChanged="SeasonPenaltyInput_TextChanged"
|
||||||
Grid.Column="3" Width="85" Margin="0,160,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
Grid.Column="3" Width="85" Margin="0,130,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<GroupBox Grid.Column="1" Grid.Row="1" Header="Zu-/Abschläge" Margin="0,0,10,10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
<GroupBox Grid.Column="1" Grid.Row="1" Header="Zu-/Abschläge" Margin="0,0,10,10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
using Elwig.Helpers;
|
using Elwig.Dialogs;
|
||||||
|
using Elwig.Helpers;
|
||||||
using Elwig.Models.Entities;
|
using Elwig.Models.Entities;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Elwig.Windows {
|
namespace Elwig.Windows {
|
||||||
public partial class BaseDataWindow {
|
public partial class BaseDataWindow {
|
||||||
@ -13,17 +17,23 @@ namespace Elwig.Windows {
|
|||||||
private bool _seasonUpdate = false;
|
private bool _seasonUpdate = false;
|
||||||
|
|
||||||
private async Task SeasonsInitEditing(AppDbContext ctx) {
|
private async Task SeasonsInitEditing(AppDbContext ctx) {
|
||||||
|
SeasonAddButton.IsEnabled = false;
|
||||||
|
SeasonRemoveButton.IsEnabled = false;
|
||||||
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
|
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
|
||||||
.OrderByDescending(s => s.Year)
|
.OrderByDescending(s => s.Year)
|
||||||
.Include(s => s.Modifiers)
|
.Include(s => s.Modifiers)
|
||||||
|
.Include(s => s.Currency)
|
||||||
.ToListAsync());
|
.ToListAsync());
|
||||||
SeasonList_SelectionChanged(null, null);
|
SeasonList_SelectionChanged(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SeasonsFinishEditing(AppDbContext ctx) {
|
private async Task SeasonsFinishEditing(AppDbContext ctx) {
|
||||||
|
SeasonAddButton.IsEnabled = true;
|
||||||
|
SeasonRemoveButton.IsEnabled = true;
|
||||||
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
|
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
|
||||||
.OrderByDescending(s => s.Year)
|
.OrderByDescending(s => s.Year)
|
||||||
.Include(s => s.Modifiers)
|
.Include(s => s.Modifiers)
|
||||||
|
.Include(s => s.Currency)
|
||||||
.ToListAsync());
|
.ToListAsync());
|
||||||
_seasonChanged = false;
|
_seasonChanged = false;
|
||||||
}
|
}
|
||||||
@ -49,13 +59,17 @@ namespace Elwig.Windows {
|
|||||||
SeasonPenaltyPerKgInput.Text = s.PenaltyPerKg?.ToString() ?? "";
|
SeasonPenaltyPerKgInput.Text = s.PenaltyPerKg?.ToString() ?? "";
|
||||||
SeasonPenaltyInput.Text = s.PenaltyAmount?.ToString() ?? "";
|
SeasonPenaltyInput.Text = s.PenaltyAmount?.ToString() ?? "";
|
||||||
SeasonPenaltyNoneInput.Text = s.PenaltyNone?.ToString() ?? "";
|
SeasonPenaltyNoneInput.Text = s.PenaltyNone?.ToString() ?? "";
|
||||||
|
SeasonPenaltyPerBsInput.Text = s.PenaltyPerBsAmount?.ToString() ?? "";
|
||||||
|
SeasonPenaltyPerBsNoneInput.Text = s.PenaltyPerBsNone?.ToString() ?? "";
|
||||||
SeasonBsValueInput.Text = s.BusinessShareValue?.ToString() ?? "";
|
SeasonBsValueInput.Text = s.BusinessShareValue?.ToString() ?? "";
|
||||||
|
|
||||||
var sym = s.Currency.Symbol ?? "";
|
var sym = s.Currency.Symbol ?? s.Currency.Code;
|
||||||
SeasonModifierAbsInput.Unit = $"{sym}/kg";
|
SeasonModifierAbsInput.Unit = $"{sym}/kg";
|
||||||
SeasonPenaltyPerKgInput.Unit = $"{sym}/kg";
|
SeasonPenaltyPerKgInput.Unit = $"{sym}/kg";
|
||||||
SeasonPenaltyInput.Unit = sym;
|
SeasonPenaltyInput.Unit = sym;
|
||||||
SeasonPenaltyNoneInput.Unit = sym;
|
SeasonPenaltyNoneInput.Unit = sym;
|
||||||
|
SeasonPenaltyPerBsInput.Unit = $"{sym}/GA";
|
||||||
|
SeasonPenaltyPerBsNoneInput.Unit = $"{sym}/GA";
|
||||||
SeasonBsValueInput.Unit = $"{sym}/GA";
|
SeasonBsValueInput.Unit = $"{sym}/GA";
|
||||||
AreaCommitmentTypePenaltyPerKgInput.Unit = $"{sym}/kg";
|
AreaCommitmentTypePenaltyPerKgInput.Unit = $"{sym}/kg";
|
||||||
AreaCommitmentTypePenaltyInput.Unit = sym;
|
AreaCommitmentTypePenaltyInput.Unit = sym;
|
||||||
@ -72,6 +86,8 @@ namespace Elwig.Windows {
|
|||||||
SeasonPenaltyPerKgInput.Text = "";
|
SeasonPenaltyPerKgInput.Text = "";
|
||||||
SeasonPenaltyInput.Text = "";
|
SeasonPenaltyInput.Text = "";
|
||||||
SeasonPenaltyNoneInput.Text = "";
|
SeasonPenaltyNoneInput.Text = "";
|
||||||
|
SeasonPenaltyPerBsInput.Text = "";
|
||||||
|
SeasonPenaltyPerBsNoneInput.Text = "";
|
||||||
SeasonBsValueInput.Text = "";
|
SeasonBsValueInput.Text = "";
|
||||||
}
|
}
|
||||||
_seasonUpdate = false;
|
_seasonUpdate = false;
|
||||||
@ -94,6 +110,8 @@ namespace Elwig.Windows {
|
|||||||
s.PenaltyPerKg = (SeasonPenaltyPerKgInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerKgInput.Text) : null;
|
s.PenaltyPerKg = (SeasonPenaltyPerKgInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerKgInput.Text) : null;
|
||||||
s.PenaltyAmount = (SeasonPenaltyInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyInput.Text) : null;
|
s.PenaltyAmount = (SeasonPenaltyInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyInput.Text) : null;
|
||||||
s.PenaltyNone = (SeasonPenaltyNoneInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyNoneInput.Text) : null;
|
s.PenaltyNone = (SeasonPenaltyNoneInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyNoneInput.Text) : null;
|
||||||
|
s.PenaltyPerBsAmount = (SeasonPenaltyPerBsInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerBsInput.Text) : null;
|
||||||
|
s.PenaltyPerBsNone = (SeasonPenaltyPerBsNoneInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerBsNoneInput.Text) : null;
|
||||||
s.BusinessShareValue = (SeasonBsValueInput.Text.Length > 0) ? decimal.Parse(SeasonBsValueInput.Text) : null;
|
s.BusinessShareValue = (SeasonBsValueInput.Text.Length > 0) ? decimal.Parse(SeasonBsValueInput.Text) : null;
|
||||||
|
|
||||||
UpdateButtons();
|
UpdateButtons();
|
||||||
@ -119,5 +137,92 @@ namespace Elwig.Windows {
|
|||||||
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, 2));
|
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, 2));
|
||||||
Season_Changed(sender, evt);
|
Season_Changed(sender, evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SeasonPenaltyPerBsInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||||
|
if (SeasonList.SelectedItem is not Season s) return;
|
||||||
|
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, s.Precision));
|
||||||
|
Season_Changed(sender, evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void SeasonAddButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
var s = SeasonList.ItemsSource.Cast<Season>().FirstOrDefault();
|
||||||
|
var year = Utils.CurrentYear;
|
||||||
|
if (year == s?.Year) year++;
|
||||||
|
|
||||||
|
List<Currency> currencies;
|
||||||
|
using (var ctx = new AppDbContext()) {
|
||||||
|
currencies = await ctx.Currencies
|
||||||
|
.OrderBy(c => c.Code)
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
var d = new NewSeasonDialog(s, currencies);
|
||||||
|
if (d.ShowDialog() == true) {
|
||||||
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
|
try {
|
||||||
|
using var ctx = new AppDbContext();
|
||||||
|
ctx.Add(new Season {
|
||||||
|
Year = year,
|
||||||
|
CurrencyCode = d.CurrencyCode,
|
||||||
|
Precision = d.Precision,
|
||||||
|
MaxKgPerHa = s?.MaxKgPerHa ?? 10000,
|
||||||
|
VatNormal = s?.VatNormal ?? 0.10,
|
||||||
|
VatFlatrate = s?.VatFlatrate ?? 0.13,
|
||||||
|
MinKgPerBusinessShare = s?.MinKgPerBusinessShare ?? 500,
|
||||||
|
MaxKgPerBusinessShare = s?.MaxKgPerBusinessShare ?? 1000,
|
||||||
|
PenaltyPerKgValue = s?.PenaltyPerKgValue,
|
||||||
|
PenaltyAmoutValue = s?.PenaltyAmoutValue,
|
||||||
|
PenaltyNoneValue = s?.PenaltyNoneValue,
|
||||||
|
PenaltyPerBsAmountValue = s?.PenaltyPerBsAmountValue,
|
||||||
|
PenaltyPerBsNoneValue = s?.PenaltyPerBsNoneValue,
|
||||||
|
BusinessShareValueValue = s?.BusinessShareValueValue,
|
||||||
|
CalcMode = s?.CalcMode ?? 0,
|
||||||
|
});
|
||||||
|
if (s != null && d.CopyModifiers) {
|
||||||
|
int mult = d.Precision > s.Precision ? (int)Math.Pow(10, d.Precision - s.Precision) : 1;
|
||||||
|
int div = d.Precision < s.Precision ? (int)Math.Pow(10, s.Precision - d.Precision) : 1;
|
||||||
|
ctx.AddRange(s.Modifiers.Select(m => new Modifier {
|
||||||
|
Year = year,
|
||||||
|
ModId = m.ModId,
|
||||||
|
Ordering = m.Ordering,
|
||||||
|
Name = m.Name,
|
||||||
|
AbsValue = m.AbsValue * mult / div,
|
||||||
|
RelValue = m.RelValue,
|
||||||
|
IsStandard = m.IsStandard,
|
||||||
|
IsQuickSelect = m.IsQuickSelect,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
} catch (Exception exc) {
|
||||||
|
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
|
||||||
|
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
|
||||||
|
MessageBox.Show(str, "Saison anlegen", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
await App.HintContextChange();
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
SeasonList.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void SeasonRemoveButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
if (SeasonList.SelectedItem is not Season s)
|
||||||
|
return;
|
||||||
|
var r = MessageBox.Show(
|
||||||
|
$"Soll die Saison {s.Year} wirklich unwiderruflich gelöscht werden?",
|
||||||
|
"Saison löschen", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
|
||||||
|
if (r == MessageBoxResult.OK) {
|
||||||
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
|
try {
|
||||||
|
using var ctx = new AppDbContext();
|
||||||
|
ctx.Remove(s);
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
} catch (Exception exc) {
|
||||||
|
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
|
||||||
|
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
|
||||||
|
MessageBox.Show(str, "Saison löschen", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
await App.HintContextChange();
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ namespace Elwig.Windows {
|
|||||||
SeasonMaxKgPerHaInput, SeasonVatNormalInput, SeasonVatFlatrateInput, SeasonStartInput, SeasonEndInput,
|
SeasonMaxKgPerHaInput, SeasonVatNormalInput, SeasonVatFlatrateInput, SeasonStartInput, SeasonEndInput,
|
||||||
SeasonMinKgPerBsInput, SeasonMaxKgPerBsInput, SeasonBsValueInput,
|
SeasonMinKgPerBsInput, SeasonMaxKgPerBsInput, SeasonBsValueInput,
|
||||||
SeasonPenaltyPerKgInput, SeasonPenaltyInput, SeasonPenaltyNoneInput,
|
SeasonPenaltyPerKgInput, SeasonPenaltyInput, SeasonPenaltyNoneInput,
|
||||||
|
SeasonPenaltyPerBsInput, SeasonPenaltyPerBsNoneInput,
|
||||||
SeasonModifierIdInput, SeasonModifierNameInput, SeasonModifierRelInput, SeasonModifierAbsInput,
|
SeasonModifierIdInput, SeasonModifierNameInput, SeasonModifierRelInput, SeasonModifierAbsInput,
|
||||||
];
|
];
|
||||||
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
|
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
|
||||||
@ -80,6 +81,8 @@ namespace Elwig.Windows {
|
|||||||
SeasonPenaltyPerKgInput.IsReadOnly = true;
|
SeasonPenaltyPerKgInput.IsReadOnly = true;
|
||||||
SeasonPenaltyInput.IsReadOnly = true;
|
SeasonPenaltyInput.IsReadOnly = true;
|
||||||
SeasonPenaltyNoneInput.IsReadOnly = true;
|
SeasonPenaltyNoneInput.IsReadOnly = true;
|
||||||
|
SeasonPenaltyPerBsInput.IsReadOnly = true;
|
||||||
|
SeasonPenaltyPerBsNoneInput.IsReadOnly = true;
|
||||||
SeasonBsValueInput.IsReadOnly = true;
|
SeasonBsValueInput.IsReadOnly = true;
|
||||||
|
|
||||||
SeasonModifierIdInput.IsReadOnly = true;
|
SeasonModifierIdInput.IsReadOnly = true;
|
||||||
@ -130,6 +133,8 @@ namespace Elwig.Windows {
|
|||||||
SeasonPenaltyPerKgInput.IsReadOnly = false;
|
SeasonPenaltyPerKgInput.IsReadOnly = false;
|
||||||
SeasonPenaltyInput.IsReadOnly = false;
|
SeasonPenaltyInput.IsReadOnly = false;
|
||||||
SeasonPenaltyNoneInput.IsReadOnly = false;
|
SeasonPenaltyNoneInput.IsReadOnly = false;
|
||||||
|
SeasonPenaltyPerBsInput.IsReadOnly = false;
|
||||||
|
SeasonPenaltyPerBsNoneInput.IsReadOnly = false;
|
||||||
SeasonBsValueInput.IsReadOnly = false;
|
SeasonBsValueInput.IsReadOnly = false;
|
||||||
|
|
||||||
SeasonModifierIdInput.IsReadOnly = false;
|
SeasonModifierIdInput.IsReadOnly = false;
|
||||||
@ -152,6 +157,7 @@ namespace Elwig.Windows {
|
|||||||
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
|
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
|
||||||
.OrderByDescending(s => s.Year)
|
.OrderByDescending(s => s.Year)
|
||||||
.Include(s => s.Modifiers)
|
.Include(s => s.Modifiers)
|
||||||
|
.Include(s => s.Currency)
|
||||||
.ToListAsync(), null, ControlUtils.RenewSourceDefault.First);
|
.ToListAsync(), null, ControlUtils.RenewSourceDefault.First);
|
||||||
var year = (SeasonList.SelectedItem as Season)?.Year;
|
var year = (SeasonList.SelectedItem as Season)?.Year;
|
||||||
ControlUtils.RenewItemsSource(BranchList, await ctx.Branches
|
ControlUtils.RenewItemsSource(BranchList, await ctx.Branches
|
||||||
@ -329,7 +335,7 @@ namespace Elwig.Windows {
|
|||||||
LockInputs();
|
LockInputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
await HintContextChange();
|
await App.HintContextChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FillInputs(ClientParameters p, Season? s) {
|
private void FillInputs(ClientParameters p, Season? s) {
|
||||||
|
@ -509,7 +509,7 @@ namespace Elwig.Windows {
|
|||||||
ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph!.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint));
|
ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph!.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint));
|
||||||
|
|
||||||
OechsleInput.Text = Highlighted.Graph!.GetOechsleAt(Highlighted.Index).ToString();
|
OechsleInput.Text = Highlighted.Graph!.GetOechsleAt(Highlighted.Index).ToString();
|
||||||
PriceInput.Text = Highlighted.Graph.GetPriceAt(Highlighted.Index).ToString();
|
PriceInput.Text = Math.Round(Highlighted.Graph.GetPriceAt(Highlighted.Index), Season.Precision).ToString();
|
||||||
|
|
||||||
EnableActionButtons();
|
EnableActionButtons();
|
||||||
} else {
|
} else {
|
||||||
|
@ -175,9 +175,9 @@
|
|||||||
</TextBlock>
|
</TextBlock>
|
||||||
</TextBox.ToolTip>
|
</TextBox.ToolTip>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
<xctk:IntegerUpDown x:Name="SeasonInput" Grid.ColumnSpan="3" Height="25" Width="56" FontSize="14" Minimum="1000" Maximum="9999"
|
<ctrl:IntegerUpDown x:Name="SeasonInput" Grid.ColumnSpan="3" Height="25" Width="56" FontSize="14" Minimum="1900" Maximum="9999"
|
||||||
Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Right"
|
Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Right" Text="2020"
|
||||||
ValueChanged="SeasonInput_ValueChanged"/>
|
TextChanged="SeasonInput_TextChanged"/>
|
||||||
<CheckBox x:Name="TodayOnlyInput" Content="Nur heute"
|
<CheckBox x:Name="TodayOnlyInput" Content="Nur heute"
|
||||||
HorizontalAlignment="Right" Margin="0,7,18,0" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2"
|
HorizontalAlignment="Right" Margin="0,7,18,0" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2"
|
||||||
Checked="TodayOnlyInput_Changed" Unchecked="TodayOnlyInput_Changed"/>
|
Checked="TodayOnlyInput_Changed" Unchecked="TodayOnlyInput_Changed"/>
|
||||||
|
@ -1067,7 +1067,7 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
await RefreshDeliveryList();
|
await RefreshDeliveryList();
|
||||||
var d = DeliveryList.SelectedItem as Delivery;
|
var d = DeliveryList.SelectedItem as Delivery;
|
||||||
var y = d?.Year ?? Utils.CurrentLastSeason;
|
var y = d?.Year ?? SeasonInput.Value;
|
||||||
ControlUtils.RenewItemsSource(MemberInput, await ctx.Members
|
ControlUtils.RenewItemsSource(MemberInput, await ctx.Members
|
||||||
.Where(m => m.IsActive || !IsCreating)
|
.Where(m => m.IsActive || !IsCreating)
|
||||||
.Include(m => m.PostalDest.AtPlz!.Ort)
|
.Include(m => m.PostalDest.AtPlz!.Ort)
|
||||||
@ -1084,7 +1084,11 @@ namespace Elwig.Windows {
|
|||||||
cultList.Insert(0, new NullItem(""));
|
cultList.Insert(0, new NullItem(""));
|
||||||
ControlUtils.RenewItemsSource(CultivationInput, cultList, null, ControlUtils.RenewSourceDefault.First);
|
ControlUtils.RenewItemsSource(CultivationInput, cultList, null, ControlUtils.RenewSourceDefault.First);
|
||||||
ControlUtils.RenewItemsSource(WineQualityLevelInput, await ctx.WineQualityLevels.ToListAsync());
|
ControlUtils.RenewItemsSource(WineQualityLevelInput, await ctx.WineQualityLevels.ToListAsync());
|
||||||
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers.Where(m => m.Year == y).OrderBy(m => m.Ordering).ToListAsync());
|
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
||||||
|
.Where(m => m.Year == y)
|
||||||
|
.OrderBy(m => m.Ordering)
|
||||||
|
.Include(m => m.Season.Currency)
|
||||||
|
.ToListAsync());
|
||||||
ControlUtils.RenewItemsSource(WineOriginInput, (await ctx.WineOrigins.ToListAsync()).OrderByDescending(o => o.SortKey).ThenBy(o => o.HkId));
|
ControlUtils.RenewItemsSource(WineOriginInput, (await ctx.WineOrigins.ToListAsync()).OrderByDescending(o => o.SortKey).ThenBy(o => o.HkId));
|
||||||
var kgList = (await ctx.Katastralgemeinden
|
var kgList = (await ctx.Katastralgemeinden
|
||||||
.Where(k => k.WbKg != null)
|
.Where(k => k.WbKg != null)
|
||||||
@ -1112,10 +1116,18 @@ namespace Elwig.Windows {
|
|||||||
private async Task RefreshDeliveryParts() {
|
private async Task RefreshDeliveryParts() {
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
if (DeliveryList.SelectedItem is Delivery d) {
|
if (DeliveryList.SelectedItem is Delivery d) {
|
||||||
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers.Where(m => m.Year == d.Year).OrderBy(m => m.Ordering).ToListAsync());
|
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
||||||
|
.Where(m => m.Year == d.Year)
|
||||||
|
.OrderBy(m => m.Ordering)
|
||||||
|
.Include(m => m.Season.Currency)
|
||||||
|
.ToListAsync());
|
||||||
ControlUtils.RenewItemsSource(DeliveryPartList, d.FilteredParts.OrderBy(p => p.DPNr).ToList(), DeliveryPartList_SelectionChanged, ControlUtils.RenewSourceDefault.First);
|
ControlUtils.RenewItemsSource(DeliveryPartList, d.FilteredParts.OrderBy(p => p.DPNr).ToList(), DeliveryPartList_SelectionChanged, ControlUtils.RenewSourceDefault.First);
|
||||||
} else {
|
} else {
|
||||||
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers.Where(m => m.Year == Utils.CurrentLastSeason).OrderBy(m => m.Ordering).ToListAsync());
|
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
|
||||||
|
.Where(m => m.Year == SeasonInput.Value)
|
||||||
|
.OrderBy(m => m.Ordering)
|
||||||
|
.Include(m => m.Season.Currency)
|
||||||
|
.ToListAsync());
|
||||||
DeliveryPartList.ItemsSource = null;
|
DeliveryPartList.ItemsSource = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1267,7 +1279,10 @@ namespace Elwig.Windows {
|
|||||||
ctx.Add(p);
|
ctx.Add(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.UpdateDeliveryPartModifiers(p, ModifiersInput.SelectedItems.Cast<Modifier>());
|
ctx.UpdateDeliveryPartModifiers(p, await ctx.DeliveryPartModifiers
|
||||||
|
.Where(m => m.Year == p.Year && m.DId == p.DId && m.DPNr == p.DPNr)
|
||||||
|
.Select(m => m.Modifier)
|
||||||
|
.ToListAsync(), ModifiersInput.SelectedItems.Cast<Modifier>());
|
||||||
|
|
||||||
if (originalMgNr != null && originalMgNr.Value != d.MgNr) {
|
if (originalMgNr != null && originalMgNr.Value != d.MgNr) {
|
||||||
// update origin (KgNr), if default is selected
|
// update origin (KgNr), if default is selected
|
||||||
@ -1344,8 +1359,8 @@ namespace Elwig.Windows {
|
|||||||
await RefreshDeliveryListQuery(true);
|
await RefreshDeliveryListQuery(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void SeasonInput_ValueChanged(object sender, RoutedEventArgs evt) {
|
private async void SeasonInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||||
if (SeasonInput.Value == null) return;
|
if (SeasonInput.Value == null || TodayOnlyInput == null || AllSeasonsInput == null) return;
|
||||||
TodayOnlyInput.IsChecked = false;
|
TodayOnlyInput.IsChecked = false;
|
||||||
AllSeasonsInput.IsChecked = false;
|
AllSeasonsInput.IsChecked = false;
|
||||||
await RefreshDeliveryListQuery();
|
await RefreshDeliveryListQuery();
|
||||||
@ -1592,7 +1607,7 @@ namespace Elwig.Windows {
|
|||||||
p2.HkId = "OEST";
|
p2.HkId = "OEST";
|
||||||
ctx.Add(p2);
|
ctx.Add(p2);
|
||||||
|
|
||||||
ctx.UpdateDeliveryPartModifiers(p2, p.Modifiers);
|
ctx.UpdateDeliveryPartModifiers(p2, [], p.Modifiers);
|
||||||
}
|
}
|
||||||
await ctx.SaveChangesAsync();
|
await ctx.SaveChangesAsync();
|
||||||
await RefreshDeliveryParts();
|
await RefreshDeliveryParts();
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
<Button x:Name="DocumentAddButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="14"
|
<Button x:Name="DocumentAddButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="14"
|
||||||
Grid.Column="1" Margin="0,0,0,30" VerticalAlignment="Center" Height="25" IsEnabled="False"
|
Grid.Column="1" Margin="0,0,0,30" VerticalAlignment="Center" Height="25" IsEnabled="False"
|
||||||
Click="DocumentAddButton_Click"/>
|
Click="DocumentAddButton_Click"/>
|
||||||
<Button x:Name="DocumentRemoveButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="14" Padding="1.5,0,0,0"
|
<Button x:Name="DocumentRemoveButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="16" Padding="1.5,0,0,0"
|
||||||
Grid.Column="1" Margin="0,30,0,0" VerticalAlignment="Center" Height="25" IsEnabled="False"
|
Grid.Column="1" Margin="0,30,0,0" VerticalAlignment="Center" Height="25" IsEnabled="False"
|
||||||
Click="DocumentRemoveButton_Click"/>
|
Click="DocumentRemoveButton_Click"/>
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace Elwig.Windows {
|
|||||||
CreditNote.Name,
|
CreditNote.Name,
|
||||||
];
|
];
|
||||||
|
|
||||||
public readonly int? Year;
|
public readonly int Year;
|
||||||
public ObservableCollection<SelectedDoc> SelectedDocs = [];
|
public ObservableCollection<SelectedDoc> SelectedDocs = [];
|
||||||
public IEnumerable<Member> Recipients = [];
|
public IEnumerable<Member> Recipients = [];
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ namespace Elwig.Windows {
|
|||||||
public MailWindow(int? year = null) {
|
public MailWindow(int? year = null) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
using (var ctx = new AppDbContext()) {
|
using (var ctx = new AppDbContext()) {
|
||||||
Year = year ?? ctx.Seasons.OrderBy(s => s.Year).LastOrDefault()?.Year;
|
Year = year ?? ctx.Seasons.OrderBy(s => s.Year).LastOrDefault()!.Year;
|
||||||
Title = $"Rundschreiben - Lese {Year} - Elwig";
|
Title = $"Rundschreiben - Lese {Year} - Elwig";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,6 +168,14 @@ namespace Elwig.Windows {
|
|||||||
.Where(m => m.IsActive)
|
.Where(m => m.IsActive)
|
||||||
.OrderBy(m => m.FamilyName)
|
.OrderBy(m => m.FamilyName)
|
||||||
.ThenBy(m => m.GivenName)
|
.ThenBy(m => m.GivenName)
|
||||||
|
.Include(m => m.Branch)
|
||||||
|
.Include(m => m.DefaultWbKg!.AtKg)
|
||||||
|
.Include(m => m.EmailAddresses)
|
||||||
|
.Include(m => m.TelephoneNumbers)
|
||||||
|
.Include(m => m.PostalDest.AtPlz!.Ort)
|
||||||
|
.Include(m => m.PostalDest.AtPlz!.Country)
|
||||||
|
.Include(m => m.BillingAddress!.PostalDest.AtPlz!.Ort)
|
||||||
|
.Include(m => m.BillingAddress!.PostalDest.AtPlz!.Country)
|
||||||
.ToListAsync(), MemberInput_SelectionChanged);
|
.ToListAsync(), MemberInput_SelectionChanged);
|
||||||
if (MemberCustomInput.SelectedItems.Count == 0) {
|
if (MemberCustomInput.SelectedItems.Count == 0) {
|
||||||
MemberCustomInput.ItemSelectionChanged -= MemberInput_SelectionChanged;
|
MemberCustomInput.ItemSelectionChanged -= MemberInput_SelectionChanged;
|
||||||
@ -245,7 +253,7 @@ namespace Elwig.Windows {
|
|||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
SelectedDocs.Add(new(DocType.MemberDataSheet, s, null));
|
SelectedDocs.Add(new(DocType.MemberDataSheet, s, null));
|
||||||
} else if (idx == 1) {
|
} else if (idx == 1) {
|
||||||
SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, ((int)Year!, DocumentNonDeliverersInput.IsChecked == true)));
|
SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, (Year, DocumentNonDeliverersInput.IsChecked == true)));
|
||||||
} else if (idx >= 2) {
|
} else if (idx >= 2) {
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
var name = s.Split(" – ")[^1];
|
var name = s.Split(" – ")[^1];
|
||||||
@ -297,25 +305,23 @@ namespace Elwig.Windows {
|
|||||||
if (RecipientsCustomInput.IsChecked == true) {
|
if (RecipientsCustomInput.IsChecked == true) {
|
||||||
Recipients = MemberCustomInput.SelectedItems.Cast<Member>().ToList();
|
Recipients = MemberCustomInput.SelectedItems.Cast<Member>().ToList();
|
||||||
} else {
|
} else {
|
||||||
var year = (!await ctx.Deliveries.AnyAsync()) ? 0 : await ctx.Deliveries.MaxAsync(d => d.Year);
|
|
||||||
|
|
||||||
IQueryable<Member> query = ctx.Members.Where(m => m.IsActive);
|
IQueryable<Member> query = ctx.Members.Where(m => m.IsActive);
|
||||||
if (MemberBranchInput.SelectedItems.Count != MemberBranchInput.Items.Count) {
|
if (MemberBranchInput.SelectedItems.Count != MemberBranchInput.Items.Count) {
|
||||||
var zwst = MemberBranchInput.SelectedItems.Cast<Branch>().Select(b => b.ZwstId).ToList();
|
var zwst = MemberBranchInput.SelectedItems.Cast<Branch>().Select(b => b.ZwstId).ToList();
|
||||||
query = query.Where(m => zwst.Contains(m.ZwstId));
|
query = query.Where(m => zwst.Contains(m.ZwstId!));
|
||||||
}
|
}
|
||||||
if (MemberKgInput.SelectedItems.Count != MemberKgInput.Items.Count) {
|
if (MemberKgInput.SelectedItems.Count != MemberKgInput.Items.Count) {
|
||||||
var kgs = MemberKgInput.SelectedItems.Cast<AT_Kg>().Select(k => k.KgNr).ToList();
|
var kgs = MemberKgInput.SelectedItems.Cast<AT_Kg>().Select(k => k.KgNr).ToList();
|
||||||
query = query.Where(m => kgs.Contains((int)m.DefaultKgNr));
|
query = query.Where(m => kgs.Contains((int)m.DefaultKgNr!));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RecipientsAreaComMembersInput.IsChecked == true) {
|
if (RecipientsAreaComMembersInput.IsChecked == true) {
|
||||||
var vtrg = MemberAreaComInput.SelectedItems.Cast<AreaComType>().Select(a => a.VtrgId).ToList();
|
var vtrg = MemberAreaComInput.SelectedItems.Cast<AreaComType>().Select(a => a.VtrgId).ToList();
|
||||||
query = query.Where(m => Utils.ActiveAreaCommitments(m.AreaCommitments).Any(c => vtrg.Contains(c.VtrgId)));
|
query = query.Where(m => m.AreaCommitments.AsQueryable().Where(Utils.ActiveAreaCommitments(Year)).Any(c => vtrg.Contains(c.VtrgId)));
|
||||||
} else if (year > 0 && RecipientsDeliveryMembersInput.IsChecked == true) {
|
} else if (RecipientsDeliveryMembersInput.IsChecked == true) {
|
||||||
query = query.Where(m => m.Deliveries.Any(d => d.Year == year));
|
query = query.Where(m => m.Deliveries.Any(d => d.Year == Year));
|
||||||
} else if (year > 0 && RecipientsNonDeliveryMembersInput.IsChecked == true) {
|
} else if (RecipientsNonDeliveryMembersInput.IsChecked == true) {
|
||||||
query = query.Where(m => !m.Deliveries.Any(d => d.Year == year));
|
query = query.Where(m => !m.Deliveries.Any(d => d.Year == Year));
|
||||||
}
|
}
|
||||||
Recipients = await query
|
Recipients = await query
|
||||||
.Include(m => m.Branch)
|
.Include(m => m.Branch)
|
||||||
@ -707,7 +713,7 @@ namespace Elwig.Windows {
|
|||||||
AvaiableDocumentsList.SelectedIndex = 1;
|
AvaiableDocumentsList.SelectedIndex = 1;
|
||||||
if (AvaiableDocumentsList.SelectedItem is not string s || SelectedDocs.Any(d => d.Type == DocType.DeliveryConfirmation))
|
if (AvaiableDocumentsList.SelectedItem is not string s || SelectedDocs.Any(d => d.Type == DocType.DeliveryConfirmation))
|
||||||
return;
|
return;
|
||||||
SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, ((int)Year!, DocumentNonDeliverersInput.IsChecked == true)));
|
SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, (Year, DocumentNonDeliverersInput.IsChecked == true)));
|
||||||
SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;
|
SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
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:local="clr-namespace:Elwig.Windows"
|
||||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
xmlns:ctrl="clr-namespace:Elwig.Controls"
|
||||||
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>
|
||||||
@ -71,9 +71,9 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Border BorderBrush="LightGray" BorderThickness="1"/>
|
<Border BorderBrush="LightGray" BorderThickness="1"/>
|
||||||
<Label Content="Saison:" Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Center" Padding="2,4,2,4" Height="25"/>
|
<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"
|
<ctrl:IntegerUpDown x:Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1900" Maximum="9999"
|
||||||
Margin="0,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
|
Margin="0,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
|
||||||
ValueChanged="SeasonInput_ValueChanged"/>
|
TextChanged="SeasonInput_TextChanged"/>
|
||||||
|
|
||||||
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigung"
|
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigung"
|
||||||
Click="DeliveryConfirmationButton_Click"
|
Click="DeliveryConfirmationButton_Click"
|
||||||
@ -87,8 +87,8 @@
|
|||||||
Click="OverUnderDeliveryButton_Click"
|
Click="OverUnderDeliveryButton_Click"
|
||||||
Margin="0,90,200,10" Width="190"/>
|
Margin="0,90,200,10" Width="190"/>
|
||||||
|
|
||||||
<Button x:Name="AutoBusinessSharesButton" Content="Autom. GA nachzeichnen"
|
<Button x:Name="PaymentAdjustmentButton" Content="Anpassung"
|
||||||
Click="AutoBusinessSharesButton_Click" IsEnabled="False"
|
Click="PaymentAdjustmentButton_Click" IsEnabled="False"
|
||||||
Margin="200,90,0,10" Width="190"/>
|
Margin="200,90,0,10" Width="190"/>
|
||||||
|
|
||||||
<Button x:Name="BreakdownButton" Content="Sorten-/Qual.aufteilung"
|
<Button x:Name="BreakdownButton" Content="Sorten-/Qual.aufteilung"
|
||||||
|
@ -14,6 +14,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Elwig.Windows {
|
namespace Elwig.Windows {
|
||||||
@ -147,7 +148,7 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Task OnRenewContext(AppDbContext ctx) {
|
protected override Task OnRenewContext(AppDbContext ctx) {
|
||||||
SeasonInput_ValueChanged(null, null);
|
SeasonInput_TextChanged(null, null);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,13 +160,13 @@ namespace Elwig.Windows {
|
|||||||
Height = 390;
|
Height = 390;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void SeasonInput_ValueChanged(object? sender, RoutedEventArgs? evt) {
|
private async void SeasonInput_TextChanged(object? sender, TextChangedEventArgs? evt) {
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
var s0 = await ctx.Seasons.FindAsync(SeasonInput.Value);
|
var s0 = await ctx.Seasons.FindAsync(SeasonInput.Value);
|
||||||
var valid = (s0 != null);
|
var valid = (s0 != null);
|
||||||
DeliveryConfirmationButton.IsEnabled = valid;
|
DeliveryConfirmationButton.IsEnabled = valid;
|
||||||
OverUnderDeliveryButton.IsEnabled = valid;
|
OverUnderDeliveryButton.IsEnabled = valid;
|
||||||
AutoBusinessSharesButton.IsEnabled = valid && false;
|
PaymentAdjustmentButton.IsEnabled = valid && false;
|
||||||
PaymentButton.IsEnabled = valid;
|
PaymentButton.IsEnabled = valid;
|
||||||
BreakdownButton.IsEnabled = valid;
|
BreakdownButton.IsEnabled = valid;
|
||||||
}
|
}
|
||||||
@ -210,18 +211,18 @@ namespace Elwig.Windows {
|
|||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void AutoBusinessSharesButton_Click(object sender, RoutedEventArgs evt) {
|
private async void PaymentAdjustmentButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
if (SeasonInput.Value is not int year)
|
if (SeasonInput.Value is not int year)
|
||||||
return;
|
return;
|
||||||
if (false && App.Client.IsMatzen) {
|
if (false && App.Client.IsMatzen) {
|
||||||
AutoBusinessSharesButton.IsEnabled = false;
|
PaymentAdjustmentButton.IsEnabled = false;
|
||||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
|
|
||||||
var b = new Billing(year);
|
var b = new Billing(year);
|
||||||
await b.AutoAdjustBusinessShare();
|
await b.AutoAdjustBusinessShare();
|
||||||
|
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
AutoBusinessSharesButton.IsEnabled = true;
|
PaymentAdjustmentButton.IsEnabled = true;
|
||||||
} else {
|
} else {
|
||||||
MessageBox.Show(
|
MessageBox.Show(
|
||||||
"Es ist kein automatisches Nachzeichnen der Geschäftsanteile\n" +
|
"Es ist kein automatisches Nachzeichnen der Geschäftsanteile\n" +
|
||||||
|
@ -15,6 +15,7 @@ using Elwig.Models.Dtos;
|
|||||||
using Elwig.Helpers.Export;
|
using Elwig.Helpers.Export;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Elwig.Helpers.Billing;
|
using Elwig.Helpers.Billing;
|
||||||
|
using Elwig.Dialogs;
|
||||||
|
|
||||||
namespace Elwig.Windows {
|
namespace Elwig.Windows {
|
||||||
public partial class MemberAdminWindow : AdministrationWindow {
|
public partial class MemberAdminWindow : AdministrationWindow {
|
||||||
@ -454,20 +455,38 @@ namespace Elwig.Windows {
|
|||||||
if (MemberList.SelectedItem is not Member m)
|
if (MemberList.SelectedItem is not Member m)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var r = MessageBox.Show(
|
int areaComs = 0, deliveries = 0, credits = 0;
|
||||||
$"Soll das Mitglied \"{m.AdministrativeName}\" (MgNr. {m.MgNr}) wirklich unwiderruflich gelöscht werden?\n" +
|
using (var ctx = new AppDbContext()) {
|
||||||
$"Sämtliche Lieferungen und Flächenbindungen dieses Mitglieds werden auch gelöscht!",
|
var l = (await ctx.Members.FindAsync(m.MgNr))!;
|
||||||
"Mitglied löschen", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
|
areaComs = l.AreaCommitments.Count;
|
||||||
if (r == MessageBoxResult.OK) {
|
deliveries = l.Deliveries.Count;
|
||||||
|
credits = l.Credits.Count;
|
||||||
|
}
|
||||||
|
var d = new DeleteMemberDialog(m.MgNr, m.AdministrativeName, areaComs, deliveries, credits);
|
||||||
|
if (d.ShowDialog() == true) {
|
||||||
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
try {
|
try {
|
||||||
using (var ctx = new AppDbContext()) {
|
using (var ctx = new AppDbContext()) {
|
||||||
ctx.Remove(m);
|
var l = (await ctx.Members.FindAsync(m.MgNr))!;
|
||||||
|
if (d.DeletePaymentData) {
|
||||||
|
ctx.RemoveRange(l.Credits);
|
||||||
|
}
|
||||||
|
if (d.DeleteDeliveries) {
|
||||||
|
ctx.RemoveRange(l.Deliveries);
|
||||||
|
}
|
||||||
|
if (d.DeleteAreaComs) {
|
||||||
|
ctx.RemoveRange(l.AreaCommitments);
|
||||||
|
}
|
||||||
|
ctx.Remove(l);
|
||||||
await ctx.SaveChangesAsync();
|
await ctx.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
await App.HintContextChange();
|
await App.HintContextChange();
|
||||||
} catch (Exception exc) {
|
} catch (Exception exc) {
|
||||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
|
||||||
|
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
|
||||||
|
MessageBox.Show(str, "Mitglied löschen", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1115,7 +1134,7 @@ namespace Elwig.Windows {
|
|||||||
var valid = InputLostFocus((TextBox)sender, Validator.CheckPredecessorMgNr);
|
var valid = InputLostFocus((TextBox)sender, Validator.CheckPredecessorMgNr);
|
||||||
if (valid && PredecessorMgNrInput.Text != "" && (IsEditing || IsCreating)) {
|
if (valid && PredecessorMgNrInput.Text != "" && (IsEditing || IsCreating)) {
|
||||||
var mgnr = int.Parse(PredecessorMgNrInput.Text);
|
var mgnr = int.Parse(PredecessorMgNrInput.Text);
|
||||||
if (MemberList.SelectedItem is Member m && m.MgNr == mgnr)
|
if (MemberList.SelectedItem is not Member m || m.MgNr == mgnr)
|
||||||
return;
|
return;
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
var areaComs = await ctx.AreaCommitments
|
var areaComs = await ctx.AreaCommitments
|
||||||
@ -1123,13 +1142,12 @@ namespace Elwig.Windows {
|
|||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (areaComs.Count == 0)
|
if (areaComs.Count == 0)
|
||||||
return;
|
return;
|
||||||
var res = MessageBox.Show("Sollen die aktiven Flächenbindungen des angegebenen\n" +
|
|
||||||
$"Vorgängers übernommen werden? ({areaComs.Sum(c => c.Area)} m²)\n\n" +
|
var oldMember = (await ctx.Members.FindAsync(mgnr))!;
|
||||||
"Die Änderungen werden erst beim Speichern übernommen!",
|
var d = new AreaComDialog(oldMember.AdministrativeName, m.AdministrativeName, areaComs.Count, areaComs.Sum(c => c.Area));
|
||||||
"Aktive Flächenbindungen übernehmen", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
|
if (d.ShowDialog() != true)
|
||||||
if (res != MessageBoxResult.Yes)
|
|
||||||
return;
|
return;
|
||||||
TransferPredecessorAreaComs = Utils.FollowingSeason;
|
TransferPredecessorAreaComs = d.SuccessorSeason;
|
||||||
SetOriginalValue(PredecessorMgNrInput, -1); // hack to allow user to save
|
SetOriginalValue(PredecessorMgNrInput, -1); // hack to allow user to save
|
||||||
UpdateButtons();
|
UpdateButtons();
|
||||||
}
|
}
|
||||||
@ -1171,18 +1189,18 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async void ActiveInput_Changed(object sender, RoutedEventArgs evt) {
|
private async void ActiveInput_Changed(object sender, RoutedEventArgs evt) {
|
||||||
|
if (MemberList.SelectedItem is not Member m)
|
||||||
|
return;
|
||||||
if ((IsEditing || IsCreating) && ActiveInput.IsChecked == false && int.TryParse(MgNrInput.Text, out var mgnr)) {
|
if ((IsEditing || IsCreating) && ActiveInput.IsChecked == false && int.TryParse(MgNrInput.Text, out var mgnr)) {
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
var areaComs = await ctx.AreaCommitments
|
var areaComs = await ctx.AreaCommitments
|
||||||
.Where(c => c.MgNr == mgnr && (c.YearTo == null || c.YearTo >= Utils.FollowingSeason))
|
.Where(c => c.MgNr == mgnr && (c.YearTo == null || c.YearTo >= Utils.FollowingSeason))
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (areaComs.Count >= 0) {
|
if (areaComs.Count > 0) {
|
||||||
var res = MessageBox.Show($"Sollen die aktiven Flächenbindungen gekündigt werden? ({areaComs.Sum(c => c.Area)} m²)\n" +
|
var d = new AreaComDialog(m.AdministrativeName, areaComs.Count, areaComs.Sum(c => c.Area));
|
||||||
"Falls die Flächenbindungen später an ein neues Mitglied\n" +
|
if (d.ShowDialog() == true) {
|
||||||
"übertragen werden sollen bitte \"Nein\" auswählen!\n\n" +
|
CancelAreaComs = d.CancelSeason;
|
||||||
"Die Änderungen werden erst beim Speichern übernommen!",
|
}
|
||||||
"Flächenbindungen kündigen", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
|
|
||||||
CancelAreaComs = res == MessageBoxResult.Yes ? Utils.FollowingSeason - 1 : null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckBox_Changed(sender, evt);
|
CheckBox_Changed(sender, evt);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
::mkdir "C:\Program Files\Elwig"
|
::mkdir "C:\Program Files\Elwig"
|
||||||
::curl -s -L "https://github.com/emendelson/pdftoprinter/raw/main/PDFtoPrinter.exe" -z "C:\Program Files\Elwig\PDFtoPrinter.exe" -o "C:\Program Files\Elwig\PDFtoPrinter.exe"
|
::curl --fail -s -L "https://github.com/emendelson/pdftoprinter/raw/main/PDFtoPrinter.exe" -z "C:\Program Files\Elwig\PDFtoPrinter.exe" -o "C:\Program Files\Elwig\PDFtoPrinter.exe"
|
||||||
mkdir "C:\ProgramData\Elwig\resources"
|
mkdir "C:\ProgramData\Elwig\resources"
|
||||||
copy /b /y Documents\*.css "C:\ProgramData\Elwig\resources"
|
copy /b /y Documents\*.css "C:\ProgramData\Elwig\resources"
|
||||||
copy /b /y Documents\*.cshtml "C:\ProgramData\Elwig\resources"
|
copy /b /y Documents\*.cshtml "C:\ProgramData\Elwig\resources"
|
||||||
|
@ -11,11 +11,11 @@ file = database.sqlite3
|
|||||||
;log = db.log
|
;log = db.log
|
||||||
|
|
||||||
[update]
|
[update]
|
||||||
url = https://www.necronda.net/elwig/files/elwig/latest
|
url = https://elwig.at/files/elwig/latest
|
||||||
auto = true
|
auto = true
|
||||||
|
|
||||||
[sync]
|
[sync]
|
||||||
;url = https://www.necronda.net/elwig/clients/WGX/
|
;url = https://elwig.at/clients/WGX/
|
||||||
;username = ""
|
;username = ""
|
||||||
;password = ""
|
;password = ""
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
</Task>
|
</Task>
|
||||||
</UsingTask>
|
</UsingTask>
|
||||||
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
||||||
<Exec Command="curl -s -L "https://github.com/emendelson/pdftoprinter/raw/main/PDFtoPrinter.exe" -z "$(ProjectDir)\Files\PDFtoPrinter.exe" -o "$(ProjectDir)\Files\PDFtoPrinter.exe"" />
|
<Exec Command="curl --fail -s -L "https://github.com/emendelson/pdftoprinter/raw/main/PDFtoPrinter.exe" -z "$(ProjectDir)\Files\PDFtoPrinter.exe" -o "$(ProjectDir)\Files\PDFtoPrinter.exe"" />
|
||||||
<Exec Command="dotnet publish "$(ProjectDir)\..\Elwig\Elwig.csproj" "/p:PublishProfile=$(ProjectDir)\..\Elwig\Properties\PublishProfiles\FolderProfile.pubxml"" />
|
<Exec Command="dotnet publish "$(ProjectDir)\..\Elwig\Elwig.csproj" "/p:PublishProfile=$(ProjectDir)\..\Elwig\Properties\PublishProfiles\FolderProfile.pubxml"" />
|
||||||
<GetFileVersion AssemblyPath="..\Elwig\bin\Publish\Elwig.exe">
|
<GetFileVersion AssemblyPath="..\Elwig\bin\Publish\Elwig.exe">
|
||||||
<Output TaskParameter="Version" PropertyName="ElwigFileVersion" />
|
<Output TaskParameter="Version" PropertyName="ElwigFileVersion" />
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<Cultures>de-AT</Cultures>
|
<Cultures>de-AT</Cultures>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
||||||
<Exec Command="curl -s -L "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -z "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe" -o "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe"" />
|
<Exec Command="curl --fail -s -L "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -z "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe" -o "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe"" />
|
||||||
<Exec Command="curl -s -L "https://aka.ms/vs/17/release/vc_redist.x86.exe" -z "$(ProjectDir)\Files\VC_redist.x86.exe" -o "$(ProjectDir)\Files\VC_redist.x86.exe"" />
|
<Exec Command="curl --fail -s -L "https://aka.ms/vs/17/release/vc_redist.x86.exe" -z "$(ProjectDir)\Files\VC_redist.x86.exe" -o "$(ProjectDir)\Files\VC_redist.x86.exe"" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<DefineConstants>ElwigProjectDir=..\Elwig</DefineConstants>
|
<DefineConstants>ElwigProjectDir=..\Elwig</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
||||||
<PackageReference Include="NReco.PdfRenderer" Version="1.5.3" />
|
<PackageReference Include="NReco.PdfRenderer" Version="1.5.3" />
|
||||||
<PackageReference Include="NUnit" Version="4.1.0" />
|
<PackageReference Include="NUnit" Version="4.1.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||||
|
@ -1 +1 @@
|
|||||||
curl -s -L "https://elwig.at/files/create.sql?v=19" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
curl --fail -s -L "https://elwig.at/files/create.sql?v=20" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
||||||
|
Reference in New Issue
Block a user