Compare commits

...

40 Commits

Author SHA1 Message Date
6c1e50ad02 Bump version to 0.8.4
All checks were successful
Test / Run tests (push) Successful in 1m44s
Deploy / Build and Deploy (push) Successful in 2m23s
2024-06-13 01:45:53 +02:00
46551fb142 Tests: Implement tests for Austrian Ebics
All checks were successful
Test / Run tests (push) Successful in 2m0s
2024-06-13 01:43:23 +02:00
b404839ad1 Tests: Fix DocumentTests? 2024-06-13 01:39:12 +02:00
ab926421b0 Export/Ebics: Implement version customization
Some checks failed
Test / Run tests (push) Failing after 2m22s
2024-06-13 01:19:36 +02:00
bbd8b67afd MainWindow: Unify gaps between buttons
All checks were successful
Test / Run tests (push) Successful in 1m45s
2024-06-12 18:55:50 +02:00
70f8276808 MainWindow: Fix crash on closing, when other window is in editing or creating mode
All checks were successful
Test / Run tests (push) Successful in 2m1s
2024-06-12 17:05:57 +02:00
4483eb6a69 [#37] Controls: Implement CheckComboBox and remove xctk
All checks were successful
Test / Run tests (push) Successful in 2m26s
2024-06-12 16:29:57 +02:00
6fc38b9db0 Bump version to 0.8.3
All checks were successful
Test / Run tests (push) Successful in 1m44s
Deploy / Build and Deploy (push) Successful in 2m27s
2024-06-11 12:43:13 +02:00
5a4ff26f31 [#16] DeleteMemberDialog: Highlight invalid/not-checked inputs
All checks were successful
Test / Run tests (push) Successful in 1m59s
2024-06-11 12:34:07 +02:00
012352c562 DeliveryAdminWindow: Fix ModifierInput source
All checks were successful
Test / Run tests (push) Successful in 1m45s
2024-06-11 11:55:47 +02:00
81f286f504 BaseDataWindow: Set SeasonPenaltyPerBs inputs to readonly when applicable
All checks were successful
Test / Run tests (push) Successful in 2m21s
2024-06-11 11:21:21 +02:00
324a63cf9a DeliveryAdminWindow: Fix modifier bug
All checks were successful
Test / Run tests (push) Successful in 2m2s
2024-06-11 01:22:43 +02:00
ca0497e396 [#44] BaseDataWindow: Fix conversion between season precisions
All checks were successful
Test / Run tests (push) Successful in 1m59s
2024-06-10 23:01:42 +02:00
08f551a394 PaymentVariantSummary: Show net/gross modifier in statistics
All checks were successful
Test / Run tests (push) Successful in 2m18s
2024-06-10 22:48:44 +02:00
3460b9378c [#44] BaseDataWindow: Add button to add/delete seasons
All checks were successful
Test / Run tests (push) Successful in 2m1s
2024-06-10 20:43:38 +02:00
a06921d4ec Windows: Minor UI text changes
All checks were successful
Test / Run tests (push) Successful in 1m57s
2024-06-10 17:38:27 +02:00
f2c2d3270b ChartWindow: Round PriceInput.Text
All checks were successful
Test / Run tests (push) Successful in 1m44s
2024-06-10 16:30:21 +02:00
6927d44b82 AreaComWindow: Add style for UnitTextBox
All checks were successful
Test / Run tests (push) Successful in 1m55s
2024-06-10 16:26:25 +02:00
cc0843f183 [#45] MemberAdminWindow: Add dialog for area commitment cancellation/transfer
Some checks failed
Test / Run tests (push) Failing after 52s
2024-06-10 16:22:28 +02:00
5039c1252a MailWindow: Fix crash on area commitment filter
All checks were successful
Test / Run tests (push) Successful in 2m0s
2024-06-10 12:43:42 +02:00
6e4f3b799d MailWindow: Fix crash when selecting custom members
All checks were successful
Test / Run tests (push) Successful in 1m44s
2024-06-10 11:53:53 +02:00
4c9a151f77 DeliveryConfirmation: Do not print sender by default
All checks were successful
Test / Run tests (push) Successful in 2m2s
2024-06-10 11:49:20 +02:00
03cacf604b Dialogs: Refactor XAML
All checks were successful
Test / Run tests (push) Successful in 2m27s
2024-06-10 10:10:45 +02:00
c12d111c57 [#16] Dialogs: Add DeleteMemberDialog
All checks were successful
Test / Run tests (push) Successful in 2m0s
2024-06-08 18:22:55 +02:00
302870fb58 [#47] Billing: Add penalty per business share
All checks were successful
Test / Run tests (push) Successful in 2m2s
2024-06-08 16:13:01 +02:00
f756220d75 BaseDataWindow: Fix 'Schilling crash'
All checks were successful
Test / Run tests (push) Successful in 2m17s
2024-06-07 09:51:23 +02:00
293c8967be Installer: Update URLs in config.ini
All checks were successful
Test / Run tests (push) Successful in 2m27s
2024-06-07 00:23:34 +02:00
601ac548fe Tests: Update dependencies
All checks were successful
Test / Run tests (push) Successful in 2m7s
2024-06-03 18:30:42 +02:00
4e477c38e0 Elwig: Update dependencies 2024-06-03 18:30:34 +02:00
46fc0db6ba IntegerUpDown: Fix xml spacing
All checks were successful
Test / Run tests (push) Successful in 1m41s
2024-06-03 17:13:37 +02:00
a531e948c1 [#37] IntegerUpDown: Add middle line
All checks were successful
Test / Run tests (push) Successful in 1m42s
2024-06-03 17:07:40 +02:00
cc4ec6c5db [#37] Controls: Implement IntegerUpDown
All checks were successful
Test / Run tests (push) Successful in 2m28s
2024-06-03 16:59:45 +02:00
ff375e3caf curl: Add '--fail' argument to return a meaningful status code
All checks were successful
Test / Run tests (push) Successful in 1m54s
2024-05-15 00:24:42 +02:00
5b952c4eb1 Workflows: Update upload URL
All checks were successful
Test / Run tests (push) Successful in 1m37s
Deploy / Build and Deploy (push) Successful in 2m26s
2024-05-14 23:00:29 +02:00
48c441b787 Bump version to 0.8.2
Some checks failed
Test / Run tests (push) Successful in 1m43s
Deploy / Build and Deploy (push) Failing after 2m17s
2024-05-14 22:51:36 +02:00
be246d6f06 Tests: Fix old url in fetch-resources.bat 2024-05-14 22:51:00 +02:00
2b10e52ab0 Installer: Fix url for PDFtoPrinter once again
Some checks failed
Test / Run tests (push) Failing after 1m36s
Deploy / Build and Deploy (push) Has been cancelled
2024-05-14 22:45:26 +02:00
e3fd705f52 App: Show scale errors always in debug mode
All checks were successful
Test / Run tests (push) Successful in 2m12s
2024-05-13 22:34:19 +02:00
81e18ac553 Config: Add 'required' option to scales
All checks were successful
Test / Run tests (push) Successful in 4m3s
2024-05-13 11:33:27 +02:00
f95f0f0ef3 BaseDataWindow: Fix crash when CurrentLastSeason does not exist
All checks were successful
Test / Run tests (push) Successful in 2m8s
2024-05-12 22:34:53 +02:00
59 changed files with 2659 additions and 286 deletions

View File

@ -48,7 +48,7 @@ jobs:
run: |
$content = [System.IO.File]::ReadAllBytes("Setup/bin/x64/Release/Elwig-${{ env.APP_VERSION }}.exe")
Invoke-WebRequest `
-Uri "https://www.necronda.net/elwig/files/Elwig-${{ env.APP_VERSION }}.exe" `
-Uri "https://elwig.at/files/Elwig-${{ env.APP_VERSION }}.exe" `
-Method PUT `
-Body $content `
-Headers @{ Authorization = "${{ secrets.API_AUTHORIZATION }}" } `

View File

@ -159,7 +159,9 @@ namespace Elwig {
list.Add(Scale.FromConfig(s));
} catch (Exception e) {
list.Add(new InvalidScale(s.Id));
MessageBox.Show($"Unable to create scale {s.Id}:\n\n{e.Message}", "Scale Error", MessageBoxButton.OK, MessageBoxImage.Error);
if (Config.Debug || s.Required)
MessageBox.Show($"Unable to create scale {s.Id}:\n\n{e.Message}", "Scale Error",
MessageBoxButton.OK, MessageBoxImage.Error);
}
}
Scales = list;

View File

@ -0,0 +1,106 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace Elwig.Controls {
public class CheckComboBox : ListBox {
public static readonly DependencyProperty DelimiterProperty = DependencyProperty.Register("Delimiter", typeof(string), typeof(CheckComboBox), new FrameworkPropertyMetadata(", "));
public string Delimiter {
get => (string)GetValue(DelimiterProperty);
set => SetValue(DelimiterProperty, value);
}
public static readonly DependencyProperty AllItemsSelectedContentProperty = DependencyProperty.Register("AllItemsSelectedContent", typeof(string), typeof(CheckComboBox), new FrameworkPropertyMetadata("All"));
public string AllItemsSelectedContent {
get => (string)GetValue(AllItemsSelectedContentProperty);
set => SetValue(AllItemsSelectedContentProperty, value);
}
public static readonly DependencyProperty IsSelectAllActiveProperty = DependencyProperty.Register("IsSelectAllActive", typeof(bool), typeof(CheckComboBox), new FrameworkPropertyMetadata(false));
public bool IsSelectAllActive {
get => (bool)GetValue(IsSelectAllActiveProperty);
set => SetValue(IsSelectAllActiveProperty, value);
}
public static readonly DependencyProperty SelectAllContentProperty = DependencyProperty.Register("SelectAllContent", typeof(string), typeof(CheckComboBox), new FrameworkPropertyMetadata("All"));
public string SelectAllContent {
get => (string)GetValue(SelectAllContentProperty);
set => SetValue(SelectAllContentProperty, value);
}
public static readonly DependencyProperty AllItemsSelectedProperty = DependencyProperty.Register("AllItemsSelected", typeof(bool?), typeof(CheckComboBox), new FrameworkPropertyMetadata(false));
public bool? AllItemsSelected {
get => (bool?)GetValue(AllItemsSelectedProperty);
set => SetValue(AllItemsSelectedProperty, value);
}
public static readonly DependencyProperty IsDropDownOpenProperty = DependencyProperty.Register("IsDropDownOpen", typeof(bool), typeof(CheckComboBox), new FrameworkPropertyMetadata(false));
public bool IsDropDownOpen {
get => (bool)GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, value);
}
public static readonly DependencyProperty MaxDropDownHeightProperty = DependencyProperty.Register("MaxDropDownHeight", typeof(double), typeof(CheckComboBox), new FrameworkPropertyMetadata(ComboBox.MaxDropDownHeightProperty.DefaultMetadata.DefaultValue));
public double MaxDropDownHeight {
get => (double)GetValue(MaxDropDownHeightProperty);
set => SetValue(MaxDropDownHeightProperty, value);
}
static CheckComboBox() {
DefaultStyleKeyProperty.OverrideMetadata(typeof(CheckComboBox), new FrameworkPropertyMetadata(typeof(CheckComboBox)));
}
private TextBlock TextBox;
public CheckComboBox() {
SelectionMode = SelectionMode.Multiple;
}
public override void OnApplyTemplate() {
TextBox = (GetTemplateChild("TextBox") as TextBlock)!;
var button = GetTemplateChild("Button") as Button;
button!.Click += Button_MouseDown;
var item = GetTemplateChild("SelectAllItem") as ListBoxItem;
item!.PreviewMouseDown += SelectAllItem_MouseDown;
SelectionChanged += OnSelectionChanged;
IsEnabledChanged += OnIsEnabledChanged;
base.OnApplyTemplate();
}
private void Button_MouseDown(object sender, RoutedEventArgs evt) {
IsDropDownOpen = !IsDropDownOpen;
}
private void SelectAllItem_MouseDown(object sender, RoutedEventArgs evt) {
if (AllItemsSelected == false) {
SelectAll();
} else {
UnselectAll();
}
evt.Handled = true;
}
private void OnSelectionChanged(object sender, SelectionChangedEventArgs evt) {
var dmp = DisplayMemberPath != null && DisplayMemberPath != "" ? DisplayMemberPath : null;
if (SelectedItems.Count == ItemsSource.Cast<object>().Count() && AllItemsSelectedContent != null) {
TextBox.Text = AllItemsSelectedContent;
AllItemsSelected = true;
} else if (SelectedItems.Count == 0) {
TextBox.Text = "";
AllItemsSelected = false;
} else {
TextBox.Text = string.Join(Delimiter,
dmp == null ? SelectedItems.Cast<object>() :
SelectedItems.Cast<object>()
.Select(i => i.GetType().GetProperty(dmp)?.GetValue(i))
);
AllItemsSelected = null;
}
}
private void OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs evt) {
if (!IsEnabled) IsDropDownOpen = false;
}
}
}

View File

@ -0,0 +1,118 @@
<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">
<ctrl:VisibilityConverter x:Key="VisibilityConverter"/>
<Style TargetType="ctrl:CheckComboBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:CheckComboBox">
<Grid Style="{x:Null}">
<Button x:Name="Button" ClickMode="Press" BorderThickness="1"
BorderBrush="{TemplateBinding BorderBrush}"
IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}" SnapsToDevicePixels="True"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
<ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
<Path x:Name="IconDropdown" Data="M 0,0 L 3,3 L 6,0" Stroke="#FF606060" StrokeThickness="1" Margin="0,0,5,0"
HorizontalAlignment="Right" VerticalAlignment="Center"/>
</Button>
<TextBlock x:Name="TextBox" Style="{x:Null}" Margin="6,0,18,0" IsHitTestVisible="False"
HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<Popup x:Name="Popup" Placement="Bottom" Focusable="True"
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
PopupAnimation="Slide" AllowsTransparency="True">
<Popup.Style>
<Style TargetType="{x:Type Popup}">
<Setter Property="StaysOpen" Value="False"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=Button}" Value="True">
<Setter Property="StaysOpen" Value="True"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=Border}" Value="True">
<Setter Property="StaysOpen" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Popup.Style>
<Border x:Name="Border" Style="{x:Null}" BorderThickness="1" BorderBrush="Gray" Background="White" SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<DockPanel>
<ListBoxItem x:Name="SelectAllItem" Padding="2,1,2,1" DockPanel.Dock="Top"
Visibility="{TemplateBinding IsSelectAllActive, Converter={StaticResource VisibilityConverter}}">
<StackPanel Orientation="Horizontal">
<CheckBox VerticalAlignment="Center" Margin="0,0,5,0" IsThreeState="True"
IsChecked="{Binding AllItemsSelected, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
<TextBlock Text="{TemplateBinding SelectAllContent}" VerticalAlignment="Center" Margin="0" SnapsToDevicePixels="True"/>
</StackPanel>
</ListBoxItem>
<ScrollViewer Style="{x:Null}">
<StackPanel Style="{x:Null}" IsItemsHost="True" SnapsToDevicePixels="True"
KeyboardNavigation.DirectionalNavigation="Contained"/>
</ScrollViewer>
</DockPanel>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="IconDropdown" Property="Stroke" Value="#FFA0A0A0"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="IconDropdown" Property="Stroke" Value="Black"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="2,1,2,1">
<StackPanel Orientation="Horizontal">
<CheckBox VerticalAlignment="Center" Margin="0,0,5,0"
IsChecked="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=ListBoxItem}}"/>
<ContentPresenter VerticalAlignment="Center" Margin="0" SnapsToDevicePixels="True"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="1"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#FF70C0E7"/>
<Setter Property="Background" Value="#FFE5F3FB"/>
</Trigger>
</Style.Triggers>
</Style>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#FF7EB4EA"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View 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;
}
}
}
}

