Compare commits

..

11 Commits

Author SHA1 Message Date
3f7cd2a6ff DeliveryAncmtAdminWindow: Focus MgNrInput when creating new ancmt
All checks were successful
Test / Run tests (push) Successful in 2m8s
2024-09-19 09:34:44 +02:00
21a1b11d68 AreaCom: Make YearFrom nullable
All checks were successful
Test / Run tests (push) Successful in 1m48s
2024-09-18 18:26:16 +02:00
d8beb03b96 Tests: Update dependencies
All checks were successful
Test / Run tests (push) Successful in 1m53s
2024-09-17 23:18:51 +02:00
eee90c784b Elwig: Update dependencies 2024-09-17 23:18:41 +02:00
74200083ab DeliveryAncmtAdminWindow: Mark cancelled schedules with Strikethrough
All checks were successful
Test / Run tests (push) Successful in 1m38s
2024-09-17 23:08:22 +02:00
871bc299bd Utils: Fix SplitName() for double names
All checks were successful
Test / Run tests (push) Successful in 1m46s
2024-09-17 19:18:43 +02:00
a18b58f438 DeliveryAncmtAdminWindow: Make delivery schedule list bigger
All checks were successful
Test / Run tests (push) Successful in 2m10s
2024-09-17 19:07:59 +02:00
cadb5515ea Bump version to 0.11.0
All checks were successful
Deploy / Build and Deploy (push) Successful in 2m9s
2024-09-16 11:17:23 +02:00
d8a10152b3 DeliveryScheduleAdminWindow: Add Attribute, Cultivation and IsCancelled
All checks were successful
Test / Run tests (push) Successful in 1m37s
2024-09-16 10:10:31 +02:00
f09c43c1bd App: Make HintContextChange() synchronous by using MainDispatcher
All checks were successful
Test / Run tests (push) Successful in 2m37s
2024-09-12 11:40:32 +02:00
5c08f61963 MailWindow: Add feature to address members with ancmts on specific day
All checks were successful
Test / Run tests (push) Successful in 2m28s
2024-09-08 15:55:10 +02:00
34 changed files with 275 additions and 72 deletions

View File

