Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
f29a609d3b | |||
8a61747538 | |||
4a7c95e250 | |||
4fa5b8f6d4 | |||
579ed53487 |
23
CHANGELOG.md
23
CHANGELOG.md
@ -3,6 +3,27 @@ Changelog
|
||||
=========
|
||||
|
||||
|
||||
[v0.13.0][v0.13.0] (2024-09-25) {#v0.13.0}
|
||||
------------------------------------------
|
||||
|
||||
> [!NOTE]
|
||||
> Ab dieser Version verhält sich die Berechnung der Unterlieferungen bei Flächenbindungen anders.
|
||||
|
||||
### Behobene Fehler {#0.13.0-bugfixes}
|
||||
|
||||
* Im Lieferungen-Fenster (`DeliveryAdminWindow`) war das Extrahieren in eine neue Lieferung seit ca. 6 Monaten (98688168b8) nicht mehr möglich. (8a61747538)
|
||||
|
||||
### Sonstiges {#v0.13.0-misc}
|
||||
|
||||
* Es werden alle Lieferungen (inkl. `WEI`, `RSW`, `LDW`) zur Berechnung der Unterlieferung bei Flächenbindungen herangezogen. (4fa5b8f6d4)
|
||||
* In diversen Fenstern die Formatierung von Zahlen verbessert. (579ed53487)
|
||||
* Das Rundschreiben-Fenster (`MailWindow`) ist nun benutzerfreundlicher/-sicherer. (4a7c95e250)
|
||||
|
||||
[v0.13.0]: https://git.necronda.net/winzer/elwig/releases/tag/v0.13.0
|
||||
|
||||
|
||||
|
||||
|
||||
[v0.12.0][v0.12.0] (2024-09-24) {#v0.12.0}
|
||||
------------------------------------------
|
||||
|
||||
@ -274,7 +295,7 @@ Changelog
|
||||
|
||||
> [!NOTE]
|
||||
> Mitglieder können ab dieser Version als juristische Person markiert werden.
|
||||
> Es ist empfohlen, dies bei entsprechenden Mitglieder zu überprüfen und einzusetzen (z.B. Bezirksbauernkammer, Lagerhaus).
|
||||
> Es wird empfohlen, dies bei entsprechenden Mitglieder zu überprüfen und einzusetzen (z.B. Bezirksbauernkammer, Lagerhaus).
|
||||
|
||||
### Neue Funktionen {#v0.10.0-features}
|
||||
|
||||
|
@ -81,11 +81,11 @@ namespace Elwig.Documents {
|
||||
}
|
||||
|
||||
private static string FormatRow(
|
||||
int obligation, int right, int delivery, int? payment = null, int? area = null,
|
||||
int obligation, int right, int delivery, int? totalDelivery = null, int? payment = null, int? area = null,
|
||||
bool isGa = false, bool showPayment = false, bool showArea = false
|
||||
) {
|
||||
totalDelivery ??= delivery;
|
||||
payment ??= delivery;
|
||||
var baseline = showPayment ? payment : delivery;
|
||||
|
||||
if (showArea) {
|
||||
return $"<td>{(area == null ? "" : $"{area:N0}")}</td>" +
|
||||
@ -95,15 +95,15 @@ namespace Elwig.Documents {
|
||||
|
||||
return $"<td>{(obligation == 0 ? "-" : $"{obligation:N0}")}</td>" +
|
||||
$"<td>{(right == 0 ? "-" : $"{right:N0}")}</td>" +
|
||||
$"<td>{(baseline < obligation ? $"<b>{obligation - baseline:N0}</b>" : "-")}</td>" +
|
||||
$"<td>{(baseline >= obligation && delivery <= right ? $"{right - delivery:N0}" : "-")}</td>" +
|
||||
$"<td>{(totalDelivery < obligation ? $"<b>{obligation - totalDelivery:N0}</b>" : "-")}</td>" +
|
||||
$"<td>{(delivery <= right ? $"{right - delivery:N0}" : "-")}</td>" +
|
||||
$"<td>{(obligation == 0 && right == 0 ? "-" : (delivery > right ? ((isGa ? "<b>" : "") + $"{delivery - right:N0}" + (isGa ? "</b>" : "")) : "-"))}</td>" +
|
||||
(showPayment ? $"<td>{(isGa ? "" : obligation == 0 && right == 0 ? "-" : $"{payment:N0}")}</td>" : "") +
|
||||
$"<td>{delivery:N0}</td>";
|
||||
$"<td>{totalDelivery:N0}</td>";
|
||||
}
|
||||
|
||||
private static string FormatRow(MemberBucket bucket, bool isGa = false, bool showPayment = false, bool showArea = false) {
|
||||
return FormatRow(bucket.Obligation, bucket.Right, bucket.Delivery, bucket.Payment, bucket.Area, isGa, showPayment, showArea);
|
||||
return FormatRow(bucket.Obligation, bucket.Right, bucket.Delivery, bucket.DeliveryTotal, bucket.Payment, bucket.Area, isGa, showPayment, showArea);
|
||||
}
|
||||
|
||||
public string PrintBucketTable(
|
||||
|
@ -7,7 +7,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
|
||||
<Version>0.12.0</Version>
|
||||
<Version>0.13.0</Version>
|
||||
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
|
@ -17,7 +17,7 @@ namespace Elwig.Helpers {
|
||||
|
||||
public record struct AreaComBucket(int Area, int Obligation, int Right);
|
||||
public record struct UnderDelivery(int Weight, int Diff);
|
||||
public record struct MemberBucket(string Name, int Area, int Obligation, int Right, int Delivery, int DeliveryStrict, int Payment);
|
||||
public record struct MemberBucket(string Name, int Area, int Obligation, int Right, int Delivery, int DeliveryStrict, int DeliveryTotal, int Payment);
|
||||
public record struct MemberStat(string Variety, string Discr, int Weight);
|
||||
public record struct ModifierStat(string ModId, string Name, int Count, decimal? Min, decimal? Max, decimal Sum);
|
||||
|
||||
@ -203,10 +203,10 @@ namespace Elwig.Helpers {
|
||||
return c + 1;
|
||||
}
|
||||
|
||||
public async Task<int> NextLNr(DateOnly date) {
|
||||
public async Task<int> NextLNr(DateOnly date, string zwstid) {
|
||||
var dateStr = date.ToString("yyyy-MM-dd");
|
||||
int c = 0;
|
||||
(await Deliveries.Where(d => d.DateString == dateStr).Select(d => d.LNr).ToListAsync())
|
||||
(await Deliveries.Where(d => d.DateString == dateStr && d.ZwstId == zwstid).Select(d => d.LNr).ToListAsync())
|
||||
.ForEach(a => { if (a <= c + 100) c = a; });
|
||||
return c + 1;
|
||||
}
|
||||
@ -442,6 +442,7 @@ namespace Elwig.Helpers {
|
||||
rightsAndObligations.GetValueOrDefault(id).Right,
|
||||
deliveryBuckets.GetValueOrDefault(id),
|
||||
deliveryBucketsStrict.GetValueOrDefault(id),
|
||||
deliveryBuckets.GetValueOrDefault(id) + deliveryBuckets.GetValueOrDefault(id + "_"),
|
||||
paymentBuckets.GetValueOrDefault(id)
|
||||
);
|
||||
}
|
||||
|
@ -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 = 30;
|
||||
public static readonly int RequiredSchemaVersion = 31;
|
||||
|
||||
private static int VersionOffset = 0;
|
||||
|
||||
|
14
Elwig/Resources/Sql/30-31.sql
Normal file
14
Elwig/Resources/Sql/30-31.sql
Normal file
@ -0,0 +1,14 @@
|
||||
-- schema version 30 to 31
|
||||
|
||||
PRAGMA writable_schema = ON;
|
||||
|
||||
DROP VIEW v_under_delivery_bucket_strict;
|
||||
CREATE VIEW v_under_delivery_bucket_strict AS
|
||||
SELECT c.year, c.mgnr, c.bucket, c.min_kg, SUM(COALESCE(p.weight, 0)) AS weight
|
||||
FROM v_area_commitment_bucket_strict c
|
||||
LEFT JOIN v_payment_bucket_strict p ON (p.year, p.mgnr, p.bucket) = (c.year, c.mgnr, c.bucket) OR (p.year, p.mgnr, p.bucket) = (c.year, c.mgnr, c.bucket || '_')
|
||||
GROUP BY c.year, c.mgnr, c.bucket
|
||||
ORDER BY c.year, c.mgnr, c.bucket;
|
||||
|
||||
PRAGMA schema_version = 3001;
|
||||
PRAGMA writable_schema = OFF;
|
@ -443,7 +443,7 @@ namespace Elwig.Services {
|
||||
var originalMemberKgNr = oldDelivery?.Member.DefaultKgNr;
|
||||
|
||||
var date = DateOnly.ParseExact(vm.Date!, "dd.MM.yyyy");
|
||||
int? newLnr = (deliveryNew || dateHasChanged) ? await ctx.NextLNr(date) : null;
|
||||
int? newLnr = (deliveryNew || dateHasChanged) ? await ctx.NextLNr(date, vm.Branch!.ZwstId) : null;
|
||||
string? newLsNr = (newLnr != null) ? Utils.GenerateLsNr(date, vm.Branch!.ZwstId, newLnr.Value) : null;
|
||||
|
||||
string? newTimeString = null;
|
||||
@ -631,7 +631,7 @@ namespace Elwig.Services {
|
||||
} else {
|
||||
await ElwigData.Export(path, list, filterNames);
|
||||
await Utils.UploadExportData(path, App.Config.SyncUrl, App.Config.SyncUsername, App.Config.SyncPassword);
|
||||
MessageBox.Show($"Hochladen von {list.Count} Lieferungen erfolgreich!", "Lieferungen hochgeladen",
|
||||
MessageBox.Show($"Hochladen von {list.Count:N0} Lieferungen erfolgreich!", "Lieferungen hochgeladen",
|
||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
} catch (HttpRequestException exc) {
|
||||
|
@ -499,7 +499,7 @@ namespace Elwig.Services {
|
||||
} else {
|
||||
await ElwigData.Export(path, members, areaComs, filterNames);
|
||||
await Utils.UploadExportData(path, App.Config.SyncUrl, App.Config.SyncUsername, App.Config.SyncPassword);
|
||||
MessageBox.Show($"Hochladen von {members.Count} Mitgliedern erfolgreich!", "Mitglieder hochgeladen",
|
||||
MessageBox.Show($"Hochladen von {members.Count:N0} Mitgliedern erfolgreich!", "Mitglieder hochgeladen",
|
||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
} catch (HttpRequestException exc) {
|
||||
|
@ -386,14 +386,14 @@ namespace Elwig.Windows {
|
||||
await RefreshDeliveryParts();
|
||||
|
||||
var members = deliveries.Select(d => d.Member).DistinctBy(m => m.MgNr).ToList();
|
||||
ViewModel.StatusMembers = $"{members.Count}" + (members.Count > 0 && members.Count <= 4 ? $" ({string.Join(", ", members.Select(m => m.AdministrativeName))})" : "");
|
||||
ViewModel.StatusDeliveries = $"{deliveries.Count}";
|
||||
ViewModel.StatusMembers = $"{members.Count:N0}" + (members.Count > 0 && members.Count <= 4 ? $" ({string.Join(", ", members.Select(m => m.AdministrativeName))})" : "");
|
||||
ViewModel.StatusDeliveries = $"{deliveries.Count:N0}";
|
||||
|
||||
if (filter.Count == 0) {
|
||||
var deliveryParts = deliveryPartsQuery;
|
||||
ViewModel.StatusDeliveries = $"{deliveries.Count} ({await deliveryParts.CountAsync()})";
|
||||
ViewModel.StatusDeliveries = $"{deliveries.Count:N0} ({await deliveryParts.CountAsync():N0})";
|
||||
var varieties = await deliveryParts.Select(d => d.SortId).Distinct().ToListAsync();
|
||||
ViewModel.StatusVarieties = $"{varieties.Count}" + (varieties.Count > 0 && varieties.Count <= 10 ? $" ({string.Join(", ", varieties)})" : "");
|
||||
ViewModel.StatusVarieties = $"{varieties.Count:N0}" + (varieties.Count > 0 && varieties.Count <= 10 ? $" ({string.Join(", ", varieties)})" : "");
|
||||
var (wText, wData, gText, gData) = await DeliveryService.GenerateToolTipData(deliveryParts);
|
||||
ViewModel.StatusWeight = wText;
|
||||
ViewModel.StatusGradation = gText;
|
||||
@ -1072,7 +1072,8 @@ namespace Elwig.Windows {
|
||||
try {
|
||||
using var ctx = new AppDbContext();
|
||||
if (res == "new") {
|
||||
var lnr = await ctx.NextLNr(delivery.Date);
|
||||
var lnr = await ctx.NextLNr(delivery.Date, delivery.ZwstId);
|
||||
var lsnr = Utils.GenerateLsNr(delivery.Date, delivery.ZwstId, lnr);
|
||||
ctx.Add(new Delivery {
|
||||
Year = p.Year,
|
||||
DId = await ctx.NextDId(p.Year),
|
||||
@ -1082,9 +1083,10 @@ namespace Elwig.Windows {
|
||||
ZwstId = delivery.ZwstId,
|
||||
MgNr = delivery.MgNr,
|
||||
Comment = delivery.Comment,
|
||||
LsNr = Utils.GenerateLsNr(delivery.Date, delivery.ZwstId, lnr),
|
||||
LsNr = lsnr,
|
||||
});
|
||||
await ctx.SaveChangesAsync();
|
||||
res = lsnr;
|
||||
}
|
||||
Delivery? d = await ctx.Deliveries.Where(d => d.LsNr == res).FirstOrDefaultAsync();
|
||||
if (d == null) return;
|
||||
@ -1235,7 +1237,7 @@ namespace Elwig.Windows {
|
||||
var branch = (Branch)BranchInput.SelectedItem;
|
||||
var date = DateOnly.ParseExact(ViewModel.Date!, "dd.MM.yyyy");
|
||||
using var ctx = new AppDbContext();
|
||||
var lnr = await ctx.NextLNr(date);
|
||||
var lnr = await ctx.NextLNr(date, branch.ZwstId);
|
||||
ViewModel.LsNr = Utils.GenerateLsNr(date, branch.ZwstId, lnr);
|
||||
} catch {
|
||||
ViewModel.LsNr = "";
|
||||
|
@ -86,14 +86,16 @@
|
||||
<Label x:Name="DocumentFooterLabel" Content="Fußtext:" Margin="10,40,0,10"/>
|
||||
<TextBox x:Name="DeliveryConfirmationFooterInput" Grid.Column="1"
|
||||
Margin="0,40,10,10" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
|
||||
AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap"/>
|
||||
AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap"
|
||||
TextChanged="DocumentInput_TextChanged"/>
|
||||
<TextBox x:Name="CreditNoteFooterInput" Grid.Column="1"
|
||||
Margin="0,10,10,10" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
|
||||
AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap"/>
|
||||
AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap"
|
||||
TextChanged="DocumentInput_TextChanged"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<TextBox x:Name="PostalLocation" Grid.Column="1"
|
||||
<TextBox x:Name="PostalLocation" Grid.Column="1" TextChanged="PostalLocation_TextChanged"
|
||||
Margin="10,30,10,10" Width="120" HorizontalAlignment="Left"/>
|
||||
<Label Content=", am" Margin="130,30,10,10" FontSize="14" Grid.Column="1"/>
|
||||
<TextBox x:Name="PostalDate" Grid.Column="1" Text="01.01.2020"
|
||||
@ -195,41 +197,42 @@
|
||||
<Grid>
|
||||
<GroupBox Header="Zusenden an..." Margin="10,10,10,10" Height="150" Width="220" VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||
<StackPanel>
|
||||
<RadioButton x:Name="PostalAllInput" Margin="10,10,10,2.5">
|
||||
<RadioButton x:Name="PostalAllInput" Margin="10,10,10,2.5" Click="PostalInput_Changed">
|
||||
<TextBlock>
|
||||
... alle (<Run Text="{Binding Path=PostalAllCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
|
||||
...alle (<Run Text="{Binding Path=PostalAllCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
|
||||
</TextBlock>
|
||||
</RadioButton>
|
||||
<RadioButton x:Name="PostalWishInput" Margin="10,2.5,10,2.5" IsChecked="True">
|
||||
<RadioButton x:Name="PostalWishInput" Margin="10,2.5,10,2.5" Click="PostalInput_Changed" IsChecked="True">
|
||||
<TextBlock>
|
||||
...Mitglieder, die Zusendung<LineBreak/>
|
||||
per Post wünschen (<Run Text="{Binding Path=PostalWishCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
|
||||
</TextBlock>
|
||||
</RadioButton>
|
||||
<RadioButton x:Name="PostalNoEmailInput" Margin="10,2.5,10,2.5">
|
||||
<RadioButton x:Name="PostalNoEmailInput" Margin="10,2.5,10,2.5" Click="PostalInput_Changed">
|
||||
<TextBlock>
|
||||
...Mitglieder, die keine<LineBreak/>
|
||||
E-Mail erhalten würden (<Run Text="{Binding Path=PostalNoEmailCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
|
||||
</TextBlock>
|
||||
</RadioButton>
|
||||
<RadioButton x:Name="PostalNobodyInput" Margin="10,2.5,10,10" Content="...niemanden (0)"/>
|
||||
<RadioButton x:Name="PostalNobodyInput" Margin="10,2.5,10,10" Content="...niemanden (0)" Click="PostalInput_Changed"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Sortieren nach" Margin="10,180,10,10" Width="180" Height="80" VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||
<StackPanel Margin="5,5,0,5">
|
||||
<RadioButton GroupName="Order" x:Name="OrderMgNrInput" Content="Mitgliedsnummer" IsChecked="True"/>
|
||||
<RadioButton GroupName="Order" x:Name="OrderNameInput" Content="Name"/>
|
||||
<RadioButton GroupName="Order" x:Name="OrderPlzInput" Content="PLZ, Ort, Name"/>
|
||||
<RadioButton GroupName="Order" x:Name="OrderMgNrInput" Content="Mitgliedsnummer" Click="OrderInput_Changed" IsChecked="True"/>
|
||||
<RadioButton GroupName="Order" x:Name="OrderNameInput" Content="Name" Click="OrderInput_Changed"/>
|
||||
<RadioButton GroupName="Order" x:Name="OrderPlzInput" Content="PLZ, Ort, Name" Click="OrderInput_Changed"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<CheckBox x:Name="DoublePagedInput" Margin="20,270,10,10" Content="Doppelseitig drucken"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Checked="DoublePagedInput_Changed" Unchecked="DoublePagedInput_Changed"/>
|
||||
|
||||
<TextBox x:Name="PostalSender1" IsEnabled="False"
|
||||
<TextBox x:Name="PostalSender1" TextChanged="PostalSender_TextChanged" IsEnabled="False"
|
||||
Margin="10,300,10,10"/>
|
||||
<TextBox x:Name="PostalSender2"
|
||||
<TextBox x:Name="PostalSender2" TextChanged="PostalSender_TextChanged"
|
||||
Margin="10,330,10,10"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
@ -200,6 +200,48 @@ namespace Elwig.Windows {
|
||||
await UpdateRecipients(ctx);
|
||||
}
|
||||
|
||||
private void ResetDocuments() {
|
||||
DisposeDocs();
|
||||
if (IsLoaded) {
|
||||
PreviewButton.IsEnabled = false;
|
||||
PrintButton.IsEnabled = false;
|
||||
EmailButton.IsEnabled = false;
|
||||
ProgressBar.Value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void LockInputs() {
|
||||
DocumentAddButton.IsEnabled = false;
|
||||
DocumentRemoveButton.IsEnabled = false;
|
||||
SelectDocumentButton.IsEnabled = false;
|
||||
foreach (var tb in ControlUtils.FindAllChildren<TextBox>(this, []))
|
||||
tb.IsReadOnly = true;
|
||||
foreach (var cb in ControlUtils.FindAllChildren<ComboBox>(this, []))
|
||||
cb.IsEnabled = false;
|
||||
foreach (var cb in ControlUtils.FindAllChildren<CheckBox>(this, []))
|
||||
cb.IsEnabled = false;
|
||||
foreach (var lb in ControlUtils.FindAllChildren<ListBox>(this, []))
|
||||
lb.IsEnabled = false;
|
||||
foreach (var rb in ControlUtils.FindAllChildren<RadioButton>(this, []))
|
||||
rb.IsEnabled = false;
|
||||
}
|
||||
|
||||
private void UnlockInputs() {
|
||||
DocumentAddButton.IsEnabled = true;
|
||||
DocumentRemoveButton.IsEnabled = true;
|
||||
SelectDocumentButton.IsEnabled = true;
|
||||
foreach (var tb in ControlUtils.FindAllChildren<TextBox>(this, []))
|
||||
tb.IsReadOnly = false;
|
||||
foreach (var cb in ControlUtils.FindAllChildren<ComboBox>(this, []))
|
||||
cb.IsEnabled = true;
|
||||
foreach (var cb in ControlUtils.FindAllChildren<CheckBox>(this, []))
|
||||
cb.IsEnabled = true;
|
||||
foreach (var lb in ControlUtils.FindAllChildren<ListBox>(this, []))
|
||||
lb.IsEnabled = true;
|
||||
foreach (var rb in ControlUtils.FindAllChildren<RadioButton>(this, []))
|
||||
rb.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void ContinueButton_Click(object sender, RoutedEventArgs evt) {
|
||||
TabControl.SelectedIndex = 1;
|
||||
TabControl.AllowDrop = false;
|
||||
@ -210,7 +252,7 @@ namespace Elwig.Windows {
|
||||
TabControl.AllowDrop = true;
|
||||
}
|
||||
|
||||
private void Document_Drop(object sender, DragEventArgs evt) {
|
||||
private async void Document_Drop(object sender, DragEventArgs evt) {
|
||||
if (evt.Data.GetDataPresent(DataFormats.FileDrop)) {
|
||||
var files = (string[])evt.Data.GetData(DataFormats.FileDrop);
|
||||
foreach (var file in files) {
|
||||
@ -218,6 +260,8 @@ namespace Elwig.Windows {
|
||||
SelectedDocs.Add(new(DocType.Custom, Path.GetFileName(file), file));
|
||||
}
|
||||
}
|
||||
using var ctx = new AppDbContext();
|
||||
await UpdateRecipients(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,8 +304,9 @@ namespace Elwig.Windows {
|
||||
}
|
||||
}
|
||||
|
||||
private void DocumentAddButton_Click(object sender, RoutedEventArgs evt) {
|
||||
private async void DocumentAddButton_Click(object sender, RoutedEventArgs evt) {
|
||||
var idx = AvaiableDocumentsList.SelectedIndex;
|
||||
using var ctx = new AppDbContext();
|
||||
if (AvaiableDocumentsList.SelectedItem is not string s)
|
||||
return;
|
||||
if (idx == 0) {
|
||||
@ -270,20 +315,22 @@ namespace Elwig.Windows {
|
||||
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)!;
|
||||
var pv = await ctx.PaymentVariants.SingleAsync(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;
|
||||
await UpdateRecipients(ctx);
|
||||
}
|
||||
|
||||
private void DocumentRemoveButton_Click(object sender, RoutedEventArgs evt) {
|
||||
private async void DocumentRemoveButton_Click(object sender, RoutedEventArgs evt) {
|
||||
DeleteCommand.Execute(null);
|
||||
using var ctx = new AppDbContext();
|
||||
await UpdateRecipients(ctx);
|
||||
}
|
||||
|
||||
private void SelectDocumentButton_Click(object sender, RoutedEventArgs evt) {
|
||||
private async void SelectDocumentButton_Click(object sender, RoutedEventArgs evt) {
|
||||
var d = new OpenFileDialog() {
|
||||
Title = "Dokument auswählen - Elwig",
|
||||
DefaultExt = "pdf",
|
||||
@ -296,6 +343,8 @@ namespace Elwig.Windows {
|
||||
SelectedDocs.Add(new(DocType.Custom, Path.GetFileName(file), file));
|
||||
}
|
||||
}
|
||||
using var ctx = new AppDbContext();
|
||||
await UpdateRecipients(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,6 +383,7 @@ namespace Elwig.Windows {
|
||||
|
||||
private void Date_TextChanged(object sender, RoutedEventArgs evt) {
|
||||
Validator.CheckDate((TextBox)sender, true);
|
||||
ResetDocuments();
|
||||
}
|
||||
|
||||
private void Date_LostFocus(object sender, RoutedEventArgs evt) {
|
||||
@ -375,6 +425,8 @@ namespace Elwig.Windows {
|
||||
query = query.Where(m => m.Deliveries.Any(d => d.Year == Year));
|
||||
} else if (RecipientsNonDeliveryMembersInput.IsChecked == true) {
|
||||
query = query.Where(m => m.IsActive && !m.Deliveries.Any(d => d.Year == Year));
|
||||
} else if (RecipientsActiveMembersInput.IsChecked == true && SelectedDocs.Any(d => d.Type == DocType.DeliveryConfirmation || d.Type == DocType.CreditNote)) {
|
||||
query = query.Where(m => m.IsActive || m.Deliveries.Any(d => d.Year == Year));
|
||||
} else {
|
||||
query = query.Where(m => m.IsActive);
|
||||
}
|
||||
@ -403,6 +455,7 @@ namespace Elwig.Windows {
|
||||
PostalWishCount = Recipients.Count(m => m.ContactViaPost);
|
||||
var m = EmailAllInput.IsChecked == true ? 3 : EmailWishInput.IsChecked == true ? 2 : 1;
|
||||
PostalNoEmailCount = PostalAllCount - (m == 3 ? EmailAllCount : m == 2 ? EmailWishCount : 0);
|
||||
ResetDocuments();
|
||||
}
|
||||
|
||||
private async Task UpdateTextParameters() {
|
||||
@ -458,6 +511,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void GenerateButton_Click(object sender, RoutedEventArgs evt) {
|
||||
LockInputs();
|
||||
PreviewButton.IsEnabled = false;
|
||||
PrintButton.IsEnabled = false;
|
||||
EmailButton.IsEnabled = false;
|
||||
@ -520,6 +574,7 @@ namespace Elwig.Windows {
|
||||
dcData[year] = await DeliveryConfirmationDeliveryData.ForSeason(ctx.DeliveryParts, year);
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
UnlockInputs();
|
||||
GenerateButton.IsEnabled = true;
|
||||
Mouse.OverrideCursor = null;
|
||||
return;
|
||||
@ -536,6 +591,7 @@ namespace Elwig.Windows {
|
||||
);
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
UnlockInputs();
|
||||
GenerateButton.IsEnabled = true;
|
||||
Mouse.OverrideCursor = null;
|
||||
return;
|
||||
@ -626,6 +682,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
UnlockInputs();
|
||||
GenerateButton.IsEnabled = true;
|
||||
Mouse.OverrideCursor = null;
|
||||
return;
|
||||
@ -665,6 +722,7 @@ namespace Elwig.Windows {
|
||||
PrintDocument = print;
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
UnlockInputs();
|
||||
GenerateButton.IsEnabled = true;
|
||||
Mouse.OverrideCursor = null;
|
||||
return;
|
||||
@ -672,6 +730,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
ProgressBar.Value = 100.0;
|
||||
|
||||
UnlockInputs();
|
||||
GenerateButton.IsEnabled = true;
|
||||
Mouse.OverrideCursor = null;
|
||||
PreviewButton.IsEnabled = true;
|
||||
@ -705,7 +764,11 @@ namespace Elwig.Windows {
|
||||
|
||||
private async void PrintButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (PrintDocument == null) return;
|
||||
|
||||
PrintButton.IsEnabled = false;
|
||||
GenerateButton.IsEnabled = false;
|
||||
LockInputs();
|
||||
|
||||
var res = MessageBox.Show($"Sollen {PrintDocument.Pages} Blätter ({PrintDocument.TotalPages} Seiten) gedruckt werden?",
|
||||
"Rundschreiben drucken", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
|
||||
if (res == MessageBoxResult.Yes) {
|
||||
@ -717,20 +780,26 @@ namespace Elwig.Windows {
|
||||
}
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
|
||||
PrintButton.IsEnabled = true;
|
||||
GenerateButton.IsEnabled = true;
|
||||
UnlockInputs();
|
||||
}
|
||||
|
||||
private async void EmailButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (App.Config.Smtp == null || EmailDocuments == null) return;
|
||||
|
||||
EmailButton.IsEnabled = false;
|
||||
GenerateButton.IsEnabled = false;
|
||||
LockInputs();
|
||||
|
||||
SmtpClient? client = null;
|
||||
try {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
client = await Utils.GetSmtpClient();
|
||||
Mouse.OverrideCursor = null;
|
||||
|
||||
var res = MessageBox.Show($"Sollen {EmailDocuments.Count} E-Mails verschickt werden?",
|
||||
var res = MessageBox.Show($"Sollen {EmailDocuments.Count:N0} E-Mails verschickt werden?",
|
||||
"Rundschreiben verschicken", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
|
||||
if (res != MessageBoxResult.Yes) {
|
||||
return;
|
||||
@ -754,6 +823,8 @@ namespace Elwig.Windows {
|
||||
msg.Body = body;
|
||||
await client!.SendAsync(msg);
|
||||
}
|
||||
|
||||
MessageBox.Show("Erfolgreich alle E-Mails verschickt!", "Rundschreiben verschicken", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
} finally {
|
||||
@ -761,11 +832,14 @@ namespace Elwig.Windows {
|
||||
await client.DisconnectAsync(true);
|
||||
client?.Dispose();
|
||||
EmailButton.IsEnabled = true;
|
||||
GenerateButton.IsEnabled = true;
|
||||
UnlockInputs();
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddDeliveryConfirmation() {
|
||||
if (!GenerateButton.IsEnabled) return;
|
||||
AvaiableDocumentsList.SelectedIndex = 1;
|
||||
if (AvaiableDocumentsList.SelectedItem is not string s || SelectedDocs.Any(d => d.Type == DocType.DeliveryConfirmation))
|
||||
return;
|
||||
@ -775,6 +849,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
public void AddCreditNote(int index) {
|
||||
if (!GenerateButton.IsEnabled) return;
|
||||
AvaiableDocumentsList.SelectedIndex = 2 + index;
|
||||
if (AvaiableDocumentsList.SelectedItem is not string s || SelectedDocs.Any(d => d.Type == DocType.CreditNote))
|
||||
return;
|
||||
@ -785,5 +860,29 @@ namespace Elwig.Windows {
|
||||
SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;
|
||||
RecipientsDeliveryMembersInput.IsChecked = true;
|
||||
}
|
||||
|
||||
private void DocumentInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
ResetDocuments();
|
||||
}
|
||||
|
||||
private void PostalLocation_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
ResetDocuments();
|
||||
}
|
||||
|
||||
private void PostalInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
ResetDocuments();
|
||||
}
|
||||
|
||||
private void OrderInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
ResetDocuments();
|
||||
}
|
||||
|
||||
private void DoublePagedInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
ResetDocuments();
|
||||
}
|
||||
|
||||
private void PostalSender_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
ResetDocuments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ namespace Elwig.Windows {
|
||||
} else {
|
||||
await ElwigData.Export(path, deliveries, [$"{Utils.CurrentLastSeason}", $"Zweigstelle {App.BranchName}"]);
|
||||
await Utils.UploadExportData(path, App.Config.SyncUrl, App.Config.SyncUsername, App.Config.SyncPassword);
|
||||
MessageBox.Show($"Hochladen von {deliveries.Count} Lieferungen erfolgreich!", "Lieferungen hochladen",
|
||||
MessageBox.Show($"Hochladen von {deliveries.Count:N0} Lieferungen erfolgreich!", "Lieferungen hochladen",
|
||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
} catch (HttpRequestException exc) {
|
||||
|
@ -1 +1 @@
|
||||
curl --fail -s -L "https://elwig.at/files/create.sql?v=30" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
||||
curl --fail -s -L "https://elwig.at/files/create.sql?v=31" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
||||
|
Reference in New Issue
Block a user