View 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>

View File

@ -5,7 +5,8 @@
<Setter Property="Template">
<Setter.Value>
<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}"
SnapsToDevicePixels="True">
<Grid>
@ -22,9 +23,19 @@
FontSize="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="3"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="BorderBrush" Value="LightGray"/>
</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>

View File

@ -0,0 +1,16 @@
using System;
using System.Windows;
using System.Windows.Data;
using System.Globalization;
namespace Elwig.Controls {
public class VisibilityConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
return (bool)value ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
return (Visibility)value == Visibility.Visible;
}
}
}

View File

@ -4,10 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Dialogs"
mc:Ignorable="d"
ResizeMode="NoResize"
ShowInTaskbar="False"
Topmost="True"
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
WindowStartupLocation="CenterOwner"
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
Title="Teillieferung abwerten" Height="190" Width="400">

View 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>

View 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();
}
}
}

View 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>

View 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();
}
}
}

View File

@ -4,10 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Dialogs"
mc:Ignorable="d"
ResizeMode="NoResize"
ShowInTaskbar="False"
Topmost="True"
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
WindowStartupLocation="CenterOwner"
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
Title="Teillieferung extrahieren" Height="210" Width="380">

View File

@ -4,10 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Dialogs"
mc:Ignorable="d"
ResizeMode="NoResize"
ShowInTaskbar="False"
Topmost="True"
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
WindowStartupLocation="CenterOwner"
FocusManager.FocusedElement="{Binding ElementName=PriceInput}"
Title="Linear wachsen" Height="140" Width="270">

View File

@ -4,10 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Dialogs"
mc:Ignorable="d"
ResizeMode="NoResize"
ShowInTaskbar="False"
Topmost="True"
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
WindowStartupLocation="CenterOwner"
FocusManager.FocusedElement="{Binding ElementName=WeightInput}"
Title="Handwiegung" Height="170" Width="400">

View 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>

View 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();
}
}
}

View File

@ -3,10 +3,7 @@
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"
mc:Ignorable="d"
ResizeMode="NoResize"
ShowInTaskbar="False"
Topmost="True"
ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
WindowStartupLocation="CenterOwner"
Title="Neues Update verfügbar - Elwig" Height="180" Width="400">
<Grid>

View File