@@ -3,6 +3,23 @@ Changelog
=========
[v0.11.0][v0.11.0] (2024-09-16) {#v0.11.0}
------------------------------------------
### Neue Funktionen {#v0.11.0-features}
* Im Rundschreiben-Fenster (`MailWindow`) können jetzt auch Funktionäre, Bio-Betriebe oder angemeldete Mitglieder für einen Leseplan adressiert werden. (5c08f61963)
* Im Leseplan-Fenster (`DeliveryScheduleAdminWindow`) können nun auch Attribut, Bewirtschaftungsart, und ob der Leseplan abgesagt ist angegeben werden. (d8a10152b3)
### Sonstiges {#v0.11.0-misc}
* `App.HintContextChange()` ist synchron und fügt Arbeitsaufträge dem Dispatcher hinzu. (f09c43c1bd)
[v0.11.0]: https://git.necronda.net/winzer/elwig/releases/tag/v0.11.0
[v0.10.8][v0.10.8] (2024-09-05) {#v0.10.8}
------------------------------------------

View File

@@ -79,7 +79,7 @@ namespace Elwig {
}
private static void OnContextChanged() {
MainDispatcher.BeginInvoke(async () => await HintContextChange());
MainDispatcher.BeginInvoke(HintContextChange);
}
private static void OverrideCulture() {
@@ -201,13 +201,13 @@ namespace Elwig {
BranchMobileNr = entry.Item8;
}
public static async Task HintContextChange() {
public static void HintContextChange() {
var ch = CurrentLastWrite;
if (ch > CurrentApp.LastChanged)
CurrentApp.LastChanged = ch;
foreach (Window w in CurrentApp.Windows) {
if (w is not ContextWindow c) continue;
await c.HintContextChange();
MainDispatcher.BeginInvoke(c.HintContextChange);
}
}

View File

@@ -206,7 +206,7 @@
<td class="text">@areaCom.GstNr.Replace(",", ", ").Replace("-", "")</td>
<td class="number">@($"{areaCom.Area:N0}")</td>
<td class="center">@areaCom.WineCult?.Name</td>
<td class="center">@(areaCom.YearTo == null ? $"ab {areaCom.YearFrom}" : $"{areaCom.YearFrom}{areaCom.YearTo}")</td>
<td class="center">@(areaCom.YearTo == null ? (areaCom.YearFrom == null ? "unbefristet" : $"ab {areaCom.YearFrom}") : (areaCom.YearFrom == null ? $"bis {areaCom.YearTo}" : $"{areaCom.YearFrom}{areaCom.YearTo}"))</td>
</tr>
lastContract = contractType.AreaComType.DisplayName;
}

View File

@@ -7,7 +7,7 @@
<UseWPF>true</UseWPF>
<PreserveCompilationContext>true</PreserveCompilationContext>
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
<Version>0.10.8</Version>
<Version>0.11.0</Version>
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationManifest>app.manifest</ApplicationManifest>
@@ -25,17 +25,17 @@
</Target>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.1" />
<PackageReference Include="LinqKit" Version="1.3.0" />
<PackageReference Include="MailKit" Version="4.7.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.32" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.33" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="8.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2739.15" />
<PackageReference Include="NJsonSchema" Version="11.0.2" />
<PackageReference Include="RazorLight" Version="2.3.1" />
<PackageReference Include="ScottPlot.WPF" Version="5.0.36" />
<PackageReference Include="ScottPlot.WPF" Version="5.0.39" />
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
</ItemGroup>

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

View File

@@ -274,7 +274,7 @@ namespace Elwig.Helpers.Export {
await ctx.SaveChangesAsync();
await AddImportedFiles(Path.GetFileName(meta.FileName));
}
await App.HintContextChange();
App.HintContextChange();
MessageBox.Show(
$"Das importieren der Daten war erfolgreich!\n" +
@@ -565,7 +565,7 @@ namespace Elwig.Helpers.Export {
KgNr = kgnr,
GstNr = json["gstnr"]?.AsValue().GetValue<string>() ?? "-",
RdNr = rd?.RdNr,
YearFrom = json["year_from"]!.AsValue().GetValue<int>(),
YearFrom = json["year_from"]?.AsValue().GetValue<int>(),
YearTo = json["year_to"]?.AsValue().GetValue<int>(),
Comment = json["comment"]?.AsValue().GetValue<string>(),
}, newRd ? rd : null);

View File

@@ -348,7 +348,7 @@ namespace Elwig.Helpers {
}
public static (string, string?) SplitName(string fullName, string? familyName) {
if (familyName == null || familyName == "") return (fullName, null);
if (string.IsNullOrWhiteSpace(familyName)) return (fullName, null);
var p0 = fullName.IndexOf(familyName, StringComparison.CurrentCultureIgnoreCase);
if (p0 == -1) return (fullName, null);
var p1 = fullName.IndexOf(" und ");
@@ -362,8 +362,10 @@ namespace Elwig.Helpers {
var p3 = fullName.LastIndexOf(' ', p2 - 1);
return (fullName[0..p3], fullName[(p3 + 1)..^0]);
}
} else {
} else if (p0 + familyName.Length >= fullName.Length || fullName[p0 + familyName.Length] == ' ') {
return (familyName, fullName.Replace(familyName, "").Replace(" ", " ").Trim());
} else {
return (fullName, null);
}
}
@@ -558,7 +560,7 @@ namespace Elwig.Helpers {
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments() => ActiveAreaCommitments(CurrentYear);
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments(int year) =>
c => (c.YearFrom <= year) && (c.YearTo == null || c.YearTo >= year);
c => (c.YearFrom == null || c.YearFrom <= year) && (c.YearTo == null || c.YearTo >= year);
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query) => ActiveAreaCommitments(query, CurrentYear);
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query, int year) =>

View File

@@ -32,7 +32,7 @@ namespace Elwig.Models.Entities {
public int? RdNr { get; set; }
[Column("year_from")]
public int YearFrom { get; set; }
public int? YearFrom { get; set; }
[Column("year_to")]
public int? YearTo { get; set; }

View File

@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Windows;
namespace Elwig.Models.Entities {
[Table("delivery_schedule"), PrimaryKey("Year", "DsNr")]
@@ -29,6 +30,15 @@ namespace Elwig.Models.Entities {
[Column("description")]
public required string Description { get; set; }
[NotMapped]
public string Identifier => $"{Date:dd.MM.} - {ZwstId} - {Description}";
[Column("attrid")]
public string? AttrId { get; set; }
[Column("cultid")]
public string? CultId { get; set; }
[Column("max_weight")]
public int? MaxWeight { get; set; }
[NotMapped]
@@ -36,6 +46,11 @@ namespace Elwig.Models.Entities {
[NotMapped]
public double? Percent => (double)AnnouncedWeight / MaxWeight * 100;
[Column("cancelled")]
public bool IsCancelled { get; set; }
[NotMapped]
public TextDecorationCollection? TextDecoration => IsCancelled ? TextDecorations.Strikethrough : null;
[Column("ancmt_from")]
public long? AncmtFromUnix { get; set; }
[NotMapped]
@@ -58,6 +73,12 @@ namespace Elwig.Models.Entities {
[ForeignKey("ZwstId")]
public virtual Branch Branch { get; private set; } = null!;
[ForeignKey("AttrId")]
public virtual WineAttr? Attribute { get; private set; }
[ForeignKey("CultId")]
public virtual WineCult? Cultivation { get; private set; }
[InverseProperty(nameof(DeliveryScheduleWineVar.Schedule))]
public virtual ICollection<DeliveryScheduleWineVar> Varieties { get; private set; } = null!;

View File

@@ -167,6 +167,9 @@ namespace Elwig.Models.Entities {
[InverseProperty(nameof(BillingAddr.Member))]
public virtual BillingAddr? BillingAddress { get; private set; }
[InverseProperty(nameof(Delivery.Member))]
public virtual ICollection<DeliveryAncmt> Announcements { get; private set; } = null!;
[InverseProperty(nameof(Delivery.Member))]
public virtual ICollection<Delivery> Deliveries { get; private set; } = null!;

View File

@@ -0,0 +1,23 @@
-- schema version 28 to 29
ALTER TABLE delivery_schedule ADD COLUMN attrid TEXT DEFAULT NULL;
ALTER TABLE delivery_schedule ADD COLUMN cultid TEXT DEFAULT NULL;
ALTER TABLE delivery_schedule ADD COLUMN cancelled INTEGER NOT NULL CHECK (cancelled IN (TRUE, FALSE)) DEFAULT FALSE;
UPDATE delivery_schedule SET cultid = 'B' WHERE UPPER(description) LIKE '%BIO%';
UPDATE delivery_schedule SET cancelled = TRUE WHERE zwstid = 'M' AND date IN ('2024-09-14', '2024-09-16');
PRAGMA writable_schema = ON;
UPDATE sqlite_schema SET sql = REPLACE(sql, '
) STRICT', ',
CONSTRAINT fk_delivery_schedule_wine_attribute FOREIGN KEY (attrid) REFERENCES wine_attribute (attrid)
ON UPDATE CASCADE
ON DELETE RESTRICT,
CONSTRAINT fk_delivery_schedule_wine_cultivation FOREIGN KEY (cultid) REFERENCES wine_cultivation (cultid)
ON UPDATE CASCADE
ON DELETE RESTRICT
) STRICT')
WHERE type = 'table' AND name = 'delivery_schedule';
PRAGMA schema_version = 2801;
PRAGMA writable_schema = OFF;

View File

@@ -0,0 +1,18 @@
-- schema version 29 to 30
PRAGMA writable_schema = ON;
DROP VIEW v_bki_member;
CREATE VIEW v_bki_member AS
SELECT s.year, m.mgnr, m.lfbis_nr, m.name,
(COALESCE(m.prefix || ' ', '') || m.given_name || COALESCE(' ' || m.middle_names, '') || COALESCE(' ' || m.suffix, '')) AS other_names,
a.name AS billing_name, COALESCE(a.address, m.address) AS address,
COALESCE(a.country, m.country) AS country, COALESCE(a.postal_dest, m.postal_dest) AS postal_dest,
SUM(COALESCE(IIF((c.year_from IS NULL OR c.year_from <= s.year) AND (c.year_to IS NULL OR c.year_to >= s.year), c.area, NULL), 0)) AS area
FROM season s, member m
LEFT JOIN member_billing_address a ON a.mgnr = m.mgnr
LEFT JOIN area_commitment c ON c.mgnr = m.mgnr
GROUP BY s.year, m.mgnr;
PRAGMA schema_version = 2901;
PRAGMA writable_schema = OFF;

View File

@@ -106,7 +106,7 @@ namespace Elwig.Services {
var a = new AreaCom {
FbNr = oldFbNr ?? newFbNr,
MgNr = (int)vm.MgNr!,
YearFrom = (int)vm.YearFrom!,
YearFrom = vm.YearFrom,
YearTo = vm.YearTo,
VtrgId = vm.AreaComType!.VtrgId,
CultId = vm.WineCult?.CultId,
@@ -136,7 +136,7 @@ namespace Elwig.Services {
}
}
await App.HintContextChange();
App.HintContextChange();
return newFbNr;
}

View File

@@ -125,7 +125,7 @@ namespace Elwig.Services {
}
}
await App.HintContextChange();
App.HintContextChange();
return (year, dsnr, newMgNr, newSortId);
}

View File

@@ -26,6 +26,7 @@ namespace Elwig.Services {
vm.Branch = (Branch?)ControlUtils.GetItemFromSourceWithPk(vm.BranchSource, s.ZwstId);
vm.Description = s.Description;
vm.MaxWeight = s.MaxWeight;
vm.IsCancelled = s.IsCancelled;
vm.MainVarieties.Clear();
foreach (var v in s.Varieties.Where(v => v.Priority == 1)) {
vm.MainVarieties.Add((WineVar)ControlUtils.GetItemFromSourceWithPk(vm.MainVarietiesSource, v.SortId)!);
@@ -34,6 +35,8 @@ namespace Elwig.Services {
foreach (var v in s.Varieties.Where(v => v.Priority != 1)) {
vm.OtherVarieties.Add((WineVar)ControlUtils.GetItemFromSourceWithPk(vm.OtherVarietiesSource, v.SortId)!);
}
vm.Attribute = ControlUtils.GetItemFromSourceWithPk(vm.AttributeSource, s.AttrId) as WineAttr;
vm.Cultivation = ControlUtils.GetItemFromSourceWithPk(vm.CultivationSource, s.CultId) as WineCult;
vm.AncmtFrom = s.AncmtFrom;
vm.AncmtTo = s.AncmtTo?.AddSeconds(-1);
}
@@ -156,7 +159,10 @@ namespace Elwig.Services {
DateString = $"{vm.Date:yyyy-MM-dd}",
ZwstId = vm.Branch!.ZwstId,
Description = vm.Description,
AttrId = vm.Attribute?.AttrId,
CultId = vm.Cultivation?.CultId,
MaxWeight = vm.MaxWeight,
IsCancelled = vm.IsCancelled,
AncmtFrom = vm.AncmtFrom,
AncmtTo = vm.AncmtTo?.AddMinutes(1),
};
@@ -177,7 +183,7 @@ namespace Elwig.Services {
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
App.HintContextChange();
}
}
}

View File

@@ -338,7 +338,7 @@ namespace Elwig.Services {
var b = new Billing(year);
await b.FinishSeason();
await b.CalculateBuckets();
await App.HintContextChange();
App.HintContextChange();
using var ctx = new AppDbContext();
var data = await DeliveryConfirmationDeliveryData.ForMember(ctx.DeliveryParts, year, m);
@@ -626,7 +626,7 @@ namespace Elwig.Services {
}
}
await App.HintContextChange();
App.HintContextChange();
return newMgNr;
}

View File

@@ -47,12 +47,30 @@ namespace Elwig.ViewModels {
get => int.TryParse(MaxWeightString, out var w) ? w : null;
set => MaxWeightString = $"{value}";
}
[ObservableProperty]
private bool _isCancelled;
public ObservableCollection<WineVar> MainVarieties { get; set; } = [];
[ObservableProperty]
private IEnumerable<WineVar> _mainVarietiesSource = [];
public ObservableCollection<WineVar> OtherVarieties { get; set; } = [];
[ObservableProperty]
private IEnumerable<WineVar> _otherVarietiesSource = [];
[ObservableProperty]
private IEnumerable<object> _attributeSource = [];
[ObservableProperty]
private object? _attributeObj;
public WineAttr? Attribute {
get => AttributeObj as WineAttr;
set => AttributeObj = value ?? AttributeSource.FirstOrDefault();
}
[ObservableProperty]
private IEnumerable<object> _cultivationSource = [];
[ObservableProperty]
private object? _cultivationObj;
public WineCult? Cultivation {
get => CultivationObj as WineCult;
set => CultivationObj = value ?? CultivationSource.FirstOrDefault();
}
[ObservableProperty]
private string _ancmtFromDateString = "";

View File

@@ -209,7 +209,7 @@ namespace Elwig.Windows {
ctx.Remove(a);
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
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;

View File

@@ -196,7 +196,7 @@ namespace Elwig.Windows {
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
MessageBox.Show(str, "Saison anlegen", MessageBoxButton.OK, MessageBoxImage.Error);
}
await App.HintContextChange();
App.HintContextChange();
Mouse.OverrideCursor = null;
SeasonList.SelectedIndex = 0;
}
@@ -219,7 +219,7 @@ namespace Elwig.Windows {
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
MessageBox.Show(str, "Saison löschen", MessageBoxButton.OK, MessageBoxImage.Error);
}
await App.HintContextChange();
App.HintContextChange();
Mouse.OverrideCursor = null;
}
}

View File

@@ -340,7 +340,7 @@ namespace Elwig.Windows {
LockInputs();
}
await App.HintContextChange();
App.HintContextChange();
}
private void FillInputs(ClientParameters p, Season? s) {

View File

@@ -672,7 +672,7 @@ namespace Elwig.Windows {
await ctx.SaveChangesAsync();
}
LockContext = false;
await App.HintContextChange();
App.HintContextChange();
} catch (Exception exc) {
var str = "Der Eintrag konnte nicht in der Datenbank gespeichert werden!\n\n" + exc.Message;
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;

View File

@@ -84,7 +84,7 @@
<RowDefinition Height="42"/>
<RowDefinition Height="1*" MinHeight="100"/>
<RowDefinition Height="5"/>
<RowDefinition Height="2*" MinHeight="100"/>
<RowDefinition Height="1*" MinHeight="100"/>
<RowDefinition Height="42"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@@ -129,7 +129,7 @@
<TextBlock Text="{Binding Date, StringFormat='ddd.'}" Width="24"/>
<TextBlock Text="{Binding Date, StringFormat='dd.MM.'}" Width="32"/>
<TextBlock Text="{Binding ZwstId}" Width="25" TextAlignment="Center"/>
<TextBlock Text="{Binding Description}" Width="200"/>
<TextBlock Text="{Binding Description}" Width="200" TextDecorations="{Binding TextDecoration}"/>
<TextBlock TextAlignment="Right">
<TextBlock Text="{Binding AnnouncedWeight, StringFormat='{}{0:N0}'}" Width="42" TextAlignment="Right"/> kg
/ <TextBlock Text="{Binding MaxWeight, StringFormat='{}{0:N0}'}" Width="42" TextAlignment="Right"/> kg
@@ -288,7 +288,7 @@
<TextBlock Text="{Binding Date, StringFormat='ddd.'}" Width="28"/>
<TextBlock Text="{Binding Date, StringFormat='dd.MM.'}" Width="35"/>
<TextBlock Text="{Binding ZwstId}" Width="30" TextAlignment="Center"/>
<TextBlock Text="{Binding Description}"/>
<TextBlock Text="{Binding Description}" TextDecorations="{Binding TextDecoration}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>

View File

@@ -276,6 +276,9 @@ namespace Elwig.Windows {
InitInputs();
ViewModel.MgNr = mgnr;
ViewModel.EnableSearchInputs = false;
MgNrInput.Focus();
MgNrInput.SelectAll();
}
protected override void ShortcutEdit() {
@@ -313,7 +316,7 @@ namespace Elwig.Windows {
ctx.Remove(a);
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
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;

View File

@@ -195,29 +195,34 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Content="Datum/Zwst.:" Margin="10,10,0,10"/>
<TextBox x:Name="DateInput" Text="{Binding DateString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Margin="0,10,10,10" Width="77" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right"
Margin="0,10,10,10" Width="77" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Left" TextAlignment="Right"
TextChanged="ScheduleDateInput_TextChanged" LostFocus="DateInput_LostFocus"/>
<ComboBox x:Name="BranchInput" SelectedItem="{Binding Branch, Mode=TwoWay}" ItemsSource="{Binding BranchSource, Mode=TwoWay}"
DisplayMemberPath="Name" TextSearch.TextPath="Name"
Margin="82,10,10,10" Width="150" Grid.Column="1" HorizontalAlignment="Left"/>
Margin="82,10,10,10" Width="150" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Left"/>
<Label Content="Beschreibung:" Margin="10,40,0,10"/>
<TextBox x:Name="DescriptionInput" Text="{Binding Description, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Margin="0,40,10,10" Grid.Column="1"
Margin="0,40,10,10" Grid.Column="1" Grid.ColumnSpan="2"
TextChanged="TextBox_TextChanged"/>
<Label Content="Max. Gewicht:" Margin="10,70,0,10"/>
<ctrl:UnitTextBox x:Name="MaxWeightInput" Unit="kg" Text="{Binding MaxWeightString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Margin="0,70,10,10" Grid.Column="1" Width="68" HorizontalAlignment="Left"
Margin="0,70,10,10" Grid.Column="1" Grid.ColumnSpan="2" Width="68" HorizontalAlignment="Left"
TextChanged="MaxWeightInput_TextChanged"/>
<CheckBox x:Name="CancelledInput" Content="Abgesagt" IsChecked="{Binding IsCancelled, Mode=TwoWay}"
Grid.Column="1" Grid.ColumnSpan="2" Margin="80,75,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
<Label Content="Sorten:" Margin="10,100,0,10"/>
<ctrl:CheckComboBox x:Name="MainWineVarietiesInput" SelectedItems="{Binding MainVarieties}" ItemsSource="{Binding MainVarietiesSource, Mode=TwoWay}"
Grid.Column="1" Margin="0,100,10,10"
Grid.Column="1" Grid.ColumnSpan="2" Margin="0,100,10,10"
Delimiter=", " AllItemsSelectedContent="Alle Sorten" ListDisplayMemberPath="SortId" TextSearch.TextPath="Name">
<ctrl:CheckComboBox.ItemTemplateSelector>
<ctrl:WineVarietyTemplateSelector/>
@@ -226,12 +231,20 @@
<Label Content="Weitere Sorten:" Margin="10,130,0,10"/>
<ctrl:CheckComboBox x:Name="OtherWineVarietiesInput" SelectedItems="{Binding OtherVarieties}" ItemsSource="{Binding OtherVarietiesSource, Mode=TwoWay}"
Grid.Column="1" Margin="0,130,10,10"
Grid.Column="1" Grid.ColumnSpan="2" Margin="0,130,10,10"
Delimiter=", " AllItemsSelectedContent="Alle Sorten" ListDisplayMemberPath="SortId" TextSearch.TextPath="Name">
<ctrl:CheckComboBox.ItemTemplateSelector>
<ctrl:WineVarietyTemplateSelector/>
</ctrl:CheckComboBox.ItemTemplateSelector>
</ctrl:CheckComboBox>
<Label Content="Attribut/Bewirt.:" Margin="10,160,0,10"/>
<ComboBox x:Name="AttributeInput" SelectedItem="{Binding AttributeObj, Mode=TwoWay}" ItemsSource="{Binding AttributeSource, Mode=TwoWay}"
Grid.Column="1" Margin="0,160,5,10"
DisplayMemberPath="Name"/>
<ComboBox x:Name="CultivationInput" SelectedItem="{Binding CultivationObj, Mode=TwoWay}" ItemsSource="{Binding CultivationSource, Mode=TwoWay}"
Grid.Column="2" Margin="0,160,10,10"
DisplayMemberPath="Name"/>
</Grid>
</GroupBox>

View File

@@ -103,6 +103,12 @@ namespace Elwig.Windows {
var varieties = await ctx.WineVarieties.OrderBy(v => v.Name).ToListAsync();
ControlUtils.RenewItemsSource(MainWineVarietiesInput, varieties);
ControlUtils.RenewItemsSource(OtherWineVarietiesInput, varieties);
var attrList = await ctx.WineAttributes.OrderBy(a => a.Name).Cast<object>().ToListAsync();
attrList.Insert(0, new NullItem("- Keine Angabe -"));
ControlUtils.RenewItemsSource(AttributeInput, attrList, null, ControlUtils.RenewSourceDefault.First);
var cultList = await ctx.WineCultivations.OrderBy(a => a.Name).Cast<object>().ToListAsync();
cultList.Insert(0, new NullItem("- Kein Angabe -"));
ControlUtils.RenewItemsSource(CultivationInput, cultList, null, ControlUtils.RenewSourceDefault.First);
await RefreshList();
}
@@ -177,7 +183,7 @@ namespace Elwig.Windows {
ctx.Remove(s);
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
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;

View File

@@ -108,36 +108,67 @@
<RadioButton GroupName="Recipients" x:Name="RecipientsAreaComMembersInput" Content="Mitglieder mit Flächenbindung"
Margin="10,30,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
<RadioButton GroupName="Recipients" x:Name="RecipientsDeliveryMembersInput" Content="Lieferanten der Saison"
<RadioButton GroupName="Recipients" x:Name="RecipientsDeliveryAncmtMembersInput" Content="Mitglieder mit Anmeldung"
Margin="10,50,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
<RadioButton GroupName="Recipients" x:Name="RecipientsNonDeliveryMembersInput" Content="Nicht-Lieferanten der Saison"
<RadioButton GroupName="Recipients" x:Name="RecipientsDeliveryMembersInput" Content="Lieferanten der Saison"
Margin="10,70,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
<RadioButton GroupName="Recipients" x:Name="RecipientsCustomInput" Content="Benutzerdefiniert"
<RadioButton GroupName="Recipients" x:Name="RecipientsNonDeliveryMembersInput" Content="Nicht-Lieferanten der Saison"
Margin="10,90,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
<RadioButton GroupName="Recipients" x:Name="RecipientsCustomInput" Content="Benutzerdefiniert"
Margin="10,110,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
<Label Content="Zwst.:" x:Name="MemberBranchLabel" Margin="10,120,0,10"/>
<Label Content="Zwst.:" x:Name="MemberBranchLabel" Margin="10,140,0,10"/>
<ctrl:CheckComboBox x:Name="MemberBranchInput" AllItemsSelectedContent="Alle Stammzweigstellen" Delimiter=", " DisplayMemberPath="Name"
Margin="50,120,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
Margin="50,140,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
SelectionChanged="MemberInput_SelectionChanged"/>
<Label Content="Gem.:" x:Name="MemberKgLabel" Margin="10,150,0,10"/>
<Label Content="Gem.:" x:Name="MemberKgLabel" Margin="10,170,0,10"/>
<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"
Margin="50,170,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
SelectionChanged="MemberInput_SelectionChanged"/>
<Label Content="Vtrg.:" x:Name="MemberAreaComLabel" Margin="10,180,0,10"/>
<Label Content="Bio-Betrieb:" x:Name="MemberOrganicLabel" Margin="10,200,0,10"/>
<RadioButton x:Name="MemberOrganicYesInput" Content="Ja" GroupName="MemberOrganic"
Margin="80,205,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
<RadioButton x:Name="MemberOrganicNoInput" Content="Nein" GroupName="MemberOrganic"
Margin="125,205,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
<RadioButton x:Name="MemberOrganicIndifferentInput" Content="Egal" GroupName="MemberOrganic"
Margin="180,205,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
<Label Content="Funktionär:" x:Name="MemberFunktionärLabel" Margin="10,230,0,10"/>
<RadioButton x:Name="MemberFunktionärYesInput" Content="Ja" GroupName="MemberFunktionär"
Margin="80,235,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
<RadioButton x:Name="MemberFunktionärNoInput" Content="Nein" GroupName="MemberFunktionär"
Margin="125,235,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
<RadioButton x:Name="MemberFunktionärIndifferentInput" Content="Egal" GroupName="MemberFunktionär"
Margin="180,235,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
<Label Content="Vtrg.:" x:Name="MemberAreaComLabel" Margin="10,260,0,10"/>
<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"
Margin="50,260,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
SelectionChanged="MemberInput_SelectionChanged"/>
<Label Content="Tag:" x:Name="MemberDeliveryAncmtLabel" Margin="10,260,0,10"/>
<ctrl:CheckComboBox x:Name="MemberDeliveryAncmtInput" AllItemsSelectedContent="Alle Lesepläne" Delimiter=", " DisplayMemberPath="Identifier"
IsSelectAllActive="True" SelectAllContent="Alle Lesepläne"
Margin="50,260,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
SelectionChanged="MemberInput_SelectionChanged"/>
<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"
Margin="10,140,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
SelectionChanged="MemberInput_SelectionChanged"/>
</Grid>
</GroupBox>

View File

@@ -116,6 +116,9 @@ namespace Elwig.Windows {
CreditNoteFooterInput.Visibility = Visibility.Hidden;
RecipientsActiveMembersInput.IsChecked = true;
MemberOrganicIndifferentInput.IsChecked = true;
MemberFunktionärIndifferentInput.IsChecked = true;
DeliveryConfirmationFooterInput.Text = App.Client.TextDeliveryConfirmation;
CreditNoteFooterInput.Text = App.Client.TextCreditNote;
@@ -164,6 +167,17 @@ namespace Elwig.Windows {
MemberAreaComInput.SelectAll();
MemberAreaComInput.SelectionChanged += MemberInput_SelectionChanged;
}
ControlUtils.RenewItemsSource(MemberDeliveryAncmtInput, await ctx.DeliverySchedules
.Where(s => s.Year == Year)
.OrderBy(s => s.DateString)
.ThenBy(s => s.Branch.Name)
.ThenBy(s => s.Description)
.ToListAsync(), MemberInput_SelectionChanged);
if (MemberDeliveryAncmtInput.SelectedItems.Count == 0) {
MemberDeliveryAncmtInput.SelectionChanged -= MemberInput_SelectionChanged;
MemberDeliveryAncmtInput.SelectAll();
MemberDeliveryAncmtInput.SelectionChanged += MemberInput_SelectionChanged;
}
ControlUtils.RenewItemsSource(MemberCustomInput, await ctx.Members
.Where(m => m.IsActive)
.OrderBy(m => m.Name)
@@ -291,8 +305,18 @@ namespace Elwig.Windows {
MemberBranchInput.Visibility = vis;
MemberKgLabel.Visibility = vis;
MemberKgInput.Visibility = vis;
MemberOrganicLabel.Visibility = vis;
MemberOrganicYesInput.Visibility = vis;
MemberOrganicNoInput.Visibility = vis;
MemberOrganicIndifferentInput.Visibility = vis;
MemberFunktionärLabel.Visibility = vis;
MemberFunktionärYesInput.Visibility = vis;
MemberFunktionärNoInput.Visibility = vis;
MemberFunktionärIndifferentInput.Visibility = vis;
MemberAreaComInput.Visibility = RecipientsAreaComMembersInput.IsChecked == true ? Visibility.Visible : Visibility.Hidden;
MemberAreaComLabel.Visibility = RecipientsAreaComMembersInput.IsChecked == true ? Visibility.Visible : Visibility.Hidden;
MemberDeliveryAncmtInput.Visibility = RecipientsDeliveryAncmtMembersInput.IsChecked == true ? Visibility.Visible : Visibility.Hidden;
MemberDeliveryAncmtLabel.Visibility = RecipientsDeliveryAncmtMembersInput.IsChecked == true ? Visibility.Visible : Visibility.Hidden;
MemberCustomInput.Visibility = RecipientsCustomInput.IsChecked == true ? Visibility.Visible : Visibility.Hidden;
using var ctx = new AppDbContext();
await UpdateRecipients(ctx);
@@ -303,6 +327,11 @@ namespace Elwig.Windows {
await UpdateRecipients(ctx);
}
private async void MemberInput_Checked(object sender, RoutedEventArgs evt) {
using var ctx = new AppDbContext();
await UpdateRecipients(ctx);
}
private void Date_TextChanged(object sender, RoutedEventArgs evt) {
Validator.CheckDate((TextBox)sender, true);
}
@@ -325,10 +354,23 @@ namespace Elwig.Windows {
var kgs = MemberKgInput.SelectedItems.Cast<AT_Kg>().Select(k => k.KgNr).ToList();
query = query.Where(m => kgs.Contains((int)m.DefaultKgNr!));
}
if (MemberOrganicYesInput.IsChecked == true) {
query = query.Where(m => m.IsOrganic);
} else if (MemberOrganicNoInput.IsChecked == true) {
query = query.Where(m => !m.IsOrganic);
}
if (MemberFunktionärYesInput.IsChecked == true) {
query = query.Where(m => m.IsFunktionär);
} else if (MemberFunktionärNoInput.IsChecked == true) {
query = query.Where(m => !m.IsFunktionär);
}
if (RecipientsAreaComMembersInput.IsChecked == true) {
var vtrg = MemberAreaComInput.SelectedItems.Cast<AreaComType>().Select(a => a.VtrgId).ToList();
query = query.Where(m => m.IsActive && m.AreaCommitments.AsQueryable().Where(Utils.ActiveAreaCommitments(Year)).Any(c => vtrg.Contains(c.VtrgId)));
} else if (RecipientsDeliveryAncmtMembersInput.IsChecked == true) {
var dsnrs = MemberDeliveryAncmtInput.SelectedItems.Cast<DeliverySchedule>().Select(s => s.DsNr).ToList();
query = query.Where(m => m.Announcements.Any(a => a.Year == Year && dsnrs.Contains(a.DsNr)));
} else if (RecipientsDeliveryMembersInput.IsChecked == true) {
query = query.Where(m => m.Deliveries.Any(d => d.Year == Year));
} else if (RecipientsNonDeliveryMembersInput.IsChecked == true) {
@@ -473,7 +515,7 @@ namespace Elwig.Windows {
var b = new Billing(year);
await b.FinishSeason();
await b.CalculateBuckets();
await App.HintContextChange();
App.HintContextChange();
dcData[year] = await DeliveryConfirmationDeliveryData.ForSeason(ctx.DeliveryParts, year);
} catch (Exception exc) {

View File

@@ -287,7 +287,7 @@ namespace Elwig.Windows {
var b = new Billing(year);
await b.FinishSeason();
await b.CalculateBuckets();
await App.HintContextChange();
App.HintContextChange();
using var ctx = new AppDbContext();
var tbl1 = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, year);
@@ -326,7 +326,7 @@ namespace Elwig.Windows {
var b = new Billing(year);
await b.FinishSeason();
await b.CalculateBuckets();
await App.HintContextChange();
App.HintContextChange();
using var ctx = new AppDbContext();
using var ods = new OdsFile(d.FileName);

View File

@@ -374,7 +374,7 @@ namespace Elwig.Windows {
ctx.Remove(l);
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
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;

View File

@@ -191,7 +191,7 @@ namespace Elwig.Windows {
}
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
App.HintContextChange();
ControlUtils.SelectItemWithPk(WbGlKgs, k.KgNr);
} catch (Exception exc) {
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
@@ -211,7 +211,7 @@ namespace Elwig.Windows {
ctx.Remove(k.WbKg);
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
App.HintContextChange();
ControlUtils.SelectItemWithPk(WbKgs, k.KgNr);
} catch (Exception exc) {
await HintContextChange();

View File

@@ -173,7 +173,7 @@ namespace Elwig.Windows {
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();
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;
@@ -187,7 +187,7 @@ namespace Elwig.Windows {
try {
var b = new Billing(Year);
await b.UnAdjustBusinessShares();
await App.HintContextChange();
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;
@@ -309,7 +309,7 @@ namespace Elwig.Windows {
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
MessageBox.Show(str, "Benutzerdefinierten Zu-/Abschlag speichern", MessageBoxButton.OK, MessageBoxImage.Error);
}
await App.HintContextChange();
App.HintContextChange();
Mouse.OverrideCursor = null;
}
}

View File

@@ -240,7 +240,7 @@ namespace Elwig.Windows {
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
App.HintContextChange();
ControlUtils.SelectItem(PaymentVariantList, v);
} catch (Exception exc) {
@@ -268,7 +268,7 @@ namespace Elwig.Windows {
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
App.HintContextChange();
ControlUtils.SelectItem(PaymentVariantList, n);
} catch (Exception exc) {
@@ -285,7 +285,7 @@ namespace Elwig.Windows {
ctx.Remove(v);
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
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;
@@ -304,7 +304,7 @@ namespace Elwig.Windows {
} catch (Exception exc) {
MessageBox.Show(exc.Message, "Berechnungsfehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
await App.HintContextChange();
App.HintContextChange();
Mouse.OverrideCursor = null;
CalculateButton.IsEnabled = true;
}
@@ -399,7 +399,7 @@ namespace Elwig.Windows {
}
Mouse.OverrideCursor = null;
RevertButton.IsEnabled = true;
await App.HintContextChange();
App.HintContextChange();
}
private async void RevertButton_Click(object sender, RoutedEventArgs evt) {
@@ -415,7 +415,7 @@ namespace Elwig.Windows {
Mouse.OverrideCursor = Cursors.AppStarting;
var b = new BillingVariant(v.Year, v.AvNr);
await b.Revert();
await App.HintContextChange();
App.HintContextChange();
Mouse.OverrideCursor = null;
CommitButton.IsEnabled = true;
}
@@ -507,7 +507,7 @@ namespace Elwig.Windows {
await ctx.SaveChangesAsync();
}
await App.HintContextChange();
App.HintContextChange();
CommentInput_TextChanged(null, null);
ConsiderModifiersInput_Changed(null, null);
ConsiderPenaltiesInput_Changed(null, null);

View File

@@ -19,12 +19,12 @@
</Target>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Appium.WebDriver" Version="4.4.5" />
<PackageReference Include="NReco.PdfRenderer" Version="1.5.3" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
<PackageReference Include="NReco.PdfRenderer" Version="1.5.4" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

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