Compare commits

...

23 Commits

Author SHA1 Message Date
70129695ae Bump version to 0.8.5
All checks were successful
Test / Run tests (push) Successful in 1m41s
Deploy / Build and Deploy (push) Successful in 2m21s
2024-06-17 11:31:26 +02:00
51b9799b56 [#46] PaymentAdjustmentWindow: Persist parameters in ClientParameters
All checks were successful
Test / Run tests (push) Successful in 1m53s
2024-06-17 11:25:35 +02:00
c1903b1f36 [#46] PaymentAdjustmentWindow: Refine DataGrid
All checks were successful
Test / Run tests (push) Successful in 1m55s
2024-06-17 11:03:32 +02:00
66eb177fbf [#46] Billing: Only adjust business shares for active members 2024-06-17 10:51:48 +02:00
87467bbe75 Export/Ebics: Remove blank line for not shown <Ctry/> 2024-06-17 10:47:14 +02:00
abf465f821 OverUnderDeliveryData: Also show inactive members
All checks were successful
Test / Run tests (push) Successful in 1m42s
2024-06-17 10:24:58 +02:00
792c18365e MailWindow: Send DeliveryConfirmations and CreditNotes also to inactive members
All checks were successful
Test / Run tests (push) Successful in 2m16s
2024-06-17 10:17:28 +02:00
5c46a00752 [#46] Windows: Add PaymentAdjustmentWindow
All checks were successful
Test / Run tests (push) Successful in 2m13s
2024-06-17 01:41:32 +02:00
9d9f929843 [#46] MemberHistory: Add Type to PK 2024-06-17 01:19:25 +02:00
b76c5ea874 [#46] CreditNote: Show number of added business shares
All checks were successful
Test / Run tests (push) Successful in 1m57s
2024-06-16 23:54:53 +02:00
86e69e9ff8 [#48] PaymentVariantsWindow: Add checkbox for custom member modifiers
All checks were successful
Test / Run tests (push) Successful in 2m22s
2024-06-16 18:31:02 +02:00
050e4f5b6f ControlUtils: Allow RenewItemsSource for ListBox to reselect all items
All checks were successful
Test / Run tests (push) Successful in 2m21s
2024-06-14 17:02:25 +02:00
01f055ee17 Test: Fix DocumentTests again?
All checks were successful
Test / Run tests (push) Successful in 1m42s
2024-06-14 12:15:05 +02:00
da9df5cbeb Export/Ebics: Warn user if no client IBAN is set
Some checks failed
Test / Run tests (push) Failing after 2m22s
2024-06-14 12:11:49 +02:00
cc0aa6046f Export/Ebics: Also export Ctry in address line mode
All checks were successful
Test / Run tests (push) Successful in 2m25s
2024-06-13 10:00:49 +02:00
5cb7d2cbb0 Export/Ebics: Escape address properly
All checks were successful
Test / Run tests (push) Successful in 1m47s
2024-06-13 01:48:37 +02:00
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
40 changed files with 2208 additions and 199 deletions

View File

@ -296,6 +296,10 @@ namespace Elwig {
return FocusWindow<PaymentVariantsWindow>(() => new(year), w => w.Year == year);
}
public static PaymentAdjustmentWindow FocusPaymentAdjustment(int year) {
return FocusWindow<PaymentAdjustmentWindow>(() => new(year), w => w.Year == year);
}
public static ChartWindow FocusChartWindow(int year, int avnr) {
return FocusWindow<ChartWindow>(() => new(year, avnr), w => w.Year == year && w.AvNr == avnr);
}

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

@ -18,7 +18,8 @@ namespace Elwig.Documents {
public string MemberModifier;
public IEnumerable<(string Name, int Kg, decimal Amount)>? MemberUnderDeliveries;
public decimal MemberTotalUnderDelivery;
public decimal MemberAutoBusinessShares;
public int MemberAutoBusinessShares;
public decimal MemberAutoBusinessSharesAmount;
public CreditNote(
AppDbContext ctx,
@ -66,7 +67,8 @@ namespace Elwig.Documents {
MemberAutoBusinessShares = ctx.MemberHistory
.Where(h => h.MgNr == p.Member.MgNr && h.Type == "auto")
.Where(h => h.DateString.CompareTo(fromDate) >= 0 && h.DateString.CompareTo(toDate) <= 0)
.Sum(h => h.BusinessShares) * (-season.BusinessShareValue ?? 0);
.Sum(h => h.BusinessShares);
MemberAutoBusinessSharesAmount = MemberAutoBusinessShares * (-season.BusinessShareValue ?? 0);
}
if (considerContractPenalties) {
var varieties = ctx.WineVarieties.ToDictionary(v => v.SortId, v => v);

View File

@ -153,9 +153,9 @@
@Raw(FormatRow("Unterlieferung (GA)", Model.MemberTotalUnderDelivery, add: true));
penalty += Model.MemberTotalUnderDelivery;
}
@if (Model.MemberAutoBusinessShares != 0) {
@Raw(FormatRow("Autom. Nachz. von GA", Model.MemberAutoBusinessShares, add: true));
penalty += Model.MemberAutoBusinessShares;
@if (Model.MemberAutoBusinessSharesAmount != 0) {
@Raw(FormatRow($"Autom. Nachz. von GA ({Model.MemberAutoBusinessShares})", Model.MemberAutoBusinessSharesAmount, add: true));
penalty += Model.MemberAutoBusinessSharesAmount;
}
@if (Model.Credit == null) {

View File

@ -66,6 +66,12 @@
<th colspan="2" class="lborder">Automatische Nachzeichnung der GA:</th>
<td class="center">@(Model.BillingData.ConsiderAutoBusinessShares ? "Ja" : "Nein")</td>
</tr>
<tr>
<th>Berechnung:</th>
<td colspan="3" class="center">@($"{Model.Variant.CalcTime:dd.MM.yyyy, HH:mm:ss}")</td>
<th colspan="2" class="lborder">Benutzerdef. Zu-/Abschläge pro Mitglied:</th>
<td class="center">@(Model.BillingData.ConsiderCustomModifiers ? "Ja" : "Nein")</td>
</tr>
<tr class="sectionheading">
<th colspan="4">Beträge</th>
<th colspan="3" class="lborder">Statistik</th>

View File

@ -7,7 +7,7 @@
<UseWPF>true</UseWPF>
<PreserveCompilationContext>true</PreserveCompilationContext>
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
<Version>0.8.3</Version>
<Version>0.8.5</Version>
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationManifest>app.manifest</ApplicationManifest>
@ -25,7 +25,6 @@
</Target>
<ItemGroup>
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.0" />
<PackageReference Include="LinqKit" Version="1.2.5" />
<PackageReference Include="MailKit" Version="4.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.31" />

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 = 20;
public static readonly int RequiredSchemaVersion = 21;
private static int VersionOffset = 0;

View File

@ -3,6 +3,7 @@ using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
@ -33,15 +34,45 @@ namespace Elwig.Helpers.Billing {
""");
}
public async Task AutoAdjustBusinessShare() {
public async Task AutoAdjustBusinessShares(DateOnly date, int allowanceKg = 0, double allowanceBs = 0, int allowanceKgPerBs = 0, double allowanceRel = 0, int addMinBs = 1) {
if (addMinBs < 1) addMinBs = 1;
using var cnx = await AppDbContext.ConnectAsync();
await AppDbContext.ExecuteBatch(cnx, $"""
INSERT INTO member_history (mgnr, date, business_shares, type)
SELECT u.mgnr, '{Utils.Today:yyyy-MM-dd}', u.diff / s.max_kg_per_bs AS bs, 'auto'
UPDATE member
SET business_shares = member.business_shares - h.business_shares
FROM member_history h
WHERE h.date = '{Year}-11-30' AND h.type = 'auto' AND h.mgnr = member.mgnr AND member.active;
INSERT INTO member_history (mgnr, date, type, business_shares)
SELECT u.mgnr,
'{date:yyyy-MM-dd}',
'auto',
CEIL((u.diff - {allowanceKg}.0 - {allowanceKgPerBs}.0 * u.business_shares) / s.max_kg_per_bs
- {allowanceBs.ToString(CultureInfo.InvariantCulture)}
- {allowanceRel.ToString(CultureInfo.InvariantCulture)} * u.business_shares) AS bs
FROM v_total_under_delivery u
JOIN season s ON s.year = u.year
WHERE s.year = {Year} AND bs > 0
ON CONFLICT DO NOTHING
JOIN member m ON m.mgnr = u.mgnr
WHERE s.year = {Year} AND bs >= {addMinBs} AND m.active
ON CONFLICT DO UPDATE
SET business_shares = excluded.business_shares;
UPDATE member
SET business_shares = member.business_shares + h.business_shares
FROM member_history h
WHERE h.date = '{Year}-11-30' AND h.type = 'auto' AND h.mgnr = member.mgnr;
""");
}
public async Task UnAdjustBusinessShares() {
using var cnx = await AppDbContext.ConnectAsync();
await AppDbContext.ExecuteBatch(cnx, $"""
UPDATE member
SET business_shares = member.business_shares - h.business_shares
FROM member_history h
WHERE h.date = '{Year}-11-30' AND h.type = 'auto' AND h.mgnr = member.mgnr AND member.active;
DELETE FROM member_history WHERE date = '{Year}-11-30' AND type = 'auto';
""");
}

View File

@ -41,6 +41,10 @@ namespace Elwig.Helpers.Billing {
get => GetConsider("consider_auto_business_shares");
set => SetConsider(value, "consider_auto_business_shares");
}
public bool ConsiderCustomModifiers {
get => GetConsider("consider_custom_modifiers");
set => SetConsider(value, "consider_custom_modifiers");
}
public double NetWeightModifier {
get => GetWeightModifier("net_weight_modifier", "Rebelzuschlag");

View File

@ -1,6 +1,7 @@
using Elwig.Models.Entities;
using Microsoft.Data.Sqlite;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
@ -66,6 +67,11 @@ namespace Elwig.Helpers {
public string? TextEmailSubject;
public string? TextEmailBody;
public int ExportEbicsVersion;
public int ExportEbicsAddress;
public (int? AllowanceKg, double? AllowanceBs, int? AllowanceKgPerBs, double? AllowancePercent, int? MinBs) AutoAdjustBs;
public ClientParameters(AppDbContext ctx) : this(ctx.ClientParameters.ToDictionary(e => e.Param, e => e.Value)) { }
public ClientParameters(Dictionary<string, string?> parameters) {
@ -128,6 +134,22 @@ 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;
}
var autoAdjust = (parameters.GetValueOrDefault("AUTOADJUST_BUSINESSSHARES") ?? "").Split(';');
AutoAdjustBs = autoAdjust.Length == 5 ? (
int.TryParse(autoAdjust[0], out var v1) ? v1 : null,
double.TryParse(autoAdjust[1], out var v2) ? v2 : null,
int.TryParse(autoAdjust[2], out var v3) ? v3 : null,
double.TryParse(autoAdjust[3], out var v4) ? v4 : null,
int.TryParse(autoAdjust[4], out var v5) ? v5 : null
) : (null, null, null, null, null);
} catch {
throw new KeyNotFoundException();
}
@ -155,6 +177,15 @@ 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;
}
string autoAdjust = $"{AutoAdjustBs.AllowanceKg};{AutoAdjustBs.AllowanceBs?.ToString(CultureInfo.InvariantCulture)};" +
$"{AutoAdjustBs.AllowanceKgPerBs};{AutoAdjustBs.AllowancePercent?.ToString(CultureInfo.InvariantCulture)};" +
$"{AutoAdjustBs.MinBs}";
return [
("CLIENT_NAME_TOKEN", NameToken),
("CLIENT_NAME_SHORT", NameShort),
@ -180,7 +211,10 @@ 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),
("AUTOADJUST_BUSINESSSHARES", autoAdjust),
];
}

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;
@ -148,19 +134,31 @@ namespace Elwig.Helpers {
public static void RenewItemsSource(ListBox listBox, IEnumerable? source, SelectionChangedEventHandler? handler = null, RenewSourceDefault def = RenewSourceDefault.None) {
if (listBox.ItemsSource == source)
return;
var selectedId = Utils.GetEntityIdentifier(listBox.SelectedItem);
object? selItem = null;
if (selectedId != 0 && source != null)
selItem = source.Cast<object>().FirstOrDefault(i => selectedId.Equals(Utils.GetEntityIdentifier(i)));
if (source != null && selItem == null) {
if ((def == RenewSourceDefault.IfOnly && source.Cast<object>().Count() == 1) || def == RenewSourceDefault.First) {
selItem = source.Cast<object>().FirstOrDefault();
if (listBox.SelectionMode == SelectionMode.Single) {
var selectedId = Utils.GetEntityIdentifier(listBox.SelectedItem);
object? selItem = null;
if (selectedId != 0 && source != null)
selItem = source.Cast<object>().FirstOrDefault(i => selectedId.Equals(Utils.GetEntityIdentifier(i)));
if (source != null && selItem == null) {
if ((def == RenewSourceDefault.IfOnly && source.Cast<object>().Count() == 1) || def == RenewSourceDefault.First) {
selItem = source.Cast<object>().FirstOrDefault();
}
}
if (handler != null && selItem != null) listBox.SelectionChanged -= handler;
listBox.ItemsSource = source;
if (handler != null && selItem != null) listBox.SelectionChanged += handler;
listBox.SelectedItem = selItem;
} else {
var selectedIds = listBox.SelectedItems.Cast<object>().Select(Utils.GetEntityIdentifier).ToList();
if (handler != null && selectedIds != null) listBox.SelectionChanged -= handler;
listBox.ItemsSource = source;
if (source != null && selectedIds != null) {
listBox.SelectedItems.Clear();
foreach (var i in source.Cast<object>().Where(i => selectedIds.Contains(Utils.GetEntityIdentifier(i))))
listBox.SelectedItems.Add(i);
}
if (handler != null && selectedIds != null) listBox.SelectionChanged += handler;
}
if (handler != null && selItem != null) listBox.SelectionChanged -= handler;
listBox.ItemsSource = source;
if (handler != null && selItem != null) listBox.SelectionChanged += handler;
listBox.SelectedItem = selItem;
}
public static object? GetItemFromSource(IEnumerable source, int? hash) {
@ -210,15 +208,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 +224,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);
@ -35,8 +38,11 @@ namespace Elwig.Helpers.Export {
}
public async Task ExportAsync(IEnumerable<Transaction> transactions, IProgress<double>? progress = null) {
if (transactions.Any(tx => tx.Amount < 0))
if (transactions.Any(tx => tx.Amount < 0)) {
throw new ArgumentException("Tranaction amount may not be negative");
} else if (App.Client.Iban == null) {
throw new ArgumentException("Client IBAN has to be set");
}
progress?.Report(0.0);
var nbOfTxs = transactions.Count();
int count = nbOfTxs + 2, i = 0;
@ -78,11 +84,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 ? "" : $"\r\n <Ctry>{a.PostalDest.Country.Alpha2}</Ctry>")}
{(full ? $"<StrtNm>{SecurityElement.Escape(a1?[..Math.Min(70, a1.Length)])}</StrtNm> <BldgNb>{SecurityElement.Escape(a2?[..Math.Min(16, a2.Length)])}</BldgNb>" :
$"<AdrLine>{SecurityElement.Escape(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>\r\n " : "")}</PstlAdr>
""");
}
await Writer.WriteLineAsync($"""
</Cdtr>
<CdtrAcct><Id><IBAN>{tx.Member.Iban!}</IBAN></Id></CdtrAcct>
<RmtInf><Ustrd>{SecurityElement.Escape(info)}</Ustrd></RmtInf>

View File

@ -38,7 +38,7 @@ namespace Elwig.Models.Dtos {
LEFT JOIN AT_ort o ON o.okz = p.okz
LEFT JOIN season s ON s.year = {year}
LEFT JOIN v_delivery d ON d.mgnr = m.mgnr AND d.year = s.year
WHERE m.active = 1
WHERE m.active = TRUE OR d.weight > 0
GROUP BY d.year, m.mgnr
ORDER BY 100.0 * sum / max_kg, m.mgnr;
""").ToListAsync();

View File

@ -3,7 +3,7 @@ using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models.Entities {
[Table("member_history"), PrimaryKey("MgNr", "DateString")]
[Table("member_history"), PrimaryKey("MgNr", "DateString", "Type")]
public class MemberHistory {
[Column("mgnr")]
public int MgNr { get; set; }
@ -16,12 +16,12 @@ namespace Elwig.Models.Entities {
set => value.ToString("yyyy-MM-dd");
}
[Column("business_shares")]
public int BusinessShares { get; set; }
[Column("type")]
public required string Type { get; set; }
[Column("business_shares")]
public int BusinessShares { get; set; }
[Column("comment")]
public string? Comment { get; set; }

View File

@ -17,7 +17,6 @@ namespace Elwig.Models.Entities {
[Column("date")]
public required string DateString { get; set; }
[NotMapped]
public DateOnly Date {
get => DateOnly.ParseExact(DateString, "yyyy-MM-dd");
@ -26,7 +25,6 @@ namespace Elwig.Models.Entities {
[Column("transfer_date")]
public string? TransferDateString { get; set; }
[NotMapped]
public DateOnly? TransferDate {
get => TransferDateString != null ? DateOnly.ParseExact(TransferDateString, "yyyy-MM-dd") : null;
@ -37,7 +35,9 @@ namespace Elwig.Models.Entities {
public bool TestVariant { get; set; }
[Column("calc_time")]
public int? CalcTime { get; set; }
public int? CalcTimeUnix { get; set; }
[NotMapped]
public DateTime? CalcTime => CalcTimeUnix != null ? DateTimeOffset.FromUnixTimeSeconds((long)CalcTimeUnix).UtcDateTime.ToLocalTime() : null;
[Column("comment")]
public string? Comment { get; set; }

View File

@ -12,6 +12,7 @@
"consider_contract_penalties": {"type": "boolean"},
"consider_total_penalty": {"type": "boolean"},
"consider_auto_business_shares": {"type": "boolean"},
"consider_custom_modifiers": {"type": "boolean"},
"net_weight_modifier": {"type": "number"},
"gross_weight_modifier": {"type": "number"},
"payment": {"$ref": "#/definitions/payment_1"},

View File

@ -0,0 +1,16 @@
-- schema version 20 to 21
DROP TABLE member_history;
CREATE TABLE member_history (
mgnr INTEGER NOT NULL,
date TEXT NOT NULL CHECK (date REGEXP '^[1-9][0-9]{3}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$') DEFAULT CURRENT_DATE,
type TEXT NOT NULL CHECK (type REGEXP '^[a-z_]+$'),
business_shares INTEGER NOT NULL,
comment TEXT DEFAULT NULL,
CONSTRAINT pk_member_history PRIMARY KEY (mgnr, date, type),
CONSTRAINT fk_member_history_member FOREIGN KEY (mgnr) REFERENCES member (mgnr)
ON UPDATE CASCADE
ON DELETE CASCADE
) STRICT;

View File

@ -2,5 +2,6 @@
<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>
@ -41,13 +40,6 @@
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style TargetType="xctk:CheckComboBox">
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Height" Value="25"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style TargetType="Button">
<Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="9,3"/>

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

@ -526,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"
@ -541,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

@ -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,
@ -93,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() {
@ -145,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) {
@ -372,6 +377,8 @@ namespace Elwig.Windows {
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();
}
@ -399,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"/>

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 {
@ -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"/>
@ -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 {
@ -2062,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"
@ -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

@ -143,26 +143,26 @@ 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)
@ -178,9 +178,9 @@ namespace Elwig.Windows {
.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);
@ -254,11 +254,13 @@ namespace Elwig.Windows {
SelectedDocs.Add(new(DocType.MemberDataSheet, s, null));
} else if (idx == 1) {
SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, (Year, DocumentNonDeliverersInput.IsChecked == true)));
RecipientsDeliveryMembersInput.IsChecked = true;
} else if (idx >= 2) {
using var ctx = new AppDbContext();
var name = s.Split(" ")[^1];
var pv = ctx.PaymentVariants.Single(v => v.Year == Year && v.Name == name)!;
SelectedDocs.Add(new(DocType.CreditNote, s, (pv.Year, pv.AvNr)));
RecipientsDeliveryMembersInput.IsChecked = true;
}
SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;
}
@ -296,7 +298,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);
}
@ -305,7 +307,7 @@ namespace Elwig.Windows {
if (RecipientsCustomInput.IsChecked == true) {
Recipients = MemberCustomInput.SelectedItems.Cast<Member>().ToList();
} else {
IQueryable<Member> query = ctx.Members.Where(m => m.IsActive);
IQueryable<Member> query = ctx.Members;
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!));
@ -317,11 +319,13 @@ namespace Elwig.Windows {
if (RecipientsAreaComMembersInput.IsChecked == true) {
var vtrg = MemberAreaComInput.SelectedItems.Cast<AreaComType>().Select(a => a.VtrgId).ToList();
query = query.Where(m => m.AreaCommitments.AsQueryable().Where(Utils.ActiveAreaCommitments(Year)).Any(c => vtrg.Contains(c.VtrgId)));
query = query.Where(m => m.IsActive && 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));
query = query.Where(m => m.IsActive && !m.Deliveries.Any(d => d.Year == Year));
} else {
query = query.Where(m => m.IsActive);
}
Recipients = await query
.Include(m => m.Branch)
@ -715,6 +719,7 @@ namespace Elwig.Windows {
return;
SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, (Year, DocumentNonDeliverersInput.IsChecked == true)));
SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;
RecipientsDeliveryMembersInput.IsChecked = true;
}
public void AddCreditNote(int index) {
@ -726,6 +731,7 @@ namespace Elwig.Windows {
var pv = ctx.PaymentVariants.Single(v => v.Year == Year && v.Name == name)!;
SelectedDocs.Add(new(DocType.CreditNote, s, (pv.Year, pv.AvNr)));
SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;
RecipientsDeliveryMembersInput.IsChecked = true;
}
}
}

View File

@ -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,43 @@
</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"/>
<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,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
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"/>
<Button x:Name="PaymentButton" Content="Auszahlung"
Click="PaymentButton_Click"
Margin="200,50,0,10" Width="190"/>
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
Click="OverUnderDeliveryButton_Click"
Margin="0,90,200,10" Width="190"/>
Margin="0,50,195,10" Width="190"/>
<Button x:Name="PaymentAdjustmentButton" Content="Anpassung"
Click="PaymentAdjustmentButton_Click" IsEnabled="False"
Margin="200,90,0,10" Width="190"/>
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigung"
Click="DeliveryConfirmationButton_Click"
Margin="195,50,0,10" Width="190"/>
<Button x:Name="BreakdownButton" Content="Sorten-/Qual.aufteilung"
Click="BreakdownButton_Click"
Margin="0,130,200,10" Width="190"/>
Margin="0,90,195,10" Width="190"/>
<Button x:Name="PaymentButton" Content="Auszahlung"
Click="PaymentButton_Click"
Margin="195,90,0,10" Width="190"/>
</Grid>
</Expander>
</Grid>

View File

@ -35,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) {
@ -153,7 +153,7 @@ namespace Elwig.Windows {
}
private void SeasonFinish_Expanded(object sender, RoutedEventArgs evt) {
Height = 570;
Height = 530;
}
private void SeasonFinish_Collapsed(object sender, RoutedEventArgs evt) {
@ -166,7 +166,6 @@ namespace Elwig.Windows {
var valid = (s0 != null);
DeliveryConfirmationButton.IsEnabled = valid;
OverUnderDeliveryButton.IsEnabled = valid;
PaymentAdjustmentButton.IsEnabled = valid && false;
PaymentButton.IsEnabled = valid;
BreakdownButton.IsEnabled = valid;
}
@ -211,27 +210,6 @@ namespace Elwig.Windows {
Mouse.OverrideCursor = null;
}
private async void PaymentAdjustmentButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
if (false && App.Client.IsMatzen) {
PaymentAdjustmentButton.IsEnabled = false;
Mouse.OverrideCursor = Cursors.AppStarting;
var b = new Billing(year);
await b.AutoAdjustBusinessShare();
Mouse.OverrideCursor = null;
PaymentAdjustmentButton.IsEnabled = true;
} else {
MessageBox.Show(
"Es ist kein automatisches Nachzeichnen der Geschäftsanteile\n" +
"für diese Genossenschaft eingestellt!\n" +
"Bitte wenden Sie sich an die Programmierer!", "Fehler",
MessageBoxButton.OK, MessageBoxImage.Information);
}
}
private void PaymentButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;

View File

@ -0,0 +1,128 @@
<local:ContextWindow
x:Class="Elwig.Windows.PaymentAdjustmentWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:ctrl="clr-namespace:Elwig.Controls"
Title="Auszahlung anpassen - Elwig" Height="500" Width="850" MinHeight="400" MinWidth="850">
<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="ctrl:UnitTextBox">
<Setter Property="HorizontalAlignment" Value="Left"/>
<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="FontSize" Value="14"/>
<Setter Property="Padding" Value="9,3"/>
<Setter Property="Height" Value="27"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="19"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="24"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="450"/>
<ColumnDefinition Width="2.5*"/>
</Grid.ColumnDefinitions>
<Menu Grid.ColumnSpan="2" BorderThickness="0,0,0,1" BorderBrush="LightGray" Background="White">
</Menu>
<Grid Grid.Row="1">
<DataGrid x:Name="MemberList" AutoGenerateColumns="False" HeadersVisibility="Column" IsReadOnly="True" GridLinesVisibility="None" SelectionMode="Single"
CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False" Margin="10,10,10,10">
<DataGrid.Columns>
<DataGridTextColumn Header="MgNr." Binding="{Binding MgNr, StringFormat='{}{0} '}" Width="45">
<DataGridTextColumn.CellStyle>
<Style>
<Setter Property="TextBlock.TextAlignment" Value="Right"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Nachname" Binding="{Binding FamilyName}" Width="100"/>
<DataGridTextColumn Header="Vorname" Binding="{Binding GivenName}" Width="100"/>
<DataGridTextColumn Header="GA" Binding="{Binding BusinessShares, StringFormat='{}{0} '}" Width="35">
<DataGridTextColumn.CellStyle>
<Style>
<Setter Property="TextBlock.TextAlignment" Value="Right"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Ü.-/U.-Lfrg." Binding="{Binding OverUnder, StringFormat='{}{0} kg '}" Width="70">
<DataGridTextColumn.CellStyle>
<Style>
<Setter Property="TextBlock.TextAlignment" Value="Right"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Nachz." Binding="{Binding Adjust, StringFormat='{}{0} '}" Width="45">
<DataGridTextColumn.CellStyle>
<Style>
<Setter Property="TextBlock.TextAlignment" Value="Right"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
<Grid Grid.Column="1" Grid.Row="1">
<GroupBox Header="Automatische Nachzeichnung der Geschäftsanteile" Margin="10,10,10,10" Height="180" Width="360"
VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid>
<Label Content="Absoluter Freibetrag:" Margin="10,10,10,10"/>
<ctrl:UnitTextBox x:Name="AllowanceKgInput" Unit="kg" Margin="140,10,10,10" Width="70"
TextChanged="KgInput_TextChanged"/>
<ctrl:UnitTextBox x:Name="AllowanceBsInput" Unit="GA" Margin="215,10,10,10" Width="60"
TextChanged="PercentInput_TextChanged"/>
<Label Content="Relativer Freibetrag:" Margin="10,40,10,10"/>
<ctrl:UnitTextBox x:Name="AllowanceKgPerBsInput" Unit="kg/GA" Margin="140,40,10,10" Width="87"
TextChanged="KgInput_TextChanged"/>
<ctrl:UnitTextBox x:Name="AllowancePercentInput" Unit="%" Margin="232,40,10,10" Width="60"
TextChanged="PercentInput_TextChanged"/>
<Label Content="Nur mind. nachz.:" Margin="10,70,10,10"/>
<ctrl:UnitTextBox x:Name="MinBsInput" Unit="GA" Margin="140,70,10,10" Width="50"
TextChanged="BsInput_TextChanged"/>
<Button x:Name="SeasonButton" Content="GA-Wert" Margin="10,10,10,42" Width="120"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Click="SeasonButton_Click"/>
<Button x:Name="AutoAdjustBsButton" Content="Nachzeichnen" Margin="10,10,135,10" Width="120"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Click="AutoAdjustBsButton_Click"/>
<Button x:Name="UnAdjustBsButton" Content="Rückgängig" Margin="10,10,10,10" Width="120"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Click="UnAdjustBsButton_Click"/>
</Grid>
</GroupBox>
</Grid>
<StatusBar Grid.Row="2" Grid.ColumnSpan="2" BorderThickness="0,1,0,0" BorderBrush="Gray">
</StatusBar>
</Grid>
</local:ContextWindow>

View File

@ -0,0 +1,143 @@
using Elwig.Helpers;
using Elwig.Helpers.Billing;
using Elwig.Models.Dtos;
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 PaymentAdjustmentWindow : ContextWindow {
public readonly int Year;
public readonly bool SeasonLocked;
public PaymentAdjustmentWindow(int year) {
InitializeComponent();
Year = year;
using (var ctx = new AppDbContext()) {
SeasonLocked = ctx.Seasons.Find(Year + 1) != null;
}
Title = $"Auszahlung anpassen - Lese {Year} - Elwig";
AllowanceKgInput.Text = $"{App.Client.AutoAdjustBs.AllowanceKg}";
AllowanceBsInput.Text = $"{App.Client.AutoAdjustBs.AllowanceBs}";
AllowanceKgPerBsInput.Text = $"{App.Client.AutoAdjustBs.AllowanceKgPerBs}";
AllowancePercentInput.Text = $"{App.Client.AutoAdjustBs.AllowancePercent}";
MinBsInput.Text = $"{App.Client.AutoAdjustBs.MinBs}";
}
protected override async Task OnRenewContext(AppDbContext ctx) {
var members = await ctx.Members
.Select(m => new {
m.MgNr,
m.FamilyName,
m.GivenName,
m.BusinessShares,
})
.OrderBy(m => m.FamilyName)
.ThenBy(m => m.GivenName)
.ThenBy(m => m.MgNr)
.ToListAsync();
var season = (await ctx.Seasons.FindAsync(Year))!;
var tbl = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, Year);
var weight = tbl.Rows.ToDictionary(r => r.MgNr, r => r.Weight);
var history = await ctx.MemberHistory
.Where(h => h.DateString.CompareTo($"{Year}-01-01") >= 0 && h.DateString.CompareTo($"{Year}-12-31") <= 0 && h.Type == "auto" && h.BusinessShares > 0)
.GroupBy(h => h.Member)
.ToDictionaryAsync(h => h.Key.MgNr, h => h.Sum(g => g.BusinessShares));
var list = members
.Select(m => new {
m.MgNr,
m.FamilyName,
m.GivenName,
BusinessShares = m.BusinessShares - history.GetValueOrDefault(m.MgNr, 0),
DeliveryObligation = (m.BusinessShares - history.GetValueOrDefault(m.MgNr, 0)) * season.MinKgPerBusinessShare,
DeliveryRight = (m.BusinessShares - history.GetValueOrDefault(m.MgNr, 0)) * season.MaxKgPerBusinessShare,
})
.Select(m => new {
m.MgNr,
m.FamilyName,
m.GivenName,
m.BusinessShares,
OverUnder = weight.TryGetValue(m.MgNr, out int v1) ?
(v1 < m.DeliveryObligation ? (int?)v1 - m.DeliveryObligation :
v1 > m.DeliveryRight ? (int?)v1 - m.DeliveryRight : null)
: null,
Adjust = history.TryGetValue(m.MgNr, out int v2) ? (int?)v2 : null
})
.Where(m => m.OverUnder != null || m.Adjust != null)
.OrderByDescending(m => m.OverUnder)
.ThenBy(m => m.FamilyName)
.ThenBy(m => m.GivenName)
.ThenBy(m => m.MgNr)
.ToList();
MemberList.ItemsSource = list;
}
private async void AutoAdjustBsButton_Click(object sender, RoutedEventArgs evt) {
Mouse.OverrideCursor = Cursors.AppStarting;
try {
int? kg = AllowanceKgInput.Text == "" ? null : int.Parse(AllowanceKgInput.Text);
double? bs = AllowanceBsInput.Text == "" ? null : double.Parse(AllowanceBsInput.Text);
int? kgPerBs = AllowanceKgPerBsInput.Text == "" ? null : int.Parse(AllowanceKgPerBsInput.Text);
double? percent = AllowancePercentInput.Text == "" ? null : double.Parse(AllowancePercentInput.Text);
int? minBs = MinBsInput.Text == "" ? null : int.Parse(MinBsInput.Text);
App.Client.AutoAdjustBs.AllowanceKg = kg;
App.Client.AutoAdjustBs.AllowanceBs = bs;
App.Client.AutoAdjustBs.AllowanceKgPerBs = kgPerBs;
App.Client.AutoAdjustBs.AllowancePercent = percent;
App.Client.AutoAdjustBs.MinBs = minBs;
await App.Client.UpdateValues();
var b = new Billing(Year);
await b.AutoAdjustBusinessShares(new DateOnly(Year, 11, 30), kg ?? default, bs ?? default, kgPerBs ?? default, percent / 100.0 ?? default, minBs ?? default);
await App.HintContextChange();
} 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, "GA Nachzeichnen", MessageBoxButton.OK, MessageBoxImage.Error);
}
Mouse.OverrideCursor = null;
}
private async void UnAdjustBsButton_Click(object sender, RoutedEventArgs evt) {
Mouse.OverrideCursor = Cursors.AppStarting;
try {
var b = new Billing(Year);
await b.UnAdjustBusinessShares();
await App.HintContextChange();
} 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, "GA Nachzeichnen", MessageBoxButton.OK, MessageBoxImage.Error);
}
Mouse.OverrideCursor = null;
}
private void SeasonButton_Click(object sender, RoutedEventArgs evt) {
App.FocusBaseDataSeason(Year);
}
private void KgInput_TextChanged(object sender, TextChangedEventArgs evt) {
Validator.CheckInteger((TextBox)sender, false, 6);
}
private void BsInput_TextChanged(object sender, TextChangedEventArgs evt) {
Validator.CheckInteger((TextBox)sender, false, 3);
}
private void PercentInput_TextChanged(object sender, TextChangedEventArgs evt) {
Validator.CheckDecimal((TextBox)sender, false, 3, 2);
}
}
}

View File

@ -6,8 +6,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:ctrl="clr-namespace:Elwig.Controls"
mc:Ignorable="d"
Title="Auszahlungsvarianten - Elwig" Height="450" Width="820" MinHeight="380" MinWidth="820">
Title="Auszahlungsvarianten - Elwig" Height="480" Width="850" MinHeight="400" MinWidth="830">
<Window.Resources>
<Style TargetType="Label">
<Setter Property="HorizontalAlignment" Value="Left"/>
@ -142,9 +141,12 @@
<CheckBox x:Name="ConsiderAutoInput" Content="Automatische Nachzeichnungen der GA"
Margin="110,155,10,10" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top"
Checked="ConsiderAutoInput_Changed" Unchecked="ConsiderAutoInput_Changed"/>
<Label Content="&#xF0AE;" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="0" Grid.Column="1" Margin="108,175,10,10"/>
<CheckBox x:Name="ConsiderCustomInput" Content="Benutzerdefinierte Zu-/Abschläge pro Mitglied"
Margin="110,175,10,10" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top"
Checked="ConsiderCustomInput_Changed" Unchecked="ConsiderCustomInput_Changed"/>
<Label Content="&#xF0AE;" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="0" Grid.Column="1" Margin="108,195,10,10"/>
<Grid Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="50,180,10,10">
<Grid Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="50,200,10,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition Width="27"/>
@ -156,6 +158,8 @@
<RowDefinition Height="27"/>
<RowDefinition Height="5"/>
<RowDefinition Height="27"/>
<RowDefinition Height="5"/>
<RowDefinition Height="27"/>
</Grid.RowDefinitions>
<Grid.Resources>
@ -184,6 +188,16 @@
<Button x:Name="EditButton" Content="Bearbeiten" Grid.Column="0" Grid.Row="2"
Click="EditButton_Click"/>
<Label Content="&#xF0AF;" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="2" Grid.Column="1"/>
<Button x:Name="PaymentAdjustmentButton" Content="Anpassen" Grid.Column="0" Grid.Row="4"
Click="PaymentAdjustmentButton_Click"/>
<Label Content="&#xF0AF;" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="4" Grid.Column="1" RenderTransformOrigin="0.5,0.5" >
<Label.RenderTransform>
<TransformGroup>
<RotateTransform Angle="-45"/>
<TranslateTransform Y="-5"/>
</TransformGroup>
</Label.RenderTransform>
</Label>
<Button x:Name="CalculateButton" Content="Berechnen" Grid.Column="2" Grid.Row="2"
Click="CalculateButton_Click"/>
<Label Content="&#xF0AF;" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="2" Grid.Column="3" x:Name="Arrow3"/>

View File

@ -91,6 +91,7 @@ namespace Elwig.Windows {
ConsiderPenaltiesInput.IsChecked = BillingData.ConsiderContractPenalties;
ConsiderPenaltyInput.IsChecked = BillingData.ConsiderTotalPenalty;
ConsiderAutoInput.IsChecked = BillingData.ConsiderAutoBusinessShares;
ConsiderCustomInput.IsChecked = BillingData.ConsiderCustomModifiers;
if (BillingData.NetWeightModifier != 0) {
WeightModifierInput.Text = $"{Math.Round(BillingData.NetWeightModifier * 100.0, 8)}";
} else if (BillingData.GrossWeightModifier != 0) {
@ -105,6 +106,7 @@ namespace Elwig.Windows {
ConsiderPenaltiesInput.IsChecked = false;
ConsiderPenaltyInput.IsChecked = false;
ConsiderAutoInput.IsChecked = false;
ConsiderCustomInput.IsChecked = false;
WeightModifierInput.Text = "";
DataInput.Text = v.Data;
}
@ -113,6 +115,7 @@ namespace Elwig.Windows {
ConsiderPenaltiesInput.IsEnabled = !locked;
ConsiderPenaltyInput.IsEnabled = !locked;
ConsiderAutoInput.IsEnabled = !locked;
ConsiderCustomInput.IsEnabled = !locked;
DataInput.IsReadOnly = locked;
} else {
EditButton.Content = "Bearbeiten";
@ -153,6 +156,8 @@ namespace Elwig.Windows {
ConsiderPenaltyInput.IsEnabled = false;
ConsiderAutoInput.IsChecked = false;
ConsiderAutoInput.IsEnabled = false;
ConsiderCustomInput.IsChecked = false;
ConsiderCustomInput.IsEnabled = false;
DataInput.Text = "";
DataInput.IsReadOnly = true;
}
@ -168,6 +173,7 @@ namespace Elwig.Windows {
(ConsiderPenaltiesInput.IsChecked != BillingData?.ConsiderContractPenalties) ||
(ConsiderPenaltyInput.IsChecked != BillingData?.ConsiderTotalPenalty) ||
(ConsiderAutoInput.IsChecked != BillingData?.ConsiderAutoBusinessShares) ||
(ConsiderCustomInput.IsChecked != BillingData?.ConsiderCustomModifiers) ||
WeightModifierChanged);
CalculateButton.IsEnabled = !SaveButton.IsEnabled && PaymentVariantList.SelectedItem is PaymentVar { TestVariant: true };
CommitButton.IsEnabled = CalculateButton.IsEnabled;
@ -295,6 +301,10 @@ namespace Elwig.Windows {
App.FocusChartWindow(v.Year, v.AvNr);
}
private void PaymentAdjustmentButton_Click(object sender, RoutedEventArgs evt) {
App.FocusPaymentAdjustment(Year);
}
private async void MailButton_Click(object sender, RoutedEventArgs evt) {
if (PaymentVariantList.SelectedItem is not PaymentVar pv)
return;
@ -424,7 +434,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);
@ -471,6 +481,7 @@ namespace Elwig.Windows {
d.ConsiderContractPenalties = ConsiderPenaltiesInput.IsChecked ?? false;
d.ConsiderTotalPenalty = ConsiderPenaltyInput.IsChecked ?? false;
d.ConsiderAutoBusinessShares = ConsiderAutoInput.IsChecked ?? false;
d.ConsiderCustomModifiers = ConsiderCustomInput.IsChecked ?? false;
var modVal = WeightModifierInput.Text.Length > 0 ? double.Parse(WeightModifierInput.Text) : 0;
d.NetWeightModifier = modVal > 0 ? modVal / 100.0 : 0;
d.GrossWeightModifier = modVal < 0 ? modVal / 100.0 : 0;
@ -488,6 +499,7 @@ namespace Elwig.Windows {
ConsiderPenaltiesInput_Changed(null, null);
ConsiderPenaltyInput_Changed(null, null);
ConsiderAutoInput_Changed(null, null);
ConsiderCustomInput_Changed(null, null);
WeightModifierInput_TextChanged(null, null);
} catch (Exception exc) {
await HintContextChange();
@ -630,6 +642,19 @@ namespace Elwig.Windows {
UpdateSaveButton();
}
private void ConsiderCustomInput_Changed(object? sender, RoutedEventArgs? evt) {
if (BillingData == null) {
ControlUtils.ClearInputState(ConsiderCustomInput);
return;
}
if (BillingData.ConsiderCustomModifiers != ConsiderCustomInput.IsChecked) {
ControlUtils.SetInputChanged(ConsiderCustomInput);
} else {
ControlUtils.ClearInputState(ConsiderCustomInput);
}
UpdateSaveButton();
}
private void WeightModifierInput_TextChanged(object? sender, TextChangedEventArgs? evt) {
var res = Validator.CheckDecimal(WeightModifierInput, false, 3, 2, true);
if (BillingData == null) {

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

@ -1 +1 @@
curl --fail -s -L "https://elwig.at/files/create.sql?v=20" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
curl --fail -s -L "https://elwig.at/files/create.sql?v=21" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"