@ -20,7 +20,6 @@ namespace Elwig.Documents {
Season = ctx.Seasons.Find(year) ?? throw new ArgumentException("invalid season");
ShowDateAndLocation = true;
UseBillingAddress = true;
IncludeSender = true;
DocumentId = $"Anl.-Best. {Season.Year}/{m.MgNr}";
Data = data;
MemberBuckets = ctx.GetMemberBuckets(Season.Year, m.MgNr).GetAwaiter().GetResult();

View File

@ -49,14 +49,20 @@
<td class="center">@(Model.BillingData.ConsiderContractPenalties ? "Ja" : "Nein")</td>
</tr>
<tr>
<th>Datum:</th>
<td colspan="3">@($"{Model.Variant.Date:dd.MM.yyyy}")</td>
<th style="overflow: visible;">Nto./bto.-Zuschl:</th>
<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>
<td class="center">@(Model.BillingData.ConsiderTotalPenalty ? "Ja" : "Nein")</td>
</tr>
<tr>
<th>Überw.:</th>
<td colspan="3">@($"{Model.Variant.TransferDate:dd.MM.yyyy}")</td>
<th style="overflow: visible;">Datum/Überw.:</th>
<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>
<td class="center">@(Model.BillingData.ConsiderAutoBusinessShares ? "Ja" : "Nein")</td>
</tr>

View File

@ -7,7 +7,7 @@
<UseWPF>true</UseWPF>
<PreserveCompilationContext>true</PreserveCompilationContext>
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
<Version>0.8.1</Version>
<Version>0.8.4</Version>
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationManifest>app.manifest</ApplicationManifest>
@ -25,17 +25,16 @@
</Target>
<ItemGroup>
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.0" />
<PackageReference Include="LinqKit" Version="1.2.5" />
<PackageReference Include="MailKit" Version="4.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.29" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.4" />
<PackageReference Include="MailKit" Version="4.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.31" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
<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="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.Text.Encoding.CodePages" Version="8.0.0" />
</ItemGroup>

View File

@ -241,23 +241,23 @@ namespace Elwig.Helpers {
.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)) {
var mod = part.PartModifiers.Where(pa => pa.ModId == m.ModId).FirstOrDefault();
if (modifiers.Contains(m)) {
var dpm = new DeliveryPartModifier {
Year = part.Year,
DId = part.DId,
DPNr = part.DPNr,
ModId = m.ModId,
};
if (mod == null) {
Add(dpm);
var mod = new DeliveryPartModifier {
Year = part.Year,
DId = part.DId,
DPNr = part.DPNr,
ModId = m.ModId,
};
var old = oldModifiers.Where(pa => pa.ModId == m.ModId).FirstOrDefault();
if (newModifiers.Any(md => md.ModId == m.ModId)) {
if (old == null) {
Add(mod);
} else {
Update(dpm);
Update(mod);
}
} else {
if (mod != null) {
if (old != null) {
Remove(mod);
}
}
@ -354,6 +354,27 @@ namespace Elwig.Helpers {
_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) {
if (!_memberAreaCommitmentBuckets.ContainsKey(year))
await FetchMemberAreaCommitmentBuckets(year, cnx);

View File

@ -9,7 +9,7 @@ namespace Elwig.Helpers {
public static class AppDbUpdater {
// 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;

View File

@ -47,7 +47,6 @@ namespace Elwig.Helpers.Billing {
ROUND(lp.amount / POW(10, s.precision - 2)) AS prev_amount,
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.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))
AS modifiers,
lc.modifiers AS prev_modifiers
@ -66,12 +65,30 @@ namespace Elwig.Helpers.Billing {
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 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)
WHERE s.year = {Year} AND v.avnr = {AvNr};
UPDATE payment_variant SET test_variant = FALSE WHERE (year, avnr) = ({Year}, {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});
""");
}
public async Task Revert() {

View File

@ -66,6 +66,9 @@ namespace Elwig.Helpers {
public string? TextEmailSubject;
public string? TextEmailBody;
public int ExportEbicsVersion;
public int ExportEbicsAddress;
public ClientParameters(AppDbContext ctx) : this(ctx.ClientParameters.ToDictionary(e => e.Param, e => e.Value)) { }
public ClientParameters(Dictionary<string, string?> parameters) {
@ -128,6 +131,13 @@ namespace Elwig.Helpers {
if (TextEmailSubject == "") TextEmailSubject = null;
TextEmailBody = parameters.GetValueOrDefault("TEXT_EMAIL_BODY");
if (TextEmailBody == "") TextEmailBody = null;
ExportEbicsVersion = int.TryParse(parameters.GetValueOrDefault("EXPORT_EBICS_VERSION"), out var v) ? v : 9;
switch (parameters.GetValueOrDefault("EXPORT_EBICS_ADDRESS", "FULL")?.ToUpper()) {
case "OMIT": ExportEbicsAddress = 0; break;
case "LINES": ExportEbicsAddress = 1; break;
case "FULL": ExportEbicsAddress = 2; break;
}
} catch {
throw new KeyNotFoundException();
}
@ -155,6 +165,12 @@ namespace Elwig.Helpers {
case 1: orderingMemberList = "NAME"; break;
case 2: orderingMemberList = "KG"; break;
}
string exportEbicsAddress = "FULL";
switch (ExportEbicsAddress) {
case 0: exportEbicsAddress = "OMIT"; break;
case 1: exportEbicsAddress = "LINES"; break;
case 2: exportEbicsAddress = "FULL"; break;
}
return [
("CLIENT_NAME_TOKEN", NameToken),
("CLIENT_NAME_SHORT", NameShort),
@ -180,7 +196,9 @@ namespace Elwig.Helpers {
("TEXT_DELIVERYCONFIRMATION", TextDeliveryConfirmation),
("TEXT_CREDITNOTE", TextCreditNote),
("TEXT_EMAIL_SUBJECT", TextEmailSubject),
("TEXT_EMAIL_BODY", TextEmailBody)
("TEXT_EMAIL_BODY", TextEmailBody),
("EXPORT_EBICS_VERSION", ExportEbicsVersion.ToString()),
("EXPORT_EBICS_ADDRESS", exportEbicsAddress),
];
}

View File

@ -13,10 +13,11 @@ namespace Elwig.Helpers {
public string? Empty;
public string? Filling;
public string? Limit;
public bool Required;
public string? Log;
public string? _Log;
public ScaleConfig(string id, string? type, string? model, string? cnx, string? empty, string? filling, string? limit, string? log) {
public ScaleConfig(string id, string? type, string? model, string? cnx, string? empty, string? filling, string? limit, bool? required, string? log) {
Id = id;
Type = type;
Model = model;
@ -24,6 +25,7 @@ namespace Elwig.Helpers {
Empty = empty;
Filling = filling;
Limit = limit;
Required = required ?? true;
_Log = log;
Log = log != null ? Path.Combine(App.DataPath, log) : null;
}
@ -91,7 +93,9 @@ namespace Elwig.Helpers {
foreach (var s in scales) {
ScaleList.Add(new(
s, config[$"scale.{s}:type"], config[$"scale.{s}:model"], config[$"scale.{s}:connection"],
config[$"scale.{s}:empty"], config[$"scale.{s}:filling"], config[$"scale.{s}:limit"], config[$"scale.{s}:log"]
config[$"scale.{s}:empty"], config[$"scale.{s}:filling"], config[$"scale.{s}:limit"],
config[$"scale.{s}:required"] != null ? TrueValues.Contains(config[$"scale.{s}:required"]?.ToLower()) : null,
config[$"scale.{s}:log"]
));
}
}

View File

@ -102,20 +102,6 @@ namespace Elwig.Helpers {
selector.SelectedItem = selItem;
}
public static void RenewItemsSource(Xceed.Wpf.Toolkit.Primitives.Selector selector, IEnumerable? source, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventHandler? handler = null) {
if (selector.ItemsSource == source)
return;
var selectedIds = selector.SelectedItems.Cast<object>().Select(i => Utils.GetEntityIdentifier(i)).ToList();
if (handler != null && selectedIds != null) selector.ItemSelectionChanged -= handler;
selector.ItemsSource = source;
if (source != null) {
selector.SelectedItems.Clear();
foreach (var i in source.Cast<object>().Where(i => selectedIds.Contains(Utils.GetEntityIdentifier(i))))
selector.SelectedItems.Add(i);
}
if (handler != null && selectedIds != null) selector.ItemSelectionChanged += handler;
}
public static void RenewItemsSource(DataGrid dataGrid, IEnumerable? source, SelectionChangedEventHandler? handler = null, RenewSourceDefault def = RenewSourceDefault.None, bool keepSort = true) {
if (dataGrid.ItemsSource == source)
return;
@ -210,15 +196,15 @@ namespace Elwig.Helpers {
return GetItemsFromSource(source, items.Select(Utils.GetEntityIdentifier));
}
public static void SelectItems(Xceed.Wpf.Toolkit.CheckComboBox ccb, IEnumerable<int?>? ids) {
ccb.SelectedItems.Clear();
public static void SelectItems(ListBox lb, IEnumerable<int?>? ids) {
lb.SelectedItems.Clear();
if (ids == null) return;
foreach (var id in ids)
ccb.SelectedItems.Add(GetItemFromSource(ccb.ItemsSource, id));
lb.SelectedItems.Add(GetItemFromSource(lb.ItemsSource, id));
}
public static void SelectItems(Xceed.Wpf.Toolkit.CheckComboBox ccb, IEnumerable<object>? items) {
SelectItems(ccb, items?.Select(Utils.GetEntityIdentifier));
public static void SelectItems(ListBox lb, IEnumerable<object>? items) {
SelectItems(lb, items?.Select(Utils.GetEntityIdentifier));
}
public static int? GetInputHashCode(Control input) {
@ -226,8 +212,8 @@ namespace Elwig.Helpers {
return Utils.GetEntityIdentifier(tb.Text);
} else if (input is ComboBox sb) {
return Utils.GetEntityIdentifier(sb.SelectedItem);
} else if (input is Xceed.Wpf.Toolkit.CheckComboBox ccb) {
return Utils.GetEntityIdentifier(ccb.SelectedItems);
} else if (input is ListBox lb) {
return Utils.GetEntityIdentifier(lb.SelectedItems);
} else if (input is CheckBox cb) {
return Utils.GetEntityIdentifier(cb.IsChecked);
} else if (input is RadioButton rb) {

View File

@ -9,7 +9,9 @@ using System.Security;
using System.Threading.Tasks;
namespace Elwig.Helpers.Export {
public class Ebics(PaymentVar variant, string filename, int version) : IBankingExporter {
public class Ebics(PaymentVar variant, string filename, int version, Ebics.AddressMode mode = Ebics.AddressMode.Full) : IBankingExporter {
public enum AddressMode { Omit = 0, Lines = 1, Full = 2 }
public static string FileExtension => "xml";
@ -19,6 +21,7 @@ namespace Elwig.Helpers.Export {
private readonly string Name = variant.Name;
private readonly int AvNr = variant.AvNr;
private readonly int Version = version;
private readonly AddressMode ShowAddresses = mode;
public void Dispose() {
GC.SuppressFinalize(this);
@ -78,11 +81,18 @@ namespace Elwig.Helpers.Export {
<Amt><InstdAmt Ccy="{tx.Currency}">{Transaction.FormatAmount(tx.Amount)}</InstdAmt></Amt>
<Cdtr>
<Nm>{SecurityElement.Escape(a.Name[..Math.Min(140, a.Name.Length)])}</Nm>
<PstlAdr>
<StrtNm>{a1?[..Math.Min(70, a1.Length)]}</StrtNm><BldgNb>{SecurityElement.Escape(a2?[..Math.Min(16, a2.Length)])}</BldgNb>
<PstCd>{a.PostalDest.AtPlz?.Plz}</PstCd><TwnNm>{SecurityElement.Escape(a.PostalDest.AtPlz?.Ort.Name)}</TwnNm>
<Ctry>{a.PostalDest.Country.Alpha2}</Ctry>
</PstlAdr>
""");
if (ShowAddresses != AddressMode.Omit) {
var full = ShowAddresses == AddressMode.Full;
await Writer.WriteLineAsync($"""
<PstlAdr>
{(full ? $"<StrtNm>{SecurityElement.Escape(a1?[..Math.Min(70, a1.Length)])}</StrtNm> <BldgNb>{SecurityElement.Escape(a2?[..Math.Min(16, a2.Length)])}</BldgNb>" : $"<AdrLine>{a.Address[..Math.Min(70, a.Address.Length)]}</AdrLine>")}
<{(full ? "PstCd" : "AdrLine")}>{a.PostalDest.AtPlz?.Plz}{(full ? "</PstCd> <TwnNm>" : " ")}{SecurityElement.Escape(a.PostalDest.AtPlz?.Ort.Name)}</{(full ? "TwnNm" : "AdrLine")}>
<{(full ? "" : "!--")}Ctry>{a.PostalDest.Country.Alpha2}</Ctry{(full ? "" : "--")}>
</PstlAdr>
""");
}
await Writer.WriteLineAsync($"""
</Cdtr>
<CdtrAcct><Id><IBAN>{tx.Member.Iban!}</IBAN></Id></CdtrAcct>
<RmtInf><Ustrd>{SecurityElement.Escape(info)}</Ustrd></RmtInf>

View File

@ -42,8 +42,9 @@ namespace Elwig.Models.Dtos {
public static async Task<CreditNoteData> ForPaymentVariant(AppDbContext ctx, int year, int avnr) {
var variant = await ctx.PaymentVariants.FindAsync(year, avnr);
var name = variant!.Name;
var bsPenalty = await ctx.GetBusinessSharePenalties(year);
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);
}
@ -56,7 +57,6 @@ namespace Elwig.Models.Dtos {
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,
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
FROM credit c
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 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_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)
WHERE c.year = {year} AND c.avnr = {avnr}
ORDER BY m.mgnr
@ -96,7 +95,7 @@ namespace Elwig.Models.Dtos {
public decimal? Considered;
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;
MgNr = row.MgNr;
Name1 = row.Name1;
@ -120,7 +119,7 @@ namespace Elwig.Models.Dtos {
if (data.ConsiderContractPenalties)
Penalties = (row.FbPenalty == null || row.FbPenalty == 0) ? null : Utils.DecFromDb((long)row.FbPenalty, prec1);
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)
AutoBs = (row.AutoBs == null || row.AutoBs == 0) ? null : -Utils.DecFromDb((long)row.AutoBs, prec1);
mod -= (Penalties ?? 0) + (Penalty ?? 0) + (AutoBs ?? 0);
@ -175,8 +174,6 @@ namespace Elwig.Models.Dtos {
public long Amount { get; set; }
[Column("fb_penalty")]
public long? FbPenalty { get; set; }
[Column("bs_penalty")]
public long? BsPealty { get; set; }
[Column("auto_bs")]
public long? AutoBs { get; set; }
}

View File

@ -166,6 +166,9 @@ namespace Elwig.Models.Entities {
[InverseProperty(nameof(Delivery.Member))]
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))]
public virtual ICollection<MemberTelNr> TelephoneNumbers { get; private set; } = null!;

View File

@ -55,6 +55,22 @@ namespace Elwig.Models.Entities {
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")]
public long? BusinessShareValueValue { get; set; }
[NotMapped]

View 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;

View File

@ -1,5 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Elwig;component/Controls/UnitTextBox.xaml"/>
<ResourceDictionary Source="/Elwig;component/Controls/IntegerUpDown.xaml"/>
<ResourceDictionary Source="/Elwig;component/Controls/CheckComboBox.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@ -1,4 +1,3 @@
using Elwig.Controls;
using Elwig.Helpers;
using Elwig.Models.Entities;
using System;
@ -10,7 +9,6 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using Xceed.Wpf.Toolkit;
using System.Windows.Input;
namespace Elwig.Windows {
@ -21,14 +19,14 @@ namespace Elwig.Windows {
private bool _isEditing;
private bool _isCreating;
protected bool IsEditing {
public bool IsEditing {
get { return _isEditing; }
set {
_isEditing = value;
LockContext = IsEditing || IsCreating;
}
}
protected bool IsCreating {
public bool IsCreating {
get { return _isCreating; }
set {
_isCreating = value;
@ -42,7 +40,7 @@ namespace Elwig.Windows {
private TextBox[] PlzInputs;
private ComboBox[] ComboBoxInputs;
private ComboBox[] PlzOrtInputs;
private CheckComboBox[] CheckComboBoxInputs;
private ListBox[] ListBoxInputs;
private CheckBox[] CheckBoxInputs;
private RadioButton[] RadioButtonInputs;
private readonly Dictionary<Control, bool> Valid;
@ -68,7 +66,7 @@ namespace Elwig.Windows {
TextBoxInputs = [];
PlzInputs = [];
ComboBoxInputs = [];
CheckComboBoxInputs = [];
ListBoxInputs = [];
PlzOrtInputs = [];
CheckBoxInputs = [];
RadioButtonInputs = [];
@ -97,7 +95,7 @@ namespace Elwig.Windows {
TextBoxInputs = ControlUtils.FindAllChildren<TextBox>(this, ExemptInputs).ToArray();
ComboBoxInputs = ControlUtils.FindAllChildren<ComboBox>(this, ExemptInputs).ToArray();
CheckBoxInputs = ControlUtils.FindAllChildren<CheckBox>(this, ExemptInputs).ToArray();
CheckComboBoxInputs = ControlUtils.FindAllChildren<CheckComboBox>(this, ExemptInputs).ToArray();
ListBoxInputs = ControlUtils.FindAllChildren<ListBox>(this, ExemptInputs).ToArray();
RadioButtonInputs = ControlUtils.FindAllChildren<RadioButton>(this, ExemptInputs).ToArray();
PlzInputs = ControlUtils.FindAllChildren<TextBox>(this).Where(tb => "PLZ".Equals(tb.Tag)).ToArray();
PlzOrtInputs = PlzInputs.Select(tb => ControlUtils.FindNextSibling<ComboBox>(tb) ?? throw new MissingMemberException()).ToArray();
@ -105,8 +103,8 @@ namespace Elwig.Windows {
Valid[tb] = true;
foreach (var cb in ComboBoxInputs)
cb.SelectionChanged += ComboBox_SelectionChanged;
foreach (var cb in CheckComboBoxInputs)
cb.ItemSelectionChanged += ComboBox_SelectionChanged;
foreach (var lb in ListBoxInputs)
lb.SelectionChanged += ComboBox_SelectionChanged;
}
private void OnClosing(object? sender, CancelEventArgs evt) {
@ -151,8 +149,8 @@ namespace Elwig.Windows {
ControlUtils.ClearInputState(tb);
foreach (var cb in ComboBoxInputs)
ControlUtils.ClearInputState(cb);
foreach (var ccb in CheckComboBoxInputs)
ControlUtils.ClearInputState(ccb);
foreach (var lb in ListBoxInputs)
ControlUtils.ClearInputState(lb);
foreach (var cb in CheckBoxInputs)
ControlUtils.ClearInputState(cb);
foreach (var rb in RadioButtonInputs)
@ -166,7 +164,7 @@ namespace Elwig.Windows {
Valid[input] = false;
} else if (input is ComboBox cb && cb.SelectedItem == null && cb.ItemsSource != null) {
ControlUtils.SetInputInvalid(input);
} else if (input is CheckComboBox ccb && ccb.SelectedItem == null && ccb.ItemsSource != null) {
} else if (input is ListBox lb && lb.SelectedItem == null && lb.ItemsSource != null) {
ControlUtils.SetInputInvalid(input);
} else if (input is CheckBox ckb && ckb.IsChecked != true) {
ControlUtils.SetInputInvalid(input);
@ -190,8 +188,8 @@ namespace Elwig.Windows {
tb.IsReadOnly = true;
foreach (var cb in ComboBoxInputs)
cb.IsEnabled = false;
foreach (var ccb in CheckComboBoxInputs)
ccb.IsEnabled = false;
foreach (var lb in ListBoxInputs)
lb.IsEnabled = false;
foreach (var cb in CheckBoxInputs)
cb.IsEnabled = false;
foreach (var rb in RadioButtonInputs)
@ -203,8 +201,8 @@ namespace Elwig.Windows {
tb.IsReadOnly = false;
foreach (var cb in ComboBoxInputs)
cb.IsEnabled = true;
foreach (var ccb in CheckComboBoxInputs)
ccb.IsEnabled = true;
foreach (var lb in ListBoxInputs)
lb.IsEnabled = true;
foreach (var cb in CheckBoxInputs)
cb.IsEnabled = true;
foreach (var rb in RadioButtonInputs)
@ -224,8 +222,8 @@ namespace Elwig.Windows {
OriginalValues[tb] = ControlUtils.GetInputHashCode(tb);
foreach (var cb in ComboBoxInputs)
OriginalValues[cb] = ControlUtils.GetInputHashCode(cb);
foreach (var ccb in CheckComboBoxInputs)
OriginalValues[ccb] = ControlUtils.GetInputHashCode(ccb);
foreach (var lb in ListBoxInputs)
OriginalValues[lb] = ControlUtils.GetInputHashCode(lb);
foreach (var cb in CheckBoxInputs)
OriginalValues[cb] = ControlUtils.GetInputHashCode(cb);
foreach (var rb in RadioButtonInputs)
@ -277,8 +275,8 @@ namespace Elwig.Windows {
tb.Text = "";
foreach (var cb in ComboBoxInputs)
cb.SelectedItem = null;
foreach (var ccb in CheckComboBoxInputs)
ccb.SelectedItems.Clear();
foreach (var lb in ListBoxInputs)
lb.SelectedItems.Clear();
foreach (var cb in CheckBoxInputs)
cb.IsChecked = cb.IsThreeState ? null : false;
foreach (var rb in RadioButtonInputs)
@ -315,13 +313,13 @@ namespace Elwig.Windows {
!IsValid ||
TextBoxInputs.Any(InputHasChanged) ||
ComboBoxInputs.Any(InputHasChanged) ||
CheckComboBoxInputs.Any(InputHasChanged) ||
ListBoxInputs.Any(InputHasChanged) ||
CheckBoxInputs.Any(InputHasChanged) ||
RadioButtonInputs.Any(InputHasChanged)
) || IsCreating && (
TextBoxInputs.Any(i => InputIsNotDefault(i) || (!i.IsReadOnly && i.Text != "")) ||
ComboBoxInputs.Any(i => InputIsNotDefault(i) || (i.IsEnabled && i.SelectedItem != null)) ||
CheckComboBoxInputs.Any(i => InputIsNotDefault(i) || i.SelectedItem != null) ||
ListBoxInputs.Any(i => InputIsNotDefault(i) || i.SelectedItem != null) ||
CheckBoxInputs.Any(InputIsNotDefault) ||
RadioButtonInputs.Any(InputIsNotDefault)
);
@ -447,8 +445,8 @@ namespace Elwig.Windows {
bool valid = false;
if (input is ComboBox cb) {
valid = cb.ItemsSource == null || cb.SelectedItem != null || !RequiredInputs.Contains(input);
} else if (input is CheckComboBox ccb) {
valid = ccb.ItemsSource == null || ccb.SelectedItem != null || !RequiredInputs.Contains(input);
} else if (input is ListBox lb) {
valid = lb.ItemsSource == null || lb.SelectedItem != null || !RequiredInputs.Contains(input);
}
if (valid) {
ValidateInput(input, true);

View File

@ -6,7 +6,6 @@
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:ctrl="clr-namespace:Elwig.Controls"
mc:Ignorable="d"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="Flächenbindungen - Elwig" Height="500" MinHeight="440" Width="920" MinWidth="860"
Loaded="Window_Loaded">
<Window.Resources>
@ -25,14 +24,16 @@
<Setter Property="Height" Value="25"/>
<Setter Property="TextWrapping" Value="NoWrap"/>
</Style>
<Style TargetType="ComboBox">
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Height" Value="25"/>
<Setter Property="FontSize" Value="14"/>
<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="xctk:CheckComboBox">
<Style TargetType="ComboBox">
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Height" Value="25"/>
<Setter Property="FontSize" Value="14"/>

View File

@ -7,7 +7,6 @@ using Elwig.Models.Entities;
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Xceed.Wpf.Toolkit.Primitives;
namespace Elwig.Windows {
public partial class AreaComAdminWindow : AdministrationWindow {
@ -431,7 +430,7 @@ namespace Elwig.Windows {
RefreshInputs();
}
private void AttributesInput_SelectionChanged(object sender, ItemSelectionChangedEventArgs evt) {
private void AttributesInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
}

View File

@ -395,11 +395,11 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="205"/>
<RowDefinition Height="180"/>
<RowDefinition Height="*"/>
</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">
<ListBox.ItemTemplate>
<DataTemplate>
@ -411,11 +411,17 @@
</DataTemplate>
</ListBox.ItemTemplate>
</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="&#xE74D;" 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.ColumnDefinitions>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
@ -440,29 +446,32 @@
<TextBox x:Name="SeasonEndInput" Grid.Column="1" Margin="0,130,10,10" Width="78" IsEnabled="False"
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"
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"
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"/>
<Label Content="Strafe (pro unterl. kg):" 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"/>
<Label Content="Strafe (Unterlieferung):" Margin="10,70,0,10" Grid.Column="2"/>
<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"/>
<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"
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>
<GroupBox Grid.Column="1" Grid.Row="1" Header="Zu-/Abschläge" Margin="0,0,10,10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
@ -517,8 +526,8 @@
</Grid>
</TabItem>
<TabItem Header="Parameter">
<Grid>
<GroupBox x:Name="ParameterAreaComGroup" Header="Berechnung Flächenbindungen (aktuelle Saison)" Margin="10,10,10,10" VerticalAlignment="Top">
<StackPanel>
<GroupBox x:Name="ParameterAreaComGroup" Header="Berechnung Flächenbindungen (aktuelle Saison)" Margin="10,10,10,0" VerticalAlignment="Top">
<Grid>
<CheckBox x:Name="ParameterAllowAttrIntoLowerInput" Content="Erlauben Lieferungen auch auf (konfigurierte) &quot;schlechtere&quot; Flächenbindungen aufzuteilen"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,10,10,10"
@ -532,7 +541,33 @@
</CheckBox>
</Grid>
</GroupBox>
</Grid>
<GroupBox Header="Daten-Export" Margin="10,10,10,10">
<Grid>
<Label Content="Version EBICS-Überweisung:" Margin="10,10,10,10"/>
<ComboBox x:Name="ParameterExportEbicsVersion" Margin="180,10,10,10" Width="50"
HorizontalAlignment="Left">
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
<ComboBoxItem IsSelected="True">9</ComboBoxItem>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem>11</ComboBoxItem>
</ComboBox>
<Label Content="Adressen EBICS-Überweisung:" Margin="10,40,10,10"/>
<ComboBox x:Name="ParameterExportEbicsAddress" Margin="180,40,10,10" Width="150"
HorizontalAlignment="Left">
<ComboBoxItem>Nicht anführen</ComboBoxItem>
<ComboBoxItem>Adresszeilen</ComboBoxItem>
<ComboBoxItem IsSelected="True">Vollwertig</ComboBoxItem>
</ComboBox>
</Grid>
</GroupBox>
</StackPanel>
</TabItem>
<TabItem Header="Textelemente">
<ScrollViewer VerticalScrollBarVisibility="Visible">

View File

@ -1,10 +1,14 @@
using Elwig.Helpers;
using Elwig.Dialogs;
using Elwig.Helpers;
using Elwig.Models.Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Elwig.Windows {
public partial class BaseDataWindow {
@ -13,17 +17,23 @@ namespace Elwig.Windows {
private bool _seasonUpdate = false;
private async Task SeasonsInitEditing(AppDbContext ctx) {
SeasonAddButton.IsEnabled = false;
SeasonRemoveButton.IsEnabled = false;
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
.OrderByDescending(s => s.Year)
.Include(s => s.Modifiers)
.Include(s => s.Currency)
.ToListAsync());
SeasonList_SelectionChanged(null, null);
}
private async Task SeasonsFinishEditing(AppDbContext ctx) {
SeasonAddButton.IsEnabled = true;
SeasonRemoveButton.IsEnabled = true;
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
.OrderByDescending(s => s.Year)
.Include(s => s.Modifiers)
.Include(s => s.Currency)
.ToListAsync());
_seasonChanged = false;
}
@ -49,13 +59,17 @@ namespace Elwig.Windows {
SeasonPenaltyPerKgInput.Text = s.PenaltyPerKg?.ToString() ?? "";
SeasonPenaltyInput.Text = s.PenaltyAmount?.ToString() ?? "";
SeasonPenaltyNoneInput.Text = s.PenaltyNone?.ToString() ?? "";
SeasonPenaltyPerBsInput.Text = s.PenaltyPerBsAmount?.ToString() ?? "";
SeasonPenaltyPerBsNoneInput.Text = s.PenaltyPerBsNone?.ToString() ?? "";
SeasonBsValueInput.Text = s.BusinessShareValue?.ToString() ?? "";
var sym = s.Currency.Symbol ?? "";
var sym = s.Currency.Symbol ?? s.Currency.Code;
SeasonModifierAbsInput.Unit = $"{sym}/kg";
SeasonPenaltyPerKgInput.Unit = $"{sym}/kg";
SeasonPenaltyInput.Unit = sym;
SeasonPenaltyNoneInput.Unit = sym;
SeasonPenaltyPerBsInput.Unit = $"{sym}/GA";
SeasonPenaltyPerBsNoneInput.Unit = $"{sym}/GA";
SeasonBsValueInput.Unit = $"{sym}/GA";
AreaCommitmentTypePenaltyPerKgInput.Unit = $"{sym}/kg";
AreaCommitmentTypePenaltyInput.Unit = sym;
@ -72,6 +86,8 @@ namespace Elwig.Windows {
SeasonPenaltyPerKgInput.Text = "";
SeasonPenaltyInput.Text = "";
SeasonPenaltyNoneInput.Text = "";
SeasonPenaltyPerBsInput.Text = "";
SeasonPenaltyPerBsNoneInput.Text = "";
SeasonBsValueInput.Text = "";
}
_seasonUpdate = false;
@ -94,6 +110,8 @@ namespace Elwig.Windows {
s.PenaltyPerKg = (SeasonPenaltyPerKgInput.Text.Length > 0) ? decimal.Parse(SeasonPenaltyPerKgInput.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.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;
UpdateButtons();
@ -119,5 +137,92 @@ namespace Elwig.Windows {
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, 2));
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;
}
}
}
}

View File

@ -19,6 +19,7 @@ namespace Elwig.Windows {
ClientAddressInput, ClientPlzInput, ClientOrtInput,
];
ExemptInputs = [
BranchList, AreaCommitmentTypeList, WineAttributeList, WineCultivationList, SeasonList, SeasonModifierList,
ClientNameFull,
BranchIdInput, BranchNameInput, BranchPlzInput, BranchOrtInput,
BranchAddressInput, BranchPhoneNrInput, BranchFaxNrInput, BranchMobileNrInput,
@ -31,6 +32,7 @@ namespace Elwig.Windows {
SeasonMaxKgPerHaInput, SeasonVatNormalInput, SeasonVatFlatrateInput, SeasonStartInput, SeasonEndInput,
SeasonMinKgPerBsInput, SeasonMaxKgPerBsInput, SeasonBsValueInput,
SeasonPenaltyPerKgInput, SeasonPenaltyInput, SeasonPenaltyNoneInput,
SeasonPenaltyPerBsInput, SeasonPenaltyPerBsNoneInput,
SeasonModifierIdInput, SeasonModifierNameInput, SeasonModifierRelInput, SeasonModifierAbsInput,
];
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
@ -80,6 +82,8 @@ namespace Elwig.Windows {
SeasonPenaltyPerKgInput.IsReadOnly = true;
SeasonPenaltyInput.IsReadOnly = true;
SeasonPenaltyNoneInput.IsReadOnly = true;
SeasonPenaltyPerBsInput.IsReadOnly = true;
SeasonPenaltyPerBsNoneInput.IsReadOnly = true;
SeasonBsValueInput.IsReadOnly = true;
SeasonModifierIdInput.IsReadOnly = true;
@ -90,6 +94,8 @@ namespace Elwig.Windows {
ParameterAllowAttrIntoLowerInput.IsEnabled = false;
ParameterAvoidUnderDeliveriesInput.IsEnabled = false;
ParameterHonorGebundenInput.IsEnabled = false;
ParameterExportEbicsVersion.IsEnabled = false;
ParameterExportEbicsAddress.IsEnabled = false;
}
new protected void UnlockInputs() {
@ -130,6 +136,8 @@ namespace Elwig.Windows {
SeasonPenaltyPerKgInput.IsReadOnly = false;
SeasonPenaltyInput.IsReadOnly = false;
SeasonPenaltyNoneInput.IsReadOnly = false;
SeasonPenaltyPerBsInput.IsReadOnly = false;
SeasonPenaltyPerBsNoneInput.IsReadOnly = false;
SeasonBsValueInput.IsReadOnly = false;
SeasonModifierIdInput.IsReadOnly = false;
@ -140,6 +148,8 @@ namespace Elwig.Windows {
ParameterAllowAttrIntoLowerInput.IsEnabled = true;
ParameterAvoidUnderDeliveriesInput.IsEnabled = true;
ParameterHonorGebundenInput.IsEnabled = true;
ParameterExportEbicsVersion.IsEnabled = true;
ParameterExportEbicsAddress.IsEnabled = true;
}
private void Window_Loaded(object sender, RoutedEventArgs evt) {
@ -148,10 +158,11 @@ namespace Elwig.Windows {
protected override async Task OnRenewContext(AppDbContext ctx) {
await base.OnRenewContext(ctx);
FillInputs(App.Client, (await ctx.Seasons.FindAsync(Utils.CurrentLastSeason))!);
FillInputs(App.Client, await ctx.Seasons.FindAsync(Utils.CurrentLastSeason));
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
.OrderByDescending(s => s.Year)
.Include(s => s.Modifiers)
.Include(s => s.Currency)
.ToListAsync(), null, ControlUtils.RenewSourceDefault.First);
var year = (SeasonList.SelectedItem as Season)?.Year;
ControlUtils.RenewItemsSource(BranchList, await ctx.Branches
@ -274,7 +285,7 @@ namespace Elwig.Windows {
using var ctx = new AppDbContext();
ClearInputStates();
FillInputs(App.Client, (await ctx.Seasons.FindAsync(Utils.CurrentLastSeason))!);
FillInputs(App.Client, await ctx.Seasons.FindAsync(Utils.CurrentLastSeason));
LockInputs();
}
@ -294,7 +305,7 @@ namespace Elwig.Windows {
using var ctx = new AppDbContext();
ClearInputStates();
FillInputs(App.Client, (await ctx.Seasons.FindAsync(Utils.CurrentLastSeason))!);
FillInputs(App.Client, await ctx.Seasons.FindAsync(Utils.CurrentLastSeason));
UpdateButtons();
}
@ -325,14 +336,14 @@ namespace Elwig.Windows {
using (var ctx = new AppDbContext()) {
ClearInputStates();
FillInputs(App.Client, (await ctx.Seasons.FindAsync(Utils.CurrentLastSeason))!);
FillInputs(App.Client, await ctx.Seasons.FindAsync(Utils.CurrentLastSeason));
LockInputs();
}
await HintContextChange();
await App.HintContextChange();
}
private void FillInputs(ClientParameters p, Season s) {
private void FillInputs(ClientParameters p, Season? s) {
ClearOriginalValues();
ClearDefaultValues();
@ -363,9 +374,11 @@ namespace Elwig.Windows {
TextElementDeliveryConfirmation.Text = p.TextDeliveryConfirmation;
TextElementCreditNote.Text = p.TextCreditNote;
ParameterAllowAttrIntoLowerInput.IsChecked = s.Billing_AllowAttrsIntoLower;
ParameterAvoidUnderDeliveriesInput.IsChecked = s.Billing_AvoidUnderDeliveries;
ParameterHonorGebundenInput.IsChecked = s.Billing_HonorGebunden;
ParameterAllowAttrIntoLowerInput.IsChecked = s?.Billing_AllowAttrsIntoLower ?? false;
ParameterAvoidUnderDeliveriesInput.IsChecked = s?.Billing_AvoidUnderDeliveries ?? false;
ParameterHonorGebundenInput.IsChecked = s?.Billing_HonorGebunden ?? false;
ParameterExportEbicsVersion.SelectedIndex = p.ExportEbicsVersion - 3;
ParameterExportEbicsAddress.SelectedIndex = p.ExportEbicsAddress;
FinishInputFilling();
}
@ -393,6 +406,9 @@ namespace Elwig.Windows {
p.TextDeliveryConfirmation = TextElementDeliveryConfirmation.Text.Length > 0 ? TextElementDeliveryConfirmation.Text : null;
p.TextCreditNote = TextElementCreditNote.Text.Length > 0 ? TextElementCreditNote.Text : null;
p.ExportEbicsVersion = ParameterExportEbicsVersion.SelectedIndex + 3;
p.ExportEbicsAddress = ParameterExportEbicsAddress.SelectedIndex;
await p.UpdateValues();
}

View File

@ -6,7 +6,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:ctrl="clr-namespace:Elwig.Controls"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:ScottPlot="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF"
mc:Ignorable="d"
Title="Auszahlung - Elwig" Height="700" Width="1500" MinWidth="1000" MinHeight="500"
@ -70,10 +69,10 @@
</Grid.ColumnDefinitions>
<Label Content="Für:" Margin="10,-2,0,0" FontSize="14" Grid.Column="0" VerticalAlignment="Center"/>
<xctk:CheckComboBox x:Name="VaributeInput" Margin="50,0,0,0" Grid.Column="0" Width="500" Height="25" HorizontalAlignment="Left"
<ctrl:CheckComboBox x:Name="VaributeInput" Margin="50,0,0,0" Grid.Column="0" Width="500" Height="25" HorizontalAlignment="Left"
IsSelectAllActive="True" SelectAllContent="Alle Sorten" Delimiter=", " AllItemsSelectedContent="Alle Sorten"
IsEnabled="False" ItemSelectionChanged="VaributeInput_Changed">
<xctk:CheckComboBox.ItemTemplate>
IsEnabled="False" SelectionChanged="VaributeInput_Changed">
<ctrl:CheckComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Variety.Name}" Width="150"/>
@ -84,8 +83,8 @@
<TextBlock Text="{Binding AssignedAbgewGraphId}" Width="30"/>
</StackPanel>
</DataTemplate>
</xctk:CheckComboBox.ItemTemplate>
</xctk:CheckComboBox>
</ctrl:CheckComboBox.ItemTemplate>
</ctrl:CheckComboBox>
<CheckBox x:Name="AbgewertetInput" Content="Abgewertet" IsEnabled="False" Checked="AbgewertetInput_Changed" Unchecked="AbgewertetInput_Changed"
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0" Grid.Column="1"/>
@ -139,12 +138,12 @@
<Label Content="Oechsle:" Margin="10,10,0,0" Grid.Column="0"/>
<ctrl:UnitTextBox x:Name="OechsleInput" Unit="°Oe" TextChanged="OechsleInput_TextChanged" IsEnabled="False" LostFocus="OechsleInput_LostFocus"
Grid.Column="1" Width="90" Margin="0,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
Grid.Column="1" Width="90" Margin="0,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Preis:" Margin="10,40,0,0" Grid.Column="0"/>
<ctrl:UnitTextBox x:Name="PriceInput" Unit="€/kg" TextChanged="PriceInput_TextChanged" IsEnabled="False" LostFocus="PriceInput_LostFocus"
Grid.Column="1" Width="90" Margin="0,40,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
Grid.Column="1" Width="90" Margin="0,40,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</Grid>
</GroupBox>

View File

@ -9,13 +9,9 @@ using Elwig.Controls;
using Elwig.Helpers;
using Elwig.Helpers.Billing;
using Elwig.Models.Entities;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using ScottPlot.Plottables;
using ScottPlot;
using Xceed.Wpf.Toolkit.Primitives;
using ScottPlot.Control;
using System.Text.Json;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
namespace Elwig.Windows {
public partial class ChartWindow : ContextWindow {
@ -509,7 +505,7 @@ namespace Elwig.Windows {
ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph!.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint));
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();
} else {
@ -724,26 +720,31 @@ namespace Elwig.Windows {
}
}
private void VaributeInput_Changed(object sender, ItemSelectionChangedEventArgs e) {
if (FillingInputs || e.Item is not Varibute v) return;
private void VaributeInput_Changed(object sender, SelectionChangedEventArgs evt) {
if (FillingInputs) return;
var isOpen = VaributeInput.IsDropDownOpen;
if (e.IsSelected) {
if (RemoveVaributeFromOthers(e.Item.ToString())) {
foreach (var i in evt.AddedItems) {
if (i is not Varibute v) continue;
if (RemoveVaributeFromOthers(v.ToString())) {
if (AbgewertetInput.IsChecked == true) {
v.AssignedAbgewGraphId = SelectedGraphEntry?.Id;
} else {
v.AssignedGraphId = SelectedGraphEntry?.Id;
}
} else {
VaributeInput.SelectedItems.Remove(e.Item);
VaributeInput.SelectedItems.Remove(v);
}
} else {
}
foreach (var i in evt.RemovedItems) {
if (i is not Varibute v) continue;
if (AbgewertetInput.IsChecked == true) {
v.AssignedAbgewGraphId = null;
} else {
v.AssignedGraphId = null;
}
}
SelectedGraphEntry!.Vaributes = VaributeInput.SelectedItems.Cast<Varibute>().ToList();
SetHasChanged();
GraphList.Items.Refresh();

View File

@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:ctrl="clr-namespace:Elwig.Controls"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="Lieferungen - Elwig" Height="720" Width="1100" MinHeight="720" MinWidth="1000"
Loaded="Window_Loaded">
<Window.Resources>
@ -35,7 +34,7 @@
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style TargetType="xctk:CheckComboBox">
<Style TargetType="ctrl:CheckComboBox">
<Setter Property="Height" Value="25"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
@ -175,9 +174,9 @@
</TextBlock>
</TextBox.ToolTip>
</TextBox>
<xctk:IntegerUpDown x:Name="SeasonInput" Grid.ColumnSpan="3" Height="25" Width="56" FontSize="14" Minimum="1000" Maximum="9999"
Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Right"
ValueChanged="SeasonInput_ValueChanged"/>
<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" Text="2020"
TextChanged="SeasonInput_TextChanged"/>
<CheckBox x:Name="TodayOnlyInput" Content="Nur heute"
HorizontalAlignment="Right" Margin="0,7,18,0" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2"
Checked="TodayOnlyInput_Changed" Unchecked="TodayOnlyInput_Changed"/>
@ -474,9 +473,9 @@
</Grid.ColumnDefinitions>
<Label Content="Zu-/Abschläge:" Margin="10,10,0,10"/>
<xctk:CheckComboBox x:Name="ModifiersInput" Margin="0,10,10,10" Grid.Column="1" Grid.ColumnSpan="2"
<ctrl:CheckComboBox x:Name="ModifiersInput" Margin="0,10,10,10" Grid.Column="1" Grid.ColumnSpan="2"
ItemTemplate="{StaticResource ModifierTemplate}" Delimiter=", " AllItemsSelectedContent="Alle"
ItemSelectionChanged="ModifiersInput_SelectionChanged"/>
SelectionChanged="ModifiersInput_SelectionChanged"/>
<Label Content="Anmerkung:" Margin="10,40,0,10"/>
<TextBox x:Name="PartCommentInput" Grid.Column="1" Margin="0,40,10,10" Grid.ColumnSpan="2"

View File

@ -19,7 +19,6 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Threading;
using Xceed.Wpf.Toolkit.Primitives;
namespace Elwig.Windows {
public partial class DeliveryAdminWindow : AdministrationWindow {
@ -1067,7 +1066,7 @@ namespace Elwig.Windows {
await RefreshDeliveryList();
var d = DeliveryList.SelectedItem as Delivery;
var y = d?.Year ?? Utils.CurrentLastSeason;
var y = d?.Year ?? SeasonInput.Value;
ControlUtils.RenewItemsSource(MemberInput, await ctx.Members
.Where(m => m.IsActive || !IsCreating)
.Include(m => m.PostalDest.AtPlz!.Ort)
@ -1084,7 +1083,11 @@ namespace Elwig.Windows {
cultList.Insert(0, new NullItem(""));
ControlUtils.RenewItemsSource(CultivationInput, cultList, null, ControlUtils.RenewSourceDefault.First);
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));
var kgList = (await ctx.Katastralgemeinden
.Where(k => k.WbKg != null)
@ -1112,10 +1115,18 @@ namespace Elwig.Windows {
private async Task RefreshDeliveryParts() {
using var ctx = new AppDbContext();
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);
} 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;
}
}
@ -1267,7 +1278,10 @@ namespace Elwig.Windows {
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) {
// update origin (KgNr), if default is selected
@ -1344,8 +1358,8 @@ namespace Elwig.Windows {
await RefreshDeliveryListQuery(true);
}
private async void SeasonInput_ValueChanged(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value == null) return;
private async void SeasonInput_TextChanged(object sender, TextChangedEventArgs evt) {
if (SeasonInput.Value == null || TodayOnlyInput == null || AllSeasonsInput == null) return;
TodayOnlyInput.IsChecked = false;
AllSeasonsInput.IsChecked = false;
await RefreshDeliveryListQuery();
@ -1592,7 +1606,7 @@ namespace Elwig.Windows {
p2.HkId = "OEST";
ctx.Add(p2);
ctx.UpdateDeliveryPartModifiers(p2, p.Modifiers);
ctx.UpdateDeliveryPartModifiers(p2, [], p.Modifiers);
}
await ctx.SaveChangesAsync();
await RefreshDeliveryParts();
@ -2047,7 +2061,7 @@ namespace Elwig.Windows {
}
private void ModifiersInput_SelectionChanged(object sender, ItemSelectionChangedEventArgs evt) {
private void ModifiersInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
if (!IsEditing && !IsCreating) return;
var mod = ModifiersInput.SelectedItems.Cast<Modifier>();
var source = ModifiersInput.ItemsSource.Cast<Modifier>();

View File

@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:ctrl="clr-namespace:Elwig.Controls"
mc:Ignorable="d"
MinWidth="650" MinHeight="400" Height="600" Width="950"
Closed="Window_Closed"
@ -54,7 +54,7 @@
<Button x:Name="DocumentAddButton" Content="&#xF0AF;" FontFamily="Segoe MDL2 Assets" FontSize="14"
Grid.Column="1" Margin="0,0,0,30" VerticalAlignment="Center" Height="25" IsEnabled="False"
Click="DocumentAddButton_Click"/>
<Button x:Name="DocumentRemoveButton" Content="&#xE74D;" FontFamily="Segoe MDL2 Assets" FontSize="14" Padding="1.5,0,0,0"
<Button x:Name="DocumentRemoveButton" Content="&#xE74D;" 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"
Click="DocumentRemoveButton_Click"/>
@ -117,26 +117,26 @@
Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
<Label Content="Zwst.:" x:Name="MemberBranchLabel" Margin="10,120,0,10"/>
<xctk:CheckComboBox x:Name="MemberBranchInput" AllItemsSelectedContent="Alle Stammzweigstellen" Delimiter=", " DisplayMemberPath="Name"
<ctrl:CheckComboBox x:Name="MemberBranchInput" AllItemsSelectedContent="Alle Stammzweigstellen" Delimiter=", " DisplayMemberPath="Name"
Margin="50,120,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
ItemSelectionChanged="MemberInput_SelectionChanged"/>
SelectionChanged="MemberInput_SelectionChanged"/>
<Label Content="Gem.:" x:Name="MemberKgLabel" Margin="10,150,0,10"/>
<xctk:CheckComboBox x:Name="MemberKgInput" AllItemsSelectedContent="Alle Stammgemeinden" Delimiter=", " DisplayMemberPath="Name"
<ctrl:CheckComboBox x:Name="MemberKgInput" AllItemsSelectedContent="Alle Stammgemeinden" Delimiter=", " DisplayMemberPath="Name"
IsSelectAllActive="True" SelectAllContent="Alle Stammgemeinden"
Margin="50,150,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
ItemSelectionChanged="MemberInput_SelectionChanged"/>
SelectionChanged="MemberInput_SelectionChanged"/>
<Label Content="Vtrg.:" x:Name="MemberAreaComLabel" Margin="10,180,0,10"/>
<xctk:CheckComboBox x:Name="MemberAreaComInput" AllItemsSelectedContent="Alle Vertragsarten" Delimiter=", " DisplayMemberPath="VtrgId"
<ctrl:CheckComboBox x:Name="MemberAreaComInput" AllItemsSelectedContent="Alle Vertragsarten" Delimiter=", " DisplayMemberPath="VtrgId"
IsSelectAllActive="True" SelectAllContent="Alle Vertragsarten"
Margin="50,180,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
ItemSelectionChanged="MemberInput_SelectionChanged"/>
SelectionChanged="MemberInput_SelectionChanged"/>
<xctk:CheckComboBox x:Name="MemberCustomInput" AllItemsSelectedContent="Alle Mitglieder" Delimiter=", " DisplayMemberPath="AdministrativeName"
<ctrl:CheckComboBox x:Name="MemberCustomInput" AllItemsSelectedContent="Alle Mitglieder" Delimiter=", " DisplayMemberPath="AdministrativeName"
IsSelectAllActive="True" SelectAllContent="Alle Mitglieder"
Margin="10,120,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
ItemSelectionChanged="MemberInput_SelectionChanged"/>
SelectionChanged="MemberInput_SelectionChanged"/>
</Grid>
</GroupBox>

View File

@ -53,7 +53,7 @@ namespace Elwig.Windows {
CreditNote.Name,
];
public readonly int? Year;
public readonly int Year;
public ObservableCollection<SelectedDoc> SelectedDocs = [];
public IEnumerable<Member> Recipients = [];
@ -103,7 +103,7 @@ namespace Elwig.Windows {
public MailWindow(int? year = null) {
InitializeComponent();
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";
}
@ -143,36 +143,44 @@ namespace Elwig.Windows {
.OrderBy(b => b.Name)
.ToListAsync(), MemberInput_SelectionChanged);
if (MemberBranchInput.SelectedItems.Count == 0) {
MemberBranchInput.ItemSelectionChanged -= MemberInput_SelectionChanged;
MemberBranchInput.SelectionChanged -= MemberInput_SelectionChanged;
MemberBranchInput.SelectAll();
MemberBranchInput.ItemSelectionChanged += MemberInput_SelectionChanged;
MemberBranchInput.SelectionChanged += MemberInput_SelectionChanged;
}
ControlUtils.RenewItemsSource(MemberKgInput, await ctx.Katastralgemeinden
.Where(k => k.WbKg!.Members.Any())
.OrderBy(k => k.Name)
.ToListAsync(), MemberInput_SelectionChanged);
if (MemberKgInput.SelectedItems.Count == 0) {
MemberKgInput.ItemSelectionChanged -= MemberInput_SelectionChanged;
MemberKgInput.SelectionChanged -= MemberInput_SelectionChanged;
MemberKgInput.SelectAll();
MemberKgInput.ItemSelectionChanged += MemberInput_SelectionChanged;
MemberKgInput.SelectionChanged += MemberInput_SelectionChanged;
}
ControlUtils.RenewItemsSource(MemberAreaComInput, await ctx.AreaCommitmentTypes
.OrderBy(a => a.VtrgId)
.ToListAsync(), MemberInput_SelectionChanged);
if (MemberAreaComInput.SelectedItems.Count == 0) {
MemberAreaComInput.ItemSelectionChanged -= MemberInput_SelectionChanged;
MemberAreaComInput.SelectionChanged -= MemberInput_SelectionChanged;
MemberAreaComInput.SelectAll();
MemberAreaComInput.ItemSelectionChanged += MemberInput_SelectionChanged;
MemberAreaComInput.SelectionChanged += MemberInput_SelectionChanged;
}
ControlUtils.RenewItemsSource(MemberCustomInput, await ctx.Members
.Where(m => m.IsActive)
.OrderBy(m => m.FamilyName)
.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);
if (MemberCustomInput.SelectedItems.Count == 0) {
MemberCustomInput.ItemSelectionChanged -= MemberInput_SelectionChanged;
MemberCustomInput.SelectionChanged -= MemberInput_SelectionChanged;
MemberCustomInput.SelectAll();
MemberCustomInput.ItemSelectionChanged += MemberInput_SelectionChanged;
MemberCustomInput.SelectionChanged += MemberInput_SelectionChanged;
}
await UpdateRecipients(ctx);
@ -245,7 +253,7 @@ namespace Elwig.Windows {
if (idx == 0) {
SelectedDocs.Add(new(DocType.MemberDataSheet, s, null));
} 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) {
using var ctx = new AppDbContext();
var name = s.Split(" ")[^1];
@ -288,7 +296,7 @@ namespace Elwig.Windows {
await UpdateRecipients(ctx);
}
private async void MemberInput_SelectionChanged(object sender, RoutedEventArgs evt) {
private async void MemberInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
using var ctx = new AppDbContext();
await UpdateRecipients(ctx);
}
@ -297,25 +305,23 @@ namespace Elwig.Windows {
if (RecipientsCustomInput.IsChecked == true) {
Recipients = MemberCustomInput.SelectedItems.Cast<Member>().ToList();
} else {
var year = (!await ctx.Deliveries.AnyAsync()) ? 0 : await ctx.Deliveries.MaxAsync(d => d.Year);
IQueryable<Member> query = ctx.Members.Where(m => m.IsActive);
if (MemberBranchInput.SelectedItems.Count != MemberBranchInput.Items.Count) {
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) {
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) {
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)));
} else if (year > 0 && RecipientsDeliveryMembersInput.IsChecked == true) {
query = query.Where(m => m.Deliveries.Any(d => d.Year == year));
} else if (year > 0 && RecipientsNonDeliveryMembersInput.IsChecked == true) {
query = query.Where(m => !m.Deliveries.Any(d => d.Year == year));
query = query.Where(m => m.AreaCommitments.AsQueryable().Where(Utils.ActiveAreaCommitments(Year)).Any(c => vtrg.Contains(c.VtrgId)));
} else if (RecipientsDeliveryMembersInput.IsChecked == true) {
query = query.Where(m => m.Deliveries.Any(d => d.Year == Year));
} else if (RecipientsNonDeliveryMembersInput.IsChecked == true) {
query = query.Where(m => !m.Deliveries.Any(d => d.Year == Year));
}
Recipients = await query
.Include(m => m.Branch)
@ -707,7 +713,7 @@ namespace Elwig.Windows {
AvaiableDocumentsList.SelectedIndex = 1;
if (AvaiableDocumentsList.SelectedItem is not string s || SelectedDocs.Any(d => d.Type == DocType.DeliveryConfirmation))
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;
}

View File

@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
Loaded="Window_Loaded" Closing="Window_Closing">
<Window.Resources>
@ -12,7 +12,7 @@
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="9,3"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Height" Value="35"/>
<Setter Property="Width" Value="200"/>
</Style>
</Window.Resources>
@ -54,46 +54,47 @@
</Grid>
<Button x:Name="MemberAdminButton" Content="Mitglieder" Click="MemberAdminButton_Click"
Margin="0,180,210,0"/>
Margin="0,170,205,0"/>
<Button x:Name="MailButton" Content="Rundschreiben" Click="MailButton_Click"
Margin="210,180,0,0"/>
Margin="205,170,0,0"/>
<Button x:Name="DeliveryAdminButton" Content="Lieferungen" Click="DeliveryAdminButton_Click"
Margin="0,220,210,0"/>
Margin="0,210,205,0"/>
<Button x:Name="ReceiptButton" Content="Übernahme" Click="ReceiptButton_Click"
Margin="210,220,0,0"/>
Margin="205,210,0,0"/>
<Button x:Name="BaseDataButton" Content="Stammdaten" Click="BaseDataButton_Click"
Margin="0,260,210,0"/>
Margin="0,250,205,0"/>
<Button x:Name="RegistrationButton" Content="Anmeldungen" IsEnabled="False"
Margin="210,260,0,0"/>
Margin="205,250,0,0"/>
<Expander x:Name="SeasonFinish" Header="Leseabschluss" Expanded="SeasonFinish_Expanded" Collapsed="SeasonFinish_Collapsed"
HorizontalAlignment="Center" Width="410" Margin="0,300,0,0" VerticalAlignment="Top">
<Expander x:Name="SeasonFinish" Header="Leseabschluss" SnapsToDevicePixels="True"
Expanded="SeasonFinish_Expanded" Collapsed="SeasonFinish_Collapsed"
HorizontalAlignment="Center" Width="407" Margin="0,290,0,0" VerticalAlignment="Top">
<Grid>
<Border BorderBrush="LightGray" BorderThickness="1"/>
<Label Content="Saison:" Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Center" Padding="2,4,2,4" Height="25"/>
<xctk:IntegerUpDown Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1000" Maximum="9999"
Margin="0,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
ValueChanged="SeasonInput_ValueChanged"/>
<Label Content="Saison:" Margin="0,13,100,0" VerticalAlignment="Top" HorizontalAlignment="Center" Padding="2,4,2,4" Height="25"/>
<ctrl:IntegerUpDown x:Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1900" Maximum="9999"
Margin="0,13,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
TextChanged="SeasonInput_TextChanged"/>
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigung"
Click="DeliveryConfirmationButton_Click"
Margin="0,50,200,10" Width="190"/>
Margin="0,50,195,10" Width="190"/>
<Button x:Name="PaymentButton" Content="Auszahlung"
Click="PaymentButton_Click"
Margin="200,50,0,10" Width="190"/>
Margin="195,50,0,10" Width="190"/>
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
Click="OverUnderDeliveryButton_Click"
Margin="0,90,200,10" Width="190"/>
Margin="0,90,195,10" Width="190"/>
<Button x:Name="AutoBusinessSharesButton" Content="Autom. GA nachzeichnen"
Click="AutoBusinessSharesButton_Click" IsEnabled="False"
Margin="200,90,0,10" Width="190"/>
<Button x:Name="PaymentAdjustmentButton" Content="Anpassung"
Click="PaymentAdjustmentButton_Click" IsEnabled="False"
Margin="195,90,0,10" Width="190"/>
<Button x:Name="BreakdownButton" Content="Sorten-/Qual.aufteilung"
Click="BreakdownButton_Click"
Margin="0,130,200,10" Width="190"/>
Margin="0,130,195,10" Width="190"/>
</Grid>
</Expander>
</Grid>

View File

@ -14,6 +14,7 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Elwig.Windows {
@ -34,7 +35,7 @@ namespace Elwig.Windows {
}
private void Window_Closing(object sender, CancelEventArgs evt) {
if (App.NumWindows > 1 && !App.ForceShutdown) {
if (App.NumWindows > 1 && !App.ForceShutdown && !App.Current.Windows.Cast<Window>().Any(w => ((w as AdministrationWindow)?.IsEditing ?? false) || ((w as AdministrationWindow)?.IsCreating ?? false))) {
var res = MessageBox.Show("Es sind noch weitere Fenster geöffnet.\nSollen alle Fenster geschlossen werden?",
"Elwig beenden", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
if (res != MessageBoxResult.Yes) {
@ -147,7 +148,7 @@ namespace Elwig.Windows {
}
protected override Task OnRenewContext(AppDbContext ctx) {
SeasonInput_ValueChanged(null, null);
SeasonInput_TextChanged(null, null);
return Task.CompletedTask;
}
@ -159,13 +160,13 @@ namespace Elwig.Windows {
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();
var s0 = await ctx.Seasons.FindAsync(SeasonInput.Value);
var valid = (s0 != null);
DeliveryConfirmationButton.IsEnabled = valid;
OverUnderDeliveryButton.IsEnabled = valid;
AutoBusinessSharesButton.IsEnabled = valid && false;
PaymentAdjustmentButton.IsEnabled = valid && false;
PaymentButton.IsEnabled = valid;
BreakdownButton.IsEnabled = valid;
}
@ -210,18 +211,18 @@ namespace Elwig.Windows {
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)
return;
if (false && App.Client.IsMatzen) {
AutoBusinessSharesButton.IsEnabled = false;
PaymentAdjustmentButton.IsEnabled = false;
Mouse.OverrideCursor = Cursors.AppStarting;
var b = new Billing(year);
await b.AutoAdjustBusinessShare();
Mouse.OverrideCursor = null;
AutoBusinessSharesButton.IsEnabled = true;
PaymentAdjustmentButton.IsEnabled = true;
} else {
MessageBox.Show(
"Es ist kein automatisches Nachzeichnen der Geschäftsanteile\n" +

View File

@ -15,6 +15,7 @@ using Elwig.Models.Dtos;
using Elwig.Helpers.Export;
using Microsoft.Win32;
using Elwig.Helpers.Billing;
using Elwig.Dialogs;
namespace Elwig.Windows {
public partial class MemberAdminWindow : AdministrationWindow {
@ -454,20 +455,38 @@ namespace Elwig.Windows {
if (MemberList.SelectedItem is not Member m)
return;
var r = MessageBox.Show(
$"Soll das Mitglied \"{m.AdministrativeName}\" (MgNr. {m.MgNr}) wirklich unwiderruflich gelöscht werden?\n" +
$"Sämtliche Lieferungen und Flächenbindungen dieses Mitglieds werden auch gelöscht!",
"Mitglied löschen", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
if (r == MessageBoxResult.OK) {
int areaComs = 0, deliveries = 0, credits = 0;
using (var ctx = new AppDbContext()) {
var l = (await ctx.Members.FindAsync(m.MgNr))!;
areaComs = l.AreaCommitments.Count;
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 {
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 App.HintContextChange();
} 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);
if (valid && PredecessorMgNrInput.Text != "" && (IsEditing || IsCreating)) {
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;
using var ctx = new AppDbContext();
var areaComs = await ctx.AreaCommitments
@ -1123,13 +1142,12 @@ namespace Elwig.Windows {
.ToListAsync();
if (areaComs.Count == 0)
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" +
"Die Änderungen werden erst beim Speichern übernommen!",
"Aktive Flächenbindungen übernehmen", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
if (res != MessageBoxResult.Yes)
var oldMember = (await ctx.Members.FindAsync(mgnr))!;
var d = new AreaComDialog(oldMember.AdministrativeName, m.AdministrativeName, areaComs.Count, areaComs.Sum(c => c.Area));
if (d.ShowDialog() != true)
return;
TransferPredecessorAreaComs = Utils.FollowingSeason;
TransferPredecessorAreaComs = d.SuccessorSeason;
SetOriginalValue(PredecessorMgNrInput, -1); // hack to allow user to save
UpdateButtons();
}
@ -1171,18 +1189,18 @@ namespace Elwig.Windows {
}
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)) {
using var ctx = new AppDbContext();
var areaComs = await ctx.AreaCommitments
.Where(c => c.MgNr == mgnr && (c.YearTo == null || c.YearTo >= Utils.FollowingSeason))
.ToListAsync();
if (areaComs.Count >= 0) {
var res = MessageBox.Show($"Sollen die aktiven Flächenbindungen gekündigt werden? ({areaComs.Sum(c => c.Area)} m²)\n" +
"Falls die Flächenbindungen später an ein neues Mitglied\n" +
"übertragen werden sollen bitte \"Nein\" auswählen!\n\n" +
"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;
if (areaComs.Count > 0) {
var d = new AreaComDialog(m.AdministrativeName, areaComs.Count, areaComs.Sum(c => c.Area));
if (d.ShowDialog() == true) {
CancelAreaComs = d.CancelSeason;
}
}
}
CheckBox_Changed(sender, evt);

View File

@ -424,7 +424,7 @@ namespace Elwig.Windows {
Menu_EbicsSave.IsEnabled = false;
Mouse.OverrideCursor = Cursors.AppStarting;
try {
using var e = new Ebics(v, d.FileName, 9);
using var e = new Ebics(v, d.FileName, App.Client.ExportEbicsVersion, (Ebics.AddressMode)App.Client.ExportEbicsAddress);
await e.ExportAsync(Transaction.FromPaymentVariant(v));
} catch (Exception exc) {
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);

View File

@ -1,5 +1,5 @@
::mkdir "C:\Program Files\Elwig"
::curl -s -L "http://www.columbia.edu/~em36/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"
copy /b /y Documents\*.css "C:\ProgramData\Elwig\resources"
copy /b /y Documents\*.cshtml "C:\ProgramData\Elwig\resources"

View File

@ -11,11 +11,11 @@ file = database.sqlite3
;log = db.log
[update]
url = https://www.necronda.net/elwig/files/elwig/latest
url = https://elwig.at/files/elwig/latest
auto = true
[sync]
;url = https://www.necronda.net/elwig/clients/WGX/
;url = https://elwig.at/clients/WGX/
;username = ""
;password = ""

View File

@ -25,7 +25,7 @@
</Task>
</UsingTask>
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
<Exec Command="curl -s -L &quot;http://www.columbia.edu/~em36/PDFtoPrinter.exe&quot; -z &quot;$(ProjectDir)\Files\PDFtoPrinter.exe&quot; -o &quot;$(ProjectDir)\Files\PDFtoPrinter.exe&quot;" />
<Exec Command="curl --fail -s -L &quot;https://github.com/emendelson/pdftoprinter/raw/main/PDFtoPrinter.exe&quot; -z &quot;$(ProjectDir)\Files\PDFtoPrinter.exe&quot; -o &quot;$(ProjectDir)\Files\PDFtoPrinter.exe&quot;" />
<Exec Command="dotnet publish &quot;$(ProjectDir)\..\Elwig\Elwig.csproj&quot; &quot;/p:PublishProfile=$(ProjectDir)\..\Elwig\Properties\PublishProfiles\FolderProfile.pubxml&quot;" />
<GetFileVersion AssemblyPath="..\Elwig\bin\Publish\Elwig.exe">
<Output TaskParameter="Version" PropertyName="ElwigFileVersion" />

View File

@ -5,8 +5,8 @@
<Cultures>de-AT</Cultures>
</PropertyGroup>
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
<Exec Command="curl -s -L &quot;https://go.microsoft.com/fwlink/p/?LinkId=2124703&quot; -z &quot;$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe&quot; -o &quot;$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe&quot;" />
<Exec Command="curl -s -L &quot;https://aka.ms/vs/17/release/vc_redist.x86.exe&quot; -z &quot;$(ProjectDir)\Files\VC_redist.x86.exe&quot; -o &quot;$(ProjectDir)\Files\VC_redist.x86.exe&quot;" />
<Exec Command="curl --fail -s -L &quot;https://go.microsoft.com/fwlink/p/?LinkId=2124703&quot; -z &quot;$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe&quot; -o &quot;$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe&quot;" />
<Exec Command="curl --fail -s -L &quot;https://aka.ms/vs/17/release/vc_redist.x86.exe&quot; -z &quot;$(ProjectDir)\Files\VC_redist.x86.exe&quot; -o &quot;$(ProjectDir)\Files\VC_redist.x86.exe&quot;" />
<PropertyGroup>
<DefineConstants>ElwigProjectDir=..\Elwig</DefineConstants>
</PropertyGroup>

View File

@ -16,9 +16,9 @@ namespace Tests.DocumentTests {
Assert.That(text, Contains.Substring("Mitgliederliste"));
Assert.That(text, Contains.Substring("Alle Mitglieder"));
Assert.That(text, Contains.Substring("""
101 MUSTERMANN Max Winzerstraße 1 2223 Hohenruppersdorf 1472583 0 Hohenruppersdorf
102 WEINBAUER Wernhardt Winzerstraße 2 2223 Hohenruppersdorf 4725836 0 Hohenruppersdorf
W&B Weinbauer GesbR Winzerstraße 2 2223 Hohenruppersdorf
101 MUSTERMANN Max Winzerstraße 1 2223 Hohenruppersdorf 1472583 0 Hohenruppersdorf
102 WEINBAUER Wernhardt Winzerstraße 2 2223 Hohenruppersdorf 4725836 0 Hohenruppersdorf
W&B Weinbauer GesbR Winzerstraße 2 2223 Hohenruppersdorf
"""));
});
}

View File

@ -14,16 +14,16 @@ namespace Tests.HelperTests {
public static readonly string FileName = Path.Combine(Path.GetTempPath(), "test_ebics.xml");
public static readonly string Iban = "AT123456789012345678";
private static void ValidateSchema(string xmlPath, int version) {
private static void ValidateSchema(string xmlPath, int version, string? extra = null) {
XmlDocument xml = new();
xml.Load(xmlPath);
var schema = new XmlTextReader(Assembly.GetExecutingAssembly()
.GetManifestResourceStream($"Tests.Resources.Schemas.pain.001.001.{version:00}.xsd")!);
.GetManifestResourceStream($"Tests.Resources.Schemas.pain.001.001.{version:00}{extra}.xsd")!);
xml.Schemas.Add(null, schema);
xml.Validate(null);
}
private static async Task CreateXmlFile(int version) {
private static async Task CreateXmlFile(int version, Ebics.AddressMode mode = Ebics.AddressMode.Full) {
var v = new PaymentVar() {
Year = 2020,
AvNr = 1,
@ -35,7 +35,7 @@ namespace Tests.HelperTests {
using var ctx = new AppDbContext();
var members = ctx.Members.ToList();
Assert.That(members, Has.Count.GreaterThan(0));
using var exporter = new Ebics(v, FileName, version);
using var exporter = new Ebics(v, FileName, version, mode);
await exporter.ExportAsync(members.Select(m => new Transaction(m, 1234.56m, "EUR", m.MgNr % 100)));
}
@ -64,6 +64,12 @@ namespace Tests.HelperTests {
Assert.DoesNotThrow(() => ValidateSchema(FileName, 3));
}
[Test]
public async Task Test_CustomerCreditTransferInitiationV03_AT() {
await CreateXmlFile(3, Ebics.AddressMode.Lines);
Assert.DoesNotThrow(() => ValidateSchema(FileName, 3, ".AT"));
}
[Test]
public async Task Test_CustomerCreditTransferInitiationV04() {
await CreateXmlFile(4);

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
</Target>
<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="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />

View File

@ -1 +1 @@
curl -s -L "https://www.necronda.net/elwig/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"